Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 01:09:12 +0000 (01:09 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 01:09:12 +0000 (01:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196407
<rdar://problem/47859936>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html

This patch removes old code for the batching into "statistics updated" calls.
Since the move of Resource Load Statistics to the network process, all such
collection is done directly through dedicated calls to the network process.

The remaining functionality was renamed to make it more clear, i.e.
ResourceLoadObserver::notifyObserver() renamed to
ResourceLoadObserver::updateCentralStatisticsStore().

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::setStatisticsUpdatedCallback):
(WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
(WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
(WebCore::ResourceLoadObserver::clearState):
(WebCore::ResourceLoadObserver::setNotificationCallback): Deleted.
(WebCore::ResourceLoadObserver::ResourceLoadObserver): Deleted.
(WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded): Deleted.
(WebCore::ResourceLoadObserver::notifyObserver): Deleted.
* loader/ResourceLoadObserver.h:
* testing/Internals.cpp:
(WebCore::Internals::notifyResourceLoadObserver):

Source/WebKit:

The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
moved Resource Load Statistics from the UI process to the network process. One
of the endpoints is the message RequestStorageAccessUnderOpener which underpins
our compatibility fix for federated logins using popups. This patch redirects
these IPC calls to the network process and cleans up some assumptions around
them.

* CMakeLists.txt:
    Removed the old IPC receiver.
* DerivedSources.make:
    Removed the old IPC receiver.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
    This is no longer needed since there is a dedicated update mechanism
    that actually sends the update.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
(WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
    Two new IPC receivers to pipe the calls to the network process.
(WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
    NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
    this purpose.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
    Removed the old IPC receiver.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleResourceLoadStatisticsNotifyObserver):
    Function name update.
* WebProcess/WebProcess.cpp:
    Now calls IPC to the network process instead of the UI process.

LayoutTests:

* http/tests/storageAccess/deny-storage-access-under-opener-expected.txt:
* http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-expected.txt:
* http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-expected.txt: Added.
* http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html: Added.
* http/tests/storageAccess/resources/get-cookies.php:
* http/tests/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html: Added.

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

24 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-expected.txt
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-expected.txt
LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/resources/get-cookies.php
LayoutTests/http/tests/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadObserver.h
Source/WebCore/testing/Internals.cpp
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/DerivedSources.make
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.messages.in [deleted file]
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp
Source/WebKit/WebProcess/WebProcess.cpp

index 7932e59..a0062f4 100644 (file)
@@ -1,3 +1,18 @@
+2019-03-29  John Wilander  <wilander@apple.com>
+
+        Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
+        https://bugs.webkit.org/show_bug.cgi?id=196407
+        <rdar://problem/47859936>
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/storageAccess/deny-storage-access-under-opener-expected.txt:
+        * http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-expected.txt:
+        * http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-expected.txt: Added.
+        * http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html: Added.
+        * http/tests/storageAccess/resources/get-cookies.php:
+        * http/tests/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html: Added.
+
 2019-03-29  Chris Dumez  <cdumez@apple.com>
 
         Make someWindow.frames, .self, .window always return someWindow
index 8b4a645..365fd68 100644 (file)
@@ -14,5 +14,4 @@ Frame: '<!--frame1-->'
 --------
 Should not receive first-party cookie.
 Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named ''.
 Client-side document.cookie:
diff --git a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-expected.txt b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-expected.txt
new file mode 100644 (file)
index 0000000..cc62bfc
--- /dev/null
@@ -0,0 +1,17 @@
+Tests that a cross-origin window from a prevalent domain with previous user interaction gets storage access under its opener if it gets user interaction.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Cookie created.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+Should receive first-party cookie.
+Received cookie named 'firstPartyCookie'.
+Client-side document.cookie: firstPartyCookie=value
diff --git a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html
new file mode 100644 (file)
index 0000000..92a6f06
--- /dev/null
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="/js-test-resources/js-test.js"></script>
+    <script src="/resourceLoadStatistics/resources/util.js"></script>
+</head>
+<body onload="run()">
+<script>
+    description("Tests that a cross-origin window from a prevalent domain with previous user interaction gets storage access under its opener if it gets user interaction.");
+    jsTestIsAsync = true;
+
+    function finishTest() {
+        setEnableFeature(false, finishJSTest);
+    }
+
+    function openIframe(url, onLoadHandler) {
+        const element = document.createElement("iframe");
+        element.src = url;
+        if (onLoadHandler) {
+            element.onload = onLoadHandler;
+        }
+        document.body.appendChild(element);
+    }
+
+    function receiveMessage(event) {
+        if (event.origin === "http://localhost:8000") {
+            if (event.data.indexOf("PASS") !== -1)
+                testPassed(event.data.replace("PASS ", ""));
+            else
+                testFailed(event.data);
+        } else
+            testFailed("Received a message from an unexpected origin: " + event.origin);
+
+        newWin.close();
+        openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", finishTest);
+    }
+
+    const thirdPartyOrigin = "http://localhost:8000";
+    const resourcePath = "/storageAccess/resources";
+    const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
+    const firstPartyCookieName = "firstPartyCookie";
+    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName;
+    var newWin;
+
+    function run() {
+        setEnableFeature(true, function() {
+            window.addEventListener("message", receiveMessage, false);
+
+            testRunner.setCanOpenWindows();
+
+            testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
+                    testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() {
+                    if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+                        testFailed("Host did not get logged for user interaction.");
+                    testRunner.dumpChildFramesAsText();
+                    testRunner.setCloseRemainingWindowsWhenComplete(true);
+
+                    testRunner.statisticsUpdateCookieBlocking(function () {
+                        newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html", "testWindow");
+                    });
+                });
+            });
+        });
+    }
+</script>
+</body>
+</html>
\ No newline at end of file
index a4fb6a8..2d156b2 100644 (file)
@@ -5,10 +5,12 @@ if(!isset($_COOKIE[$_GET["name1"]])) {
 } else {
     echo "Received cookie named '" . $_GET["name1"] . "'.<br>";
 }
-if(!isset($_COOKIE[$_GET["name2"]])) {
-    echo "Did not receive cookie named '" . $_GET["name2"] . "'.<br>";
-} else {
-    echo "Received cookie named '" . $_GET["name2"] . "'.<br>";
+if(!empty($_GET["name2"])) {
+    if(!isset($_COOKIE[$_GET["name2"]])) {
+        echo "Did not receive cookie named '" . $_GET["name2"] . "'.<br>";
+    } else {
+        echo "Received cookie named '" . $_GET["name2"] . "'.<br>";
+    }
 }
 if(!empty($_GET["name3"])) {
     if(!isset($_COOKIE[$_GET["name3"]])) {
diff --git a/LayoutTests/http/tests/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html b/LayoutTests/http/tests/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html
new file mode 100644 (file)
index 0000000..133affc
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="/js-test-resources/ui-helper.js"></script>
+    <script>
+        let intervalID;
+        function setCookieAndPostMessage() {
+            internals.withUserGesture(function() {
+                intervalID = setInterval(function() {
+                    var promise = document.hasStorageAccess();
+                    promise.then(
+                        function (hasAccess) {
+                            if (hasAccess) {
+                                clearInterval(intervalID);
+                                document.cookie = "firstPartyCookie=value";
+                                window.opener.postMessage("PASS Cookie created.", "http://127.0.0.1:8000");
+                            }
+                        },
+                        function (reason) {
+                            window.opener.postMessage("FAIL Promise was rejected, reason: " + reason, "http://127.0.0.1:8000");
+                        }
+                    );
+                }, 100);
+
+            });
+        }
+    </script>
+</head>
+<body onload="setCookieAndPostMessage()">
+</body>
+</html>
\ No newline at end of file
index e517021..953c4b3 100644 (file)
@@ -1,3 +1,38 @@
+2019-03-29  John Wilander  <wilander@apple.com>
+
+        Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
+        https://bugs.webkit.org/show_bug.cgi?id=196407
+        <rdar://problem/47859936>
+
+        Reviewed by Brent Fulgham.
+
+        Test: http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture.html
+
+        This patch removes old code for the batching into "statistics updated" calls.
+        Since the move of Resource Load Statistics to the network process, all such
+        collection is done directly through dedicated calls to the network process.
+
+        The remaining functionality was renamed to make it more clear, i.e.
+        ResourceLoadObserver::notifyObserver() renamed to
+        ResourceLoadObserver::updateCentralStatisticsStore().
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::setStatisticsUpdatedCallback):
+        (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
+        (WebCore::ResourceLoadObserver::logSubresourceLoading):
+        (WebCore::ResourceLoadObserver::logWebSocketLoading):
+        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
+        (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
+        (WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
+        (WebCore::ResourceLoadObserver::clearState):
+        (WebCore::ResourceLoadObserver::setNotificationCallback): Deleted.
+        (WebCore::ResourceLoadObserver::ResourceLoadObserver): Deleted.
+        (WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded): Deleted.
+        (WebCore::ResourceLoadObserver::notifyObserver): Deleted.
+        * loader/ResourceLoadObserver.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::notifyResourceLoadObserver):
+
 2019-03-29  Chris Dumez  <cdumez@apple.com>
 
         Make someWindow.frames, .self, .window always return someWindow
index d00d250..68a98a4 100644 (file)
@@ -53,13 +53,13 @@ ResourceLoadObserver& ResourceLoadObserver::shared()
     return resourceLoadObserver;
 }
 
-void ResourceLoadObserver::setNotificationCallback(WTF::Function<void (Vector<ResourceLoadStatistics>&&)>&& notificationCallback)
+void ResourceLoadObserver::setStatisticsUpdatedCallback(WTF::Function<void(Vector<ResourceLoadStatistics>&&)>&& notificationCallback)
 {
     ASSERT(!m_notificationCallback);
     m_notificationCallback = WTFMove(notificationCallback);
 }
 
-void ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback(WTF::Function<void(const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, const RegistrableDomain& openerDomain)>&& callback)
+void ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback(WTF::Function<void(PAL::SessionID sessionID, const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, const RegistrableDomain& openerDomain)>&& callback)
 {
     ASSERT(!m_requestStorageAccessUnderOpenerCallback);
     m_requestStorageAccessUnderOpenerCallback = WTFMove(callback);
@@ -89,11 +89,6 @@ void ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback(Functio
     m_logSubresourceRedirectNotificationCallback = WTFMove(callback);
 }
     
-ResourceLoadObserver::ResourceLoadObserver()
-    : m_notificationTimer(*this, &ResourceLoadObserver::notifyObserver)
-{
-}
-
 static inline bool is3xxRedirect(const ResourceResponse& response)
 {
     return response.httpStatusCode() >= 300 && response.httpStatusCode() <= 399;
@@ -133,31 +128,23 @@ void ResourceLoadObserver::logSubresourceLoading(const Frame* frame, const Resou
     if (targetDomain == topFrameDomain || (isRedirect && targetDomain == redirectedFromDomain))
         return;
 
-    bool shouldCallNotificationCallback = false;
     {
         auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
         auto lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
         targetStatistics.lastSeen = lastSeen;
-        if (targetStatistics.subresourceUnderTopFrameDomains.add(topFrameDomain).isNewEntry)
-            shouldCallNotificationCallback = true;
+        targetStatistics.subresourceUnderTopFrameDomains.add(topFrameDomain);
 
         m_logSubresourceLoadingNotificationCallback(page->sessionID(), targetDomain, topFrameDomain, lastSeen);
     }
 
     if (isRedirect) {
         auto& redirectingOriginStatistics = ensureResourceStatisticsForRegistrableDomain(redirectedFromDomain);
-        bool isNewRedirectToEntry = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetDomain).isNewEntry;
+        redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetDomain);
         auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
-        bool isNewRedirectFromEntry = targetStatistics.subresourceUniqueRedirectsFrom.add(redirectedFromDomain).isNewEntry;
-
-        if (isNewRedirectToEntry || isNewRedirectFromEntry)
-            shouldCallNotificationCallback = true;
+        targetStatistics.subresourceUniqueRedirectsFrom.add(redirectedFromDomain);
 
         m_logSubresourceRedirectNotificationCallback(page->sessionID(), redirectedFromDomain, targetDomain);
     }
-
-    if (shouldCallNotificationCallback)
-        scheduleNotificationIfNeeded();
 }
 
 void ResourceLoadObserver::logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL, PAL::SessionID sessionID)
@@ -181,8 +168,7 @@ void ResourceLoadObserver::logWebSocketLoading(const URL& targetURL, const URL&
 
     auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
     targetStatistics.lastSeen = lastSeen;
-    if (targetStatistics.subresourceUnderTopFrameDomains.add(topFrameDomain).isNewEntry)
-        scheduleNotificationIfNeeded();
+    targetStatistics.subresourceUnderTopFrameDomains.add(topFrameDomain);
 
     m_logWebSocketLoadingNotificationCallback(sessionID, targetDomain, topFrameDomain, lastSeen);
 }
@@ -215,7 +201,7 @@ void ResourceLoadObserver::logUserInteractionWithReducedTimeResolution(const Doc
             if (auto* openerDocument = opener->document()) {
                 if (auto* openerFrame = openerDocument->frame()) {
                     if (auto openerPageID = openerFrame->loader().client().pageID())
-                        requestStorageAccessUnderOpener(topFrameDomain, openerPageID.value(), *openerDocument);
+                        requestStorageAccessUnderOpener(document.sessionID(), topFrameDomain, openerPageID.value(), *openerDocument);
                 }
             }
         }
@@ -224,9 +210,6 @@ void ResourceLoadObserver::logUserInteractionWithReducedTimeResolution(const Doc
     m_logUserInteractionNotificationCallback(document.sessionID(), topFrameDomain);
 #endif
 
-    m_notificationTimer.stop();
-    notifyObserver();
-
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
     if (shouldLogUserInteraction()) {
         auto counter = ++m_loggingCounter;
@@ -250,14 +233,14 @@ void ResourceLoadObserver::logUserInteractionWithReducedTimeResolution(const Doc
 }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-void ResourceLoadObserver::requestStorageAccessUnderOpener(const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument)
+void ResourceLoadObserver::requestStorageAccessUnderOpener(PAL::SessionID sessionID, const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument)
 {
     auto openerUrl = openerDocument.url();
     RegistrableDomain openerDomain { openerUrl };
     if (domainInNeedOfStorageAccess != openerDomain
         && !openerDocument.hasRequestedPageSpecificStorageAccessWithUserInteraction(domainInNeedOfStorageAccess)
         && !equalIgnoringASCIICase(openerUrl.string(), WTF::blankURL())) {
-        m_requestStorageAccessUnderOpenerCallback(domainInNeedOfStorageAccess, openerPageID, openerDomain);
+        m_requestStorageAccessUnderOpenerCallback(sessionID, domainInNeedOfStorageAccess, openerPageID, openerDomain);
         // Remember user interaction-based requests since they don't need to be repeated.
         openerDocument.setHasRequestedPageSpecificStorageAccessWithUserInteraction(domainInNeedOfStorageAccess);
     }
@@ -382,22 +365,8 @@ ResourceLoadStatistics& ResourceLoadObserver::ensureResourceStatisticsForRegistr
     return addResult.iterator->value;
 }
 
-void ResourceLoadObserver::scheduleNotificationIfNeeded()
-{
-    ASSERT(m_notificationCallback);
-    if (m_resourceStatisticsMap.isEmpty()) {
-        m_notificationTimer.stop();
-        return;
-    }
-
-    if (!m_notificationTimer.isActive())
-        m_notificationTimer.startOneShot(minimumNotificationInterval);
-}
-
-void ResourceLoadObserver::notifyObserver()
+void ResourceLoadObserver::updateCentralStatisticsStore()
 {
-    ASSERT(m_notificationCallback);
-    m_notificationTimer.stop();
     m_notificationCallback(takeStatistics());
 }
 
@@ -424,7 +393,6 @@ Vector<ResourceLoadStatistics> ResourceLoadObserver::takeStatistics()
 
 void ResourceLoadObserver::clearState()
 {
-    m_notificationTimer.stop();
     m_resourceStatisticsMap.clear();
     m_lastReportedUserInteractionMap.clear();
 }
index 07df552..c4661b0 100644 (file)
@@ -72,14 +72,14 @@ public:
 
     WEBCORE_EXPORT String statisticsForURL(const URL&);
 
-    WEBCORE_EXPORT void setNotificationCallback(WTF::Function<void (Vector<ResourceLoadStatistics>&&)>&&);
-    WEBCORE_EXPORT void setRequestStorageAccessUnderOpenerCallback(Function<void(const RegistrableDomain&, uint64_t, const RegistrableDomain&)>&&);
+    WEBCORE_EXPORT void setStatisticsUpdatedCallback(WTF::Function<void(Vector<ResourceLoadStatistics>&&)>&&);
+    WEBCORE_EXPORT void setRequestStorageAccessUnderOpenerCallback(Function<void(PAL::SessionID, const RegistrableDomain&, uint64_t, const RegistrableDomain&)>&&);
     WEBCORE_EXPORT void setLogUserInteractionNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&)>&&);
     WEBCORE_EXPORT void setLogWebSocketLoadingNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)>&&);
     WEBCORE_EXPORT void setLogSubresourceLoadingNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)>&&);
     WEBCORE_EXPORT void setLogSubresourceRedirectNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&)>&&);
 
