Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Dec 2017 23:24:51 +0000 (23:24 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Dec 2017 23:24:51 +0000 (23:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180669

Reviewed by Youenn Fablet.

Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::setServiceWorkerConnection):
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::postMessage):
* workers/service/ServiceWorkerClient.cpp:
(WebCore::ServiceWorkerClient::getOrCreate):
(WebCore::ServiceWorkerClient::ServiceWorkerClient):
* workers/service/ServiceWorkerClient.h:
(WebCore::ServiceWorkerClient::identifier const):
* workers/service/ServiceWorkerClientData.cpp:
(WebCore::ServiceWorkerClientData::isolatedCopy const):
(WebCore::ServiceWorkerClientData::from):
* workers/service/ServiceWorkerClientData.h:
(WebCore::ServiceWorkerClientData::encode const):
(WebCore::ServiceWorkerClientData::decode):
* workers/service/ServiceWorkerClientInformation.h: Removed.
* workers/service/ServiceWorkerClients.cpp:
(WebCore::didFinishGetRequest):
(WebCore::ServiceWorkerClients::get):
(WebCore::matchAllCompleted):
* workers/service/ServiceWorkerTypes.h:
* workers/service/ServiceWorkerWindowClient.cpp:
(WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
* workers/service/ServiceWorkerWindowClient.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::postMessageToServiceWorker):
* workers/service/context/SWContextManager.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::postMessageToServiceWorker):
* workers/service/context/ServiceWorkerThread.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::findClientByIdentifier):
(WebCore::SWServer::matchAll):
(WebCore::SWServer::claim):
(WebCore::SWServer::registerServiceWorkerClient):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.h:

Source/WebKit:

