Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 23:22:58 +0000 (23:22 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 23:22:58 +0000 (23:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174038

Reviewed by Brent Fulgham.

Source/WebKit2:

Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore.
WebResourceLoadStatisticsManager is now essentially a proxy to the
WebResourceLoadStatisticsStore to support the current C API.

In a follow-up, I plan to to replace the C API with a Cocoa SPI which works on a
WebResourceLoadStatisticsStore directly instead of requiring a
WebResourceLoadStatisticsManager singleton.

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval):
(WKResourceLoadStatisticsManagerResetToConsistentState):
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm: Removed.
* UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
(WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::WebResourceLoadStatisticsManager):
(WebKit::WebResourceLoadStatisticsManager::~WebResourceLoadStatisticsManager):
(WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
(WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
(WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
(WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweenDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
(WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
(WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::primaryDomain):
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
(WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
(WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler):
(WebKit::WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
(WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler):
(WebKit::WebResourceLoadStatisticsStore::clearInMemory):
(WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
(WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Fix typo in API name.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setStatisticsMinimumTimeBetweenDataRecordsRemoval):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setStatisticsMinimumTimeBetweenDataRecordsRemoval):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

Fix typo in testRunner API.

* http/tests/loading/resourceLoadStatistics/grandfathering.html:
* http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html:
* http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:
* http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219025 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/loading/resourceLoadStatistics/grandfathering.html
LayoutTests/http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
LayoutTests/http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html
LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp
Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h
Source/WebKit2/UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm [deleted file]
Source/WebKit2/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm
Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h
Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp

index e0d45b5..669a191 100644 (file)
@@ -1,3 +1,20 @@
+2017-06-30  Chris Dumez  <cdumez@apple.com>
+
+        Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore
+        https://bugs.webkit.org/show_bug.cgi?id=174038
+
+        Reviewed by Brent Fulgham.
+
+        Fix typo in testRunner API.
+
+        * http/tests/loading/resourceLoadStatistics/grandfathering.html:
+        * http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html:
+        * http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html:
+        * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html:
+        * http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:
+        * http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
+        * http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:
+
 2017-06-30  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Default string comparisons to treat numeric characters as numbers
index 9b69bc2..2dc92c8 100644 (file)
         setEnableFeature(true);
 
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
 
         testRunner.waitUntilDone();
         testRunner.dumpChildFramesAsText();
     runTest();
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index c134f00..8aec067 100644 (file)
@@ -42,7 +42,7 @@
             testRunner.notifyDone();
         });
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
         testRunner.statisticsFireDataModificationHandler();
     }
 
@@ -54,4 +54,4 @@
     }
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index 724dfd8..a9cfa2e 100644 (file)
@@ -42,7 +42,7 @@
             testRunner.notifyDone();
         });
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
         testRunner.statisticsFireDataModificationHandler();
     }
 
@@ -54,4 +54,4 @@
     }
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index 798cd05..478a4e4 100644 (file)
@@ -91,7 +91,7 @@
         setEnableFeature(true);
 
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
 
         testRunner.statisticsFireShouldPartitionCookiesHandlerForOneDomain("localhost", true);
         testRunner.setStatisticsPrevalentResource("http://localhost", true);
     runTest();
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index e10ef52..ed7015d 100644 (file)
@@ -35,7 +35,7 @@
             testRunner.notifyDone();
         });
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
         testRunner.setStatisticsTimeToLiveUserInteraction(0);
         setTimeout("testRunner.statisticsFireDataModificationHandler()", 1000);
     }
@@ -48,4 +48,4 @@
     }
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index d1a64fc..04c4601 100644 (file)
@@ -42,7 +42,7 @@
             testRunner.notifyDone();
         });
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
         testRunner.statisticsFireDataModificationHandler();
     }
 
@@ -54,4 +54,4 @@
     }
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index 08403ed..11faca4 100644 (file)
@@ -35,7 +35,7 @@
             testRunner.notifyDone();
         });
         testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-        testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
+        testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
         testRunner.statisticsFireDataModificationHandler();
     }
 
