Bug 201506 - Remove ServiceWorkerProcessProxy
Summary: Remove ServiceWorkerProcessProxy
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-05 05:25 PDT by youenn fablet
Modified: 2019-09-09 10:03 PDT (History)
5 users (show)

See Also:


Attachments
Patch (40.75 KB, patch)
2019-09-05 06:34 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (43.06 KB, patch)
2019-09-05 07:16 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (43.27 KB, patch)
2019-09-06 04:50 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (36.58 KB, patch)
2019-09-09 00:47 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-09-05 05:25:34 PDT
Remove ServiceWorkerProcessProxy and use WebProcessProxy directly.
This will allow us to run service workers inside already launched regular web processes.
Comment 1 youenn fablet 2019-09-05 06:34:57 PDT
Created attachment 378077 [details]
Patch
Comment 2 youenn fablet 2019-09-05 07:16:32 PDT
Created attachment 378081 [details]
Patch
Comment 3 youenn fablet 2019-09-06 04:50:49 PDT
Created attachment 378182 [details]
Patch
Comment 4 Chris Dumez 2019-09-06 08:47:17 PDT
Comment on attachment 378182 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378182&action=review

> Source/WebCore/workers/service/ServiceWorkerProvider.cpp:70
> +        if (dummyDocumentIdentifiers.contains(document->identifier()))

Why cannot we simply use if (!document->page() || document->page()->isUtilityPage()) continue; ?

> Source/WebCore/workers/service/context/SWContextManager.cpp:180
> +HashSet<DocumentIdentifier> SWContextManager::dummyDocumentIdentifiers() const

Not convinced this is needed.

> Source/WebCore/workers/service/context/SWContextManager.cpp:193
> +        m_pendingServiceWorkerTerminationRequests.add(serviceWorker->identifier(), makeUnique<ServiceWorkerTerminationRequest>(*this, serviceWorker->identifier(), 10_s));

We likely want a global constant for this 10_s.

> Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h:79
> +    DocumentIdentifier dummyDocumentIdentifier() const { return m_document->identifier(); }

Not convinced this is needed.

> Source/WebKit/UIProcess/WebProcessProxy.cpp:137
> +Ref<WebProcessProxy> WebProcessProxy::createForServiceWorkers(WebProcessPool& processPool, RegistrableDomain&& registrableDomain, WebsiteDataStore& websiteDataStore)

Why do we want a new createForServiceWorkers() factory function? Why cannot we use the regular create() and then have a setter for the service worker information (e.g. WebProcessProxy::initializeServiceWorkerInformation())?
I imagine that in the future, the WebProcessProxy may already be running (for a page) and we'll need to add the service worker information to it after the fact, so such setter would be useful anyway.

> Source/WebKit/UIProcess/WebProcessProxy.cpp:292
> +        launchOptions.extraInitializationData.add("service-worker-process"_s, "1"_s);

Looks like this is going to need to change at some point if we want process sharing between service workers and pages.
Comment 5 youenn fablet 2019-09-09 00:25:17 PDT
I'll reduce the patch to removing ServiceWorkerProcessProxy only, we can then progressively land the changes to make service workers coexist with real pages.
Comment 6 youenn fablet 2019-09-09 00:47:26 PDT
Created attachment 378355 [details]
Patch
Comment 7 youenn fablet 2019-09-09 00:49:00 PDT
> Why do we want a new createForServiceWorkers() factory function? Why cannot
> we use the regular create() and then have a setter for the service worker
> information (e.g. WebProcessProxy::initializeServiceWorkerInformation())?
> I imagine that in the future, the WebProcessProxy may already be running
> (for a page) and we'll need to add the service worker information to it
> after the fact, so such setter would be useful anyway.

I kept it this way for now, m_registrableDomain is fully controlled by WebProcessProxy for now.
Comment 8 Chris Dumez 2019-09-09 08:52:54 PDT
Comment on attachment 378355 [details]
Patch

r=me
Comment 9 WebKit Commit Bot 2019-09-09 10:02:21 PDT
Comment on attachment 378355 [details]
Patch

Clearing flags on attachment: 378355

Committed r249647: <https://trac.webkit.org/changeset/249647>
Comment 10 WebKit Commit Bot 2019-09-09 10:02:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2019-09-09 10:03:22 PDT
<rdar://problem/55186170>