Introduce ServiceWorkerContainer::ensureSWClientConnection()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 19:41:22 +0000 (19:41 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 19:41:22 +0000 (19:41 +0000)
commit84550bfa15830554184a1eedfca09b14d9e28e89
tree0906d92252c701a2291a8956189b291d673674f9
parent781f2f1a56a47a4211c99257aef5b08999ebc0e9
Introduce ServiceWorkerContainer::ensureSWClientConnection()
https://bugs.webkit.org/show_bug.cgi?id=180146

Reviewed by Youenn Fablet.

Introduce ServiceWorkerContainer::ensureSWClientConnection() to reduce
code duplication. Also use callOnMainThread() in preparation for this
getting called from a service worker thread (now that ServiceWorkerContainer
is exposed to service workers). This is needed because constructing the
SWClientConnection initializes the IPC connection from the WebProcess to
the StorageProcess, which involves a synchronous IPC with the UIProcess.
Doing a synchronous IPC from a background thread is unsupported.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::getRegistration):
(WebCore::ServiceWorkerContainer::getRegistrations):
(WebCore::ServiceWorkerContainer::ensureSWClientConnection):
* workers/service/ServiceWorkerContainer.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225283 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h