@@ -47,4 +47,4 @@
     }
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index 0013b34..07a980a 100644 (file)
@@ -1,3 +1,78 @@
+2017-06-30  Chris Dumez  <cdumez@apple.com>
+
+        Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore
+        https://bugs.webkit.org/show_bug.cgi?id=174038
+
+        Reviewed by Brent Fulgham.
+
+        Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore.
+        WebResourceLoadStatisticsManager is now essentially a proxy to the
+        WebResourceLoadStatisticsStore to support the current C API.
+
+        In a follow-up, I plan to to replace the C API with a Cocoa SPI which works on a
+        WebResourceLoadStatisticsStore directly instead of requiring a
+        WebResourceLoadStatisticsManager singleton.
+
+        * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
+        (WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval):
+        (WKResourceLoadStatisticsManagerResetToConsistentState):
+        * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
+        * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm: Removed.
+        * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
+        (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
+        * UIProcess/WebResourceLoadStatisticsManager.cpp:
+        (WebKit::WebResourceLoadStatisticsManager::WebResourceLoadStatisticsManager):
+        (WebKit::WebResourceLoadStatisticsManager::~WebResourceLoadStatisticsManager):
+        (WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
+        (WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
+        (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
+        (WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
+        (WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
+        (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
+        (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
+        (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
+        (WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
+        (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
+        (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
+        (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
+        (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
+        (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
+        (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
+        (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
+        (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweenDataRecordsRemoval):
+        (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
+        (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
+        (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
+        (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
+        * UIProcess/WebResourceLoadStatisticsManager.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::primaryDomain):
+        (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
+        (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
+        (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
+        (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
+        (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
+        (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
+        (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
+        (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
+        (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
+        (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
+        (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
+        (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
+        (WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler):
+        (WebKit::WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
+        (WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler):
+        (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
+        (WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
+        (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
+        (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
+        (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
+        (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::removeData):
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2017-06-30  John Wilander  <wilander@apple.com>
 
         [WK2] Resource load statistics code is spamming the WebProcess with a test-only message 
index 9ee08da..696abc8 100644 (file)
@@ -96,9 +96,9 @@ void WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree(double seco
     WebResourceLoadStatisticsManager::shared().setTimeToLiveCookiePartitionFree(Seconds { seconds });
 }
 
-void WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(double seconds)
+void WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval(double seconds)
 {
-    WebResourceLoadStatisticsManager::shared().setMinimumTimeBetweeenDataRecordsRemoval(Seconds { seconds });
+    WebResourceLoadStatisticsManager::shared().setMinimumTimeBetweenDataRecordsRemoval(Seconds { seconds });
 }
 
 void WKResourceLoadStatisticsManagerSetGrandfatheringTime(double seconds)
@@ -163,7 +163,7 @@ void WKResourceLoadStatisticsManagerResetToConsistentState()
 {
     WebResourceLoadStatisticsManager::shared().setTimeToLiveUserInteraction(24_h * 30.);
     WebResourceLoadStatisticsManager::shared().setTimeToLiveCookiePartitionFree(24_h);
-    WebResourceLoadStatisticsManager::shared().setMinimumTimeBetweeenDataRecordsRemoval(1_h);
+    WebResourceLoadStatisticsManager::shared().setMinimumTimeBetweenDataRecordsRemoval(1_h);
     WebResourceLoadStatisticsManager::shared().setGrandfatheringTime(1_h);
     WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned(false);
     WebResourceLoadStatisticsTelemetry::setNotifyPagesWhenTelemetryWasCaptured(false);
index c0fa13e..81fe244 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
     WK_EXPORT void WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo);
     WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds);
     WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree(double seconds);
-    WK_EXPORT void WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(double seconds);
+    WK_EXPORT void WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval(double seconds);
     WK_EXPORT void WKResourceLoadStatisticsManagerSetGrandfatheringTime(double seconds);
     WK_EXPORT void WKResourceLoadStatisticsManagerFireDataModificationHandler();
     WK_EXPORT void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler();
diff --git a/Source/WebKit2/UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm b/Source/WebKit2/UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm
deleted file mode 100644 (file)
index 3e009df..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebResourceLoadStatisticsManager.h"
-
-#import "WebPreferencesKeys.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-    
-void WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded()
-{
-    static dispatch_once_t initOnce;
-    
-    dispatch_once(&initOnce, ^ {
-        const size_t hourInSeconds = 3600;
-        const size_t dayInSeconds = 24 * hourInSeconds;
-        
-        double timeToLiveUserInteraction = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsTimeToLiveUserInteractionKey()];
-        if (timeToLiveUserInteraction > 0 && timeToLiveUserInteraction <= 30 * dayInSeconds)
-            setTimeToLiveUserInteraction(Seconds { timeToLiveUserInteraction });
-        
-        double timeToLiveCookiePartitionFree = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsTimeToLiveCookiePartitionFreeKey()];
-        if (timeToLiveCookiePartitionFree > 0 && timeToLiveCookiePartitionFree <= dayInSeconds)
-            setTimeToLiveCookiePartitionFree(Seconds { timeToLiveCookiePartitionFree });
-
-        double grandfatheringTime = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsGrandfatheringTimeKey()];
-        if (grandfatheringTime > 0 && grandfatheringTime <= 7 * dayInSeconds)
-            setGrandfatheringTime(Seconds { grandfatheringTime });
-    });
-}
-
-}
index 587dcf0..0c0f8a2 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #import "WebResourceLoadStatisticsStore.h"
 
+#import "WebPreferencesKeys.h"
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -37,4 +39,26 @@ void WebResourceLoadStatisticsStore::platformExcludeFromBackup() const
 #endif
 }
 
+void WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded()
+{
+    static dispatch_once_t initOnce;
+
+    dispatch_once(&initOnce, ^ {
+        const size_t hourInSeconds = 3600;
+        const size_t dayInSeconds = 24 * hourInSeconds;
+
+        double timeToLiveUserInteraction = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsTimeToLiveUserInteractionKey()];
+        if (timeToLiveUserInteraction > 0 && timeToLiveUserInteraction <= 30 * dayInSeconds)
+            setTimeToLiveUserInteraction(Seconds { timeToLiveUserInteraction });
+
+        double timeToLiveCookiePartitionFree = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsTimeToLiveCookiePartitionFreeKey()];
+        if (timeToLiveCookiePartitionFree > 0 && timeToLiveCookiePartitionFree <= dayInSeconds)
+            setTimeToLiveCookiePartitionFree(Seconds { timeToLiveCookiePartitionFree });
+
+        double grandfatheringTime = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsGrandfatheringTimeKey()];
+        if (grandfatheringTime > 0 && grandfatheringTime <= 7 * dayInSeconds)
+            setGrandfatheringTime(Seconds { grandfatheringTime });
+    });
+}
+
 }
index 9ad3fdf..827072c 100644 (file)
@@ -43,7 +43,7 @@ static const auto statisticsModelVersion = 4;
 static Seconds timeToLiveUserInteraction { 24_h * 30. };
 static Seconds timeToLiveCookiePartitionFree { 24_h };
 static Seconds grandfatheringTime { 1_h };
-static Seconds minimumTimeBetweeenDataRecordsRemoval { 1_h };
+static Seconds minimumTimeBetweenDataRecordsRemoval { 1_h };
 
 Ref<ResourceLoadStatisticsStore> ResourceLoadStatisticsStore::create()
 {
@@ -281,10 +281,10 @@ void ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree(Seconds secon
         timeToLiveCookiePartitionFree = seconds;
 }
 
-void ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval(Seconds seconds)
+void ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds)
 {
     if (seconds >= 0_s)
-        minimumTimeBetweeenDataRecordsRemoval = seconds;
+        minimumTimeBetweenDataRecordsRemoval = seconds;
 }
 
 void ResourceLoadStatisticsStore::setGrandfatheringTime(Seconds seconds)
@@ -398,7 +398,7 @@ bool ResourceLoadStatisticsStore::shouldRemoveDataRecords() const
     if (m_dataRecordsRemovalPending)
         return false;
 
-    if (m_lastTimeDataRecordsWereRemoved && MonotonicTime::now() < (m_lastTimeDataRecordsWereRemoved + minimumTimeBetweeenDataRecordsRemoval))
+    if (m_lastTimeDataRecordsWereRemoved && MonotonicTime::now() < (m_lastTimeDataRecordsWereRemoved + minimumTimeBetweenDataRecordsRemoval))
         return false;
 
     return true;
index 8533beb..5051a0e 100644 (file)
@@ -83,7 +83,7 @@ public:
     void fireTelemetryHandler();
     void setTimeToLiveUserInteraction(Seconds);
     void setTimeToLiveCookiePartitionFree(Seconds);
-    void setMinimumTimeBetweeenDataRecordsRemoval(Seconds);
+    void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
     void setGrandfatheringTime(Seconds);
     void fireShouldPartitionCookiesHandler();
     void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
index d758f83..bc5fde7 100644 (file)
 #include "config.h"
 #include "WebResourceLoadStatisticsManager.h"
 
-#include "ResourceLoadStatisticsStore.h"
-#include <WebCore/ResourceLoadStatistics.h>
+#include "WebResourceLoadStatisticsStore.h"
 #include <WebCore/URL.h>
-#include <wtf/CrossThreadCopier.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/RunLoop.h>
-#include <wtf/WorkQueue.h>
 
 namespace WebKit {
 
 using namespace WebCore;
 
-template<typename T> static inline String primaryDomain(const T& value)
-{
-    return ResourceLoadStatistics::primaryDomain(value);
-}
-
 WebResourceLoadStatisticsManager& WebResourceLoadStatisticsManager::shared()
 {
     static NeverDestroyed<WebResourceLoadStatisticsManager> webResourceLoadStatisticsManager;
     return webResourceLoadStatisticsManager;
 }
 
-void WebResourceLoadStatisticsManager::setStatisticsStore(Ref<ResourceLoadStatisticsStore>&& store)
+WebResourceLoadStatisticsManager::WebResourceLoadStatisticsManager()
+{
+}
+
+WebResourceLoadStatisticsManager::~WebResourceLoadStatisticsManager()
 {
-    if (m_store && m_queue)
-        m_queue = nullptr;
-    m_store = WTFMove(store);
 }
 
-void WebResourceLoadStatisticsManager::setStatisticsQueue(Ref<WTF::WorkQueue>&& queue)
+void WebResourceLoadStatisticsManager::setStatisticsStore(Ref<WebResourceLoadStatisticsStore>&& store)
 {
-    ASSERT(!m_queue);
-    m_queue = WTFMove(queue);
+    m_store = WTFMove(store);
 }
 
 void WebResourceLoadStatisticsManager::clearInMemoryStore()
@@ -67,10 +58,7 @@ void WebResourceLoadStatisticsManager::clearInMemoryStore()
     if (!m_store)
         return;
 
-    ASSERT(m_queue);
-    m_queue->dispatch([this] {
-        m_store->clearInMemory();
-    });
+    m_store->clearInMemory();
 }
 
 void WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore()
@@ -78,205 +66,166 @@ void WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore()
     if (!m_store)
         return;
 
-    ASSERT(m_queue);
-    m_queue->dispatch([this] {
-        m_store->clearInMemoryAndPersistent();
-    });
+    m_store->clearInMemoryAndPersistent();
 }
 
 void WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore(std::chrono::system_clock::time_point modifiedSince)
 {
-    // For now, be conservative and clear everything regardless of modifiedSince
-    UNUSED_PARAM(modifiedSince);
-    clearInMemoryAndPersistentStore();
+    if (!m_store)
+        return;
+
+    m_store->clearInMemoryAndPersistent(modifiedSince);
 }
 
 void WebResourceLoadStatisticsManager::logUserInteraction(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return;
 
-    ASSERT(m_queue);
-    m_queue->dispatch([this, primaryDomainString = primaryDomain(url).isolatedCopy()] {
-        {
-            auto locker = holdLock(m_store->statisticsLock());
-            auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomainString);
-            statistics.hadUserInteraction = true;
-            statistics.mostRecentUserInteractionTime = WallTime::now();
-        }
-
-        m_store->fireShouldPartitionCookiesHandler({ primaryDomainString }, { }, false);
-    });
+    m_store->logUserInteraction(url);
 }
 
 void WebResourceLoadStatisticsManager::clearUserInteraction(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    statistics.hadUserInteraction = false;
-    statistics.mostRecentUserInteractionTime = { };
+    m_store->clearUserInteraction(url);
 }
 
 bool WebResourceLoadStatisticsManager::hasHadUserInteraction(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return false;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    return m_store->hasHadRecentUserInteraction(statistics);
+    return m_store->hasHadUserInteraction(url);
 }
 
 void WebResourceLoadStatisticsManager::setPrevalentResource(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    statistics.isPrevalentResource = true;
+    m_store->setPrevalentResource(url);
 }
 
 bool WebResourceLoadStatisticsManager::isPrevalentResource(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return false;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    return statistics.isPrevalentResource;
+    return m_store->isPrevalentResource(url);
 }
 
 void WebResourceLoadStatisticsManager::clearPrevalentResource(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    statistics.isPrevalentResource = false;
+    m_store->clearPrevalentResource(url);
 }
 
 void WebResourceLoadStatisticsManager::setGrandfathered(const URL& url, bool value)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    statistics.grandfathered = value;
+    m_store->setGrandfathered(url, value);
 }
 
 bool WebResourceLoadStatisticsManager::isGrandfathered(const URL& url)
 {
-    if (url.isBlankURL() || url.isEmpty())
+    if (!m_store)
         return false;
 
-    auto locker = holdLock(m_store->statisticsLock());
-    auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
-
-    return statistics.grandfathered;
+    return m_store->isGrandfathered(url);
 }
 
 void WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame)
 {
-    if (subframe.isBlankURL() || subframe.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty())
+    if (!m_store)
         return;
 
-    ASSERT(m_queue);
-    m_queue->dispatch([this, primaryTopFrameDomainString = primaryDomain(topFrame).isolatedCopy(), primarySubFrameDomainString = primaryDomain(subframe).isolatedCopy()] {
-        auto locker = holdLock(m_store->statisticsLock());
-        auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primarySubFrameDomainString);
-        statistics.subframeUnderTopFrameOrigins.add(primaryTopFrameDomainString);
-    });
+    m_store->setSubframeUnderTopFrameOrigin(subframe, topFrame);
 }
 
 void WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame)
 {
-    if (subresource.isBlankURL() || subresource.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty())
+    if (!m_store)
         return;
 
-    ASSERT(m_queue);
-    m_queue->dispatch([this, primaryTopFrameDomainString = primaryDomain(topFrame).isolatedCopy(), primarySubresourceDomainString = primaryDomain(subresource).isolatedCopy()] {
-        auto locker = holdLock(m_store->statisticsLock());
-        auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomainString);
-        statistics.subresourceUnderTopFrameOrigins.add(primaryTopFrameDomainString);
-    });
+    m_store->setSubresourceUnderTopFrameOrigin(subresource, topFrame);
 }
 
 void WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo)
 {
-    if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty())
+    if (!m_store)
         return;
 
-    ASSERT(m_queue);
-    m_queue->dispatch([this, primaryRedirectDomainString = primaryDomain(hostNameRedirectedTo).isolatedCopy(), primarySubresourceDomainString = primaryDomain(subresource).isolatedCopy()] {
-        auto locker = holdLock(m_store->statisticsLock());
-        auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomainString);
-        statistics.subresourceUniqueRedirectsTo.add(primaryRedirectDomainString);
-    });
+    m_store->setSubresourceUniqueRedirectTo(subresource, hostNameRedirectedTo);
 }
 
 void WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction(Seconds seconds)
 {
+    if (!m_store)
+        return;
+
     m_store->setTimeToLiveUserInteraction(seconds);
 }
 
 void WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree(Seconds seconds)
 {
+    if (!m_store)
+        return;
+
     m_store->setTimeToLiveCookiePartitionFree(seconds);
 }
 
-void WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval(Seconds seconds)
+void WebResourceLoadStatisticsManager::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds)
 {
-    m_store->setMinimumTimeBetweeenDataRecordsRemoval(seconds);
+    if (!m_store)
+        return;
+
+    m_store->setMinimumTimeBetweenDataRecordsRemoval(seconds);
 }
 
 void WebResourceLoadStatisticsManager::setGrandfatheringTime(Seconds seconds)
 {
-    m_store->setMinimumTimeBetweeenDataRecordsRemoval(seconds);
+    if (!m_store)
+        return;
+
+    m_store->setGrandfatheringTime(seconds);
 }
 
 void WebResourceLoadStatisticsManager::fireDataModificationHandler()
 {
-    // Helper function used by testing system. Should only be called from the main thread.
-    ASSERT(RunLoop::isMain());
-    m_queue->dispatch([this] {
-        m_store->fireDataModificationHandler();
-    });
+    if (!m_store)
+        return;
+
+    m_store->fireDataModificationHandler();
 }
 
 void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler()
 {
-    // Helper function used by testing system. Should only be called from the main thread.
-    ASSERT(RunLoop::isMain());
-    m_queue->dispatch([this] {
-        m_store->fireShouldPartitionCookiesHandler();
-    });
+    if (!m_store)
+        return;
+
+    m_store->fireShouldPartitionCookiesHandler();
 }
 
 void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
 {
-    // Helper function used by testing system. Should only be called from the main thread.
-    ASSERT(RunLoop::isMain());
-    m_queue->dispatch([this, domainsToRemove = CrossThreadCopier<Vector<String>>::copy(domainsToRemove), domainsToAdd = CrossThreadCopier<Vector<String>>::copy(domainsToAdd), clearFirst] {
-        m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
-    });
+    if (!m_store)
+        return;
+
+    m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
 }
 
 void WebResourceLoadStatisticsManager::fireTelemetryHandler()
 {
-    // Helper function used by testing system. Should only be called from the main thread.
-    ASSERT(RunLoop::isMain());
+    if (!m_store)
+        return;
+
     m_store->fireTelemetryHandler();
 }
 
index eb844f5..22bb208 100644 (file)
 #include <wtf/Seconds.h>
 #include <wtf/text/WTFString.h>
 
-namespace WTF {
-class WorkQueue;
-}
-
 namespace WebCore {
 class URL;
 }
 
 namespace WebKit {
 
-class ResourceLoadStatisticsStore;
+class WebResourceLoadStatisticsStore;
 
+// FIXME: This should probably become an APIObject for the WebResourceLoadStatisticsStore.
 class WebResourceLoadStatisticsManager {
     friend class NeverDestroyed<WebResourceLoadStatisticsManager>;
 public:
+    // FIXME: This should not be a singleton.
     static WebResourceLoadStatisticsManager& shared();
+    void setStatisticsStore(Ref<WebResourceLoadStatisticsStore>&&);
+
+    ~WebResourceLoadStatisticsManager();
 
     void logUserInteraction(const WebCore::URL&);
     bool hasHadUserInteraction(const WebCore::URL&);
@@ -62,7 +63,7 @@ public:
 
     void setTimeToLiveUserInteraction(Seconds);
     void setTimeToLiveCookiePartitionFree(Seconds);
-    void setMinimumTimeBetweeenDataRecordsRemoval(Seconds);
+    void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
     void setGrandfatheringTime(Seconds);
 
     void fireDataModificationHandler();
@@ -70,19 +71,14 @@ public:
     void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
     void fireTelemetryHandler();
 
-    void setStatisticsStore(Ref<ResourceLoadStatisticsStore>&&);
-    void setStatisticsQueue(Ref<WTF::WorkQueue>&&);
     void clearInMemoryStore();
     void clearInMemoryAndPersistentStore();
     void clearInMemoryAndPersistentStore(std::chrono::system_clock::time_point modifiedSince);
 
-#if PLATFORM(COCOA)
-    void registerUserDefaultsIfNeeded();
-#endif
-
 private:
-    RefPtr<ResourceLoadStatisticsStore> m_store;
-    RefPtr<WTF::WorkQueue> m_queue;
+    WebResourceLoadStatisticsManager();
+
+    RefPtr<WebResourceLoadStatisticsStore> m_store;
 };
 
 } // namespace WebKit
index 39ea42d..6c3d00e 100644 (file)
@@ -54,6 +54,11 @@ using namespace WebCore;
 
 namespace WebKit {
 
+template<typename T> static inline String primaryDomain(const T& value)
+{
+    return ResourceLoadStatistics::primaryDomain(value);
+}
+
 static bool notifyPagesWhenDataRecordsWereScanned = false;
 static bool shouldClassifyResourcesBeforeDataRecordsRemoval = true;
 static auto shouldSubmitTelemetry = true;
@@ -209,8 +214,7 @@ void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
 {
     ASSERT(RunLoop::isMain());
     
-    WebResourceLoadStatisticsManager::shared().setStatisticsStore(m_resourceLoadStatisticsStore.copyRef());
-    WebResourceLoadStatisticsManager::shared().setStatisticsQueue(m_statisticsQueue.copyRef());
+    WebResourceLoadStatisticsManager::shared().setStatisticsStore(*this);
     m_resourceLoadStatisticsStore->setNotificationCallback([this, protectedThis = makeRef(*this)] {
         if (m_resourceLoadStatisticsStore->isEmpty())
             return;
@@ -232,11 +236,12 @@ void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
     m_resourceLoadStatisticsStore->setFireTelemetryCallback([this, protectedThis = makeRef(*this)] {
         submitTelemetry();
     });
+
 #if PLATFORM(COCOA)
-    WebResourceLoadStatisticsManager::shared().registerUserDefaultsIfNeeded();
+    registerUserDefaultsIfNeeded();
 #endif
 }
-    
+
 void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(WTF::Function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&& shouldPartitionCookiesForDomainsHandler)
 {
     ASSERT(RunLoop::isMain());
@@ -505,5 +510,207 @@ void WebResourceLoadStatisticsStore::submitTelemetry()
         WebResourceLoadStatisticsTelemetry::calculateAndSubmit(coreStore());
     });
 }
+
+void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return;
+
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomainString = primaryDomain(url).isolatedCopy()] {
+        {
+            auto locker = holdLock(coreStore().statisticsLock());
+            auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomainString);
+            statistics.hadUserInteraction = true;
+            statistics.mostRecentUserInteractionTime = WallTime::now();
+        }
+
+        coreStore().fireShouldPartitionCookiesHandler({ primaryDomainString }, { }, false);
+    });
+}
+
+void WebResourceLoadStatisticsStore::clearUserInteraction(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    statistics.hadUserInteraction = false;
+    statistics.mostRecentUserInteractionTime = { };
+}
+
+bool WebResourceLoadStatisticsStore::hasHadUserInteraction(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return false;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    // FIXME: Why is this potentially creating a store entry just for querying?
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    return coreStore().hasHadRecentUserInteraction(statistics);
+}
+
+void WebResourceLoadStatisticsStore::setPrevalentResource(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    statistics.isPrevalentResource = true;
+}
+
+bool WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return false;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    // FIXME: Why is this potentially creating a store entry just for querying?
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    return statistics.isPrevalentResource;
+}
+
+void WebResourceLoadStatisticsStore::clearPrevalentResource(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    statistics.isPrevalentResource = false;
+}
+
+void WebResourceLoadStatisticsStore::setGrandfathered(const URL& url, bool value)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    statistics.grandfathered = value;
+}
+
+bool WebResourceLoadStatisticsStore::isGrandfathered(const URL& url)
+{
+    if (url.isBlankURL() || url.isEmpty())
+        return false;
+
+    auto locker = holdLock(coreStore().statisticsLock());
+    // FIXME: Why is this potentially creating a store entry just for querying?
+    auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
+    return statistics.grandfathered;
+}
+
+void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame)
+{
+    if (subframe.isBlankURL() || subframe.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty())
+        return;
+
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryTopFrameDomainString = primaryDomain(topFrame).isolatedCopy(), primarySubFrameDomainString = primaryDomain(subframe).isolatedCopy()] {
+        auto locker = holdLock(coreStore().statisticsLock());
+        auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primarySubFrameDomainString);
+        statistics.subframeUnderTopFrameOrigins.add(primaryTopFrameDomainString);
+    });
+}
+
+void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame)
+{
+    if (subresource.isBlankURL() || subresource.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty())
+        return;
+
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryTopFrameDomainString = primaryDomain(topFrame).isolatedCopy(), primarySubresourceDomainString = primaryDomain(subresource).isolatedCopy()] {
+        auto locker = holdLock(coreStore().statisticsLock());
+        auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomainString);
+        statistics.subresourceUnderTopFrameOrigins.add(primaryTopFrameDomainString);
+    });
+}
+
+void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo)
+{
+    if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty())
+        return;
+
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryRedirectDomainString = primaryDomain(hostNameRedirectedTo).isolatedCopy(), primarySubresourceDomainString = primaryDomain(subresource).isolatedCopy()] {
+        auto locker = holdLock(coreStore().statisticsLock());
+        auto& statistics = coreStore().ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomainString);
+        statistics.subresourceUniqueRedirectsTo.add(primaryRedirectDomainString);
+    });
+}
+
+void WebResourceLoadStatisticsStore::fireDataModificationHandler()
+{
+    // Helper function used by testing system. Should only be called from the main thread.
+    ASSERT(RunLoop::isMain());
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+        coreStore().fireDataModificationHandler();
+    });
+}
+
+void WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
+{
+    // Helper function used by testing system. Should only be called from the main thread.
+    ASSERT(RunLoop::isMain());
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+        coreStore().fireShouldPartitionCookiesHandler();
+    });
+}
+
+void WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
+{
+    // Helper function used by testing system. Should only be called from the main thread.
+    ASSERT(RunLoop::isMain());
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domainsToRemove = CrossThreadCopier<Vector<String>>::copy(domainsToRemove), domainsToAdd = CrossThreadCopier<Vector<String>>::copy(domainsToAdd), clearFirst] {
+        coreStore().fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
+    });
+}
+
+void WebResourceLoadStatisticsStore::fireTelemetryHandler()
+{
+    // Helper function used by testing system. Should only be called from the main thread.
+    ASSERT(RunLoop::isMain());
+    coreStore().fireTelemetryHandler();
+}
+
+void WebResourceLoadStatisticsStore::clearInMemory()
+{
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+        coreStore().clearInMemory();
+    });
+}
+
+void WebResourceLoadStatisticsStore::clearInMemoryAndPersistent()
+{
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+        coreStore().clearInMemoryAndPersistent();
+    });
+}
+
+void WebResourceLoadStatisticsStore::clearInMemoryAndPersistent(std::chrono::system_clock::time_point modifiedSince)
+{
+    // For now, be conservative and clear everything regardless of modifiedSince.
+    UNUSED_PARAM(modifiedSince);
+    clearInMemoryAndPersistent();
+}
+
+void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds)
+{
+    coreStore().setTimeToLiveUserInteraction(seconds);
+}
+
+void WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree(Seconds seconds)
+{
+    coreStore().setTimeToLiveCookiePartitionFree(seconds);
+}
+
+void WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds)
+{
+    coreStore().setMinimumTimeBetweenDataRecordsRemoval(seconds);
+}
+
+void WebResourceLoadStatisticsStore::setGrandfatheringTime(Seconds seconds)
+{
+    coreStore().setGrandfatheringTime(seconds);
+}
     
 } // namespace WebKit
