Title: [250424] trunk/Source/WebKit
Revision
250424
Author
achristen...@apple.com
Date
2019-09-27 08:55:01 -0700 (Fri, 27 Sep 2019)

Log Message

Enable and disable ResourceLoadStatistics only by session
https://bugs.webkit.org/show_bug.cgi?id=202298

Reviewed by Chris Dumez.

This is needed to keep per-session things per-session and per-process-pool things per-process-pool.
This was a strange case where we would take the current session's value and apply it globally.
This has no change in behavior because it is globally enabled and disabled by API clients anyways.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setResourceLoadStatisticsEnabled): Deleted.
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (250423 => 250424)


--- trunk/Source/WebKit/ChangeLog	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/ChangeLog	2019-09-27 15:55:01 UTC (rev 250424)
@@ -1,5 +1,28 @@
 2019-09-27  Alex Christensen  <achristen...@webkit.org>
 
+        Enable and disable ResourceLoadStatistics only by session
+        https://bugs.webkit.org/show_bug.cgi?id=202298
+
+        Reviewed by Chris Dumez.
+
+        This is needed to keep per-session things per-session and per-process-pool things per-process-pool.
+        This was a strange case where we would take the current session's value and apply it globally.
+        This has no change in behavior because it is globally enabled and disabled by API clients anyways.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled): Deleted.
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
+
+2019-09-27  Alex Christensen  <achristen...@webkit.org>
+
         Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation
         https://bugs.webkit.org/show_bug.cgi?id=202285
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (250423 => 250424)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-09-27 15:55:01 UTC (rev 250424)
@@ -1150,11 +1150,10 @@
     }
 }
 
-void NetworkProcess::setResourceLoadStatisticsEnabled(bool enabled)
+void NetworkProcess::setResourceLoadStatisticsEnabled(PAL::SessionID sessionID, bool enabled)
 {
-    forEachNetworkSession([enabled](auto& networkSession) {
-        networkSession.setResourceLoadStatisticsEnabled(enabled);
-    });
+    if (auto* networkSession = this->networkSession(sessionID))
+        networkSession->setResourceLoadStatisticsEnabled(enabled);
 }
 
 void NetworkProcess::setResourceLoadStatisticsLogTestingEvent(bool enabled)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (250423 => 250424)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2019-09-27 15:55:01 UTC (rev 250424)
@@ -246,7 +246,7 @@
     void setNotifyPagesWhenDataRecordsWereScanned(PAL::SessionID, bool value, CompletionHandler<void()>&&);
     void setIsRunningResourceLoadStatisticsTest(PAL::SessionID, bool value, CompletionHandler<void()>&&);
     void setNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID, bool value, CompletionHandler<void()>&&);
-    void setResourceLoadStatisticsEnabled(bool);
+    void setResourceLoadStatisticsEnabled(PAL::SessionID, bool);
     void setResourceLoadStatisticsLogTestingEvent(bool);
     void setResourceLoadStatisticsDebugMode(PAL::SessionID, bool debugMode, CompletionHandler<void()>&&d);
     void setShouldClassifyResourcesBeforeDataRecordsRemoval(PAL::SessionID, bool value, CompletionHandler<void()>&&);

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (250423 => 250424)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in	2019-09-27 15:55:01 UTC (rev 250424)
@@ -86,7 +86,7 @@
     ClearPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
     ClearUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
     DumpResourceLoadStatistics(PAL::SessionID sessionID) -> (String dumpedStatistics) Async
-    SetResourceLoadStatisticsEnabled(bool enabled)
+    SetResourceLoadStatisticsEnabled(PAL::SessionID sessionID, bool enabled)
     SetResourceLoadStatisticsLogTestingEvent(bool enabled)
     UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsToBlock) -> () Async
     IsGrandfathered(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain) -> (bool isGrandfathered) Async

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (250423 => 250424)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-09-27 15:55:01 UTC (rev 250424)
@@ -579,7 +579,6 @@
     validate(_configuration.get());
 
     WebKit::WebProcessPool& processPool = *[_configuration processPool]->_processPool;
