Add a SW context process (where SW scripts will actually execute).
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 17:27:08 +0000 (17:27 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 17:27:08 +0000 (17:27 +0000)
commit152248f5578aa99148300f50897298dd43a5c0b4
treec211e2b115b11068919e5b2f39acb7622660b6c7
parent0c83458b5bd27e69cda845ae2e104ccc3772b957
Add a SW context process (where SW scripts will actually execute).
https://bugs.webkit.org/show_bug.cgi?id=178156
Source/WebCore:

Reviewed by Andy Estes.

No new tests (Covered by changes to existing tests).

This patch adds an auxiliary "ServiceWorker context" WebProcess to a WebProcessPool.

This process is where ServiceWorker scripts will execute, separate from the client WebProcess
hosting the page(s) they are serving.

This patch also adds all of the plumbing to pass along a fetched service worker script to this
context WebProcess, as well as message back failure to actually start the script so we can test.

Touches lots of code sites but is basically just a lot of plumbing.

* WebCore.xcodeproj/project.pbxproj:

* workers/service/ServiceWorkerContextData.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.h.
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::finishFetchingScriptInServer):
(WebCore::SWServer::Connection::scriptContextFailedToStart):
(WebCore::SWServer::scriptFetchFinished):
(WebCore::SWServer::scriptContextFailedToStart):
(WebCore::SWServer::createWorker):
* workers/service/server/SWServer.h:

* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scriptFetchFinished):
(WebCore::SWServerRegistration::scriptContextFailedToStart):
* workers/service/server/SWServerRegistration.h:

* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::~SWServerWorker):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::create):
(WebCore::SWServerWorker::scriptURL const):
(WebCore::SWServerWorker::script const):
(WebCore::SWServerWorker::type const):
(WebCore::SWServerWorker::workerID const):

Source/WebKit:

Reviewed by Andy Estes.

This patch adds an auxiliary "ServiceWorker context" WebProcess to a WebProcessPool.

This process is where ServiceWorker scripts will execute, separate from the client WebProcess
hosting the page(s) they are serving.

This patch also adds all of the plumbing to pass along a fetched service worker script to this
context WebProcess, as well as message back failure to actually start the script so we can test.

Touches lots of code sites but is basically just a lot of plumbing.

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::WebSWServerConnection):
(WebKit::WebSWServerConnection::startServiceWorkerContext):
(WebKit::WebSWServerConnection::sendToContextProcess):
(WebKit::WebSWServerConnection::setContextConnection):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::workerContextProcessConnection):
(WebKit::StorageProcess::createWorkerContextProcessConnection):
(WebKit::StorageProcess::didGetWorkerContextProcessConnection):
(WebKit::StorageProcess::serviceWorkerContextFailedToStart):
(WebKit::StorageProcess::registerSWServerConnection):
(WebKit::StorageProcess::unregisterSWServerConnection):
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:

* StorageProcess/StorageToWebProcessConnection.cpp:
(WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
(WebKit::StorageToWebProcessConnection::establishSWServerConnection):
(WebKit::StorageToWebProcessConnection::removeSWServerConnection):
(WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated):
* StorageProcess/StorageToWebProcessConnection.h:

* UIProcess/Storage/StorageProcessProxy.cpp:
(WebKit::StorageProcessProxy::create):
(WebKit::StorageProcessProxy::StorageProcessProxy):
(WebKit::StorageProcessProxy::didClose):
(WebKit::StorageProcessProxy::getWorkerContextProcessConnection):
(WebKit::StorageProcessProxy::didGetWorkerContextProcessConnection):
* UIProcess/Storage/StorageProcessProxy.h:
* UIProcess/Storage/StorageProcessProxy.messages.in:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
(WebKit::WebProcessPool::getWorkerContextProcessConnection):
(WebKit::WebProcessPool::didGetWorkerContextProcessConnection):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::createWebPage):
* UIProcess/WebProcessPool.h:

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didGetWorkerContextConnection):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::getWorkerContextConnection):
(WebKit::WebProcess::startServiceWorkerContext):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

LayoutTests:

Reviewed by Andy Estes.

* http/tests/workers/service/basic-register-exceptions-expected.txt:
* http/tests/workers/service/basic-register-expected.txt:
* http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt
LayoutTests/http/tests/workers/service/basic-register-expected.txt
LayoutTests/http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/workers/service/ServiceWorkerContextData.h [new file with mode: 0644]
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerRegistration.cpp
Source/WebCore/workers/service/server/SWServerRegistration.h
Source/WebCore/workers/service/server/SWServerWorker.cpp
Source/WebCore/workers/service/server/SWServerWorker.h
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h
Source/WebKit/StorageProcess/StorageProcess.cpp
Source/WebKit/StorageProcess/StorageProcess.h
Source/WebKit/StorageProcess/StorageProcess.messages.in
Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp
Source/WebKit/StorageProcess/StorageToWebProcessConnection.h
Source/WebKit/UIProcess/Storage/StorageProcessProxy.cpp
Source/WebKit/UIProcess/Storage/StorageProcessProxy.h
Source/WebKit/UIProcess/Storage/StorageProcessProxy.messages.in
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/UIProcess/WebProcessProxy.messages.in
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in