index 33fed92..2455bb7 100644 (file)
@@ -59,7 +59,6 @@ public:
     static Ref<WebResourceLoadStatisticsStore> create(const String&);
     static void setNotifyPagesWhenDataRecordsWereScanned(bool);
     static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
-    static void setMinimumTimeBetweeenDataRecordsRemoval(Seconds);
     static void setShouldSubmitTelemetry(bool);
     virtual ~WebResourceLoadStatisticsStore();
     
@@ -76,12 +75,37 @@ public:
 
     void readDataFromDiskIfNeeded();
 
-    ResourceLoadStatisticsStore& coreStore() { return m_resourceLoadStatisticsStore.get(); }
-    const ResourceLoadStatisticsStore& coreStore() const { return m_resourceLoadStatisticsStore.get(); }
+    void logUserInteraction(const WebCore::URL&);
+    void clearUserInteraction(const WebCore::URL&);
+    bool hasHadUserInteraction(const WebCore::URL&);
+    void setPrevalentResource(const WebCore::URL&);
+    bool isPrevalentResource(const WebCore::URL&);
+    void clearPrevalentResource(const WebCore::URL&);
+    void setGrandfathered(const WebCore::URL&, bool);
+    bool isGrandfathered(const WebCore::URL&);
+    void setSubframeUnderTopFrameOrigin(const WebCore::URL& subframe, const WebCore::URL& topFrame);
+    void setSubresourceUnderTopFrameOrigin(const WebCore::URL& subresource, const WebCore::URL& topFrame);
+    void setSubresourceUniqueRedirectTo(const WebCore::URL& subresource, const WebCore::URL& hostNameRedirectedTo);
+    void fireDataModificationHandler();
+    void fireShouldPartitionCookiesHandler();
+    void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
+
+    void fireTelemetryHandler();
+    void clearInMemory();
+    void clearInMemoryAndPersistent();
+    void clearInMemoryAndPersistent(std::chrono::system_clock::time_point modifiedSince);
+
+    void setTimeToLiveUserInteraction(Seconds);
+    void setTimeToLiveCookiePartitionFree(Seconds);
+    void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
+    void setGrandfatheringTime(Seconds);
 
 private:
     explicit WebResourceLoadStatisticsStore(const String&);
 