-    WEBCORE_EXPORT void notifyObserver();
+    WEBCORE_EXPORT void updateCentralStatisticsStore();
     WEBCORE_EXPORT void clearState();
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
@@ -88,28 +88,23 @@ public:
 #endif
 
 private:
-    ResourceLoadObserver();
-
     bool shouldLog(bool usesEphemeralSession) const;
     ResourceLoadStatistics& ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain&);
 
-    void scheduleNotificationIfNeeded();
     Vector<ResourceLoadStatistics> takeStatistics();
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    void requestStorageAccessUnderOpener(const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument);
+    void requestStorageAccessUnderOpener(PAL::SessionID, const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument);
 #endif
 
     HashMap<RegistrableDomain, ResourceLoadStatistics> m_resourceStatisticsMap;
     HashMap<RegistrableDomain, WTF::WallTime> m_lastReportedUserInteractionMap;
     Function<void(Vector<ResourceLoadStatistics>&&)> m_notificationCallback;
-    Function<void(const RegistrableDomain&, uint64_t, const RegistrableDomain&)> m_requestStorageAccessUnderOpenerCallback;
+    Function<void(PAL::SessionID, const RegistrableDomain&, uint64_t, const RegistrableDomain&)> m_requestStorageAccessUnderOpenerCallback;
     Function<void(PAL::SessionID, const RegistrableDomain&)> m_logUserInteractionNotificationCallback;
     Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)> m_logWebSocketLoadingNotificationCallback;
     Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)> m_logSubresourceLoadingNotificationCallback;
     Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&)> m_logSubresourceRedirectNotificationCallback;
