Bug 180669 - Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
Summary: Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-11 13:49 PST by Chris Dumez
Modified: 2017-12-11 16:59 PST (History)
8 users (show)

See Also:


Attachments
Patch (69.36 KB, patch)
2017-12-11 13:58 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (69.37 KB, patch)
2017-12-11 14:00 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (68.52 KB, patch)
2017-12-11 15:08 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-12-11 13:49:33 PST
Merge ServiceWorkerClientIdentifier into ServiceWorkerCientData, for consistency with ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
Comment 1 Chris Dumez 2017-12-11 13:58:57 PST
Created attachment 329030 [details]
Patch
Comment 2 Chris Dumez 2017-12-11 14:00:25 PST
Created attachment 329031 [details]
Patch
Comment 3 youenn fablet 2017-12-11 14:56:22 PST
Comment on attachment 329031 [details]
Patch

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

> Source/WebCore/dom/Document.cpp:7630
> +        m_serviceWorkerConnection->unregisterServiceWorkerClient({ m_serviceWorkerConnection->serverConnectionIdentifier(), identifier() });

I wonder whether we should not have made SWClientConnection only take DocumentIdentifier and do the translation to ServiceWorkerClientIdentifier on its own.
Maybe this is too late for that. If not we could stick with passing a DocumentIdentifier to unregisterServieWorkerClient.

> Source/WebCore/workers/service/ServiceWorkerClientData.cpp:65
> +    RELEASE_ASSERT(isDocument); // We do not support dedicated workers as clients yet.

Isn't the downcast<Document> doing this release assert already?

> Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:121
> +            auto sourceClient = ServiceWorkerClient::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerClientData>(sourceData)));

Maybe use RefPtr<ServiceWorkerClient> here instead of auto so that there is not the need for it below for source =...?

> Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h:93
> +    void unregisterServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier&);

Sometimes we are using const ServiceWorkerClientIdentifier&, sometimes ServiceWorkerClientIdentifier directly.
Comment 4 Chris Dumez 2017-12-11 15:02:20 PST
Comment on attachment 329031 [details]
Patch

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

>> Source/WebCore/workers/service/ServiceWorkerClientData.cpp:65
>> +    RELEASE_ASSERT(isDocument); // We do not support dedicated workers as clients yet.
> 
> Isn't the downcast<Document> doing this release assert already?

Nah, only a ASSERT_WITH_SECURITY_IMPLICATION() (i.e. debug only)
Comment 5 Chris Dumez 2017-12-11 15:08:45 PST
Created attachment 329042 [details]
Patch
Comment 6 Chris Dumez 2017-12-11 15:24:57 PST
Comment on attachment 329042 [details]
Patch

Clearing flags on attachment: 329042

Committed r225760: <https://trac.webkit.org/changeset/225760>
Comment 7 Chris Dumez 2017-12-11 15:24:58 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2017-12-11 15:25:25 PST
<rdar://problem/35980151>