+    ResourceLoadStatisticsStore& coreStore() { return m_resourceLoadStatisticsStore.get(); }
+    const ResourceLoadStatisticsStore& coreStore() const { return m_resourceLoadStatisticsStore.get(); }
+
     void processStatisticsAndDataRecords();
 
     void classifyResource(WebCore::ResourceLoadStatistics&);
@@ -107,6 +131,10 @@ private:
     void telemetryTimerFired();
     void submitTelemetry();
 
+#if PLATFORM(COCOA)
+    void registerUserDefaultsIfNeeded();
+#endif
+
     Ref<ResourceLoadStatisticsStore> m_resourceLoadStatisticsStore;
 #if HAVE(CORE_PREDICTION)
     ResourceLoadStatisticsClassifierCocoa m_resourceLoadStatisticsClassifier;
index 2fb9cc5..f20546b 100644 (file)
@@ -34,7 +34,6 @@
 #include "WebCookieManagerProxy.h"
 #include "WebProcessMessages.h"
 #include "WebProcessPool.h"
-#include "WebResourceLoadStatisticsManager.h"
 #include "WebResourceLoadStatisticsStore.h"
 #include "WebResourceLoadStatisticsStoreMessages.h"
 #include "WebsiteData.h"
@@ -815,8 +814,8 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, std::chr
     }
 #endif
 
