Keep around a pre-warmed process when doing process swap on navigation
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 02:03:27 +0000 (02:03 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 02:03:27 +0000 (02:03 +0000)
commitf2f999b2b0d5d9706c2726bf8d9e1ba1e19d7731
tree30311f870243914af162f60d9fb7d42b93a646db
parentf3132919dccd9a27e999c408cdf52dba72a9b795
Keep around a pre-warmed process when doing process swap on navigation
https://bugs.webkit.org/show_bug.cgi?id=184765

Reviewed by Ryosuke Niwa.

This patch makes it so that WebProcessPool prewarms a process when process
swap on navigation is turned on. When we do a process swap on navigation,
we first try to grab a prewarmed process before creating a new one.

We try to be smart about when to create these processes. The initial heuristic
that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
layout milestone. We're going to try to improve on this heuristic in:
https://bugs.webkit.org/show_bug.cgi?id=184899

This is a 40% progression on PLT with process swap on navigation turned on.

* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
(WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::tryTakePrewarmedProcess):
(WebKit::WebProcessPool::warmInitialProcess):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::createWebPage):
(WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
(WebKit::WebProcessPool::processForNavigation):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::create):
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::m_isInPrewarmedPool):
(WebKit::m_userMediaCaptureManagerProxy): Deleted.
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::isInPrewarmedPool const):
(WebKit::WebProcessProxy::setIsInPrewarmedPool):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@230938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h