-    processPool.setResourceLoadStatisticsEnabled(configuration.websiteDataStore._resourceLoadStatisticsEnabled);
 
     auto pageConfiguration = [configuration copyPageConfiguration];
 

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (250423 => 250424)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-09-27 15:55:01 UTC (rev 250424)
@@ -569,7 +569,7 @@
 
     SandboxExtension::createHandleForReadWriteDirectory(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory, parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle);
 
-    bool enableResourceLoadStatistics = m_shouldEnableITPForDefaultSessions;
+    bool enableResourceLoadStatistics = false;
     bool enableResourceLoadStatisticsLogTestingEvent = false;
     bool shouldIncludeLocalhost = true;
     bool enableResourceLoadStatisticsDebugMode = false;
@@ -615,6 +615,8 @@
             SandboxExtension::createHandle(networkCacheDirectory, SandboxExtension::Type::ReadWrite, parameters.defaultDataStoreParameters.networkSessionParameters.networkCacheDirectoryExtensionHandle);
         }
     } else {
+        if (WebsiteDataStore::defaultDataStoreExists())
+            enableResourceLoadStatistics = WebsiteDataStore::defaultDataStore()->resourceLoadStatisticsEnabled();
         auto networkCacheDirectory = WebsiteDataStore::defaultNetworkCacheDirectory();
         parameters.defaultDataStoreParameters.networkSessionParameters.networkCacheDirectory = networkCacheDirectory;
         SandboxExtension::createHandle(networkCacheDirectory, SandboxExtension::Type::ReadWrite, parameters.defaultDataStoreParameters.networkSessionParameters.networkCacheDirectoryExtensionHandle);
@@ -1464,15 +1466,6 @@
     sendToAllProcesses(Messages::WebProcess::SetShouldUseFontSmoothing(useFontSmoothing));
 }
 
-void WebProcessPool::setResourceLoadStatisticsEnabled(bool enabled)
-{
-    m_shouldEnableITPForDefaultSessions = enabled;
-    sendToAllProcesses(Messages::WebProcess::SetResourceLoadStatisticsEnabled(enabled));
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-    sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(enabled));
-#endif
-}
-
 void WebProcessPool::clearResourceLoadStatistics()
 {
     sendToAllProcesses(Messages::WebProcess::ClearResourceLoadStatistics());

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (250423 => 250424)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-09-27 15:55:01 UTC (rev 250424)
@@ -446,7 +446,6 @@
         return m_hiddenPageThrottlingAutoIncreasesCounter.count();
     }
 
-    void setResourceLoadStatisticsEnabled(bool);
     void clearResourceLoadStatistics();
 
     bool alwaysRunsAtBackgroundPriority() const { return m_alwaysRunsAtBackgroundPriority; }
@@ -724,7 +723,6 @@
     bool m_shouldTakeUIBackgroundAssertion;
     bool m_shouldMakeNextWebProcessLaunchFailForTesting { false };
     bool m_shouldMakeNextNetworkProcessLaunchFailForTesting { false };
-    bool m_shouldEnableITPForDefaultSessions { false };
 
     UserObservablePageCounter m_userObservablePageCounter;
     ProcessSuppressionDisabledCounter m_processSuppressionDisabledForPageCounter;

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (250423 => 250424)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2019-09-27 15:31:00 UTC (rev 250423)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2019-09-27 15:55:01 UTC (rev 250424)
@@ -1889,17 +1889,13 @@
         
         resolveDirectoriesIfNecessary();
         
-        for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false)) {
-            processPool->setResourceLoadStatisticsEnabled(true);
-            processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(true));
-        }
+        for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false))
+            processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(m_sessionID, true));
         return;
     }
 
-    for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false)) {
-        processPool->setResourceLoadStatisticsEnabled(false);
-        processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(false));
-    }
+    for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false))
+        processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(m_sessionID, false));
 
     m_resourceLoadStatisticsEnabled = false;
 #else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to