-    if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics))
-        WebResourceLoadStatisticsManager::shared().clearInMemoryAndPersistentStore(modifiedSince);
+    if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics) && m_resourceLoadStatistics)
+        m_resourceLoadStatistics->clearInMemoryAndPersistent(modifiedSince);
 
     // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
     callbackAggregator->callIfNeeded();
@@ -1084,8 +1083,8 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, const Ve
     }
 #endif
 
-    if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics))
-        WebResourceLoadStatisticsManager::shared().clearInMemoryAndPersistentStore();
+    if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics) && m_resourceLoadStatistics)
+        m_resourceLoadStatistics->clearInMemoryAndPersistent();
 
     // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
     callbackAggregator->callIfNeeded();
index 1ee4961..2a53e64 100644 (file)
                65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6B821DDC1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */; };
                6B821DDD1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */; };
-               6BBBAD381EC3E57800AD0A2A /* WebResourceLoadStatisticsManagerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6BBBAD371EC3E56300AD0A2A /* WebResourceLoadStatisticsManagerCocoa.mm */; };
                6BE9699C1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6BE9699E1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */; };
                6BE969A01E43B86E008B7483 /* WebResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */; };
                65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; };
                6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsTelemetry.h; sourceTree = "<group>"; };
                6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsTelemetry.cpp; sourceTree = "<group>"; };
