Title: [232209] trunk/Source/WebKit
Revision
232209
Author
timothy_hor...@apple.com
Date
2018-05-25 14:53:17 -0700 (Fri, 25 May 2018)

Log Message

Ensure that the Web Content process doesn't sleep during initialization
https://bugs.webkit.org/show_bug.cgi?id=185975
<rdar://problem/40548159>

Reviewed by Geoffrey Garen.

WebProcessPool::warmInitialProcess isn't worth much (or at least, as much
as it could be) if the Web Content process goes to sleep in the middle
of initializeWebProcess.

Keep the Web Content process alive until it has handled all messages
sent from WebProcessPool::initializeNewWebProcess.

This is a significant speedup on some benchmarks I've been running
that involve prewarming a process long before any content is loaded.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (232208 => 232209)


--- trunk/Source/WebKit/ChangeLog	2018-05-25 21:53:08 UTC (rev 232208)
+++ trunk/Source/WebKit/ChangeLog	2018-05-25 21:53:17 UTC (rev 232209)
@@ -1,3 +1,24 @@
+2018-05-25  Tim Horton  <timothy_hor...@apple.com>
+
+        Ensure that the Web Content process doesn't sleep during initialization
+        https://bugs.webkit.org/show_bug.cgi?id=185975
+        <rdar://problem/40548159>
+
+        Reviewed by Geoffrey Garen.
+
+        WebProcessPool::warmInitialProcess isn't worth much (or at least, as much
+        as it could be) if the Web Content process goes to sleep in the middle
+        of initializeWebProcess.
+
+        Keep the Web Content process alive until it has handled all messages
+        sent from WebProcessPool::initializeNewWebProcess.
+
+        This is a significant speedup on some benchmarks I've been running
+        that involve prewarming a process long before any content is loaded.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::initializeNewWebProcess):
+
 2018-05-25  Chris Dumez  <cdu...@apple.com>
 
         WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly constructs a process pool

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (232208 => 232209)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-05-25 21:53:08 UTC (rev 232208)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-05-25 21:53:17 UTC (rev 232209)
@@ -93,6 +93,7 @@
 #include <wtf/NeverDestroyed.h>
 #include <wtf/ProcessPrivilege.h>
 #include <wtf/RunLoop.h>
+#include <wtf/Scope.h>
 #include <wtf/WallTime.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -832,6 +833,14 @@
 
 void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDataStore& websiteDataStore)
 {
+    auto initializationActivityToken = process.throttler().backgroundActivityToken();
+    auto scopeExit = makeScopeExit([&process, initializationActivityToken] {
+        // Round-trip to the Web Content process before releasing the
+        // initialization activity token, so that we're sure that all
+        // messages sent from this function have been handled.
+        process.isResponsive([initializationActivityToken] (bool) { });
+    });
+
     ensureNetworkProcess();
 
     WebProcessCreationParameters parameters;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to