* Scripts/webkit/messages.py:
(forward_declarations_and_headers):
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ServiceWorkerOrClientData>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientData>::decode):
* Shared/WebCoreArgumentCoders.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::~WebSWServerConnection):
(WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
(WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
(WebKit::WebSWServerConnection::registerServiceWorkerClient):
(WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::matchAllCompleted):
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::registerServiceWorkerClient):
(WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
(WebKit::WebSWContextManagerConnection::matchAllCompleted):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225760 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/workers/service/SWClientConnection.h
Source/WebCore/workers/service/ServiceWorker.cpp
Source/WebCore/workers/service/ServiceWorkerClient.cpp
Source/WebCore/workers/service/ServiceWorkerClient.h
Source/WebCore/workers/service/ServiceWorkerClientData.cpp
Source/WebCore/workers/service/ServiceWorkerClientData.h
Source/WebCore/workers/service/ServiceWorkerClientInformation.h [deleted file]
Source/WebCore/workers/service/ServiceWorkerClients.cpp
Source/WebCore/workers/service/ServiceWorkerTypes.h
Source/WebCore/workers/service/ServiceWorkerWindowClient.cpp
Source/WebCore/workers/service/ServiceWorkerWindowClient.h
Source/WebCore/workers/service/context/SWContextManager.cpp
Source/WebCore/workers/service/context/SWContextManager.h
Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
Source/WebCore/workers/service/context/ServiceWorkerThread.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerToContextConnection.h
Source/WebCore/workers/service/server/SWServerWorker.h
Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in

index dc66cf7..831faa1 100644 (file)
@@ -1,3 +1,54 @@
+2017-12-11  Chris Dumez  <cdumez@apple.com>
+
+        Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
+        https://bugs.webkit.org/show_bug.cgi?id=180669
+
+        Reviewed by Youenn Fablet.
+
+        Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
+        ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.cpp:
+        (WebCore::Document::setServiceWorkerConnection):
+        * workers/service/SWClientConnection.h:
+        * workers/service/ServiceWorker.cpp:
+        (WebCore::ServiceWorker::postMessage):
+        * workers/service/ServiceWorkerClient.cpp:
+        (WebCore::ServiceWorkerClient::getOrCreate):
+        (WebCore::ServiceWorkerClient::ServiceWorkerClient):
+        * workers/service/ServiceWorkerClient.h:
+        (WebCore::ServiceWorkerClient::identifier const):
+        * workers/service/ServiceWorkerClientData.cpp:
+        (WebCore::ServiceWorkerClientData::isolatedCopy const):
+        (WebCore::ServiceWorkerClientData::from):
+        * workers/service/ServiceWorkerClientData.h:
+        (WebCore::ServiceWorkerClientData::encode const):
+        (WebCore::ServiceWorkerClientData::decode):
+        * workers/service/ServiceWorkerClientInformation.h: Removed.
+        * workers/service/ServiceWorkerClients.cpp:
+        (WebCore::didFinishGetRequest):
+        (WebCore::ServiceWorkerClients::get):
+        (WebCore::matchAllCompleted):
+        * workers/service/ServiceWorkerTypes.h:
+        * workers/service/ServiceWorkerWindowClient.cpp:
+        (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
+        * workers/service/ServiceWorkerWindowClient.h:
+        * workers/service/context/SWContextManager.cpp:
+        (WebCore::SWContextManager::postMessageToServiceWorker):
+        * workers/service/context/SWContextManager.h:
+        * workers/service/context/ServiceWorkerThread.cpp:
+        (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
+        * workers/service/context/ServiceWorkerThread.h:
+        * workers/service/server/SWServer.cpp:
+        (WebCore::SWServer::findClientByIdentifier):
+        (WebCore::SWServer::matchAll):
+        (WebCore::SWServer::claim):
+        (WebCore::SWServer::registerServiceWorkerClient):
+        * workers/service/server/SWServer.h:
+        * workers/service/server/SWServerToContextConnection.h:
+        * workers/service/server/SWServerWorker.h:
+
 2017-12-11  Daniel Bates  <dabates@apple.com>
 
         Fix the macOS Sierra build following r225179
index 430e726..f8dedc4 100644 (file)
                41B2A6261EF1BF6D002B9D7A /* WebAudioSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B2A6251EF1BF60002B9D7A /* WebAudioSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41BF70100FE86F61005E8DEC /* PlatformMessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700E0FE86F61005E8DEC /* PlatformMessagePortChannel.h */; };
-               41C68AF51FD2279000AAA3B3 /* ServiceWorkerClientInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 41C68AF31FD21E8E00AAA3B3 /* ServiceWorkerClientInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41C760B10EDE03D300C1655F /* ScriptState.h in Headers */ = {isa = PBXBuildFile; fileRef = 41C760B00EDE03D300C1655F /* ScriptState.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41CAD71E1EA090A100178164 /* VideoToolBoxEncoderFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41CAD71C1EA0905700178164 /* VideoToolBoxEncoderFactory.cpp */; };
                41D015CA0F4B5C71004A662F /* ContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D015C80F4B5C71004A662F /* ContentType.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagePortChannel.h; sourceTree = "<group>"; };
                41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformMessagePortChannel.cpp; path = default/PlatformMessagePortChannel.cpp; sourceTree = "<group>"; };
                41BF700E0FE86F61005E8DEC /* PlatformMessagePortChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformMessagePortChannel.h; path = default/PlatformMessagePortChannel.h; sourceTree = "<group>"; };
-               41C68AF31FD21E8E00AAA3B3 /* ServiceWorkerClientInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerClientInformation.h; sourceTree = "<group>"; };
                41C760B00EDE03D300C1655F /* ScriptState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptState.h; sourceTree = "<group>"; };
                41C7E1051E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasCaptureMediaStreamTrack.cpp; sourceTree = "<group>"; };
                41C7E1061E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasCaptureMediaStreamTrack.h; sourceTree = "<group>"; };
                                8379363C1FBBB0A400C8023C /* ServiceWorkerClientData.cpp */,
                                8379363E1FBBB0A500C8023C /* ServiceWorkerClientData.h */,
                                837D46251FA2A8C50054E1FA /* ServiceWorkerClientIdentifier.h */,
-                               41C68AF31FD21E8E00AAA3B3 /* ServiceWorkerClientInformation.h */,
                                413FC4CD1FD1DD8C00541C4B /* ServiceWorkerClientQueryOptions.h */,
                                46EF14211F97B7BA00C2A524 /* ServiceWorkerClients.cpp */,
                                46EF14221F97B7BA00C2A524 /* ServiceWorkerClients.h */,
                                46EF142D1F97B7D800C2A524 /* ServiceWorkerClient.h in Headers */,
                                8379363F1FBBB0B400C8023C /* ServiceWorkerClientData.h in Headers */,
                                837D46271FA2A8CE0054E1FA /* ServiceWorkerClientIdentifier.h in Headers */,
-                               41C68AF51FD2279000AAA3B3 /* ServiceWorkerClientInformation.h in Headers */,
                                41519CB81FD1F02E007F623C /* ServiceWorkerClientQueryOptions.h in Headers */,
                                46EF142C1F97B7D800C2A524 /* ServiceWorkerClients.h in Headers */,
                                8369FDFC1FA102E300C1FF1F /* ServiceWorkerClientType.h in Headers */,
index 5f9c45f..bfaac49 100644 (file)
@@ -7635,7 +7635,7 @@ void Document::setServiceWorkerConnection(SWClientConnection* serviceWorkerConne
         return;
 
     auto controllingServiceWorkerIdentifier = activeServiceWorker() ? std::make_optional<ServiceWorkerIdentifier>(activeServiceWorker()->identifier()) : std::nullopt;
-    m_serviceWorkerConnection->registerServiceWorkerClient(topOrigin(), identifier(), ServiceWorkerClientData::from(*this), controllingServiceWorkerIdentifier);
+    m_serviceWorkerConnection->registerServiceWorkerClient(topOrigin(), ServiceWorkerClientData::from(*this, *serviceWorkerConnection), controllingServiceWorkerIdentifier);
 }
 #endif
 
index 4714205..5c2d392 100644 (file)
@@ -81,7 +81,7 @@ public:
     virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
     virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0;
 
-    virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, DocumentIdentifier, const ServiceWorkerClientData&, const std::optional<ServiceWorkerIdentifier>&) = 0;
+    virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, const ServiceWorkerClientData&, const std::optional<ServiceWorkerIdentifier>&) = 0;
     virtual void unregisterServiceWorkerClient(DocumentIdentifier) = 0;
 
 protected:
index 4b4de2e..e477620 100644 (file)
@@ -123,8 +123,9 @@ ExceptionOr<void> ServiceWorker::postMessage(ScriptExecutionContext& context, JS
         return { };
     }
 
-    auto sourceClientData = ServiceWorkerClientData::from(context);
     auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(context.sessionID());
+    // FIXME: We should be able to send only the client identifier and look up the clientData on server side.
+    auto sourceClientData = ServiceWorkerClientData::from(context, connection);
     ServiceWorkerClientIdentifier sourceClientIdentifier { connection.serverConnectionIdentifier(), downcast<Document>(context).identifier() };
     connection.postMessageToServiceWorker(identifier(), message.releaseReturnValue(), WTFMove(sourceClientIdentifier), WTFMove(sourceClientData));
 
index ae93b5d..874a33c 100644 (file)
 
 namespace WebCore {
 
-Ref<ServiceWorkerClient> ServiceWorkerClient::getOrCreate(ServiceWorkerGlobalScope& context, ServiceWorkerClientIdentifier identifier, ServiceWorkerClientData&& data)
+Ref<ServiceWorkerClient> ServiceWorkerClient::getOrCreate(ServiceWorkerGlobalScope& context, ServiceWorkerClientData&& data)
 {
-    if (auto* client = context.serviceWorkerClient(identifier))
+    if (auto* client = context.serviceWorkerClient(data.identifier))
         return *client;
 
     if (data.type == ServiceWorkerClientType::Window)
-        return ServiceWorkerWindowClient::create(context, identifier, WTFMove(data));
+        return ServiceWorkerWindowClient::create(context, WTFMove(data));
 
-    return adoptRef(*new ServiceWorkerClient { context, identifier, WTFMove(data) });
+    return adoptRef(*new ServiceWorkerClient { context, WTFMove(data) });
 }
 
-ServiceWorkerClient::ServiceWorkerClient(ServiceWorkerGlobalScope& context, ServiceWorkerClientIdentifier identifier, ServiceWorkerClientData&& data)
+ServiceWorkerClient::ServiceWorkerClient(ServiceWorkerGlobalScope& context, ServiceWorkerClientData&& data)
     : ContextDestructionObserver(&context)
-    , m_identifier(identifier)
     , m_data(WTFMove(data))
 {
     context.addServiceWorkerClient(*this);
index 46a438c..87ef7a3 100644 (file)
@@ -48,7 +48,7 @@ public:
     using Type = ServiceWorkerClientType;
     using FrameType = ServiceWorkerClientFrameType;
 
-    static Ref<ServiceWorkerClient> getOrCreate(ServiceWorkerGlobalScope&, ServiceWorkerClientIdentifier, ServiceWorkerClientData&&);
+    static Ref<ServiceWorkerClient> getOrCreate(ServiceWorkerGlobalScope&, ServiceWorkerClientData&&);
 
     ~ServiceWorkerClient();
 
@@ -57,14 +57,13 @@ public:
     Type type() const;
     String id() const;
 
-    Identifier identifier() const { return m_identifier; }
+    Identifier identifier() const { return m_data.identifier; }
 
     ExceptionOr<void> postMessage(ScriptExecutionContext&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&& transfer);
 
 protected:
-    ServiceWorkerClient(ServiceWorkerGlobalScope&, ServiceWorkerClientIdentifier, ServiceWorkerClientData&&);
+    ServiceWorkerClient(ServiceWorkerGlobalScope&, ServiceWorkerClientData&&);
 
-    ServiceWorkerClientIdentifier m_identifier;
     ServiceWorkerClientData m_data;
 };
 
index b2e7d33..5c4402b 100644 (file)
@@ -56,14 +56,16 @@ static ServiceWorkerClientFrameType toServiceWorkerClientFrameType(ScriptExecuti
 
 ServiceWorkerClientData ServiceWorkerClientData::isolatedCopy() const
 {
-    return { type, frameType, url.isolatedCopy() };
+    return { identifier, type, frameType, url.isolatedCopy() };
 }
 
-ServiceWorkerClientData ServiceWorkerClientData::from(ScriptExecutionContext& context)
+ServiceWorkerClientData ServiceWorkerClientData::from(ScriptExecutionContext& context, SWClientConnection& connection)
 {
     bool isDocument = is<Document>(context);
+    RELEASE_ASSERT(isDocument); // We do not support dedicated workers as clients yet.
 
     return {
+        { connection.serverConnectionIdentifier(), downcast<Document>(context).identifier() },
         isDocument ? ServiceWorkerClientType::Window : ServiceWorkerClientType::Worker,
         toServiceWorkerClientFrameType(context),
         context.url()
index 4f1ab8b..143d7d9 100644 (file)
 
 namespace WebCore {
 
+class SWClientConnection;
 class ScriptExecutionContext;
 
 struct ServiceWorkerClientData {
+    ServiceWorkerClientIdentifier identifier;
     ServiceWorkerClientType type;
     ServiceWorkerClientFrameType frameType;
     URL url;
 
     ServiceWorkerClientData isolatedCopy() const;
 
-    static ServiceWorkerClientData from(ScriptExecutionContext&);
+    static ServiceWorkerClientData from(ScriptExecutionContext&, SWClientConnection&);
 
     template<class Encoder> void encode(Encoder&) const;
     template<class Decoder> static std::optional<ServiceWorkerClientData> decode(Decoder&);
@@ -52,12 +54,17 @@ struct ServiceWorkerClientData {
 template<class Encoder>
 void ServiceWorkerClientData::encode(Encoder& encoder) const
 {
-    encoder << type << frameType << url;
+    encoder << identifier << type << frameType << url;
 }
 
 template<class Decoder>
 std::optional<ServiceWorkerClientData> ServiceWorkerClientData::decode(Decoder& decoder)
 {
+    std::optional<ServiceWorkerClientIdentifier> identifier;
+    decoder >> identifier;
+    if (!identifier)
+        return std::nullopt;
+
     std::optional<ServiceWorkerClientType> type;
     decoder >> type;
     if (!type)
@@ -73,9 +80,11 @@ std::optional<ServiceWorkerClientData> ServiceWorkerClientData::decode(Decoder&
     if (!url)
         return std::nullopt;
 
-    return { { WTFMove(*type), WTFMove(*frameType), WTFMove(*url) } };
+    return { { WTFMove(*identifier), WTFMove(*type), WTFMove(*frameType), WTFMove(*url) } };
 }
 
+using ServiceWorkerClientsMatchAllCallback = WTF::CompletionHandler<void(Vector<ServiceWorkerClientData>&&)>;
+
 } // namespace WebCore
 
 #endif // ENABLE(SERVICE_WORKER)
diff --git a/Source/WebCore/workers/service/ServiceWorkerClientInformation.h b/Source/WebCore/workers/service/ServiceWorkerClientInformation.h
deleted file mode 100644 (file)
index c9f7f64..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "ServiceWorkerClientData.h"
-#include "ServiceWorkerClientIdentifier.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-
-struct ServiceWorkerClientInformation {
-    ServiceWorkerClientIdentifier identifier;
-    ServiceWorkerClientData data;
-
-    ServiceWorkerClientInformation isolatedCopy() const { return { identifier, data.isolatedCopy() }; }
-
-    template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static std::optional<ServiceWorkerClientInformation> decode(Decoder&);
-};
-
-using ServiceWorkerClientsMatchAllCallback = WTF::CompletionHandler<void(Vector<ServiceWorkerClientInformation>&&)>;
-
-template<class Encoder>
-void ServiceWorkerClientInformation::encode(Encoder& encoder) const
-{
-    encoder << identifier << data;
-}
-
-template<class Decoder>
-std::optional<ServiceWorkerClientInformation> ServiceWorkerClientInformation::decode(Decoder& decoder)
-{
-    std::optional<ServiceWorkerClientIdentifier> identifier;
-    decoder >> identifier;
-    if (!identifier)
-        return std::nullopt;
-
-    std::optional<ServiceWorkerClientData> data;
-    decoder >> data;
-    if (!data)
-        return std::nullopt;
-
-    return { { WTFMove(*identifier), WTFMove(*data) } };
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)
index 61687f9..68247a2 100644 (file)
@@ -34,7 +34,7 @@
 
 namespace WebCore {
 
-static inline void didFinishGetRequest(ServiceWorkerGlobalScope& scope, DeferredPromise& promise, ServiceWorkerClientIdentifier identifier, ExceptionOr<std::optional<ServiceWorkerClientData>>&& clientData)
+static inline void didFinishGetRequest(ServiceWorkerGlobalScope& scope, DeferredPromise& promise, ExceptionOr<std::optional<ServiceWorkerClientData>>&& clientData)
 {
     if (clientData.hasException()) {
         promise.reject(clientData.releaseException());
@@ -46,7 +46,7 @@ static inline void didFinishGetRequest(ServiceWorkerGlobalScope& scope, Deferred
         return;
     }
 
-    promise.resolve<IDLInterface<ServiceWorkerClient>>(ServiceWorkerClient::getOrCreate(scope, identifier, WTFMove(data.value())));
+    promise.resolve<IDLInterface<ServiceWorkerClient>>(ServiceWorkerClient::getOrCreate(scope, WTFMove(data.value())));
 }
 
 void ServiceWorkerClients::get(ScriptExecutionContext& context, const String& id, Ref<DeferredPromise>&& promise)
@@ -65,20 +65,20 @@ void ServiceWorkerClients::get(ScriptExecutionContext& context, const String& id
 
     callOnMainThread([promisePointer, serviceWorkerIdentifier, clientIdentifier] () {
         auto connection = SWContextManager::singleton().connection();
-        connection->findClientByIdentifier(serviceWorkerIdentifier, clientIdentifier, [promisePointer, serviceWorkerIdentifier, clientIdentifier] (auto&& clientData) {
-            SWContextManager::singleton().postTaskToServiceWorker(serviceWorkerIdentifier, [promisePointer, clientIdentifier, data = crossThreadCopy(clientData)] (auto& context) mutable {
+        connection->findClientByIdentifier(serviceWorkerIdentifier, clientIdentifier, [promisePointer, serviceWorkerIdentifier] (auto&& clientData) {
+            SWContextManager::singleton().postTaskToServiceWorker(serviceWorkerIdentifier, [promisePointer, data = crossThreadCopy(clientData)] (auto& context) mutable {
                 if (auto promise = context.clients().m_pendingPromises.take(promisePointer))
-                    didFinishGetRequest(context, *promise, clientIdentifier, WTFMove(data));
+                    didFinishGetRequest(context, *promise, WTFMove(data));
             });
         });
     });
 }
 
 
-static inline void matchAllCompleted(ServiceWorkerGlobalScope& scope, DeferredPromise& promise, Vector<ServiceWorkerClientInformation>&& clientsData)
+static inline void matchAllCompleted(ServiceWorkerGlobalScope& scope, DeferredPromise& promise, Vector<ServiceWorkerClientData>&& clientsData)
 {
-    auto clients = WTF::map(clientsData, [&] (auto&& client) {
-        return ServiceWorkerClient::getOrCreate(scope, client.identifier, WTFMove(client.data));
+    auto clients = WTF::map(clientsData, [&] (auto&& clientData) {
+        return ServiceWorkerClient::getOrCreate(scope, WTFMove(clientData));
     });
     promise.resolve<IDLSequence<IDLInterface<ServiceWorkerClient>>>(WTFMove(clients));
 }
index 8d152d3..b9cab73 100644 (file)
@@ -35,6 +35,9 @@
 
 namespace WebCore {
 
+struct ServiceWorkerData;
+struct ServiceWorkerClientData;
+
 enum class ServiceWorkerRegistrationState {
     Installing = 0,
     Waiting = 1,
@@ -72,6 +75,8 @@ using SWServerConnectionIdentifier = ObjectIdentifier<SWServerConnectionIdentifi
 
 using DocumentOrWorkerIdentifier = Variant<DocumentIdentifier, ServiceWorkerIdentifier>;
 
+using ServiceWorkerOrClientData = Variant<ServiceWorkerData, ServiceWorkerClientData>;
+
 } // namespace WebCore
 
 namespace WTF {
index 205ba53..82fbb1f 100644 (file)
@@ -32,8 +32,8 @@
 
 namespace WebCore {
 
-ServiceWorkerWindowClient::ServiceWorkerWindowClient(ServiceWorkerGlobalScope& context, ServiceWorkerClientIdentifier identifier, ServiceWorkerClientData&& data)
-    : ServiceWorkerClient(context, identifier, WTFMove(data))
+ServiceWorkerWindowClient::ServiceWorkerWindowClient(ServiceWorkerGlobalScope& context, ServiceWorkerClientData&& data)
+    : ServiceWorkerClient(context, WTFMove(data))
 {
 }
 
index 1c1e759..f43c2c6 100644 (file)
@@ -37,9 +37,9 @@ class ServiceWorkerGlobalScope;
 
 class ServiceWorkerWindowClient final : public ServiceWorkerClient {
 public:
-    static Ref<ServiceWorkerWindowClient> create(ServiceWorkerGlobalScope& context, ServiceWorkerClientIdentifier identifier, ServiceWorkerClientData&& data)
+    static Ref<ServiceWorkerWindowClient> create(ServiceWorkerGlobalScope& context, ServiceWorkerClientData&& data)
     {
-        return adoptRef(*new ServiceWorkerWindowClient(context, identifier, WTFMove(data)));
+        return adoptRef(*new ServiceWorkerWindowClient(context, WTFMove(data)));
     }
 
     VisibilityState visibilityState() const;
@@ -49,7 +49,7 @@ public:
     void navigate(const String& url, Ref<DeferredPromise>&&);
 
 private:
-    ServiceWorkerWindowClient(ServiceWorkerGlobalScope&, ServiceWorkerClientIdentifier, ServiceWorkerClientData&&);
+    ServiceWorkerWindowClient(ServiceWorkerGlobalScope&, ServiceWorkerClientData&&);
 };
 
 } // namespace WebCore
index 3a599da..5b70595 100644 (file)
@@ -67,17 +67,7 @@ ServiceWorkerThreadProxy* SWContextManager::serviceWorkerThreadProxy(ServiceWork
     return m_workerMap.get(identifier);
 }
 
-void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
-{
-    auto* serviceWorker = m_workerMap.get(destination);
-    ASSERT(serviceWorker);
-    ASSERT(!serviceWorker->isTerminatingOrTerminated());
-
-    // FIXME: We should pass valid MessagePortChannels.
-    serviceWorker->thread().postMessageToServiceWorker(WTFMove(message), nullptr, sourceIdentifier, WTFMove(sourceData));
-}
-
-void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData)
+void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerOrClientData&& sourceData)
 {
     auto* serviceWorker = m_workerMap.get(destination);
     ASSERT(serviceWorker);
index f4e0221..b252909 100644 (file)
@@ -28,7 +28,7 @@
 #if ENABLE(SERVICE_WORKER)
 
 #include "ExceptionOr.h"
-#include "ServiceWorkerClientInformation.h"
+#include "ServiceWorkerClientData.h"
 #include "ServiceWorkerClientQueryOptions.h"
 #include "ServiceWorkerIdentifier.h"
 #include "ServiceWorkerThreadProxy.h"
@@ -67,8 +67,7 @@ public:
 
     WEBCORE_EXPORT void registerServiceWorkerThreadForInstall(Ref<ServiceWorkerThreadProxy>&&);
     WEBCORE_EXPORT ServiceWorkerThreadProxy* serviceWorkerThreadProxy(ServiceWorkerIdentifier) const;
-    WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData);
-    WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData);
+    WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerOrClientData&& sourceData);
     WEBCORE_EXPORT void fireInstallEvent(ServiceWorkerIdentifier);
     WEBCORE_EXPORT void fireActivateEvent(ServiceWorkerIdentifier);
     WEBCORE_EXPORT void terminateWorker(ServiceWorkerIdentifier, Function<void()>&&);
index 67c9806..d20ffc6 100644 (file)
@@ -111,23 +111,22 @@ static void fireMessageEvent(ServiceWorkerGlobalScope& scope, Ref<SerializedScri
     scope.updateExtendedEventsSet(messageEvent.ptr());
 }
 
-void ServiceWorkerThread::postMessageToServiceWorker(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
+void ServiceWorkerThread::postMessageToServiceWorker(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ServiceWorkerOrClientData&& sourceData)
 {
-    runLoop().postTask([channels = WTFMove(channels), message = WTFMove(message), sourceIdentifier, sourceData = sourceData.isolatedCopy()] (auto& context) mutable {
+    runLoop().postTask([channels = WTFMove(channels), message = WTFMove(message), sourceData = WTFMove(sourceData)] (auto& context) mutable {
         auto& serviceWorkerGlobalScope = downcast<ServiceWorkerGlobalScope>(context);
-        RefPtr<ServiceWorkerClient> source = ServiceWorkerClient::getOrCreate(serviceWorkerGlobalScope, sourceIdentifier, WTFMove(sourceData));
-        auto sourceOrigin = SecurityOrigin::create(source->url());
-        fireMessageEvent(serviceWorkerGlobalScope, WTFMove(message), WTFMove(channels), ExtendableMessageEventSource { source }, WTFMove(sourceOrigin));
-    });
-}
-
-void ServiceWorkerThread::postMessageToServiceWorker(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ServiceWorkerData&& sourceData)
-{
-    runLoop().postTask([channels = WTFMove(channels), message = WTFMove(message), sourceData = sourceData.isolatedCopy()] (auto& context) mutable {
-        auto& serviceWorkerGlobalScope = downcast<ServiceWorkerGlobalScope>(context);
-        RefPtr<ServiceWorker> source = ServiceWorker::getOrCreate(serviceWorkerGlobalScope, WTFMove(sourceData));
-        auto sourceOrigin = SecurityOrigin::create(source->scriptURL());
-        fireMessageEvent(downcast<ServiceWorkerGlobalScope>(context), WTFMove(message), WTFMove(channels), ExtendableMessageEventSource { source }, WTFMove(sourceOrigin));
+        RefPtr<SecurityOrigin> sourceOrigin;
+        ExtendableMessageEventSource source;
+        if (WTF::holds_alternative<ServiceWorkerClientData>(sourceData)) {
+            RefPtr<ServiceWorkerClient> sourceClient = ServiceWorkerClient::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerClientData>(sourceData)));
+            sourceOrigin = SecurityOrigin::create(sourceClient->url());
+            source = WTFMove(sourceClient);
+        } else {
+            RefPtr<ServiceWorker> sourceWorker = ServiceWorker::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerData>(sourceData)));
+            sourceOrigin = SecurityOrigin::create(sourceWorker->scriptURL());
+            source = WTFMove(sourceWorker);
+        }
+        fireMessageEvent(serviceWorkerGlobalScope, WTFMove(message), WTFMove(channels), ExtendableMessageEventSource { source }, sourceOrigin.releaseNonNull());
     });
 }
 
index 1ddbdcd..e45cfbb 100644 (file)
@@ -58,8 +58,7 @@ public:
 
     WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, ResourceRequest&&, FetchOptions&&);
     WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, std::optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, FetchOptions&&);
-    WEBCORE_EXPORT void postMessageToServiceWorker(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData);
-    WEBCORE_EXPORT void postMessageToServiceWorker(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&, ServiceWorkerData&& sourceData);
+    WEBCORE_EXPORT void postMessageToServiceWorker(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&, ServiceWorkerOrClientData&& sourceData);
 
     void fireInstallEvent();
     void fireActivateEvent();
index a332518..42c4711 100644 (file)
@@ -346,7 +346,7 @@ std::optional<ServiceWorkerClientData> SWServer::findClientByIdentifier(const Cl
         return clientIdentifier == client.identifier;
     });
 
-    return (position != notFound) ? std::make_optional(clients[position].data) : std::nullopt;
+    return (position != notFound) ? std::make_optional(clients[position]) : std::nullopt;
 }
 
 // https://w3c.github.io/ServiceWorker/#clients-getall
@@ -358,13 +358,13 @@ void SWServer::matchAll(SWServerWorker& worker, const ServiceWorkerClientQueryOp
     auto clients = m_clients.find(worker.origin())->value.clients;
 
     if (!options.includeUncontrolled) {
-        clients.removeAllMatching([&] (const auto& client) {
-            return worker.identifier() != m_clientToControllingWorker.get(client.identifier);
+        clients.removeAllMatching([&] (const auto& clientData) {
+            return worker.identifier() != m_clientToControllingWorker.get(clientData.identifier);
         });
     }
     if (options.type != ServiceWorkerClientType::All) {
-        clients.removeAllMatching([&] (const auto& client) {
-            return options.type != client.data.type;
+        clients.removeAllMatching([&] (const auto& clientData) {
+            return options.type != clientData.type;
         });
     }
     callback(WTFMove(clients));
@@ -378,20 +378,20 @@ void SWServer::claim(SWServerWorker& worker)
         return;
 
     auto& clients = iterator->value.clients;
-    for (auto& client : clients) {
-        auto* registration = doRegistrationMatching(origin.topOrigin, client.data.url);
+    for (auto& clientData : clients) {
+        auto* registration = doRegistrationMatching(origin.topOrigin, clientData.url);
         if (!(registration && registration->key() == worker.registrationKey()))
             continue;
 
-        auto result = m_clientToControllingWorker.add(client.identifier, worker.identifier());
+        auto result = m_clientToControllingWorker.add(clientData.identifier, worker.identifier());
         if (!result.isNewEntry) {
             if (result.iterator->value == worker.identifier())
                 continue;
             if (auto* controllingRegistration = registrationFromServiceWorkerIdentifier(result.iterator->value))
-                controllingRegistration->removeClientUsingRegistration(client.identifier);
+                controllingRegistration->removeClientUsingRegistration(clientData.identifier);
             result.iterator->value = worker.identifier();
         }
-        registration->controlClient(client.identifier);
+        registration->controlClient(clientData.identifier);
     }
 }
 
@@ -687,15 +687,15 @@ SWServerRegistration* SWServer::registrationFromServiceWorkerIdentifier(ServiceW
     return m_registrations.get(iterator->value->registrationKey());
 }
 
-void SWServer::registerServiceWorkerClient(ClientOrigin&& clientOrigin, ServiceWorkerClientIdentifier clientIdentifier, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
+void SWServer::registerServiceWorkerClient(ClientOrigin&& clientOrigin, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
 {
     auto& clientsData = m_clients.ensure(WTFMove(clientOrigin), [] {
         return Clients { };
     }).iterator->value;
 
-    clientsData.clients.append(ServiceWorkerClientInformation { clientIdentifier, WTFMove(data) });
-    if (clientsData.terminateServiceWorkersTimer)
-        clientsData.terminateServiceWorkersTimer = nullptr;
+    auto clientIdentifier = data.identifier;
+    clientsData.clients.append(WTFMove(data));
+    clientsData.terminateServiceWorkersTimer = nullptr;
 
     if (!controllingServiceWorkerIdentifier)
         return;
index 9a0dbed..1b2f7dc 100644 (file)
@@ -159,7 +159,7 @@ public:
     
     WEBCORE_EXPORT static HashSet<SWServer*>& allServers();
 
-    WEBCORE_EXPORT void registerServiceWorkerClient(ClientOrigin&&, ServiceWorkerClientIdentifier, ServiceWorkerClientData&&, const std::optional<ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier);
+    WEBCORE_EXPORT void registerServiceWorkerClient(ClientOrigin&&, ServiceWorkerClientData&&, const std::optional<ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier);
     WEBCORE_EXPORT void unregisterServiceWorkerClient(const ClientOrigin&, ServiceWorkerClientIdentifier);
 
     using RunServiceWorkerCallback = WTF::Function<void(bool, SWServerToContextConnection&)>;
@@ -207,7 +207,7 @@ private:
     HashMap<ServiceWorkerIdentifier, Ref<SWServerWorker>> m_runningOrTerminatingWorkers;
 
     struct Clients {
-        Vector<ServiceWorkerClientInformation> clients;
+        Vector<ServiceWorkerClientData> clients;
         std::unique_ptr<Timer> terminateServiceWorkersTimer;
     };
     HashMap<ClientOrigin, Clients> m_clients;
index b7e6271..135e2c0 100644 (file)
@@ -41,7 +41,6 @@ namespace WebCore {
 class SWServer;
 struct ServiceWorkerClientData;
 struct ServiceWorkerClientIdentifier;
-struct ServiceWorkerClientInformation;
 struct ServiceWorkerContextData;
 struct ServiceWorkerJobDataIdentifier;
 
@@ -58,7 +57,7 @@ public:
     virtual void terminateWorker(ServiceWorkerIdentifier) = 0;
     virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0;
     virtual void findClientByIdentifierCompleted(uint64_t requestIdentifier, const std::optional<ServiceWorkerClientData>&, bool hasSecurityError) = 0;
-    virtual void matchAllCompleted(uint64_t requestIdentifier, const Vector<ServiceWorkerClientInformation>&) = 0;
+    virtual void matchAllCompleted(uint64_t requestIdentifier, const Vector<ServiceWorkerClientData>&) = 0;
     virtual void claimCompleted(uint64_t requestIdentifier) = 0;
     virtual void didFinishSkipWaiting(uint64_t callbackID) = 0;
 
index fb8df84..127a5d7 100644 (file)
@@ -27,7 +27,7 @@
 
 #if ENABLE(SERVICE_WORKER)
 
-#include "ServiceWorkerClientInformation.h"
+#include "ServiceWorkerClientData.h"
 #include "ServiceWorkerData.h"
 #include "ServiceWorkerIdentifier.h"
 #include "ServiceWorkerRegistrationKey.h"
index c7c675c..9c50948 100644 (file)
@@ -1,3 +1,41 @@
+2017-12-11  Chris Dumez  <cdumez@apple.com>
+
+        Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
+        https://bugs.webkit.org/show_bug.cgi?id=180669
+
+        Reviewed by Youenn Fablet.
+
+        Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
+        ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
+
+        * Scripts/webkit/messages.py:
+        (forward_declarations_and_headers):
+        (headers_for_type):
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<ServiceWorkerOrClientData>::encode):
+        (IPC::ArgumentCoder<ServiceWorkerOrClientData>::decode):
+        * Shared/WebCoreArgumentCoders.h:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::~WebSWServerConnection):
+        (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
+        (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
+        (WebKit::WebSWServerConnection::registerServiceWorkerClient):
+        (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
+        * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
+        * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
+        (WebKit::WebSWServerToContextConnection::matchAllCompleted):
+        * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        (WebKit::WebSWClientConnection::registerServiceWorkerClient):
+        (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
+        * WebProcess/Storage/WebSWClientConnection.h:
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
+        (WebKit::WebSWContextManagerConnection::matchAllCompleted):
+        * WebProcess/Storage/WebSWContextManagerConnection.h:
+        * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
 2017-12-11  Youenn Fablet  <youenn@apple.com>
 
         RTCPacketOptions::packet_id should be encoded as 32 bits integer.
index 4ced362..5a73810 100644 (file)
@@ -186,6 +186,7 @@ def forward_declarations_and_headers(receiver):
     no_forward_declaration_types = frozenset([
         'WebCore::DocumentIdentifier',
         'WebCore::ServiceWorkerIdentifier',
+        'WebCore::ServiceWorkerOrClientData',
         'WebCore::ServiceWorkerRegistrationIdentifier',
         'WebCore::SWServerConnectionIdentifier',
     ])
@@ -382,6 +383,7 @@ def headers_for_type(type):
         'WebCore::PolicyAction': ['<WebCore/FrameLoaderTypes.h>'],
         'WebCore::RecentSearch': ['<WebCore/SearchPopupMenu.h>'],
         'WebCore::SWServerConnectionIdentifier': ['<WebCore/ServiceWorkerTypes.h>'],
+        'WebCore::ServiceWorkerOrClientData': ['<WebCore/ServiceWorkerTypes.h>', '<WebCore/ServiceWorkerClientData.h>', '<WebCore/ServiceWorkerData.h>'],
         'WebCore::ServiceWorkerRegistrationIdentifier': ['<WebCore/ServiceWorkerTypes.h>'],
         'WebCore::ServiceWorkerRegistrationState': ['<WebCore/ServiceWorkerTypes.h>'],
         'WebCore::ServiceWorkerState': ['<WebCore/ServiceWorkerTypes.h>'],
index 00a824a..0830c9a 100644 (file)
@@ -65,6 +65,8 @@
 #include <WebCore/ScrollingConstraints.h>
 #include <WebCore/ScrollingCoordinator.h>
 #include <WebCore/SearchPopupMenu.h>
+#include <WebCore/ServiceWorkerClientData.h>
+#include <WebCore/ServiceWorkerData.h>
 #include <WebCore/TextCheckerClient.h>
 #include <WebCore/TextIndicator.h>
 #include <WebCore/TimingFunction.h>
@@ -2684,6 +2686,41 @@ bool ArgumentCoder<IDBKeyPath>::decode(Decoder& decoder, IDBKeyPath& keyPath)
 }
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+void ArgumentCoder<ServiceWorkerOrClientData>::encode(Encoder& encoder, const ServiceWorkerOrClientData& data)
+{
+    bool isServiceWorkerData = WTF::holds_alternative<ServiceWorkerData>(data);
+    encoder << isServiceWorkerData;
+    if (isServiceWorkerData)
+        encoder << WTF::get<ServiceWorkerData>(data);
+    else
+        encoder << WTF::get<ServiceWorkerClientData>(data);
+}
+
+bool ArgumentCoder<ServiceWorkerOrClientData>::decode(Decoder& decoder, ServiceWorkerOrClientData& data)
+{
+    bool isServiceWorkerData;
+    if (!decoder.decode(isServiceWorkerData))
+        return false;
+    if (isServiceWorkerData) {
+        std::optional<ServiceWorkerData> workerData;
+        decoder >> workerData;
+        if (!workerData)
+            return false;
+
+        data = WTFMove(*workerData);
+    } else {
+        std::optional<ServiceWorkerClientData> clientData;
+        decoder >> clientData;
+        if (!clientData)
+            return false;
+
+        data = WTFMove(*clientData);
+    }
+    return true;
+}
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
 
 void ArgumentCoder<ScrollOffsetRange<float>>::encode(Encoder& encoder, const ScrollOffsetRange<float>& range)
index a1e7a39..910a4ec 100644 (file)
@@ -39,6 +39,7 @@
 #include <WebCore/PaymentHeaders.h>
 #include <WebCore/RealtimeMediaSource.h>
 #include <WebCore/ScrollSnapOffsetsInfo.h>
+#include <WebCore/ServiceWorkerTypes.h>
 #include <WebCore/StoredCredentialsPolicy.h>
 #include <WebCore/WorkerType.h>
 
@@ -667,6 +668,15 @@ template<> struct ArgumentCoder<WebCore::IDBKeyPath> {
 
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+
+template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientData> {
+    static void encode(Encoder&, const WebCore::ServiceWorkerOrClientData&);
+    static bool decode(Decoder&, WebCore::ServiceWorkerOrClientData&);
+};
+
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
 
 template<> struct ArgumentCoder<WebCore::ScrollOffsetRange<float>> {
index 90c97b3..55ab719 100644 (file)
@@ -68,7 +68,7 @@ WebSWServerConnection::~WebSWServerConnection()
 {
     StorageProcess::singleton().unregisterSWServerConnection(*this);
     for (auto keyValue : m_clientOrigins)
-        server().unregisterServiceWorkerClient(keyValue.value, ServiceWorkerClientIdentifier { identifier(), keyValue.key });
+        server().unregisterServiceWorkerClient(keyValue.value, keyValue.key);
 }
 
 void WebSWServerConnection::disconnectedFromWebProcess()
@@ -127,12 +127,13 @@ void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, ServiceWorkerId
     });
 }
 
-void WebSWServerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
+// FIXME: We should be able to only pass in the ServiceWorkerClientIdentifier here and look up the clientData from the SWServer.
+void WebSWServerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference&& message, ServiceWorkerClientIdentifier, ServiceWorkerClientData&& sourceData)
 {
     // It's possible this specific worker cannot be re-run (e.g. its registration has been removed)
-    server().runServiceWorkerIfNecessary(destinationIdentifier, [destinationIdentifier, message = message.vector(), sourceIdentifier, sourceData = WTFMove(sourceData)](bool success, auto& contextConnection) mutable {
+    server().runServiceWorkerIfNecessary(destinationIdentifier, [destinationIdentifier, message = message.vector(), sourceData = WTFMove(sourceData)](bool success, auto& contextConnection) mutable {
         if (success)
-            sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromClient { destinationIdentifier, message, sourceIdentifier, WTFMove(sourceData) });
+            sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorker { destinationIdentifier, message, WTFMove(sourceData) });
     });
 }
 
@@ -147,7 +148,7 @@ void WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker(ServiceW
         if (!success)
             return;
 
-        sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromServiceWorker { destinationIdentifier, message, WTFMove(sourceData) });
+        sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorker { destinationIdentifier, message, WTFMove(sourceData) });
     });
 }
 
@@ -210,20 +211,20 @@ void WebSWServerConnection::getRegistrations(uint64_t registrationMatchRequestId
     send(Messages::WebSWClientConnection::DidGetRegistrations { registrationMatchRequestIdentifier, registrations });
 }
 
-void WebSWServerConnection::registerServiceWorkerClient(SecurityOriginData&& topOrigin, DocumentIdentifier contextIdentifier, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
+void WebSWServerConnection::registerServiceWorkerClient(SecurityOriginData&& topOrigin, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
 {
     auto clientOrigin = ClientOrigin { WTFMove(topOrigin), SecurityOriginData::fromSecurityOrigin(SecurityOrigin::create(data.url)) };
-    m_clientOrigins.add(contextIdentifier, clientOrigin);
-    server().registerServiceWorkerClient(WTFMove(clientOrigin), ServiceWorkerClientIdentifier { this->identifier(), contextIdentifier } , WTFMove(data), controllingServiceWorkerIdentifier);
+    m_clientOrigins.add(data.identifier, clientOrigin);
+    server().registerServiceWorkerClient(WTFMove(clientOrigin), WTFMove(data), controllingServiceWorkerIdentifier);
 }
 
-void WebSWServerConnection::unregisterServiceWorkerClient(DocumentIdentifier contextIdentifier)
+void WebSWServerConnection::unregisterServiceWorkerClient(const ServiceWorkerClientIdentifier& clientIdentifier)
 {
-    auto iterator = m_clientOrigins.find(contextIdentifier);
+    auto iterator = m_clientOrigins.find(clientIdentifier);
     if (iterator == m_clientOrigins.end())
         return;
 
-    server().unregisterServiceWorkerClient(iterator->value, ServiceWorkerClientIdentifier { this->identifier(), contextIdentifier });
+    server().unregisterServiceWorkerClient(iterator->value, clientIdentifier);
     m_clientOrigins.remove(iterator);
 }
 
index defd3dd..a4e4997 100644 (file)
@@ -89,8 +89,8 @@ private:
     void matchRegistration(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL);
     void getRegistrations(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL);
 
-    void registerServiceWorkerClient(WebCore::SecurityOriginData&& topOrigin, WebCore::DocumentIdentifier, WebCore::ServiceWorkerClientData&&, const std::optional<WebCore::ServiceWorkerIdentifier>&);
-    void unregisterServiceWorkerClient(WebCore::DocumentIdentifier);
+    void registerServiceWorkerClient(WebCore::SecurityOriginData&& topOrigin, WebCore::ServiceWorkerClientData&&, const std::optional<WebCore::ServiceWorkerIdentifier>&);
+    void unregisterServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier&);
 
     IPC::Connection* messageSenderConnection() final { return m_contentConnection.ptr(); }
     uint64_t messageSenderDestinationID() final { return identifier().toUInt64(); }
@@ -100,7 +100,7 @@ private:
 
     PAL::SessionID m_sessionID;
     Ref<IPC::Connection> m_contentConnection;
-    HashMap<WebCore::DocumentIdentifier, WebCore::ClientOrigin> m_clientOrigins;
+    HashMap<WebCore::ServiceWorkerClientIdentifier, WebCore::ClientOrigin> m_clientOrigins;
 };
 
 } // namespace WebKit
index 55d019b..b4024ab 100644 (file)
@@ -30,6 +30,8 @@ messages -> WebSWServerConnection {
     RemoveServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier)
 
     StartFetch(uint64_t identifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody)
+
+    # FIXME: We should be able to merge the 2 following messages and use a DocumentOrWorkerIdentifier as source identifier.
     PostMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destinationServiceWorkerIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, struct WebCore::ServiceWorkerClientData sourceData)
     PostMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destinationServiceWorkerIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerIdentifier sourceIdentifier)
 
@@ -38,8 +40,8 @@ messages -> WebSWServerConnection {
     MatchRegistration(uint64_t serviceRegistrationMatchRequestIdentifier, struct WebCore::SecurityOriginData topOrigin, WebCore::URL clientURL)
     WhenRegistrationReady(uint64_t serviceRegistrationMatchRequestIdentifier, struct WebCore::SecurityOriginData topOrigin, WebCore::URL clientURL)
     GetRegistrations(uint64_t serviceRegistrationMatchRequestIdentifier, struct WebCore::SecurityOriginData topOrigin, WebCore::URL clientURL)
-    RegisterServiceWorkerClient(struct WebCore::SecurityOriginData topOrigin, WebCore::DocumentIdentifier identifier, struct WebCore::ServiceWorkerClientData data, std::optional<WebCore::ServiceWorkerIdentifier> controllingServiceWorkerIdentifier)
-    UnregisterServiceWorkerClient(WebCore::DocumentIdentifier identifier)
+    RegisterServiceWorkerClient(struct WebCore::SecurityOriginData topOrigin, struct WebCore::ServiceWorkerClientData data, std::optional<WebCore::ServiceWorkerIdentifier> controllingServiceWorkerIdentifier)
+    UnregisterServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier identifier)
 
     SyncTerminateWorker(WebCore::ServiceWorkerIdentifier workerIdentifier) -> ()
 }
index 582b125..f785938 100644 (file)
@@ -86,7 +86,7 @@ void WebSWServerToContextConnection::findClientByIdentifierCompleted(uint64_t re
     send(Messages::WebSWContextManagerConnection::FindClientByIdentifierCompleted { requestIdentifier, data, hasSecurityError });
 }
 
-void WebSWServerToContextConnection::matchAllCompleted(uint64_t requestIdentifier, const Vector<ServiceWorkerClientInformation>& clientsData)
+void WebSWServerToContextConnection::matchAllCompleted(uint64_t requestIdentifier, const Vector<ServiceWorkerClientData>& clientsData)
 {
     send(Messages::WebSWContextManagerConnection::MatchAllCompleted { requestIdentifier, clientsData });
 }
index 4d72df6..6a59159 100644 (file)
@@ -61,7 +61,7 @@ private:
     void terminateWorker(WebCore::ServiceWorkerIdentifier) final;
     void syncTerminateWorker(WebCore::ServiceWorkerIdentifier) final;
     void findClientByIdentifierCompleted(uint64_t requestIdentifier, const std::optional<WebCore::ServiceWorkerClientData>&, bool hasSecurityError) final;
-    void matchAllCompleted(uint64_t requestIdentifier, const Vector<WebCore::ServiceWorkerClientInformation>&) final;
+    void matchAllCompleted(uint64_t requestIdentifier, const Vector<WebCore::ServiceWorkerClientData>&) final;
     void claimCompleted(uint64_t requestIdentifier) final;
     void didFinishSkipWaiting(uint64_t callbackID) final;
 
index 4a2431d..701421e 100644 (file)
@@ -92,14 +92,14 @@ void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier d
     send(Messages::WebSWServerConnection::PostMessageToServiceWorkerFromServiceWorker(destinationIdentifier, IPC::DataReference { scriptValue->data() }, sourceWorkerIdentifier));
 }
 
-void WebSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, WebCore::DocumentIdentifier contextIdentifier, const WebCore::ServiceWorkerClientData& data, const std::optional<WebCore::ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
+void WebSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData& data, const std::optional<WebCore::ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
 {
-    send(Messages::WebSWServerConnection::RegisterServiceWorkerClient { SecurityOriginData::fromSecurityOrigin(topOrigin), contextIdentifier, data, controllingServiceWorkerIdentifier });
+    send(Messages::WebSWServerConnection::RegisterServiceWorkerClient { SecurityOriginData::fromSecurityOrigin(topOrigin), data, controllingServiceWorkerIdentifier });
 }
 
-void WebSWClientConnection::unregisterServiceWorkerClient(WebCore::DocumentIdentifier contextIdentifier)
+void WebSWClientConnection::unregisterServiceWorkerClient(DocumentIdentifier contextIdentifier)
 {
-    send(Messages::WebSWServerConnection::UnregisterServiceWorkerClient { contextIdentifier });
+    send(Messages::WebSWServerConnection::UnregisterServiceWorkerClient { ServiceWorkerClientIdentifier { serverConnectionIdentifier(), contextIdentifier } });
 }
 
 void WebSWClientConnection::didResolveRegistrationPromise(const ServiceWorkerRegistrationKey& key)
index 8ff94de..737b141 100644 (file)
@@ -75,7 +75,7 @@ private:
     void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
     void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& source) final;
     void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::ServiceWorkerIdentifier sourceWorkerIdentifier) final;
-    void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, WebCore::DocumentIdentifier, const WebCore::ServiceWorkerClientData&, const std::optional<WebCore::ServiceWorkerIdentifier>&) final;
+    void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData&, const std::optional<WebCore::ServiceWorkerIdentifier>&) final;
     void unregisterServiceWorkerClient(WebCore::DocumentIdentifier) final;
 
     void matchRegistration(const WebCore::SecurityOrigin& topOrigin, const WebCore::URL& clientURL, RegistrationCallback&&) final;
index 2e73ea8..a35c4e3 100644 (file)
@@ -172,12 +172,7 @@ void WebSWContextManagerConnection::startFetch(SWServerConnectionIdentifier serv
     serviceWorkerThreadProxy->thread().postFetchTask(WTFMove(client), WTFMove(clientId), WTFMove(request), WTFMove(options));
 }
 
-void WebSWContextManagerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
-{
-    SWContextManager::singleton().postMessageToServiceWorker(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), sourceIdentifier, WTFMove(sourceData));
-}
-
-void WebSWContextManagerConnection::postMessageToServiceWorkerFromServiceWorker(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerData&& sourceData)
+void WebSWContextManagerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerOrClientData&& sourceData)
 {
     SWContextManager::singleton().postMessageToServiceWorker(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), WTFMove(sourceData));
 }
@@ -261,7 +256,7 @@ void WebSWContextManagerConnection::matchAll(WebCore::ServiceWorkerIdentifier se
     m_connectionToStorageProcess->send(Messages::WebSWServerToContextConnection::MatchAll { requestIdentifier, serviceWorkerIdentifier, options }, 0);
 }
 
-void WebSWContextManagerConnection::matchAllCompleted(uint64_t requestIdentifier, Vector<ServiceWorkerClientInformation>&& clientsData)
+void WebSWContextManagerConnection::matchAllCompleted(uint64_t requestIdentifier, Vector<ServiceWorkerClientData>&& clientsData)
 {
     if (auto callback = m_matchAllRequests.take(requestIdentifier))
         callback(WTFMove(clientsData));
index 1b8889a..980dad4 100644 (file)
@@ -31,7 +31,7 @@
 #include "MessageReceiver.h"
 #include "WebSWContextManagerConnectionMessages.h"
 #include <WebCore/SWContextManager.h>
-#include <WebCore/ServiceWorkerClientInformation.h>
+#include <WebCore/ServiceWorkerClientData.h>
 #include <WebCore/ServiceWorkerTypes.h>
 
 namespace IPC {
@@ -77,14 +77,13 @@ private:
     void serviceWorkerStartedWithMessage(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;
     void installServiceWorker(const WebCore::ServiceWorkerContextData&, PAL::SessionID);
     void startFetch(WebCore::SWServerConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&);
-    void postMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& sourceData);
-    void postMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destination, const IPC::DataReference& message, WebCore::ServiceWorkerData&& sourceData);
+    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerOrClientData&& sourceData);
     void fireInstallEvent(WebCore::ServiceWorkerIdentifier);
     void fireActivateEvent(WebCore::ServiceWorkerIdentifier);
     void terminateWorker(WebCore::ServiceWorkerIdentifier);
     void syncTerminateWorker(WebCore::ServiceWorkerIdentifier, Ref<Messages::WebSWContextManagerConnection::SyncTerminateWorker::DelayedReply>&&);
     void findClientByIdentifierCompleted(uint64_t requestIdentifier, std::optional<WebCore::ServiceWorkerClientData>&&, bool hasSecurityError);
-    void matchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientInformation>&&);
+    void matchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData>&&);
     void claimCompleted(uint64_t claimRequestIdentifier);
     void didFinishSkipWaiting(uint64_t callbackID);
     void setUserAgent(String&& userAgent);
index c5715ca..c1266b9 100644 (file)
 messages -> WebSWContextManagerConnection {
     InstallServiceWorker(struct WebCore::ServiceWorkerContextData contextData, PAL::SessionID sessionID)
     StartFetch(WebCore::SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody)
-    PostMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, struct WebCore::ServiceWorkerClientData sourceData)
-    PostMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerData sourceData)
+    PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, WebCore::ServiceWorkerOrClientData sourceData)
     FireInstallEvent(WebCore::ServiceWorkerIdentifier identifier)
     FireActivateEvent(WebCore::ServiceWorkerIdentifier identifier)
     TerminateWorker(WebCore::ServiceWorkerIdentifier identifier)
     SyncTerminateWorker(WebCore::ServiceWorkerIdentifier identifier) -> () Delayed
     FindClientByIdentifierCompleted(uint64_t clientIdRequestIdentifier, std::optional<WebCore::ServiceWorkerClientData> data, bool hasSecurityError)
-    MatchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientInformation> clientsData)
+    MatchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData> clientsData)
     ClaimCompleted(uint64_t claimRequestIdentifier)
     DidFinishSkipWaiting(uint64_t callbackID)
     SetUserAgent(String userAgent)