-
-    Timer m_notificationTimer;
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
     uint64_t m_loggingCounter { 0 };
     bool m_shouldLogUserInteraction { false };
index 8369a1c..c39f1fd 100644 (file)
@@ -4916,7 +4916,7 @@ size_t Internals::pluginCount()
 
 void Internals::notifyResourceLoadObserver()
 {
-    ResourceLoadObserver::shared().notifyObserver();
+    ResourceLoadObserver::shared().updateCentralStatisticsStore();
 }
 
 unsigned Internals::primaryScreenDisplayID()
index d631a4f..c436113 100644 (file)
@@ -144,7 +144,6 @@ set(WebKit_MESSAGES_IN_FILES
     UIProcess/WebPasteboardProxy.messages.in
     UIProcess/WebProcessPool.messages.in
     UIProcess/WebProcessProxy.messages.in
-    UIProcess/WebResourceLoadStatisticsStore.messages.in
 
     UIProcess/Automation/WebAutomationSession.messages.in
 
index 30dbf6d..69661cd 100644 (file)
@@ -1,3 +1,46 @@
+2019-03-29  John Wilander  <wilander@apple.com>
+
+        Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
+        https://bugs.webkit.org/show_bug.cgi?id=196407
+        <rdar://problem/47859936>
+
+        Reviewed by Brent Fulgham.
+
+        The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
+        moved Resource Load Statistics from the UI process to the network process. One
+        of the endpoints is the message RequestStorageAccessUnderOpener which underpins
+        our compatibility fix for federated logins using popups. This patch redirects
+        these IPC calls to the network process and cleans up some assumptions around
+        them.
+
+        * CMakeLists.txt:
+            Removed the old IPC receiver.
+        * DerivedSources.make:
+            Removed the old IPC receiver.
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
+            This is no longer needed since there is a dedicated update mechanism
+            that actually sends the update.
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
+        (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
+            Two new IPC receivers to pipe the calls to the network process.
+        (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
+            NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
+            this purpose.
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
+            Removed the old IPC receiver.
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleResourceLoadStatisticsNotifyObserver):
+            Function name update.
+        * WebProcess/WebProcess.cpp:
+            Now calls IPC to the network process instead of the UI process.
+
 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Delete WebMetal implementation in favor of WebGPU
index 01482e6..0330a89 100644 (file)
@@ -178,7 +178,6 @@ MESSAGE_RECEIVERS = \
     WebRTCMonitor \
     WebRTCResolver \
     WebRTCSocket \
-    WebResourceLoadStatisticsStore \
     WebResourceLoader \
     WebSWClientConnection \
     WebSWContextManagerConnection \
index dbee094..b798fd0 100644 (file)
@@ -42,7 +42,6 @@
 #include "WebProcessMessages.h"
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
-#include "WebResourceLoadStatisticsStoreMessages.h"
 #include "WebResourceLoadStatisticsTelemetry.h"
 #include "WebsiteDataFetchOption.h"
 #include <WebCore/CookieJar.h>
@@ -251,11 +250,6 @@ void WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing(
     });
 }
 
