Title: [266433] branches/safari-610-branch/Source
Revision
266433
Author
[email protected]
Date
2020-09-01 18:19:23 -0700 (Tue, 01 Sep 2020)

Log Message

Cherry-pick r266214. rdar://problem/68164557

    Resource Load Statistics data summary does not report data which is held up in the web content process.
    https://bugs.webkit.org/show_bug.cgi?id=215822
    <rdar://problem/66682044>

    Reviewed by Chris Dumez.

    Source/WebCore:

    Send empty lambda when calling updateCentralStatisticsStore() because
    in these cases we don't care about timing.

    * loader/ResourceLoadObserver.h:
    (WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
    * page/DOMWindow.cpp:
    (WebCore::DOMWindow::close):
    * testing/Internals.cpp:
    (WebCore::Internals::notifyResourceLoadObserver):

    Source/WebKit:

    No new tests, this fixes a timing bug that is flaky to reproduce, so I
    was unable to write a test case. Non-regressed behavior is confirmed
    with existing API testing.

    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
    (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
    Most of the time, the completion handler will be an empty function,
    but we should handle it in the network process so we fix the
    case where we wait to send the full data summary until the update has
    finished.

    (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData):
    Delete extra space.

    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
    (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
    * NetworkProcess/NetworkConnectionToWebProcess.h:
    * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
    * UIProcess/WebProcessPool.cpp:
    (WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately):
    * UIProcess/WebProcessPool.h:
    * UIProcess/WebsiteData/WebsiteDataStore.cpp:
    (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
    Don't ask the network process for data until any lingering data
    in the web content process has been sent first.

    * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
    (WKBundleResourceLoadStatisticsNotifyObserver):
    * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
    (WebKit::WebResourceLoadObserver::WebResourceLoadObserver):
    (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver):
    (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore):
    * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
    * WebProcess/WebProcess.cpp:
    (WebKit::WebProcess::flushResourceLoadStatistics):
    (WebKit::WebProcess::sendResourceLoadStatisticsDataImmediately):
    * WebProcess/WebProcess.h:
    * WebProcess/WebProcess.messages.in:

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

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (266432 => 266433)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-02 01:19:23 UTC (rev 266433)
@@ -1,5 +1,90 @@
 2020-09-01  Alan Coon  <[email protected]>
 
+        Cherry-pick r266214. rdar://problem/68164557
+
+    Resource Load Statistics data summary does not report data which is held up in the web content process.
+    https://bugs.webkit.org/show_bug.cgi?id=215822
+    <rdar://problem/66682044>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    Send empty lambda when calling updateCentralStatisticsStore() because
+    in these cases we don't care about timing.
+    
+    * loader/ResourceLoadObserver.h:
+    (WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
+    * page/DOMWindow.cpp:
+    (WebCore::DOMWindow::close):
+    * testing/Internals.cpp:
+    (WebCore::Internals::notifyResourceLoadObserver):
+    
+    Source/WebKit:
+    
+    No new tests, this fixes a timing bug that is flaky to reproduce, so I
+    was unable to write a test case. Non-regressed behavior is confirmed
+    with existing API testing.
+    
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+    (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
+    Most of the time, the completion handler will be an empty function,
+    but we should handle it in the network process so we fix the
+    case where we wait to send the full data summary until the update has
+    finished.
+    
+    (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData):
+    Delete extra space.
+    
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+    (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
+    * NetworkProcess/NetworkConnectionToWebProcess.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+    * UIProcess/WebProcessPool.cpp:
+    (WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately):
+    * UIProcess/WebProcessPool.h:
+    * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+    (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
+    Don't ask the network process for data until any lingering data
+    in the web content process has been sent first.
+    
+    * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+    (WKBundleResourceLoadStatisticsNotifyObserver):
+    * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
+    (WebKit::WebResourceLoadObserver::WebResourceLoadObserver):
+    (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver):
+    (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore):
+    * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::flushResourceLoadStatistics):
+    (WebKit::WebProcess::sendResourceLoadStatisticsDataImmediately):
+    * WebProcess/WebProcess.h:
+    * WebProcess/WebProcess.messages.in:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-26  Kate Cheney  <[email protected]>
+
+            Resource Load Statistics data summary does not report data which is held up in the web content process.
+            https://bugs.webkit.org/show_bug.cgi?id=215822
+            <rdar://problem/66682044>
+
+            Reviewed by Chris Dumez.
+
+            Send empty lambda when calling updateCentralStatisticsStore() because
+            in these cases we don't care about timing.
+
+            * loader/ResourceLoadObserver.h:
+            (WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
+            * page/DOMWindow.cpp:
+            (WebCore::DOMWindow::close):
+            * testing/Internals.cpp:
+            (WebCore::Internals::notifyResourceLoadObserver):
+
+2020-09-01  Alan Coon  <[email protected]>
+
         Cherry-pick r266140. rdar://problem/68164582
 
     Fix read-after-free introduced in r266087

Modified: branches/safari-610-branch/Source/WebCore/loader/ResourceLoadObserver.h (266432 => 266433)


--- branches/safari-610-branch/Source/WebCore/loader/ResourceLoadObserver.h	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebCore/loader/ResourceLoadObserver.h	2020-09-02 01:19:23 UTC (rev 266433)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "ResourceLoadStatistics.h"
+#include <wtf/CompletionHandler.h>
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -58,7 +59,7 @@
     virtual void logSubresourceLoadingForTesting(const RegistrableDomain& /* firstPartyDomain */, const RegistrableDomain& /* thirdPartyDomain */, bool /* shouldScheduleNotification */) { }
 
     virtual String statisticsForURL(const URL&) { return { }; }
-    virtual void updateCentralStatisticsStore() { }
+    virtual void updateCentralStatisticsStore(CompletionHandler<void()>&& completionHandler) { completionHandler(); }
     virtual void clearState() { }
     
     virtual bool hasStatistics() const { return false; }

Modified: branches/safari-610-branch/Source/WebCore/page/DOMWindow.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebCore/page/DOMWindow.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebCore/page/DOMWindow.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -1048,7 +1048,7 @@
     if (!frame->loader().shouldClose())
         return;
 
-    ResourceLoadObserver::shared().updateCentralStatisticsStore();
+    ResourceLoadObserver::shared().updateCentralStatisticsStore([] { });
 
     page->setIsClosing();
     page->chrome().closeWindowSoon();

Modified: branches/safari-610-branch/Source/WebCore/testing/Internals.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebCore/testing/Internals.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebCore/testing/Internals.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -5625,7 +5625,7 @@
 
 void Internals::notifyResourceLoadObserver()
 {
-    ResourceLoadObserver::shared().updateCentralStatisticsStore();
+    ResourceLoadObserver::shared().updateCentralStatisticsStore([] { });
 }
 
 unsigned Internals::primaryScreenDisplayID()

Modified: branches/safari-610-branch/Source/WebKit/ChangeLog (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/ChangeLog	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/ChangeLog	2020-09-02 01:19:23 UTC (rev 266433)
@@ -1,5 +1,120 @@
 2020-09-01  Alan Coon  <[email protected]>
 
+        Cherry-pick r266214. rdar://problem/68164557
+
+    Resource Load Statistics data summary does not report data which is held up in the web content process.
+    https://bugs.webkit.org/show_bug.cgi?id=215822
+    <rdar://problem/66682044>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    Send empty lambda when calling updateCentralStatisticsStore() because
+    in these cases we don't care about timing.
+    
+    * loader/ResourceLoadObserver.h:
+    (WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
+    * page/DOMWindow.cpp:
+    (WebCore::DOMWindow::close):
+    * testing/Internals.cpp:
+    (WebCore::Internals::notifyResourceLoadObserver):
+    
+    Source/WebKit:
+    
+    No new tests, this fixes a timing bug that is flaky to reproduce, so I
+    was unable to write a test case. Non-regressed behavior is confirmed
+    with existing API testing.
+    
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+    (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
+    Most of the time, the completion handler will be an empty function,
+    but we should handle it in the network process so we fix the
+    case where we wait to send the full data summary until the update has
+    finished.
+    
+    (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData):
+    Delete extra space.
+    
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+    (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
+    * NetworkProcess/NetworkConnectionToWebProcess.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+    * UIProcess/WebProcessPool.cpp:
+    (WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately):
+    * UIProcess/WebProcessPool.h:
+    * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+    (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
+    Don't ask the network process for data until any lingering data
+    in the web content process has been sent first.
+    
+    * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+    (WKBundleResourceLoadStatisticsNotifyObserver):
+    * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
+    (WebKit::WebResourceLoadObserver::WebResourceLoadObserver):
+    (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver):
+    (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore):
+    * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::flushResourceLoadStatistics):
+    (WebKit::WebProcess::sendResourceLoadStatisticsDataImmediately):
+    * WebProcess/WebProcess.h:
+    * WebProcess/WebProcess.messages.in:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-26  Kate Cheney  <[email protected]>
+
+            Resource Load Statistics data summary does not report data which is held up in the web content process.
+            https://bugs.webkit.org/show_bug.cgi?id=215822
+            <rdar://problem/66682044>
+
+            Reviewed by Chris Dumez.
+
+            No new tests, this fixes a timing bug that is flaky to reproduce, so I
+            was unable to write a test case. Non-regressed behavior is confirmed
+            with existing API testing.
+
+            * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+            (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
+            Most of the time, the completion handler will be an empty function,
+            but we should handle it in the network process so we fix the
+            case where we wait to send the full data summary until the update has
+            finished.
+
+            (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData):
+            Delete extra space.
+
+            * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+            * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+            (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
+            * NetworkProcess/NetworkConnectionToWebProcess.h:
+            * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+            * UIProcess/WebProcessPool.cpp:
+            (WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately):
+            * UIProcess/WebProcessPool.h:
+            * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+            (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
+            Don't ask the network process for data until any lingering data
+            in the web content process has been sent first.
+
+            * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+            (WKBundleResourceLoadStatisticsNotifyObserver):
+            * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
+            (WebKit::WebResourceLoadObserver::WebResourceLoadObserver):
+            (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver):
+            (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore):
+            * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
+            * WebProcess/WebProcess.cpp:
+            (WebKit::WebProcess::flushResourceLoadStatistics):
+            (WebKit::WebProcess::sendResourceLoadStatisticsDataImmediately):
+            * WebProcess/WebProcess.h:
+            * WebProcess/WebProcess.messages.in:
+
+2020-09-01  Alan Coon  <[email protected]>
+
         Cherry-pick r266143. rdar://problem/68164547
 
     Trying to lookup when WebView is in a popover causes process to hang. Fix for Legacy WebView.

Modified: branches/safari-610-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -358,7 +358,7 @@
     });
 }
 
-void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&& statistics)
+void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&& statistics, CompletionHandler<void()>&& completionHandler)
 {
     ASSERT(RunLoop::isMain());
 
@@ -365,13 +365,15 @@
     // It is safe to move the origins to the background queue without isolated copy here because this is an r-value
     // coming from IPC. ResourceLoadStatistics only contains strings which are safe to move to other threads as long
     // as nobody on this thread holds a reference to those strings.
-    postTask([this, protectedThis = makeRef(*this), statistics = WTFMove(statistics)]() mutable {
-        if (!m_statisticsStore)
+    postTask([this, protectedThis = makeRef(*this), statistics = WTFMove(statistics), completionHandler = WTFMove(completionHandler)]() mutable {
+        if (!m_statisticsStore) {
+            postTaskReply(WTFMove(completionHandler));
             return;
+        }
 
         ASSERT(suspendedState != State::Suspended);
         m_statisticsStore->mergeStatistics(WTFMove(statistics));
-
+        postTaskReply(WTFMove(completionHandler));
         // We can cancel any pending request to process statistics since we're doing it synchronously below.
         m_statisticsStore->cancelPendingStatisticsProcessingRequest();
 
@@ -1449,7 +1451,7 @@
 {
     ASSERT(RunLoop::isMain());
 
-    postTask([this, completionHandler = WTFMove(completionHandler)]() mutable  {
+    postTask([this, completionHandler = WTFMove(completionHandler)]() mutable {
         if (!m_statisticsStore) {
             postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable {
                 completionHandler({ });

Modified: branches/safari-610-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h	2020-09-02 01:19:23 UTC (rev 266433)
@@ -292,7 +292,7 @@
     void sendDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned sigDigits, WebCore::ShouldSample) const;
     void notifyPageStatisticsTelemetryFinished(unsigned numberOfPrevalentResources, unsigned numberOfPrevalentResourcesWithUserInteraction, unsigned numberOfPrevalentResourcesWithoutUserInteraction, unsigned topPrevalentResourceWithUserInteractionDaysSinceUserInteraction, unsigned medianDaysSinceUserInteractionPrevalentResourceWithUserInteraction, unsigned top3NumberOfPrevalentResourcesWithUI, unsigned top3MedianSubFrameWithoutUI, unsigned top3MedianSubResourceWithoutUI, unsigned top3MedianUniqueRedirectsWithoutUI, unsigned top3MedianDataRecordsRemovedWithoutUI) const;
 
-    void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&);
+    void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&, CompletionHandler<void()>&&);
     void requestStorageAccessUnderOpener(DomainInNeedOfStorageAccess&&, WebCore::PageIdentifier openerID, OpenerDomain&&);
     void aggregatedThirdPartyData(CompletionHandler<void(Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&&)>&&);
     static void suspend(CompletionHandler<void()>&&);

Modified: branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -870,14 +870,19 @@
     }
 }
 
-void NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&& statistics)
+void NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&& statistics, CompletionHandler<void()>&& completionHandler)
 {
     if (auto* networkSession = this->networkSession()) {
-        if (networkSession->sessionID().isEphemeral())
+        if (networkSession->sessionID().isEphemeral()) {
+            completionHandler();
             return;
-        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
-            resourceLoadStatistics->resourceLoadStatisticsUpdated(WTFMove(statistics));
+        }
+        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) {
+            resourceLoadStatistics->resourceLoadStatisticsUpdated(WTFMove(statistics), WTFMove(completionHandler));
+            return;
+        }
     }
+    completionHandler();
 }
 
 void NetworkConnectionToWebProcess::hasStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, FrameIdentifier frameID, PageIdentifier pageID, CompletionHandler<void(bool)>&& completionHandler)

Modified: branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2020-09-02 01:19:23 UTC (rev 266433)
@@ -266,7 +266,7 @@
     void clearPageSpecificDataForResourceLoadStatistics(WebCore::PageIdentifier);
 
     void logUserInteraction(const RegistrableDomain&);
-    void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&);
+    void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&, CompletionHandler<void()>&&);
     void hasStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(bool)>&&);
     void requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, WebCore::FrameIdentifier, WebCore::PageIdentifier, WebPageProxyIdentifier, WebCore::StorageAccessScope, CompletionHandler<void(WebCore::RequestStorageAccessResult)>&&);
     void requestStorageAccessUnderOpener(WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, WebCore::PageIdentifier openerPageID, WebCore::RegistrableDomain&& openerDomain);

Modified: branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2020-09-02 01:19:23 UTC (rev 266433)
@@ -65,7 +65,7 @@
     RemoveStorageAccessForFrame(WebCore::FrameIdentifier frameID, WebCore::PageIdentifier pageID);
     ClearPageSpecificDataForResourceLoadStatistics(WebCore::PageIdentifier pageID);
     LogUserInteraction(WebCore::RegistrableDomain domain)
-    ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> statistics)
+    ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> statistics) -> () Async
     HasStorageAccess(WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::FrameIdentifier frameID, WebCore::PageIdentifier pageID) -> (bool hasStorageAccess) Async
     RequestStorageAccess(WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::FrameIdentifier frameID, WebCore::PageIdentifier webPageID, WebKit::WebPageProxyIdentifier webPageProxyID, enum:bool WebCore::StorageAccessScope scope) -> (struct WebCore::RequestStorageAccessResult result) Async
     RequestStorageAccessUnderOpener(WebCore::RegistrableDomain domainInNeedOfStorageAccess, WebCore::PageIdentifier openerPageID, WebCore::RegistrableDomain openerDomain)

Modified: branches/safari-610-branch/Source/WebKit/UIProcess/WebProcessPool.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/UIProcess/WebProcessPool.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/UIProcess/WebProcessPool.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -2396,6 +2396,14 @@
     for (auto& process : processes())
         process->sendWithAsyncReply(Messages::WebProcess::SeedResourceLoadStatisticsForTesting(firstPartyDomain, thirdPartyDomain, shouldScheduleNotification), [callbackAggregator] { });
 }
+
+void WebProcessPool::sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&& completionHandler)
+{
+    auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
+
+    for (auto& process : processes())
+        process->sendWithAsyncReply(Messages::WebProcess::SendResourceLoadStatisticsDataImmediately(), [callbackAggregator] { });
+}
 #endif
 
 WebProcessWithAudibleMediaToken WebProcessPool::webProcessWithAudibleMediaToken() const

Modified: branches/safari-610-branch/Source/WebKit/UIProcess/WebProcessPool.h (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/UIProcess/WebProcessPool.h	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/UIProcess/WebProcessPool.h	2020-09-02 01:19:23 UTC (rev 266433)
@@ -516,6 +516,7 @@
     void didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID, const WebCore::RegistrableDomain& fromDomain, const WebCore::RegistrableDomain& toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag>, WebPageProxyIdentifier, WebCore::PageIdentifier);
     void setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&&);
     void seedResourceLoadStatisticsForTesting(const WebCore::RegistrableDomain& firstPartyDomain, const WebCore::RegistrableDomain& thirdPartyDomain, bool shouldScheduleNotification, CompletionHandler<void()>&&);
+    void sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&&);
 #endif
 
 #if PLATFORM(GTK) || PLATFORM(WPE)

Modified: branches/safari-610-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -1560,8 +1560,10 @@
     RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));
 
     for (auto& processPool : ensureProcessPools()) {
-        processPool->ensureNetworkProcess(this).getResourceLoadStatisticsDataSummary(m_sessionID, [callbackAggregator, processPool](Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&& data) {
-            callbackAggregator->addResult(WTFMove(data));
+        processPool->sendResourceLoadStatisticsDataImmediately([this, protectedThis = makeRef(*this), processPool, callbackAggregator] {
+            processPool->ensureNetworkProcess(this).getResourceLoadStatisticsDataSummary(m_sessionID, [callbackAggregator, processPool](Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&& data) {
+                callbackAggregator->addResult(WTFMove(data));
+            });
         });
     }
 }

Modified: branches/safari-610-branch/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -304,7 +304,7 @@
     if (!WebCore::ResourceLoadObserver::shared().hasStatistics())
         return false;
 
-    WebCore::ResourceLoadObserver::shared().updateCentralStatisticsStore();
+    WebCore::ResourceLoadObserver::shared().updateCentralStatisticsStore([] { });
     return true;
 }
 

Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -63,7 +63,7 @@
 
 WebResourceLoadObserver::WebResourceLoadObserver(ResourceLoadStatistics::IsEphemeral isEphemeral)
     : m_isEphemeral(isEphemeral)
-    , m_notificationTimer(*this, &WebResourceLoadObserver::updateCentralStatisticsStore)
+    , m_notificationTimer([this] { updateCentralStatisticsStore([] { }); })
 {
 }
 
@@ -70,7 +70,7 @@
 WebResourceLoadObserver::~WebResourceLoadObserver()
 {
     if (hasStatistics())
-        updateCentralStatisticsStore();
+        updateCentralStatisticsStore([] { });
 }
 
 void WebResourceLoadObserver::requestStorageAccessUnderOpener(const RegistrableDomain& domainInNeedOfStorageAccess, WebPage& openerPage, Document& openerDocument)
@@ -109,12 +109,13 @@
         m_notificationTimer.startOneShot(minimumNotificationInterval);
 }
 
