Changeset 228495 in webkit
- Timestamp:
- Feb 14, 2018 4:52:29 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r228494 r228495 1 2018-02-14 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database 4 https://bugs.webkit.org/show_bug.cgi?id=182812 5 <rdar://problem/37511406> 6 7 Reviewed by Brent Fulgham. 8 9 No new tests. Tested manually between versions of Safari. 10 11 * loader/ResourceLoadStatistics.cpp: 12 (WebCore::ResourceLoadStatistics::decode): 13 Now only expects these fields for model version 11 or higher: 14 - topFrameUniqueRedirectsTo 15 - topFrameUniqueRedirectsFrom 16 - subresourceUniqueRedirectsFrom 17 - timesAccessedAsFirstPartyDueToUserInteraction 18 - timesAccessedAsFirstPartyDueToStorageAccessAPI 19 * loader/ResourceLoadStatistics.h: 20 1 21 2018-02-14 Basuke Suzuki <Basuke.Suzuki@sony.com> 2 22 -
trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp
r228416 r228495 119 119 } 120 120 121 bool ResourceLoadStatistics::decode(KeyedDecoder& decoder )121 bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned modelVersion) 122 122 { 123 123 if (!decoder.decodeString("PrevalentResourceOrigin", highLevelDomain)) … … 132 132 133 133 // Top frame stats 134 decodeHashCountedSet(decoder, "topFrameUniqueRedirectsTo", topFrameUniqueRedirectsTo); 135 decodeHashCountedSet(decoder, "topFrameUniqueRedirectsFrom", topFrameUniqueRedirectsFrom); 134 if (modelVersion >= 11) { 135 decodeHashCountedSet(decoder, "topFrameUniqueRedirectsTo", topFrameUniqueRedirectsTo); 136 decodeHashCountedSet(decoder, "topFrameUniqueRedirectsFrom", topFrameUniqueRedirectsFrom); 137 } 136 138 137 139 // Subframe stats … … 141 143 decodeHashCountedSet(decoder, "subresourceUnderTopFrameOrigins", subresourceUnderTopFrameOrigins); 142 144 decodeHashCountedSet(decoder, "subresourceUniqueRedirectsTo", subresourceUniqueRedirectsTo); 143 decodeHashCountedSet(decoder, "subresourceUniqueRedirectsFrom", subresourceUniqueRedirectsFrom); 145 if (modelVersion >= 11) 146 decodeHashCountedSet(decoder, "subresourceUniqueRedirectsFrom", subresourceUniqueRedirectsFrom); 144 147 145 148 // Prevalent Resource … … 163 166 lastSeen = WallTime::fromRawSeconds(lastSeenTimeAsDouble); 164 167 165 if (!decoder.decodeUInt32("timesAccessedAsFirstPartyDueToUserInteraction", timesAccessedAsFirstPartyDueToUserInteraction)) 166 timesAccessedAsFirstPartyDueToUserInteraction = 0; 167 if (!decoder.decodeUInt32("timesAccessedAsFirstPartyDueToStorageAccessAPI", timesAccessedAsFirstPartyDueToStorageAccessAPI)) 168 timesAccessedAsFirstPartyDueToStorageAccessAPI = 0; 169 168 if (modelVersion >= 11) { 169 if (!decoder.decodeUInt32("timesAccessedAsFirstPartyDueToUserInteraction", timesAccessedAsFirstPartyDueToUserInteraction)) 170 timesAccessedAsFirstPartyDueToUserInteraction = 0; 171 if (!decoder.decodeUInt32("timesAccessedAsFirstPartyDueToStorageAccessAPI", timesAccessedAsFirstPartyDueToStorageAccessAPI)) 172 timesAccessedAsFirstPartyDueToStorageAccessAPI = 0; 173 } 170 174 return true; 171 175 } -
trunk/Source/WebCore/loader/ResourceLoadStatistics.h
r228416 r228495 55 55 56 56 WEBCORE_EXPORT void encode(KeyedEncoder&) const; 57 WEBCORE_EXPORT bool decode(KeyedDecoder& );57 WEBCORE_EXPORT bool decode(KeyedDecoder&, unsigned modelVersion); 58 58 59 59 String toString() const; -
trunk/Source/WebKit/ChangeLog
r228486 r228495 1 2018-02-14 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database 4 https://bugs.webkit.org/show_bug.cgi?id=182812 5 <rdar://problem/37511406> 6 7 Reviewed by Brent Fulgham. 8 9 * UIProcess/WebResourceLoadStatisticsStore.cpp: 10 (WebKit::WebResourceLoadStatisticsStore::mergeWithDataFromDecoder): 11 Now does the following: 12 - Logs when there is a model version mismatch. 13 - Does not ingest statistics if the version on disk is newer than the supported one. 14 - Does ingest statistics if the version on disk is older than the supported one. 15 - Passes on the version found on disk to WebCore::ResourceLoadStatistics::decode(). 16 1 17 2018-02-14 Daniel Bates <dabates@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
r228416 r228495 804 804 return; 805 805 806 if (versionOnDisk != statisticsModelVersion) 807 return; 806 if (versionOnDisk > statisticsModelVersion) { 807 WTFLogAlways("Found resource load statistics on disk with model version %u whereas the highest supported version is %u. Resetting.", versionOnDisk, statisticsModelVersion); 808 return; 809 } 810 811 if (versionOnDisk < statisticsModelVersion) 812 WTFLogAlways("Found resource load statistics on disk with model version %u and the current version is %u. Ingesting old statistics.", versionOnDisk, statisticsModelVersion); 808 813 809 814 double endOfGrandfatheringTimestamp; … … 814 819 815 820 Vector<ResourceLoadStatistics> loadedStatistics; 816 bool succeeded = decoder.decodeObjects("browsingStatistics", loadedStatistics, [ ](KeyedDecoder& decoderInner, ResourceLoadStatistics& statistics) {817 return statistics.decode(decoderInner );821 bool succeeded = decoder.decodeObjects("browsingStatistics", loadedStatistics, [versionOnDisk](KeyedDecoder& decoderInner, ResourceLoadStatistics& statistics) { 822 return statistics.decode(decoderInner, versionOnDisk); 818 823 }); 819 824
Note: See TracChangeset
for help on using the changeset viewer.