-void WebResourceLoadStatisticsStore::requestUpdate()
-{
-    resourceLoadStatisticsUpdated({ });
-}
-
 void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins)
 {
     ASSERT(RunLoop::isMain());
index fc37376..a0fe8ec 100644 (file)
@@ -66,7 +66,7 @@ enum class WebsiteDataToRemove : uint8_t {
     AllButCookies
 };
 
-class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>, public IPC::MessageReceiver {
+class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main> {
 public:
     using ResourceLoadStatistics = WebCore::ResourceLoadStatistics;
     using RegistrableDomain = WebCore::RegistrableDomain;
@@ -120,7 +120,6 @@ public:
     bool hasStorageAccessForFrame(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID);
     void requestStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&);
     void requestStorageAccessGranted(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&);
-    void requestUpdate();
     void setLastSeen(const RegistrableDomain&, Seconds, CompletionHandler<void()>&&);
     void setPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&);
     void setVeryPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&);
@@ -178,19 +177,15 @@ public:
     void sendDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned sigDigits, WebCore::ShouldSample) const;
     void notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins) const;
 
+    void resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&&);
+    void requestStorageAccessUnderOpener(DomainInNeedOfStorageAccess&&, uint64_t openerPageID, OpenerDomain&&);
+
 private:
     explicit WebResourceLoadStatisticsStore(NetworkSession&, const String&, ShouldIncludeLocalhost);
 
     void postTask(WTF::Function<void()>&&);
     static void postTaskReply(WTF::Function<void()>&&);
 