-void WebResourceLoadObserver::updateCentralStatisticsStore()
+void WebResourceLoadObserver::updateCentralStatisticsStore(CompletionHandler<void()>&& completionHandler)
 {
     m_notificationTimer.stop();
-    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::ResourceLoadStatisticsUpdated(takeStatistics()), 0);
+    WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::ResourceLoadStatisticsUpdated(takeStatistics()), WTFMove(completionHandler));
 }
 
+
 String WebResourceLoadObserver::statisticsForURL(const URL& url)
 {
     auto iter = m_resourceStatisticsMap.find(RegistrableDomain { url });

Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h	2020-09-02 01:19:23 UTC (rev 266433)
@@ -57,7 +57,7 @@
 #endif
 
     String statisticsForURL(const URL&) final;
-    void updateCentralStatisticsStore() final;
+    void updateCentralStatisticsStore(CompletionHandler<void()>&&) final;
     void clearState() final;
     
     bool hasStatistics() const final { return !m_resourceStatisticsMap.isEmpty(); }

Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.cpp (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-09-02 01:19:23 UTC (rev 266433)
@@ -1595,7 +1595,7 @@
 {
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     if (auto* observer = ResourceLoadObserver::sharedIfExists())
-        observer->updateCentralStatisticsStore();
+        observer->updateCentralStatisticsStore([] { });
 #endif
 }
 
@@ -1907,6 +1907,11 @@
 {
     ResourceLoadObserver::shared().setDomainsWithUserInteraction(WTFMove(domains));
 }
+
+void WebProcess::sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&& completionHandler)
+{
+    ResourceLoadObserver::shared().updateCentralStatisticsStore(WTFMove(completionHandler));
+}
 #endif
 
 #if ENABLE(GPU_PROCESS)

Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.h (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.h	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.h	2020-09-02 01:19:23 UTC (rev 266433)
@@ -475,6 +475,7 @@
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&);
     void setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&&);
+    void sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&&);
 #endif
 
     void platformInitializeProcess(const AuxiliaryProcessInitializationParameters&);

Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.messages.in (266432 => 266433)


--- branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.messages.in	2020-09-02 01:19:17 UTC (rev 266432)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebProcess.messages.in	2020-09-02 01:19:23 UTC (rev 266433)
@@ -159,6 +159,7 @@
     SeedResourceLoadStatisticsForTesting(WebCore::RegistrableDomain firstPartyDomain, WebCore::RegistrableDomain thirdPartyDomain, bool shouldScheduleNotification) -> () Async
     SetThirdPartyCookieBlockingMode(enum:uint8_t WebCore::ThirdPartyCookieBlockingMode blockingMode) -> () Async
     SetDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain> domains)
+    SendResourceLoadStatisticsDataImmediately() -> () Async
 #endif
 
 #if PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to