Title: [242050] trunk/Source/WebKit
Revision
242050
Author
[email protected]
Date
2019-02-25 11:11:57 -0800 (Mon, 25 Feb 2019)

Log Message

A prewarmed Web process should have a process assertion.
https://bugs.webkit.org/show_bug.cgi?id=195006

Reviewed by Geoffrey Garen.

To make sure the prewarm message is handled in the Web process before the process is suspended,
the process should have a process assertion. This can be fixed by sending the prewarm message
inside WebProcessPool::initializeNewWebProcess, since all message sent inside this method are
guaranteed to be handled before the WebContent process is suspended.

This patch is based on Chris Dumez' idea and obervation of the issue.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/WebProcessPool.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (242049 => 242050)


--- trunk/Source/WebKit/ChangeLog	2019-02-25 19:09:05 UTC (rev 242049)
+++ trunk/Source/WebKit/ChangeLog	2019-02-25 19:11:57 UTC (rev 242050)
@@ -1,3 +1,22 @@
+2019-02-25  Per Arne Vollan  <[email protected]>
+
+        A prewarmed Web process should have a process assertion.
+        https://bugs.webkit.org/show_bug.cgi?id=195006
+
+        Reviewed by Geoffrey Garen.
+
+        To make sure the prewarm message is handled in the Web process before the process is suspended,
+        the process should have a process assertion. This can be fixed by sending the prewarm message
+        inside WebProcessPool::initializeNewWebProcess, since all message sent inside this method are
+        guaranteed to be handled before the WebContent process is suspended.
+
+        This patch is based on Chris Dumez' idea and obervation of the issue.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createNewWebProcess):
+        (WebKit::WebProcessPool::initializeNewWebProcess):
+        * UIProcess/WebProcessPool.h:
+
 2019-02-25  Michael Catanzaro  <[email protected]>
 
         [GTK] Enable PSON

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (242049 => 242050)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-02-25 19:09:05 UTC (rev 242049)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-02-25 19:11:57 UTC (rev 242050)
@@ -764,14 +764,8 @@
 {
     auto processProxy = WebProcessProxy::create(*this, websiteDataStore, isPrewarmed);
     auto& process = processProxy.get();
-    initializeNewWebProcess(process, websiteDataStore);
+    initializeNewWebProcess(process, websiteDataStore, isPrewarmed);
     m_processes.append(WTFMove(processProxy));
-    if (isPrewarmed == WebProcessProxy::IsPrewarmed::Yes) {
-        ASSERT(!m_prewarmedProcess);
-        m_prewarmedProcess = &process;
-        
-        m_prewarmedProcess->send(Messages::WebProcess::PrewarmGlobally(), 0);
-    }
 
     if (m_serviceWorkerProcessesTerminationTimer.isActive())
         m_serviceWorkerProcessesTerminationTimer.stop();
@@ -813,7 +807,7 @@
 }
 #endif
 
-void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDataStore& websiteDataStore)
+void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDataStore& websiteDataStore, WebProcessProxy::IsPrewarmed isPrewarmed)
 {
     auto initializationActivityToken = process.throttler().backgroundActivityToken();
     auto scopeExit = makeScopeExit([&process, initializationActivityToken] {
@@ -964,6 +958,12 @@
 
     ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty());
 
+    if (isPrewarmed == WebProcessProxy::IsPrewarmed::Yes) {
+        ASSERT(!m_prewarmedProcess);
+        m_prewarmedProcess = &process;
+        process.send(Messages::WebProcess::PrewarmGlobally(), 0);
+    }
+
 #if ENABLE(REMOTE_INSPECTOR)
     // Initialize remote inspector connection now that we have a sub-process that is hosting one of our web views.
     Inspector::RemoteInspector::singleton(); 

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (242049 => 242050)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-02-25 19:09:05 UTC (rev 242049)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-02-25 19:11:57 UTC (rev 242050)
@@ -505,7 +505,7 @@
     RefPtr<WebProcessProxy> tryTakePrewarmedProcess(WebsiteDataStore&);
 
     WebProcessProxy& createNewWebProcess(WebsiteDataStore&, WebProcessProxy::IsPrewarmed = WebProcessProxy::IsPrewarmed::No);
-    void initializeNewWebProcess(WebProcessProxy&, WebsiteDataStore&);
+    void initializeNewWebProcess(WebProcessProxy&, WebsiteDataStore&, WebProcessProxy::IsPrewarmed = WebProcessProxy::IsPrewarmed::No);
 
     void requestWebContentStatistics(StatisticsRequest&);
     void requestNetworkingStatistics(StatisticsRequest&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to