WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 21:35:30 +0000 (21:35 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 21:35:30 +0000 (21:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185992

Reviewed by Geoffrey Garen.

Update enableResourceLoadStatisticsAndSetTestingCallback() to pass the right parameter to processPools()
to avoid constructing a process pool when none exist. Also drop the 'resourceLoadStatisticsEnabled'
flag on the WebProcessPool and have it query its data store instead to know if the feature is enabled.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

index 53ca6bd..8b0dec1 100644 (file)
@@ -1,5 +1,23 @@
 2018-05-25  Chris Dumez  <cdumez@apple.com>
 
+        WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly constructs a process pool
+        https://bugs.webkit.org/show_bug.cgi?id=185992
+
+        Reviewed by Geoffrey Garen.
+
+        Update enableResourceLoadStatisticsAndSetTestingCallback() to pass the right parameter to processPools()
+        to avoid constructing a process pool when none exist. Also drop the 'resourceLoadStatisticsEnabled'
+        flag on the WebProcessPool and have it query its data store instead to know if the feature is enabled.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::initializeNewWebProcess):
+        (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
+
+2018-05-25  Chris Dumez  <cdumez@apple.com>
+
         Drop support for NSURLCache in WebKit2
         https://bugs.webkit.org/show_bug.cgi?id=185990
 
index bf3bc98..067a5b5 100644 (file)
@@ -942,7 +942,7 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa
         parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
 #endif
 
-    parameters.resourceLoadStatisticsEnabled = resourceLoadStatisticsEnabled();
+    parameters.resourceLoadStatisticsEnabled = websiteDataStore.resourceLoadStatisticsEnabled();
 #if ENABLE(MEDIA_STREAM)
     parameters.shouldCaptureAudioInUIProcess = m_configuration->shouldCaptureAudioInUIProcess();
 #endif
@@ -1368,7 +1368,6 @@ void WebProcessPool::setShouldUseFontSmoothing(bool useFontSmoothing)
 
 void WebProcessPool::setResourceLoadStatisticsEnabled(bool enabled)
 {
-    m_resourceLoadStatisticsEnabled = enabled;
     sendToAllProcesses(Messages::WebProcess::SetResourceLoadStatisticsEnabled(enabled));
 }
 
index 192fc39..aeb1910 100644 (file)
@@ -414,7 +414,6 @@ public:
     static String legacyPlatformDefaultNetworkCacheDirectory();
     static String legacyPlatformDefaultJavaScriptConfigurationDirectory();
 
-    bool resourceLoadStatisticsEnabled() { return m_resourceLoadStatisticsEnabled; }
     void setResourceLoadStatisticsEnabled(bool);
     void clearResourceLoadStatistics();
 
@@ -631,7 +630,6 @@ private:
 #endif
 
     bool m_memoryCacheDisabled { false };
-    bool m_resourceLoadStatisticsEnabled { false };
     bool m_javaScriptConfigurationFileEnabled { false };
     bool m_alwaysRunsAtBackgroundPriority;
     bool m_shouldTakeUIBackgroundAssertion;
index a9f268c..548761a 100644 (file)
@@ -1477,7 +1477,7 @@ void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Functio
     m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), m_sessionID.isEphemeral());
 #endif
 
-    for (auto& processPool : processPools())
+    for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false))
         processPool->setResourceLoadStatisticsEnabled(true);
 }