-    // IPC::MessageReceiver.
-    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
-
-    // IPC message handlers.
-    void resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&& origins);
-    void requestStorageAccessUnderOpener(DomainInNeedOfStorageAccess&&, uint64_t openerPageID, OpenerDomain&&);
-
     void performDailyTasks();
 
     StorageAccessStatus storageAccessStatus(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain);
index f0c5e6e..cab434e 100644 (file)
@@ -653,14 +653,14 @@ void NetworkConnectionToWebProcess::logSubresourceRedirect(PAL::SessionID sessio
     }
 }
 
-void NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate()
+void NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& statistics)
 {
     for (auto& networkSession : networkProcess().networkSessions().values()) {
         if (networkSession->sessionID().isEphemeral())
             continue;
 
         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
-            resourceLoadStatistics->requestUpdate();
+            resourceLoadStatistics->resourceLoadStatisticsUpdated(WTFMove(statistics));
     }
 }
 
@@ -673,6 +673,14 @@ void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionI
 {
     networkProcess().requestStorageAccessGranted(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));
 }
+
+void NetworkConnectionToWebProcess::requestStorageAccessUnderOpener(PAL::SessionID sessionID, WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain&& openerDomain)
+{
+    if (auto networkSession = networkProcess().networkSession(sessionID)) {
+        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+            resourceLoadStatistics->requestStorageAccessUnderOpener(WTFMove(domainInNeedOfStorageAccess), openerPageID, WTFMove(openerDomain));
+    }
+}
 #endif
 
 void NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains)