-               6BBBAD371EC3E56300AD0A2A /* WebResourceLoadStatisticsManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebResourceLoadStatisticsManagerCocoa.mm; sourceTree = "<group>"; };
                6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKResourceLoadStatisticsManager.h; sourceTree = "<group>"; };
                6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKResourceLoadStatisticsManager.cpp; sourceTree = "<group>"; };
                6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsManager.h; sourceTree = "<group>"; };
                                CDA29A1F1CBEB5FB00901CCF /* WebPlaybackSessionManagerProxy.mm */,
                                7CE4D2151A49148400C7F152 /* WebProcessPoolCocoa.mm */,
                                1A04F6171A4A3A7A00A21B6E /* WebProcessProxyCocoa.mm */,
-                               6BBBAD371EC3E56300AD0A2A /* WebResourceLoadStatisticsManagerCocoa.mm */,
                                7AAD175E1EA6AF37003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm */,
                                51D124311E6DE521002B2820 /* WebURLSchemeHandlerCocoa.h */,
                                51D124321E6DE521002B2820 /* WebURLSchemeHandlerCocoa.mm */,
                                510AFFB916542048001BA05E /* WebResourceLoader.cpp in Sources */,
                                51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */,
                                6BE969A21E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp in Sources */,
-                               6BBBAD381EC3E57800AD0A2A /* WebResourceLoadStatisticsManagerCocoa.mm in Sources */,
                                7A791EFC1C7D08C500C4C52B /* WebResourceLoadStatisticsStore.cpp in Sources */,
                                7AAD175F1EA6AF99003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm in Sources */,
                                7A791EFA1C7CFCF100C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp in Sources */,
