Prewarmed processes should be usable with any website data store
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 17:01:14 +0000 (17:01 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 17:01:14 +0000 (17:01 +0000)
commit6493349c70d5a7bd2a912eca610053be1b18c217
tree7f7e2832d38b3d454c450502bfde0781f99d7a6e
parent4c8397467f8405733adad88df8e8b701d3a884c8
Prewarmed processes should be usable with any website data store
https://bugs.webkit.org/show_bug.cgi?id=196104

Reviewed by Alex Christensen.

Source/WebKit:

Split WebsiteDataStore-specific data out of WebProcessCreationParameters and into a new
WebProcessDataStoreParameters struct so that we do not need a WebsiteDataStore in order
to lauch and initialize a WebProcess. When the process finally gets used and we thus
know which WebsiteDataStore they will be used for, we send the WebProcessDataStoreParameters
to the process to that it can do its data store-specific initialization.

This allows prewarmed processes not not have a WebsiteDataStore assocated with them. They
can then be used for any WebsiteDataStore when we need them.

This is also used by our dummy WebProcessProxy since it does not have a backing process and
thus has no associated WebsiteDataStore.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/WebProcessDataStoreParameters.h: Added.
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/API/C/WKContext.cpp:
(WKContextWarmInitialProcess):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _warmInitialProcess]):
* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::tryTakePrewarmedProcess):
(WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::prewarmProcess):
(WebKit::WebProcessPool::processForRegistrableDomain):
(WebKit::WebProcessPool::createWebPage):
(WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
* UIProcess/WebProcessPool.h:
(WebKit::WebProcessPool::sendToOneProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::create):
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::setWebsiteDataStore):
(WebKit::WebProcessProxy::addExistingWebPage):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::websiteDataStore const):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
(WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
* WebProcess/MediaCache/WebMediaKeyStorageManager.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/WebProcessSupplement.h:
(WebKit::WebProcessSupplement::initialize):
(WebKit::WebProcessSupplement::setWebsiteDataStore):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
* WebProcess/win/WebProcessWin.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessPreWarming.mm:
(runInitialWarmedProcessUsedTest):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebProcessCreationParameters.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/Shared/WebProcessDataStoreParameters.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/WKContext.cpp
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp
Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.h
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKit/WebProcess/WebProcessSupplement.h
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Source/WebKit/WebProcess/glib/WebProcessGLib.cpp
Source/WebKit/WebProcess/win/WebProcessWin.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessPreWarming.mm