index f3937dd..98cf447 100644 (file)
@@ -218,9 +218,10 @@ private:
     void logWebSocketLoading(PAL::SessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen);
     void logSubresourceLoading(PAL::SessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen);
     void logSubresourceRedirect(PAL::SessionID, const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain);
-    void requestResourceLoadStatisticsUpdate();
+    void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&);
     void hasStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
     void requestStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
+    void requestStorageAccessUnderOpener(PAL::SessionID, WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain&& openerDomain);
 #endif
 
     void addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
index 06f8acd..16ed34a 100644 (file)
@@ -62,9 +62,10 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     LogWebSocketLoading(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WallTime lastSeen)
     LogSubresourceLoading(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WallTime lastSeen)
     LogSubresourceRedirect(PAL::SessionID sessionID, WebCore::RegistrableDomain sourceDomain, WebCore::RegistrableDomain targetDomain)
-    RequestResourceLoadStatisticsUpdate();
+    ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> statistics)
     HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
     RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool accessGranted) Async
+    RequestStorageAccessUnderOpener(PAL::SessionID sessionID, WebCore::RegistrableDomain domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain openerDomain)
 #endif
 
     AddOriginAccessWhitelistEntry(String sourceOrigin, String destinationProtocol, String destinationHost, bool allowDestinationSubdomains);
diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.messages.in b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.messages.in
deleted file mode 100644 (file)
index 39b4e6f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (C) 2016 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.
-
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-
-messages -> WebResourceLoadStatisticsStore {
-    RequestStorageAccessUnderOpener(WebCore::RegistrableDomain domainReceivingUserInteraction, uint64_t openerPageID, WebCore::RegistrableDomain openerDomain)
-    ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> origins)
-}
-
-#endif
index 43116b9..8031304 100644 (file)
@@ -40,7 +40,6 @@
 #include "WebProcessMessages.h"
 #include "WebProcessPool.h"
 #include "WebResourceLoadStatisticsStore.h"
-#include "WebResourceLoadStatisticsStoreMessages.h"
 #include "WebsiteData.h"
 #include "WebsiteDataStoreClient.h"
 #include "WebsiteDataStoreParameters.h"
index 5847588..fff1a5e 100644 (file)
                7A772C8D1DDD4A25000F34F1 /* com.apple.WebKit.plugin-common.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7A1506721DD56298001F4B58 /* com.apple.WebKit.plugin-common.sb */; };
                7A78FF32224191960096483E /* WKStorageAccessAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A78FF2E224191750096483E /* WKStorageAccessAlert.h */; };
                7A78FF332241919B0096483E /* WKStorageAccessAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A78FF2F224191760096483E /* WKStorageAccessAlert.mm */; };
-               7A791EFA1C7CFCF100C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */; };
-               7A791EFB1C7CFD0100C4C52B /* WebResourceLoadStatisticsStoreMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */; };
                7A821F4C1E2F673900604577 /* LegacyCustomProtocolManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A821F4B1E2F664800604577 /* LegacyCustomProtocolManagerClient.h */; };
                7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */; };
                7A8A9D581EF119B0009801AE /* APIInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A8A9D571EF119AA009801AE /* APIInjectedBundleClient.h */; };
                7A5E39491D5BD8A700B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "com.macromedia.Flash Player ESR.plugin.sb"; sourceTree = "<group>"; };
                7A78FF2E224191750096483E /* WKStorageAccessAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKStorageAccessAlert.h; sourceTree = "<group>"; };
                7A78FF2F224191760096483E /* WKStorageAccessAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKStorageAccessAlert.mm; sourceTree = "<group>"; };
-               7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebResourceLoadStatisticsStoreMessages.h; path = DerivedSources/WebKit2/WebResourceLoadStatisticsStoreMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
-               7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoadStatisticsStoreMessageReceiver.cpp; path = DerivedSources/WebKit2/WebResourceLoadStatisticsStoreMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
                7A821F491E2F65DD00604577 /* LegacyCustomProtocolManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LegacyCustomProtocolManagerProxy.cpp; path = CustomProtocols/LegacyCustomProtocolManagerProxy.cpp; sourceTree = "<group>"; };
                7A821F4B1E2F664800604577 /* LegacyCustomProtocolManagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyCustomProtocolManagerClient.h; sourceTree = "<group>"; };
                7A821F4D1E2F679E00604577 /* LegacyCustomProtocolManagerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyCustomProtocolManagerClient.mm; sourceTree = "<group>"; };
                7A8A9D571EF119AA009801AE /* APIInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleClient.h; sourceTree = "<group>"; };
                7A8A9D591EF13020009801AE /* APIInjectedBundleBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleBundleClient.h; sourceTree = "<group>"; };
                7A8A9D5B1EF1458E009801AE /* APIInjectedBundlePageResourceLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundlePageResourceLoadClient.h; sourceTree = "<group>"; };
-               7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebResourceLoadStatisticsStore.messages.in; sourceTree = "<group>"; };
                7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIIconDatabaseClient.h; sourceTree = "<group>"; };
                7AB6EA461EEAB6B000037B2B /* APIGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIGeolocationProvider.h; sourceTree = "<group>"; };
                7ACE82E7221CAE06000DA94C /* ResourceLoadStatisticsStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ResourceLoadStatisticsStore.h; path = Classifier/ResourceLoadStatisticsStore.h; sourceTree = "<group>"; };
                                BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */,
                                BC032DCF10F4389F0058C15A /* WebProcessProxy.h */,
                                BCEE7AB312817095009827DA /* WebProcessProxy.messages.in */,
