Changeset 219277 in webkit
- Timestamp:
- Jul 8, 2017 4:11:16 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r219272 r219277 1 2017-07-08 Chris Dumez <cdumez@apple.com> 2 3 Simplify WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore 4 https://bugs.webkit.org/show_bug.cgi?id=174290 5 6 Reviewed by Brent Fulgham. 7 8 Update layout tests to reflect changes to the testRunner API naming. 9 10 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html: 11 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html: 12 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html: 13 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html: 14 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html: 15 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html: 16 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html: 17 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html: 18 * http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html: 19 * http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html: 20 * http/tests/loading/resourceLoadStatistics/grandfathering.html: 21 * http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html: 22 * http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html: 23 * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html: 24 * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html: 25 * http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html: 26 * http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html: 27 * http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html: 28 * http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html: 29 * http/tests/loading/resourceLoadStatistics/telemetry-generation.html: 30 1 31 2017-07-07 Daniel Bates <dabates@apple.com> 2 32 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
r217606 r219277 37 37 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 38 38 39 testRunner.statistics FireDataModificationHandler();39 testRunner.statisticsProcessStatisticsAndDataRecords(); 40 40 } 41 41 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
r217606 r219277 38 38 testRunner.installStatisticsDidModifyDataRecordsCallback(completeTest); 39 39 40 testRunner.statistics FireDataModificationHandler();40 testRunner.statisticsProcessStatisticsAndDataRecords(); 41 41 } 42 42 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
r217606 r219277 35 35 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 36 36 37 testRunner.statistics FireDataModificationHandler();37 testRunner.statisticsProcessStatisticsAndDataRecords(); 38 38 } 39 39 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
r217606 r219277 36 36 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 37 37 38 testRunner.statistics FireDataModificationHandler();38 testRunner.statisticsProcessStatisticsAndDataRecords(); 39 39 } 40 40 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
r217606 r219277 45 45 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 46 46 47 testRunner.statistics FireDataModificationHandler();47 testRunner.statisticsProcessStatisticsAndDataRecords(); 48 48 } 49 49 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
r217606 r219277 40 40 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 41 41 42 testRunner.statistics FireDataModificationHandler();42 testRunner.statisticsProcessStatisticsAndDataRecords(); 43 43 } 44 44 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
r217606 r219277 40 40 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 41 41 42 testRunner.statistics FireDataModificationHandler();42 testRunner.statisticsProcessStatisticsAndDataRecords(); 43 43 } 44 44 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
r217606 r219277 40 40 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); 41 41 42 testRunner.statistics FireDataModificationHandler();42 testRunner.statisticsProcessStatisticsAndDataRecords(); 43 43 } 44 44 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html
r217606 r219277 56 56 testRunner.installStatisticsDidModifyDataRecordsCallback(testStep2); 57 57 58 testRunner.statistics FireDataModificationHandler();58 testRunner.statisticsProcessStatisticsAndDataRecords(); 59 59 } 60 60 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html
r217606 r219277 56 56 testRunner.installStatisticsDidModifyDataRecordsCallback(testStep2); 57 57 58 testRunner.statistics FireDataModificationHandler();58 testRunner.statisticsProcessStatisticsAndDataRecords(); 59 59 } 60 60 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/grandfathering.html
r219025 r219277 37 37 runTest(); 38 38 }); 39 testRunner.statistics FireDataModificationHandler();39 testRunner.statisticsProcessStatisticsAndDataRecords(); 40 40 } 41 41 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
r219025 r219277 44 44 testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false); 45 45 testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); 46 testRunner.statistics FireDataModificationHandler();46 testRunner.statisticsProcessStatisticsAndDataRecords(); 47 47 } 48 48 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
r219025 r219277 44 44 testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false); 45 45 testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); 46 testRunner.statistics FireDataModificationHandler();46 testRunner.statisticsProcessStatisticsAndDataRecords(); 47 47 } 48 48 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html
r219025 r219277 46 46 runTest(); 47 47 }); 48 testRunner.statistics FireDataModificationHandler();48 testRunner.statisticsProcessStatisticsAndDataRecords(); 49 49 } 50 50 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
r219025 r219277 38 38 testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); 39 39 testRunner.setStatisticsTimeToLiveUserInteraction(0); 40 setTimeout("testRunner.statistics FireDataModificationHandler()", 1000);40 setTimeout("testRunner.statisticsProcessStatisticsAndDataRecords()", 1000); 41 41 } 42 42 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
r219025 r219277 44 44 testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false); 45 45 testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); 46 testRunner.statistics FireDataModificationHandler();46 testRunner.statisticsProcessStatisticsAndDataRecords(); 47 47 } 48 48 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
r219025 r219277 37 37 testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false); 38 38 testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); 39 testRunner.statistics FireDataModificationHandler();39 testRunner.statisticsProcessStatisticsAndDataRecords(); 40 40 } 41 41 -
trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/telemetry-generation.html
r218841 r219277 75 75 testRunner.installStatisticsDidScanDataRecordsCallback(checkInsufficientClassificationAndContinue); 76 76 testRunner.installStatisticsDidRunTelemetryCallback(checkInsufficientTelemetry); 77 testRunner.statistics FireDataModificationHandler();77 testRunner.statisticsProcessStatisticsAndDataRecords(); 78 78 } 79 79 … … 86 86 testRunner.installStatisticsDidScanDataRecordsCallback(checkSufficientClassificationAndContinue); 87 87 testRunner.installStatisticsDidRunTelemetryCallback(checkSufficientTelemetry); 88 testRunner.statistics FireDataModificationHandler();88 testRunner.statisticsProcessStatisticsAndDataRecords(); 89 89 } 90 90 91 91 function runTelemetryAndContinue() { 92 testRunner.statistics FireTelemetryHandler();92 testRunner.statisticsSubmitTelemetry(); 93 93 } 94 94 -
trunk/Source/WebKit2/ChangeLog
r219276 r219277 1 2017-07-08 Chris Dumez <cdumez@apple.com> 2 3 Simplify WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore 4 https://bugs.webkit.org/show_bug.cgi?id=174290 5 6 Reviewed by Brent Fulgham. 7 8 * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: 9 (-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]): 10 (-[WKWebsiteDataStore _resourceLoadStatisticsSubmitTelemetry]): 11 * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: 12 Rename a couple of functions in the Cocoa SPI for clarity and to match the name 13 of their internal implementation. 14 15 * UIProcess/Storage/ResourceLoadStatisticsStore.cpp: 16 (WebKit::ResourceLoadStatisticsStore::create): 17 (WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain): 18 Stylistic changes. 19 20 (WebKit::ResourceLoadStatisticsStore::createEncoderFromData): 21 Make const. 22 23 (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder): 24 Use HashMap::add() instead of HashMap::set(). There is not supposed to have any duplicate 25 keys so add() is sufficient and more efficient. 26 27 (WebKit::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Removed. 28 clearInMemoryAndPersistent() was only called from WebResourceLoadStatisticsStore and 29 the m_deletePersistentStoreHandler / m_grandfatherExistingWebsiteDataHandler were both 30 set by the WebResourceLoadStatisticsStore as well. Therefore, we don't really need this 31 function, WebResourceLoadStatisticsStore now calls ResourceLoadStatisticsStore::clearInMemory() 32 instead and takes care of doing what the m_deletePersistentStoreHandler / 33 m_grandfatherExistingWebsiteDataHandler handlers were doing on its side. 34 35 (WebKit::ResourceLoadStatisticsStore::mergeStatistics): 36 Pass Vector as rvalue reference, as a preparation for a future optimization. Added FIXME 37 comment about the optimization. 38 39 (WebKit::ResourceLoadStatisticsStore::setNotificationCallback): Removed. 40 (WebKit::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback): Removed. 41 (WebKit::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Removed. 42 (WebKit::ResourceLoadStatisticsStore::setFireTelemetryCallback): Removed. 43 Drop those callback setters. WebResourceLoadStatisticsStore is the only client of 44 ResourceLoadStatisticsStore and those callbacks were always called as a result of 45 an operation requested by the WebResourceLoadStatisticsStore. Therefore, those are 46 not needed. WebResourceLoadStatisticsStore can take care of doing what those 47 callbacks were doing on its side. 48 49 (WebKit::ResourceLoadStatisticsStore::processStatistics): 50 Pass parameter by const reference since we clearly do not intend to transfer ownership of it. 51 52 (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor): 53 (WebKit::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords): 54 (WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore): 55 Stylistic changes. 56 57 (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords): Removed. 58 (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved): Removed. 59 (WebKit::ResourceLoadStatisticsStore::dataRecordsWereRemoved): Removed. 60 Those were moved to WebResourceLoadStatisticsStore since they do not require 61 any access to the statistics, and are only used by WebResourceLoadStatisticsStore. 62 63 * UIProcess/Storage/ResourceLoadStatisticsStore.h: 64 65 * UIProcess/WebResourceLoadStatisticsStore.cpp: 66 (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): 67 Store registering most callbacks on the coreStore. Instead, the logic of those 68 callbacks is now inlined in the few methods in WebResourceLoadStatisticsStore 69 that were causing these callbacks to be called. 70 71 (WebKit::WebResourceLoadStatisticsStore::removeDataRecords): 72 Access some methods on WebResourceLoadStatisticsStore instead of the coreStore 73 since those were moved. 74 75 (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): 76 Drop unnecessary mutable for lambda. 77 78 (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): 79 Pass parameter as rvalue reference as a preparation for a future optimization. 80 81 (WebKit::WebResourceLoadStatisticsStore::hasStatisticsFileChangedSinceLastSync): 82 Make const. 83 84 (WebKit::WebResourceLoadStatisticsStore::submitTelemetry): 85 Add assertion to make sure this is called on the main thread. 86 87 (WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler): Removed. 88 This was dispatching to a background queue to call fireDataModificationHandler() 89 on the ResourceLoadStatisticsStore. The coreStore would then dispatch back on the 90 main thread to call the WebResourceLoadStatisticsStore's modification handler. 91 This modification handler was merely calling processStatisticsAndDataRecords(). 92 Therefore, callers of WebResourceLoadStatisticsStore::fireDataModificationHandler() 93 can call WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() directly 94 instead. 95 96 (WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler): Removed. 97 This was calling ResourceLoadStatisticsStore::fireTelemetryHandler(), which was 98 calling back WebResourceLoadStatisticsStore's fireTelemetryHandler. The handler 99 in question was merely calling submitTelemetry(). Therefore, callers of 100 WebResourceLoadStatisticsStore::fireTelemetryHandler() can call 101 WebResourceLoadStatisticsStore::submitTelemetry() directly instead. 102 103 (WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent): 104 Call ResourceLoadStatisticsStore::clearInMemory() instead of clearInMemoryAndPersistent(), 105 which was removed. ResourceLoadStatisticsStore::clearInMemoryAndPersistent() was calling 106 clearInMemory() and then 2 of WebResourceLoadStatisticsStore's handlers. Instead, we now 107 call the functions that those handlers were calling directly, thus eliminating the need 108 for those handlers. 109 110 (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval): 111 Set m_minimumTimeBetweenDataRecordsRemoval directly as it is now store on this class 112 instead of the coreStore. 113 114 (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords): 115 (WebKit::WebResourceLoadStatisticsStore::dataRecordsBeingRemoved): 116 (WebKit::WebResourceLoadStatisticsStore::dataRecordsWereRemoved): 117 Those were merely moved from the ResourceLoadStatisticsStore. 118 119 * UIProcess/WebResourceLoadStatisticsStore.h: 120 121 * UIProcess/WebResourceLoadStatisticsTelemetry.cpp: 122 (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit): 123 Check for sortedPrevalentResources.isEmpty() instead of checking if the size 124 if less than minimumPrevalentResourcesForTelemetry. 125 ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry() either returns 126 an empty vector or a vector with more than minimumPrevalentResourcesForTelemetry 127 items. Therefore, there is no need to expose minimumPrevalentResourcesForTelemetry. 128 1 129 2017-07-08 Yusuke Suzuki <utatane.tea@gmail.com> 2 130 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
r219275 r219277 346 346 } 347 347 348 - (void)_resourceLoadStatistics FireDataModificationHandler349 { 350 auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics(); 351 if (!store) 352 return; 353 354 store-> fireDataModificationHandler();348 - (void)_resourceLoadStatisticsProcessStatisticsAndDataRecords 349 { 350 auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics(); 351 if (!store) 352 return; 353 354 store->processStatisticsAndDataRecords(); 355 355 } 356 356 … … 376 376 } 377 377 378 - (void)_resourceLoadStatistics FireTelemetryHandler379 { 380 auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics(); 381 if (!store) 382 return; 383 384 store-> fireTelemetryHandler();378 - (void)_resourceLoadStatisticsSubmitTelemetry 379 { 380 auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics(); 381 if (!store) 382 return; 383 384 store->submitTelemetry(); 385 385 } 386 386 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
r219071 r219277 58 58 - (void)_resourceLoadStatisticsSetMinimumTimeBetweenDataRecordsRemoval:(double)seconds WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 59 59 - (void)_resourceLoadStatisticsSetGrandfatheringTime:(double)seconds WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 60 - (void)_resourceLoadStatistics FireDataModificationHandlerWK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));60 - (void)_resourceLoadStatisticsProcessStatisticsAndDataRecords WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 61 61 - (void)_resourceLoadStatisticsFireShouldPartitionCookiesHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 62 62 - (void)_resourceLoadStatisticsFireShouldPartitionCookiesHandlerForOneDomain:(BOOL)value forHost:(NSString *)host WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 63 - (void)_resourceLoadStatistics FireTelemetryHandlerWK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));63 - (void)_resourceLoadStatisticsSubmitTelemetry WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 64 64 - (void)_resourceLoadStatisticsSetNotifyPagesWhenDataRecordsWereScanned:(BOOL)value WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 65 65 - (void)_resourceLoadStatisticsSetShouldClassifyResourcesBeforeDataRecordsRemoval:(BOOL)value WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp
r219275 r219277 27 27 #include "ResourceLoadStatisticsStore.h" 28 28 29 #include "Logging.h"30 29 #include <WebCore/KeyedCoding.h> 31 30 #include <WebCore/ResourceLoadStatistics.h> 32 #include <WebCore/SharedBuffer.h>33 #include <WebCore/URL.h>34 31 #include <wtf/CrossThreadCopier.h> 35 #include <wtf/NeverDestroyed.h>36 32 #include <wtf/RunLoop.h> 37 33 … … 40 36 using namespace WebCore; 41 37 38 const unsigned minimumPrevalentResourcesForTelemetry = 3; 39 const unsigned operatingDatesWindow { 30 }; 42 40 const unsigned statisticsModelVersion { 6 }; 43 const unsigned operatingDatesWindow { 30 }; 44 41 45 42 Ref<ResourceLoadStatisticsStore> ResourceLoadStatisticsStore::create() 46 43 { 47 return adoptRef(*new ResourceLoadStatisticsStore ());48 } 49 44 return adoptRef(*new ResourceLoadStatisticsStore); 45 } 46 50 47 bool ResourceLoadStatisticsStore::isPrevalentResource(const String& primaryDomain) const 51 48 { … … 71 68 { 72 69 ASSERT(!RunLoop::isMain()); 73 auto addResult =m_resourceStatisticsMap.ensure(primaryDomain, [&primaryDomain] {70 return m_resourceStatisticsMap.ensure(primaryDomain, [&primaryDomain] { 74 71 return ResourceLoadStatistics(primaryDomain); 75 }); 76 77 return addResult.iterator->value; 72 }).iterator->value; 78 73 } 79 74 80 75 typedef HashMap<String, ResourceLoadStatistics>::KeyValuePairType StatisticsValue; 81 76 82 std::unique_ptr<KeyedEncoder> ResourceLoadStatisticsStore::createEncoderFromData() 77 std::unique_ptr<KeyedEncoder> ResourceLoadStatisticsStore::createEncoderFromData() const 83 78 { 84 79 ASSERT(!RunLoop::isMain()); … … 101 96 { 102 97 ASSERT(!RunLoop::isMain()); 103 if ( m_resourceStatisticsMap.size())98 if (!m_resourceStatisticsMap.isEmpty()) 104 99 return; 105 100 … … 132 127 statistics.isMarkedForCookiePartitioning = true; 133 128 } 134 m_resourceStatisticsMap. set(statistics.highLevelDomain, WTFMove(statistics));129 m_resourceStatisticsMap.add(statistics.highLevelDomain, WTFMove(statistics)); 135 130 } 136 131 … … 159 154 } 160 155 161 void ResourceLoadStatisticsStore::clearInMemoryAndPersistent() 162 { 163 ASSERT(!RunLoop::isMain()); 164 clearInMemory(); 165 if (m_deletePersistentStoreHandler) 166 m_deletePersistentStoreHandler(); 167 if (m_grandfatherExistingWebsiteDataHandler) 168 m_grandfatherExistingWebsiteDataHandler(); 169 } 170 171 void ResourceLoadStatisticsStore::mergeStatistics(const Vector<ResourceLoadStatistics>& statistics) 156 void ResourceLoadStatisticsStore::mergeStatistics(Vector<ResourceLoadStatistics>&& statistics) 172 157 { 173 158 ASSERT(!RunLoop::isMain()); 174 159 for (auto& statistic : statistics) { 160 // FIXME: In the case where the statistics does not already exist, it seems inefficient to create 161 // an empty one just to merge the new one into it. 175 162 auto result = m_resourceStatisticsMap.ensure(statistic.highLevelDomain, [&statistic] { 176 163 return ResourceLoadStatistics(statistic.highLevelDomain); … … 181 168 } 182 169 183 void ResourceLoadStatisticsStore::setNotificationCallback(WTF::Function<void()>&& handler)184 {185 m_dataAddedHandler = WTFMove(handler);186 }187 188 170 void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(WTF::Function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&& handler) 189 171 { 190 172 m_shouldPartitionCookiesForDomainsHandler = WTFMove(handler); 191 173 } 192 193 void ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback(WTF::Function<void()>&& handler) 194 { 195 m_grandfatherExistingWebsiteDataHandler = WTFMove(handler); 196 } 197 198 void ResourceLoadStatisticsStore::setDeletePersistentStoreCallback(WTF::Function<void()>&& handler) 199 { 200 m_deletePersistentStoreHandler = WTFMove(handler); 201 } 202 203 void ResourceLoadStatisticsStore::setFireTelemetryCallback(WTF::Function<void()>&& handler) 204 { 205 m_fireTelemetryHandler = WTFMove(handler); 206 } 207 208 void ResourceLoadStatisticsStore::fireDataModificationHandler() 209 { 210 ASSERT(!RunLoop::isMain()); 211 RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] () { 212 if (m_dataAddedHandler) 213 m_dataAddedHandler(); 214 }); 215 } 216 217 void ResourceLoadStatisticsStore::fireTelemetryHandler() 218 { 219 ASSERT(RunLoop::isMain()); 220 if (m_fireTelemetryHandler) 221 m_fireTelemetryHandler(); 222 } 223 174 224 175 inline bool ResourceLoadStatisticsStore::shouldPartitionCookies(const ResourceLoadStatistics& statistic) const 225 176 { … … 288 239 } 289 240 290 void ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds)291 {292 ASSERT(seconds >= 0_s);293 m_minimumTimeBetweenDataRecordsRemoval = seconds;294 }295 296 241 void ResourceLoadStatisticsStore::setGrandfatheringTime(Seconds seconds) 297 242 { … … 300 245 } 301 246 302 void ResourceLoadStatisticsStore::processStatistics( WTF::Function<void(ResourceLoadStatistics&)>&& processFunction)247 void ResourceLoadStatisticsStore::processStatistics(const WTF::Function<void(ResourceLoadStatistics&)>& processFunction) 303 248 { 304 249 ASSERT(!RunLoop::isMain()); … … 337 282 Vector<String> prevalentResources; 338 283 for (auto& statistic : m_resourceStatisticsMap.values()) { 339 if (statistic.isPrevalentResource 340 && !hasHadRecentUserInteraction(statistic) 341 && (!shouldCheckForGrandfathering || !statistic.grandfathered)) 284 if (statistic.isPrevalentResource && !hasHadRecentUserInteraction(statistic) && (!shouldCheckForGrandfathering || !statistic.grandfathered)) 342 285 prevalentResources.append(statistic.highLevelDomain); 343 286 … … 383 326 ASSERT(!RunLoop::isMain()); 384 327 for (auto& prevalentResourceDomain : prevalentResourceDomains) { 385 ResourceLoadStatistics& statistic = ensureResourceStatisticsForPrimaryDomain(prevalentResourceDomain);328 auto& statistic = ensureResourceStatisticsForPrimaryDomain(prevalentResourceDomain); 386 329 ++statistic.dataRecordsRemoved; 387 330 } … … 392 335 ASSERT(!RunLoop::isMain()); 393 336 for (auto& topPrivatelyControlledDomain : topPrivatelyControlledDomainsToGrandfather) { 394 ResourceLoadStatistics& statistic = ensureResourceStatisticsForPrimaryDomain(topPrivatelyControlledDomain);337 auto& statistic = ensureResourceStatisticsForPrimaryDomain(topPrivatelyControlledDomain); 395 338 statistic.grandfathered = true; 396 339 } 397 340 m_endOfGrandfatheringTimestamp = WallTime::now() + m_grandfatheringTime; 398 }399 400 bool ResourceLoadStatisticsStore::shouldRemoveDataRecords() const401 {402 ASSERT(!RunLoop::isMain());403 if (m_dataRecordsRemovalPending)404 return false;405 406 if (m_lastTimeDataRecordsWereRemoved && MonotonicTime::now() < (m_lastTimeDataRecordsWereRemoved + m_minimumTimeBetweenDataRecordsRemoval))407 return false;408 409 return true;410 }411 412 void ResourceLoadStatisticsStore::dataRecordsBeingRemoved()413 {414 ASSERT(!RunLoop::isMain());415 m_lastTimeDataRecordsWereRemoved = MonotonicTime::now();416 m_dataRecordsRemovalPending = true;417 }418 419 void ResourceLoadStatisticsStore::dataRecordsWereRemoved()420 {421 ASSERT(!RunLoop::isMain());422 m_dataRecordsRemovalPending = false;423 341 } 424 342 -
trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h
r219275 r219277 42 42 namespace WebKit { 43 43 44 static const auto minimumPrevalentResourcesForTelemetry = 3;45 46 44 struct PrevalentResourceTelemetry { 47 45 unsigned numberOfTimesDataRecordsRemoved; … … 58 56 static Ref<ResourceLoadStatisticsStore> create(); 59 57 60 std::unique_ptr<WebCore::KeyedEncoder> createEncoderFromData() ;58 std::unique_ptr<WebCore::KeyedEncoder> createEncoderFromData() const; 61 59 void readDataFromDecoder(WebCore::KeyedDecoder&); 62 60 63 61 bool isEmpty() const { return m_resourceStatisticsMap.isEmpty(); } 64 size_t size() const { return m_resourceStatisticsMap.size(); }65 62 void clearInMemory(); 66 void clearInMemoryAndPersistent();67 63 68 64 WebCore::ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&); 69 void setResourceStatisticsForPrimaryDomain(const String&, WebCore::ResourceLoadStatistics&&);70 65 71 66 bool isPrevalentResource(const String&) const; 72 67 bool isGrandFathered(const String&) const; 73 68 74 void mergeStatistics( const Vector<WebCore::ResourceLoadStatistics>&);69 void mergeStatistics(Vector<WebCore::ResourceLoadStatistics>&&); 75 70 76 void setNotificationCallback(WTF::Function<void()>&&);77 71 void setShouldPartitionCookiesCallback(WTF::Function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&&); 78 void setDeletePersistentStoreCallback(WTF::Function<void()>&&);79 void setGrandfatherExistingWebsiteDataCallback(WTF::Function<void()>&&);80 void setFireTelemetryCallback(WTF::Function<void()>&& handler);81 72 82 void fireDataModificationHandler();83 void fireTelemetryHandler();84 73 void setTimeToLiveUserInteraction(std::optional<Seconds>); 85 74 void setTimeToLiveCookiePartitionFree(Seconds); 86 void setMinimumTimeBetweenDataRecordsRemoval(Seconds);87 75 void setGrandfatheringTime(Seconds); 76 88 77 void fireShouldPartitionCookiesHandler(); 89 78 void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst); 90 79 91 void processStatistics( WTF::Function<void (WebCore::ResourceLoadStatistics&)>&&);80 void processStatistics(const WTF::Function<void (WebCore::ResourceLoadStatistics&)>&); 92 81 93 82 bool hasHadRecentUserInteraction(WebCore::ResourceLoadStatistics&) const; … … 97 86 98 87 void handleFreshStartWithEmptyOrNoStore(HashSet<String>&& topPrivatelyControlledDomainsToGrandfather); 99 bool shouldRemoveDataRecords() const;100 void dataRecordsBeingRemoved();101 void dataRecordsWereRemoved();102 103 88 void includeTodayAsOperatingDateIfNecessary(); 104 89 … … 112 97 Deque<WTF::WallTime> m_operatingDates; 113 98 114 WTF::Function<void()> m_dataAddedHandler;115 99 WTF::Function<void(const Vector<String>&, const Vector<String>&, bool clearFirst)> m_shouldPartitionCookiesForDomainsHandler; 116 WTF::Function<void()> m_grandfatherExistingWebsiteDataHandler;117 WTF::Function<void()> m_deletePersistentStoreHandler;118 WTF::Function<void()> m_fireTelemetryHandler;119 100 120 101 std::optional<Seconds> m_timeToLiveUserInteraction; 121 102 Seconds m_timeToLiveCookiePartitionFree { 24_h }; 122 103 Seconds m_grandfatheringTime { 1_h }; 123 Seconds m_minimumTimeBetweenDataRecordsRemoval { 1_h };124 104 125 105 WallTime m_endOfGrandfatheringTimestamp; 126 MonotonicTime m_lastTimeDataRecordsWereRemoved;127 bool m_dataRecordsRemovalPending { false };128 106 }; 129 107 -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
r219275 r219277 28 28 29 29 #include "Logging.h" 30 #include "ResourceLoadStatisticsStore.h" 30 31 #include "WebProcessMessages.h" 31 #include "WebProcessPool.h"32 32 #include "WebProcessProxy.h" 33 33 #include "WebResourceLoadStatisticsStoreMessages.h" 34 #include "WebResourceLoadStatisticsTelemetry.h" 34 35 #include "WebsiteDataFetchOption.h" 35 36 #include "WebsiteDataType.h" … … 38 39 #include <WebCore/KeyedCoding.h> 39 40 #include <WebCore/ResourceLoadStatistics.h> 41 #include <WebCore/SharedBuffer.h> 40 42 #include <wtf/CrossThreadCopier.h> 41 #include <wtf/MainThread.h>42 43 #include <wtf/MathExtras.h> 43 #include <wtf/MonotonicTime.h>44 44 #include <wtf/NeverDestroyed.h> 45 #include <wtf/RunLoop.h>46 #include <wtf/Seconds.h>47 #include <wtf/WallTime.h>48 45 #include <wtf/threads/BinarySemaphore.h> 49 46 … … 104 101 #endif 105 102 106 m_resourceLoadStatisticsStore->setNotificationCallback([this, protectedThis = makeRef(*this)] {107 if (m_resourceLoadStatisticsStore->isEmpty())108 return;109 processStatisticsAndDataRecords();110 });111 m_resourceLoadStatisticsStore->setGrandfatherExistingWebsiteDataCallback([this, protectedThis = makeRef(*this)] {112 grandfatherExistingWebsiteData();113 });114 m_resourceLoadStatisticsStore->setDeletePersistentStoreCallback([this, protectedThis = makeRef(*this)] {115 m_statisticsQueue->dispatch([this, protectedThis = protectedThis.copyRef()] {116 deleteStoreFromDisk();117 });118 });119 m_resourceLoadStatisticsStore->setFireTelemetryCallback([this, protectedThis = makeRef(*this)] {120 submitTelemetry();121 });122 123 103 if (updatePartitionCookiesForDomainsHandler) { 124 104 m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([updatePartitionCookiesForDomainsHandler = WTFMove(updatePartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool shouldClearFirst) { … … 165 145 ASSERT(!RunLoop::isMain()); 166 146 167 if (! coreStore().shouldRemoveDataRecords())147 if (!shouldRemoveDataRecords()) 168 148 return; 169 149 … … 172 152 return; 173 153 174 coreStore().dataRecordsBeingRemoved();154 dataRecordsBeingRemoved(); 175 155 176 156 // Switch to the main thread to get the default website data store … … 178 158 WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(dataTypesToRemove(), WTFMove(prevalentResourceDomains), notifyPagesWhenDataRecordsWereScanned, [this, protectedThis = WTFMove(protectedThis)](const HashSet<String>& domainsWithDeletedWebsiteData) mutable { 179 159 // But always touch the ResourceLoadStatistics store on the worker queue. 180 m_statisticsQueue->dispatch([ protectedThis = WTFMove(protectedThis), topDomains = CrossThreadCopier<HashSet<String>>::copy(domainsWithDeletedWebsiteData)] () mutable {181 protectedThis->coreStore().updateStatisticsForRemovedDataRecords(topDomains);182 protectedThis->coreStore().dataRecordsWereRemoved();160 m_statisticsQueue->dispatch([this, protectedThis = WTFMove(protectedThis), topDomains = CrossThreadCopier<HashSet<String>>::copy(domainsWithDeletedWebsiteData)] () mutable { 161 coreStore().updateStatisticsForRemovedDataRecords(topDomains); 162 dataRecordsWereRemoved(); 183 163 }); 184 164 }); … … 197 177 198 178 if (notifyPagesWhenDataRecordsWereScanned) { 199 RunLoop::main().dispatch([] () mutable{179 RunLoop::main().dispatch([] { 200 180 WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed(); 201 181 }); … … 206 186 } 207 187 208 void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins) 209 { 210 coreStore().mergeStatistics(origins); 188 void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins) 189 { 190 ASSERT(!RunLoop::isMain()); 191 192 coreStore().mergeStatistics(WTFMove(origins)); 211 193 // Fire before processing statistics to propagate user 212 194 // interaction as fast as possible to the network process. … … 238 220 } 239 221 240 bool WebResourceLoadStatisticsStore::hasStatisticsFileChangedSinceLastSync(const String& path) 222 bool WebResourceLoadStatisticsStore::hasStatisticsFileChangedSinceLastSync(const String& path) const 241 223 { 242 224 return statisticsFileModificationTime(path) > m_lastStatisticsFileSyncTime; … … 550 532 void WebResourceLoadStatisticsStore::submitTelemetry() 551 533 { 534 ASSERT(RunLoop::isMain()); 552 535 m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { 553 536 WebResourceLoadStatisticsTelemetry::calculateAndSubmit(coreStore()); … … 693 676 } 694 677 695 void WebResourceLoadStatisticsStore::fire DataModificationHandler()678 void WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler() 696 679 { 697 680 // Helper function used by testing system. Should only be called from the main thread. 698 681 ASSERT(RunLoop::isMain()); 699 m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { 700 coreStore().fireDataModificationHandler(); 701 }); 702 } 703 704 void WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler() 705 { 706 // Helper function used by testing system. Should only be called from the main thread. 707 ASSERT(RunLoop::isMain()); 682 708 683 m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { 709 684 coreStore().fireShouldPartitionCookiesHandler(); … … 720 695 } 721 696 722 void WebResourceLoadStatisticsStore::fireTelemetryHandler()723 {724 // Helper function used by testing system. Should only be called from the main thread.725 ASSERT(RunLoop::isMain());726 coreStore().fireTelemetryHandler();727 }728 729 697 void WebResourceLoadStatisticsStore::clearInMemory() 730 698 { … … 737 705 { 738 706 m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { 739 coreStore().clearInMemoryAndPersistent(); 707 coreStore().clearInMemory(); 708 deleteStoreFromDisk(); 709 grandfatherExistingWebsiteData(); 740 710 }); 741 711 } … … 760 730 void WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds) 761 731 { 762 coreStore().setMinimumTimeBetweenDataRecordsRemoval(seconds); 732 ASSERT(seconds >= 0_s); 733 m_minimumTimeBetweenDataRecordsRemoval = seconds; 763 734 } 764 735 … … 767 738 coreStore().setGrandfatheringTime(seconds); 768 739 } 740 741 bool WebResourceLoadStatisticsStore::shouldRemoveDataRecords() const 742 { 743 ASSERT(!RunLoop::isMain()); 744 if (m_dataRecordsRemovalPending) 745 return false; 746 747 if (m_lastTimeDataRecordsWereRemoved && MonotonicTime::now() < (m_lastTimeDataRecordsWereRemoved + m_minimumTimeBetweenDataRecordsRemoval)) 748 return false; 749 750 return true; 751 } 752 753 void WebResourceLoadStatisticsStore::dataRecordsBeingRemoved() 754 { 755 ASSERT(!RunLoop::isMain()); 756 m_lastTimeDataRecordsWereRemoved = MonotonicTime::now(); 757 m_dataRecordsRemovalPending = true; 758 } 759 760 void WebResourceLoadStatisticsStore::dataRecordsWereRemoved() 761 { 762 ASSERT(!RunLoop::isMain()); 763 m_dataRecordsRemovalPending = false; 764 } 769 765 770 766 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h
r219275 r219277 26 26 #pragma once 27 27 28 #include "APIObject.h"29 28 #include "Connection.h" 30 29 #include "ResourceLoadStatisticsClassifier.h" 31 #include "ResourceLoadStatisticsStore.h" 32 #include "WebResourceLoadStatisticsTelemetry.h" 33 #include "WebsiteDataRecord.h" 30 #include <wtf/MonotonicTime.h> 34 31 #include <wtf/RunLoop.h> 35 32 #include <wtf/Vector.h> 33 #include <wtf/WallTime.h> 36 34 #include <wtf/text/WTFString.h> 37 35 … … 41 39 42 40 namespace WTF { 43 class MonotonicTime;44 class WallTime;45 41 class WorkQueue; 46 42 } … … 50 46 class KeyedDecoder; 51 47 class KeyedEncoder; 48 class URL; 52 49 struct ResourceLoadStatistics; 53 50 } … … 55 52 namespace WebKit { 56 53 54 class ResourceLoadStatisticsStore; 57 55 class WebProcessProxy; 58 56 … … 65 63 } 66 64 65 ~WebResourceLoadStatisticsStore(); 66 67 67 static void setNotifyPagesWhenDataRecordsWereScanned(bool); 68 68 static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool); 69 69 static void setShouldSubmitTelemetry(bool); 70 virtual ~WebResourceLoadStatisticsStore();71 70 72 void resourceLoadStatisticsUpdated( const Vector<WebCore::ResourceLoadStatistics>& origins);71 void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins); 73 72 74 73 void processWillOpenConnection(WebProcessProxy&, IPC::Connection&); … … 87 86 void setSubresourceUnderTopFrameOrigin(const WebCore::URL& subresource, const WebCore::URL& topFrame); 88 87 void setSubresourceUniqueRedirectTo(const WebCore::URL& subresource, const WebCore::URL& hostNameRedirectedTo); 89 void fireDataModificationHandler();90 88 void fireShouldPartitionCookiesHandler(); 91 89 void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst); 90 void processStatisticsAndDataRecords(); 91 void submitTelemetry(); 92 92 93 void fireTelemetryHandler();94 93 void clearInMemory(); 95 94 void clearInMemoryAndPersistent(); … … 107 106 const ResourceLoadStatisticsStore& coreStore() const { return m_resourceLoadStatisticsStore.get(); } 108 107 109 void processStatisticsAndDataRecords();110 108 void readDataFromDiskIfNeeded(); 111 109 … … 134 132 void refreshFromDisk(); 135 133 void submitTelemetryIfNecessary(); 136 void submitTelemetry(); 137 bool hasStatisticsFileChangedSinceLastSync(const String& path); 134 bool hasStatisticsFileChangedSinceLastSync(const String& path) const; 138 135 void performDailyTasks(); 136 bool shouldRemoveDataRecords() const; 137 void dataRecordsBeingRemoved(); 138 void dataRecordsWereRemoved(); 139 139 140 140 #if PLATFORM(COCOA) … … 151 151 std::unique_ptr<WebCore::FileMonitor> m_statisticsStorageMonitor; 152 152 const String m_statisticsStoragePath; 153 W TF::WallTime m_lastStatisticsFileSyncTime;154 WTF::MonotonicTime m_lastStatisticsWriteTime;153 WallTime m_lastStatisticsFileSyncTime; 154 MonotonicTime m_lastStatisticsWriteTime; 155 155 RunLoop::Timer<WebResourceLoadStatisticsStore> m_telemetryOneShotTimer; 156 156 RunLoop::Timer<WebResourceLoadStatisticsStore> m_telemetryRepeatedTimer; 157 MonotonicTime m_lastTimeDataRecordsWereRemoved; 158 Seconds m_minimumTimeBetweenDataRecordsRemoval { 1_h }; 159 bool m_dataRecordsRemovalPending { false }; 157 160 bool m_didScheduleWrite { false }; 158 161 }; -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsTelemetry.cpp
r219020 r219277 190 190 191 191 auto sortedPrevalentResources = resourceLoadStatisticsStore.sortedPrevalentResourceTelemetry(); 192 if (notifyPagesWhenTelemetryWasCaptured && sortedPrevalentResources. size() < minimumPrevalentResourcesForTelemetry) {192 if (notifyPagesWhenTelemetryWasCaptured && sortedPrevalentResources.isEmpty()) { 193 193 notifyPages(0, 0, 0); 194 194 return; -
trunk/Tools/ChangeLog
r219276 r219277 1 2017-07-08 Chris Dumez <cdumez@apple.com> 2 3 Simplify WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore 4 https://bugs.webkit.org/show_bug.cgi?id=174290 5 6 Reviewed by Brent Fulgham. 7 8 Rename testRunner API to match the new internal API names. 9 10 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 11 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 12 (WTR::TestRunner::statisticsProcessStatisticsAndDataRecords): 13 (WTR::TestRunner::statisticsSubmitTelemetry): 14 * WebKitTestRunner/InjectedBundle/TestRunner.h: 15 * WebKitTestRunner/TestController.cpp: 16 (WTR::TestController::statisticsProcessStatisticsAndDataRecords): 17 (WTR::TestController::statisticsSubmitTelemetry): 18 * WebKitTestRunner/TestController.h: 19 * WebKitTestRunner/TestInvocation.cpp: 20 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 21 * WebKitTestRunner/cocoa/TestControllerCocoa.mm: 22 (WTR::TestController::statisticsProcessStatisticsAndDataRecords): 23 (WTR::TestController::statisticsSubmitTelemetry): 24 1 25 2017-07-08 Yusuke Suzuki <utatane.tea@gmail.com> 2 26 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r219025 r219277 266 266 void setStatisticsTimeToLiveUserInteraction(double seconds); 267 267 void setStatisticsTimeToLiveCookiePartitionFree(double seconds); 268 void statistics FireDataModificationHandler();268 void statisticsProcessStatisticsAndDataRecords(); 269 269 void statisticsFireShouldPartitionCookiesHandler(); 270 270 void statisticsFireShouldPartitionCookiesHandlerForOneDomain(DOMString hostName, boolean value); 271 void statistics FireTelemetryHandler();271 void statisticsSubmitTelemetry(); 272 272 void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value); 273 273 void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r219049 r219277 1414 1414 } 1415 1415 1416 void TestRunner::statistics FireDataModificationHandler()1417 { 1418 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("Statistics FireDataModificationHandler"));1416 void TestRunner::statisticsProcessStatisticsAndDataRecords() 1417 { 1418 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsProcessStatisticsAndDataRecords")); 1419 1419 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); 1420 1420 } … … 1451 1451 } 1452 1452 1453 void TestRunner::statistics FireTelemetryHandler()1454 { 1455 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("Statistics FireTelemetryHandler"));1453 void TestRunner::statisticsSubmitTelemetry() 1454 { 1455 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsSubmitTelemetry")); 1456 1456 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); 1457 1457 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r219025 r219277 354 354 void statisticsDidScanDataRecordsCallback(); 355 355 void statisticsDidRunTelemetryCallback(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins); 356 void statistics FireDataModificationHandler();356 void statisticsProcessStatisticsAndDataRecords(); 357 357 void statisticsFireShouldPartitionCookiesHandler(); 358 358 void statisticsFireShouldPartitionCookiesHandlerForOneDomain(JSStringRef hostName, bool value); 359 void statistics FireTelemetryHandler();359 void statisticsSubmitTelemetry(); 360 360 void setStatisticsPrevalentResource(JSStringRef hostName, bool value); 361 361 bool isStatisticsPrevalentResource(JSStringRef hostName); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r219049 r219277 2297 2297 } 2298 2298 2299 void TestController::statistics FireDataModificationHandler()2299 void TestController::statisticsProcessStatisticsAndDataRecords() 2300 2300 { 2301 2301 } … … 2309 2309 } 2310 2310 2311 void TestController::statistics FireTelemetryHandler()2311 void TestController::statisticsSubmitTelemetry() 2312 2312 { 2313 2313 } -
trunk/Tools/WebKitTestRunner/TestController.h
r219025 r219277 162 162 void setStatisticsTimeToLiveUserInteraction(double seconds); 163 163 void setStatisticsTimeToLiveCookiePartitionFree(double seconds); 164 void statistics FireDataModificationHandler();164 void statisticsProcessStatisticsAndDataRecords(); 165 165 void statisticsFireShouldPartitionCookiesHandler(); 166 166 void statisticsFireShouldPartitionCookiesHandlerForOneDomain(WKStringRef hostName, bool value); 167 void statistics FireTelemetryHandler();167 void statisticsSubmitTelemetry(); 168 168 void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool); 169 169 void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r219025 r219277 1038 1038 } 1039 1039 1040 if (WKStringIsEqualToUTF8CString(messageName, "Statistics FireDataModificationHandler")) {1041 TestController::singleton().statistics FireDataModificationHandler();1040 if (WKStringIsEqualToUTF8CString(messageName, "StatisticsProcessStatisticsAndDataRecords")) { 1041 TestController::singleton().statisticsProcessStatisticsAndDataRecords(); 1042 1042 return nullptr; 1043 1043 } … … 1062 1062 } 1063 1063 1064 if (WKStringIsEqualToUTF8CString(messageName, "Statistics FireTelemetryHandler")) {1065 TestController::singleton().statistics FireTelemetryHandler();1064 if (WKStringIsEqualToUTF8CString(messageName, "StatisticsSubmitTelemetry")) { 1065 TestController::singleton().statisticsSubmitTelemetry(); 1066 1066 return nullptr; 1067 1067 } -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r219071 r219277 302 302 } 303 303 304 void TestController::statistics FireDataModificationHandler()305 { 306 [globalWebViewConfiguration.websiteDataStore _resourceLoadStatistics FireDataModificationHandler];304 void TestController::statisticsProcessStatisticsAndDataRecords() 305 { 306 [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]; 307 307 } 308 308 … … 317 317 } 318 318 319 void TestController::statistics FireTelemetryHandler()320 { 321 [globalWebViewConfiguration.websiteDataStore _resourceLoadStatistics FireTelemetryHandler];319 void TestController::statisticsSubmitTelemetry() 320 { 321 [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsSubmitTelemetry]; 322 322 } 323 323
Note: See TracChangeset
for help on using the changeset viewer.