index 6193507..75359fe 100644 (file)
@@ -1,3 +1,22 @@
+2017-06-30  Chris Dumez  <cdumez@apple.com>
+
+        Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore
+        https://bugs.webkit.org/show_bug.cgi?id=174038
+
+        Reviewed by Brent Fulgham.
+
+        Fix typo in API name.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setStatisticsMinimumTimeBetweenDataRecordsRemoval):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::setStatisticsMinimumTimeBetweenDataRecordsRemoval):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
 2017-06-30  Alex Christensen  <achristensen@webkit.org>
 
         REGRESSION(r215096) Queries of URLs with non-special schemes should not percent-encode single quotes
index 4f087f2..5776b9c 100644 (file)
@@ -272,7 +272,7 @@ interface TestRunner {
     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value);
     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value);
     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(boolean value);
-    void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds);
+    void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double seconds);
     void setStatisticsGrandfatheringTime(double seconds);
     void statisticsClearInMemoryAndPersistentStore();
     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned long hours);
index 8831f8d..1aa0e5d 100644 (file)
@@ -1480,9 +1480,9 @@ void TestRunner::setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value)
     WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured(value);
 }
 
-void TestRunner::setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds)
+void TestRunner::setStatisticsMinimumTimeBetweenDataRecordsRemoval(double seconds)
 {
-    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsMinimumTimeBetweeenDataRecordsRemoval"));
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsMinimumTimeBetweenDataRecordsRemoval"));
     WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds));
     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
 }