-                               7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */,
                                51D124241E6D3CC3002B2820 /* WebURLSchemeHandler.cpp */,
                                51D124251E6D3CC3002B2820 /* WebURLSchemeHandler.h */,
                                51E8B68D1E712873001B7132 /* WebURLSchemeTask.cpp */,
                                BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */,
                                51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */,
                                51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */,
-                               7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */,
-                               7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */,
                                51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */,
                                51F060DD1654317500F3282C /* WebRTCResolverMessageReceiver.cpp */,
                                51F060DD1654317500F3281C /* WebRTCSocketMessageReceiver.cpp */,
                                510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */,
                                51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */,
                                7AFBD36321E50F39005DBACB /* WebResourceLoadStatisticsStore.h in Headers */,
-                               7A791EFB1C7CFD0100C4C52B /* WebResourceLoadStatisticsStoreMessages.h in Headers */,
                                413075B01DE85F580039EC69 /* WebRTCMonitor.h in Headers */,
                                41FAF5F51E3C0649001AE678 /* WebRTCResolver.h in Headers */,
                                41DC459F1E3DBDA500B11F51 /* WebRTCSocket.h in Headers */,
                                7CE4D2271A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp in Sources */,
                                BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */,
                                51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */,
-                               7A791EFA1C7CFCF100C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp in Sources */,
                                51F060E11654318500F3281F /* WebRTCMonitorMessageReceiver.cpp in Sources */,
                                51F060E11654318500F3282C /* WebRTCResolverMessageReceiver.cpp in Sources */,
                                51F060E11654318500F3281C /* WebRTCSocketMessageReceiver.cpp in Sources */,
index e156297..c2d5de6 100644 (file)
@@ -323,7 +323,7 @@ void WKBundleClearResourceLoadStatistics(WKBundleRef)
 
 void WKBundleResourceLoadStatisticsNotifyObserver(WKBundleRef)
 {
-    WebCore::ResourceLoadObserver::shared().notifyObserver();
+    WebCore::ResourceLoadObserver::shared().updateCentralStatisticsStore();
 }
 
 
index b549c3d..343177d 100644 (file)
@@ -65,7 +65,6 @@
 #include "WebProcessMessages.h"
 #include "WebProcessPoolMessages.h"
 #include "WebProcessProxyMessages.h"
-#include "WebResourceLoadStatisticsStoreMessages.h"
 #include "WebSWContextManagerConnection.h"
 #include "WebSWContextManagerConnectionMessages.h"
 #include "WebServiceWorkerProvider.h"
@@ -211,14 +210,12 @@ WebProcess::WebProcess()
     m_plugInAutoStartOriginHashes.add(PAL::SessionID::defaultSessionID(), HashMap<unsigned, WallTime>());
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    ResourceLoadObserver::shared().setNotificationCallback([this] (Vector<ResourceLoadStatistics>&& statistics) {
-        parentProcessConnection()->send(Messages::WebResourceLoadStatisticsStore::ResourceLoadStatisticsUpdated(WTFMove(statistics)), 0);
-
-        ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RequestResourceLoadStatisticsUpdate(), 0);
+    ResourceLoadObserver::shared().setStatisticsUpdatedCallback([this] (Vector<ResourceLoadStatistics>&& statistics) {
+        ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::ResourceLoadStatisticsUpdated(WTFMove(statistics)), 0);
     });
 
-    ResourceLoadObserver::shared().setRequestStorageAccessUnderOpenerCallback([this] (const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, const RegistrableDomain& openerDomain) {
-        parentProcessConnection()->send(Messages::WebResourceLoadStatisticsStore::RequestStorageAccessUnderOpener(domainInNeedOfStorageAccess, openerPageID, openerDomain), 0);
+    ResourceLoadObserver::shared().setRequestStorageAccessUnderOpenerCallback([this] (PAL::SessionID sessionID, const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, const RegistrableDomain& openerDomain) {
+        ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RequestStorageAccessUnderOpener(sessionID, domainInNeedOfStorageAccess, openerPageID, openerDomain), 0);
     });
 #endif