index acb196d..4a99c8c 100644 (file)
@@ -371,7 +371,7 @@ public:
     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value);
-    void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double);
+    void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double);
     void setStatisticsGrandfatheringTime(double seconds);
     void statisticsClearInMemoryAndPersistentStore();
     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours);
index 97839df..8aa6a68 100644 (file)
@@ -2299,9 +2299,9 @@ void TestController::setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value
     WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured(value);
 }
     
-void TestController::setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds)
+void TestController::setStatisticsMinimumTimeBetweenDataRecordsRemoval(double seconds)
 {
-    WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(seconds);
+    WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval(seconds);
 }
 
 void TestController::setStatisticsGrandfatheringTime(double seconds)
index 7edc724..61b186b 100644 (file)
@@ -168,7 +168,7 @@ public:
     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value);
-    void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double);
+    void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double);
     void setStatisticsGrandfatheringTime(double seconds);
     void statisticsClearInMemoryAndPersistentStore();
     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned);
index 30efd95..1335625 100644 (file)
@@ -1087,10 +1087,10 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB
         return nullptr;
     }
 
-    if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsMinimumTimeBetweeenDataRecordsRemoval")) {
+    if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsMinimumTimeBetweenDataRecordsRemoval")) {
         ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID());
         WKDoubleRef seconds = static_cast<WKDoubleRef>(messageBody);
-        TestController::singleton().setStatisticsMinimumTimeBetweeenDataRecordsRemoval(WKDoubleGetValue(seconds));
+        TestController::singleton().setStatisticsMinimumTimeBetweenDataRecordsRemoval(WKDoubleGetValue(seconds));
         return nullptr;
     }