Title: [225355] trunk/Source/WebCore
Revision
225355
Author
[email protected]
Date
2017-11-30 15:06:34 -0800 (Thu, 30 Nov 2017)

Log Message

Move SWClientConnection class out of server/ folder
https://bugs.webkit.org/show_bug.cgi?id=180217

Reviewed by Brady Eidson.

Move SWClientConnection class out of server/ folder since the client connection
lives in the WebProcess, not the Storage process.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* workers/service/SWClientConnection.cpp: Renamed from Source/WebCore/workers/service/server/SWClientConnection.cpp.
(WebCore::SWClientConnection::scheduleJob):
(WebCore::SWClientConnection::finishedFetchingScript):
(WebCore::SWClientConnection::failedFetchingScript):
(WebCore::SWClientConnection::jobRejectedInServer):
(WebCore::SWClientConnection::registrationJobResolvedInServer):
(WebCore::SWClientConnection::unregistrationJobResolvedInServer):
(WebCore::SWClientConnection::startScriptFetchForServer):
(WebCore::SWClientConnection::postMessageToServiceWorkerClient):
(WebCore::SWClientConnection::forEachContainer):
(WebCore::SWClientConnection::updateRegistrationState):
(WebCore::SWClientConnection::updateWorkerState):
(WebCore::SWClientConnection::fireUpdateFoundEvent):
(WebCore::SWClientConnection::notifyClientsOfControllerChange):
* workers/service/SWClientConnection.h: Renamed from Source/WebCore/workers/service/server/SWClientConnection.h.
* workers/service/ServiceWorkerContainer.cpp:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225354 => 225355)


--- trunk/Source/WebCore/ChangeLog	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/ChangeLog	2017-11-30 23:06:34 UTC (rev 225355)
@@ -1,5 +1,34 @@
 2017-11-30  Chris Dumez  <[email protected]>
 
+        Move SWClientConnection class out of server/ folder
+        https://bugs.webkit.org/show_bug.cgi?id=180217
+
+        Reviewed by Brady Eidson.
+
+        Move SWClientConnection class out of server/ folder since the client connection
+        lives in the WebProcess, not the Storage process.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * workers/service/SWClientConnection.cpp: Renamed from Source/WebCore/workers/service/server/SWClientConnection.cpp.
+        (WebCore::SWClientConnection::scheduleJob):
+        (WebCore::SWClientConnection::finishedFetchingScript):
+        (WebCore::SWClientConnection::failedFetchingScript):
+        (WebCore::SWClientConnection::jobRejectedInServer):
+        (WebCore::SWClientConnection::registrationJobResolvedInServer):
+        (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
+        (WebCore::SWClientConnection::startScriptFetchForServer):
+        (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
+        (WebCore::SWClientConnection::forEachContainer):
+        (WebCore::SWClientConnection::updateRegistrationState):
+        (WebCore::SWClientConnection::updateWorkerState):
+        (WebCore::SWClientConnection::fireUpdateFoundEvent):
+        (WebCore::SWClientConnection::notifyClientsOfControllerChange):
+        * workers/service/SWClientConnection.h: Renamed from Source/WebCore/workers/service/server/SWClientConnection.h.
+        * workers/service/ServiceWorkerContainer.cpp:
+
+2017-11-30  Chris Dumez  <[email protected]>
+
         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread
         https://bugs.webkit.org/show_bug.cgi?id=180216
 

Modified: trunk/Source/WebCore/Sources.txt (225354 => 225355)


--- trunk/Source/WebCore/Sources.txt	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/Sources.txt	2017-11-30 23:06:34 UTC (rev 225355)
@@ -2175,6 +2175,7 @@
 workers/service/ExtendableEvent.cpp
 workers/service/ExtendableMessageEvent.cpp
 workers/service/FetchEvent.cpp
+workers/service/SWClientConnection.cpp
 workers/service/ServiceWorker.cpp
 workers/service/ServiceWorkerClient.cpp
 workers/service/ServiceWorkerClientData.cpp
@@ -2199,7 +2200,6 @@
 workers/service/context/ServiceWorkerThreadProxy.cpp
 workers/service/context/SWContextManager.cpp
 
-workers/service/server/SWClientConnection.cpp
 workers/service/server/SWOriginStore.cpp
 workers/service/server/SWServer.cpp
 workers/service/server/SWServerJobQueue.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (225354 => 225355)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-11-30 23:06:34 UTC (rev 225355)
@@ -1151,6 +1151,7 @@
 		46EB37CC1F97CCD200B65523 /* JSServiceWorkerClients.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EB37C51F97CCCB00B65523 /* JSServiceWorkerClients.h */; };
 		46EB37CE1F97CCD200B65523 /* JSServiceWorkerWindowClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EB37C71F97CCCB00B65523 /* JSServiceWorkerWindowClient.h */; };
 		46EBEA021B7D4D6500BE4941 /* CollectionTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EBEA011B7D4D5D00BE4941 /* CollectionTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 46ECB6371FD0A3BB0088E5AD /* SWClientConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46EF142A1F97B7D800C2A524 /* ServiceWorkerWindowClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EF14201F97B7BA00C2A524 /* ServiceWorkerWindowClient.h */; };
 		46EF142C1F97B7D800C2A524 /* ServiceWorkerClients.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EF14221F97B7BA00C2A524 /* ServiceWorkerClients.h */; };
 		46EF142D1F97B7D800C2A524 /* ServiceWorkerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EF14241F97B7BA00C2A524 /* ServiceWorkerClient.h */; };
@@ -1340,7 +1341,6 @@
 		5174E20A10A1F44F00F95E6F /* PopStateEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 5174E20810A1F44F00F95E6F /* PopStateEvent.h */; };
 		51771DFF1BDB485000CAE8E4 /* MemoryObjectStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51771DFD1BDB475600CAE8E4 /* MemoryObjectStore.h */; };
 		517A52F01F47535B00DCDC0A /* SWServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A52EE1F47535900DCDC0A /* SWServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A52FF1F478CCE00DCDC0A /* SWClientConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53261F4B90B200DCDC0A /* ServiceWorkerRegistrationKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		517A53461F50C17F00DCDC0A /* SWServerWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53421F50C16100DCDC0A /* SWServerWorker.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7278,6 +7278,8 @@
 		46EB37C61F97CCCB00B65523 /* JSServiceWorkerWindowClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerWindowClient.cpp; sourceTree = "<group>"; };
 		46EB37C71F97CCCB00B65523 /* JSServiceWorkerWindowClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSServiceWorkerWindowClient.h; sourceTree = "<group>"; };
 		46EBEA011B7D4D5D00BE4941 /* CollectionTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionTraversal.h; sourceTree = "<group>"; };
+		46ECB6361FD0A3BB0088E5AD /* SWClientConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWClientConnection.cpp; sourceTree = "<group>"; };
+		46ECB6371FD0A3BB0088E5AD /* SWClientConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWClientConnection.h; sourceTree = "<group>"; };
 		46EF14201F97B7BA00C2A524 /* ServiceWorkerWindowClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerWindowClient.h; sourceTree = "<group>"; };
 		46EF14211F97B7BA00C2A524 /* ServiceWorkerClients.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClients.cpp; sourceTree = "<group>"; };
 		46EF14221F97B7BA00C2A524 /* ServiceWorkerClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerClients.h; sourceTree = "<group>"; };
@@ -7679,8 +7681,6 @@
 		51771DFD1BDB475600CAE8E4 /* MemoryObjectStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryObjectStore.h; sourceTree = "<group>"; };
 		517A52EE1F47535900DCDC0A /* SWServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWServer.h; sourceTree = "<group>"; };
 		517A52EF1F47535900DCDC0A /* SWServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWServer.cpp; sourceTree = "<group>"; };
-		517A52FE1F478CCE00DCDC0A /* SWClientConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWClientConnection.cpp; sourceTree = "<group>"; };
-		517A52FF1F478CCE00DCDC0A /* SWClientConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWClientConnection.h; sourceTree = "<group>"; };
 		517A53241F4B904A00DCDC0A /* ServiceWorkerJobData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerJobData.cpp; sourceTree = "<group>"; };
 		517A53261F4B90B200DCDC0A /* ServiceWorkerRegistrationKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationKey.h; sourceTree = "<group>"; };
 		517A53271F4B90B200DCDC0A /* ServiceWorkerRegistrationKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationKey.cpp; sourceTree = "<group>"; };
@@ -17135,8 +17135,6 @@
 		517A52EC1F47532D00DCDC0A /* server */ = {
 			isa = PBXGroup;
 			children = (
-				517A52FE1F478CCE00DCDC0A /* SWClientConnection.cpp */,
-				517A52FF1F478CCE00DCDC0A /* SWClientConnection.h */,
 				4151E5B91FBA4C7600E47E2D /* SWOriginStore.cpp */,
 				4151E5B71FBA4C7500E47E2D /* SWOriginStore.h */,
 				517A52EF1F47535900DCDC0A /* SWServer.cpp */,
@@ -17329,6 +17327,8 @@
 				46EF14251F97B7BA00C2A524 /* ServiceWorkerWindowClient.cpp */,
 				46EF14201F97B7BA00C2A524 /* ServiceWorkerWindowClient.h */,
 				46EF14261F97B7BA00C2A524 /* ServiceWorkerWindowClient.idl */,
+				46ECB6361FD0A3BB0088E5AD /* SWClientConnection.cpp */,
+				46ECB6371FD0A3BB0088E5AD /* SWClientConnection.h */,
 			);
 			path = service;
 			sourceTree = "<group>";
@@ -27198,7 +27198,6 @@
 				B51A2F3F17D7D3AE0072517A /* ImageQualityController.h in Headers */,
 				49291E4B134172C800E753DE /* ImageRenderingMode.h in Headers */,
 				7C193BC11F5E0EED0088F3E6 /* ImageSmoothingQuality.h in Headers */,
-				B27535710B053814002CE64F /* ImageSource.h in Headers */,
 				4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */,
 				5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */,
 				26F756B31B3B66F70005DD79 /* ImmutableNFA.h in Headers */,
@@ -29419,7 +29418,7 @@
 				8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */,
 				B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
 				B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
-				517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */,
+				46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */,
 				46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */,
 				4151E5BB1FBA4C7A00E47E2D /* SWOriginStore.h in Headers */,
 				517A52F01F47535B00DCDC0A /* SWServer.h in Headers */,

Copied: trunk/Source/WebCore/workers/service/SWClientConnection.cpp (from rev 225352, trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp) (0 => 225355)


--- trunk/Source/WebCore/workers/service/SWClientConnection.cpp	                        (rev 0)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.cpp	2017-11-30 23:06:34 UTC (rev 225355)
@@ -0,0 +1,206 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "SWClientConnection.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "Document.h"
+#include "ExceptionData.h"
+#include "MessageEvent.h"
+#include "Microtasks.h"
+#include "SWContextManager.h"
+#include "ServiceWorkerContainer.h"
+#include "ServiceWorkerFetchResult.h"
+#include "ServiceWorkerJobData.h"
+#include "ServiceWorkerRegistration.h"
+#include <wtf/CrossThreadCopier.h>
+
+namespace WebCore {
+
+SWClientConnection::SWClientConnection() = default;
+
+SWClientConnection::~SWClientConnection() = default;
+
+void SWClientConnection::scheduleJob(ServiceWorkerJob& job)
+{
+    auto addResult = m_scheduledJobs.add(job.identifier(), &job);
+    ASSERT_UNUSED(addResult, addResult.isNewEntry);
+
+    scheduleJobInServer(job.data());
+}
+
+void SWClientConnection::finishedFetchingScript(ServiceWorkerJob& job, const String& script)
+{
+    ASSERT(m_scheduledJobs.get(job.identifier()) == &job);
+
+    finishFetchingScriptInServer({ job.data().identifier(), job.data().registrationKey(), script, { } });
+}
+
+void SWClientConnection::failedFetchingScript(ServiceWorkerJob& job, const ResourceError& error)
+{
+    ASSERT(m_scheduledJobs.get(job.identifier()) == &job);
+
+    finishFetchingScriptInServer({ job.data().identifier(), job.data().registrationKey(), { }, error });
+}
+
+void SWClientConnection::jobRejectedInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const ExceptionData& exceptionData)
+{
+    auto job = m_scheduledJobs.take(jobDataIdentifier.jobIdentifier);
+    if (!job) {
+        LOG_ERROR("Job %s rejected from server, but was not found", jobDataIdentifier.loggingString().utf8().data());
+        return;
+    }
+
+    job->failedWithException(exceptionData.toException());
+}
+
+void SWClientConnection::registrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerRegistrationData&& registrationData, ShouldNotifyWhenResolved shouldNotifyWhenResolved)
+{
+    auto job = m_scheduledJobs.take(jobDataIdentifier.jobIdentifier);
+    if (!job) {
+        LOG_ERROR("Job %s resolved in server, but was not found", jobDataIdentifier.loggingString().utf8().data());
+        return;
+    }
+
+    auto key = registrationData.key;
+    job->resolvedWithRegistration(WTFMove(registrationData), [this, protectedThis = makeRef(*this), key, shouldNotifyWhenResolved] {
+        if (shouldNotifyWhenResolved == ShouldNotifyWhenResolved::Yes)
+            didResolveRegistrationPromise(key);
+    });
+}
+
+void SWClientConnection::unregistrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, bool unregistrationResult)
+{
+    auto job = m_scheduledJobs.take(jobDataIdentifier.jobIdentifier);
+    if (!job) {
+        LOG_ERROR("Job %s resolved in server, but was not found", jobDataIdentifier.loggingString().utf8().data());
+        return;
+    }
+
+    job->resolvedWithUnregistrationResult(unregistrationResult);
+}
+
+void SWClientConnection::startScriptFetchForServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier)
+{
+    auto job = m_scheduledJobs.get(jobDataIdentifier.jobIdentifier);
+    if (!job) {
+        LOG_ERROR("Job %s instructed to start fetch from server, but job was not found", jobDataIdentifier.loggingString().utf8().data());
+
+        // FIXME: Should message back to the server here to signal failure to fetch,
+        // but we currently need the registration key to do so, and don't have it here.
+        // In the future we'll refactor to have a global, cross-process job identifier that can be used to overcome this.
+
+        return;
+    }
+
+    job->startScriptFetch();
+}
+
+void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData, const String& sourceOrigin)
+{
+    // FIXME: destinationContextIdentifier can only identify a Document at the moment.
+    auto* destinationDocument = Document::allDocumentsMap().get(destinationContextIdentifier);
+    if (!destinationDocument)
+        return;
+
+    auto* container = destinationDocument->serviceWorkerContainer();
+    if (!container)
+        return;
+
+    MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(*destinationDocument, WTFMove(sourceData)) };
+
+    // FIXME: We should pass in ports.
+    auto messageEvent = MessageEvent::create({ }, WTFMove(message), sourceOrigin, { }, WTFMove(source));
+    container->dispatchEvent(messageEvent);
+}
+
+void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData)
+{
+    SWContextManager::singleton().forEachServiceWorkerThread([identifier, state, &serviceWorkerData] (auto& workerThread) {
+        workerThread.thread().runLoop().postTask([identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)](ScriptExecutionContext& context) mutable {
+            if (auto* container = context.serviceWorkerContainer())
+                container->scheduleTaskToUpdateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
+        });
+    });
+
+    for (auto* document : Document::allDocuments()) {
+        if (auto* container = document->serviceWorkerContainer())
+            container->scheduleTaskToUpdateRegistrationState(identifier, state, serviceWorkerData);
+    }
+}
+
+void SWClientConnection::updateWorkerState(ServiceWorkerIdentifier identifier, ServiceWorkerState state)
+{
+    SWContextManager::singleton().forEachServiceWorkerThread([identifier, state] (auto& workerThread) {
+        workerThread.thread().runLoop().postTask([identifier, state](ScriptExecutionContext& context) {
+            if (auto* serviceWorker = context.serviceWorker(identifier))
+                serviceWorker->scheduleTaskToUpdateState(state);
+        });
+    });
+
+    for (auto* document : Document::allDocuments()) {
+        if (auto* serviceWorker = document->serviceWorker(identifier))
+            serviceWorker->scheduleTaskToUpdateState(state);
+    }
+}
+
+void SWClientConnection::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
+{
+    SWContextManager::singleton().forEachServiceWorkerThread([identifier] (auto& workerThread) {
+        workerThread.thread().runLoop().postTask([identifier](ScriptExecutionContext& context) {
+            if (auto* container = context.serviceWorkerContainer())
+                container->scheduleTaskToFireUpdateFoundEvent(identifier);
+        });
+    });
+
+    for (auto* document : Document::allDocuments()) {
+        if (auto* container = document->serviceWorkerContainer())
+            container->scheduleTaskToFireUpdateFoundEvent(identifier);
+    }
+}
+
+void SWClientConnection::notifyClientsOfControllerChange(const HashSet<DocumentIdentifier>& contextIdentifiers, ServiceWorkerData&& newController)
+{
+    ASSERT(!contextIdentifiers.isEmpty());
+
+    for (auto& clientIdentifier : contextIdentifiers) {
+        // FIXME: Support worker contexts.
+        auto* client = Document::allDocumentsMap().get(clientIdentifier);
+        if (!client)
+            continue;
+
+        ASSERT(client->activeServiceWorker());
+        ASSERT(client->activeServiceWorker()->identifier() != newController.identifier);
+        client->setActiveServiceWorker(ServiceWorker::getOrCreate(*client, ServiceWorkerData { newController }));
+        if (auto* container = client->serviceWorkerContainer())
+            container->scheduleTaskToFireControllerChangeEvent();
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Copied: trunk/Source/WebCore/workers/service/SWClientConnection.h (from rev 225352, trunk/Source/WebCore/workers/service/server/SWClientConnection.h) (0 => 225355)


--- trunk/Source/WebCore/workers/service/SWClientConnection.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h	2017-11-30 23:06:34 UTC (rev 225355)
@@ -0,0 +1,105 @@
+/*
+ * 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 "DocumentIdentifier.h"
+#include "ServiceWorkerJob.h"
+#include "ServiceWorkerTypes.h"
+#include <wtf/CompletionHandler.h>
+#include <wtf/HashMap.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+class ResourceError;
+class SecurityOrigin;
+class SerializedScriptValue;
+class ServiceWorkerContainer;
+class ServiceWorkerRegistration;
+class SharedBuffer;
+enum class ServiceWorkerRegistrationState;
+enum class ServiceWorkerState;
+enum class ShouldNotifyWhenResolved;
+struct ExceptionData;
+struct ServiceWorkerClientData;
+struct ServiceWorkerData;
+struct ServiceWorkerFetchResult;
+struct ServiceWorkerRegistrationData;
+
+class SWClientConnection : public ThreadSafeRefCounted<SWClientConnection> {
+public:
+    WEBCORE_EXPORT virtual ~SWClientConnection();
+
+    using RegistrationCallback = WTF::CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>;
+    virtual void matchRegistration(const SecurityOrigin& topOrigin, const URL& clientURL, RegistrationCallback&&) = 0;
+
+    using GetRegistrationsCallback = WTF::CompletionHandler<void(Vector<ServiceWorkerRegistrationData>&&)>;
+    virtual void getRegistrations(const SecurityOrigin& topOrigin, const URL& clientURL, GetRegistrationsCallback&&) = 0;
+
+    virtual void addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier) = 0;
+    virtual void removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier) = 0;
+
+    void scheduleJob(ServiceWorkerJob&);
+    void finishedFetchingScript(ServiceWorkerJob&, const String&);
+    void failedFetchingScript(ServiceWorkerJob&, const ResourceError&);
+
+    virtual void didResolveRegistrationPromise(const ServiceWorkerRegistrationKey&) = 0;
+
+    virtual void postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&&, DocumentIdentifier sourceContextIdentifier, ServiceWorkerClientData&& source) = 0;
+    virtual SWServerConnectionIdentifier serverConnectionIdentifier() const = 0;
+    virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
+
+    virtual void serviceWorkerStartedControllingClient(ServiceWorkerIdentifier, ServiceWorkerRegistrationIdentifier, DocumentIdentifier) = 0;
+    virtual void serviceWorkerStoppedControllingClient(ServiceWorkerIdentifier, ServiceWorkerRegistrationIdentifier, DocumentIdentifier) = 0;
+
+    virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, DocumentIdentifier, const ServiceWorkerClientData&) = 0;
+    virtual void unregisterServiceWorkerClient(DocumentIdentifier) = 0;
+
+protected:
+    WEBCORE_EXPORT SWClientConnection();
+
+    WEBCORE_EXPORT void jobRejectedInServer(const ServiceWorkerJobDataIdentifier&, const ExceptionData&);
+    WEBCORE_EXPORT void registrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier&, ServiceWorkerRegistrationData&&, ShouldNotifyWhenResolved);
+    WEBCORE_EXPORT void unregistrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier&, bool unregistrationResult);
+    WEBCORE_EXPORT void startScriptFetchForServer(const ServiceWorkerJobDataIdentifier&);
+    WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& source, const String& sourceOrigin);
+    WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&);
+    WEBCORE_EXPORT void updateWorkerState(ServiceWorkerIdentifier, ServiceWorkerState);
+    WEBCORE_EXPORT void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);
+    WEBCORE_EXPORT void notifyClientsOfControllerChange(const HashSet<DocumentIdentifier>& contextIdentifiers, ServiceWorkerData&& newController);
+
+private:
+    virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
+    virtual void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) = 0;
+
+    HashMap<ServiceWorkerJobIdentifier, RefPtr<ServiceWorkerJob>> m_scheduledJobs;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (225354 => 225355)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-11-30 23:06:34 UTC (rev 225355)
@@ -28,6 +28,7 @@
 
 #if ENABLE(SERVICE_WORKER)
 
+#include "Event.h"
 #include "EventNames.h"
 #include "Exception.h"
 #include "IDLTypes.h"

Deleted: trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp (225354 => 225355)


--- trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp	2017-11-30 23:06:34 UTC (rev 225355)
@@ -1,206 +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.
- */
-
-#include "config.h"
-#include "SWClientConnection.h"
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "Document.h"
-#include "ExceptionData.h"
-#include "MessageEvent.h"
-#include "Microtasks.h"
-#include "SWContextManager.h"
-#include "ServiceWorkerContainer.h"
-#include "ServiceWorkerFetchResult.h"
-#include "ServiceWorkerJobData.h"
-#include "ServiceWorkerRegistration.h"
-#include <wtf/CrossThreadCopier.h>
-
-namespace WebCore {
-
-SWClientConnection::SWClientConnection() = default;
-
-SWClientConnection::~SWClientConnection() = default;
-
-void SWClientConnection::scheduleJob(ServiceWorkerJob& job)
-{
-    auto addResult = m_scheduledJobs.add(job.identifier(), &job);
-    ASSERT_UNUSED(addResult, addResult.isNewEntry);
-
-    scheduleJobInServer(job.data());
-}
-
-void SWClientConnection::finishedFetchingScript(ServiceWorkerJob& job, const String& script)
-{
-    ASSERT(m_scheduledJobs.get(job.identifier()) == &job);
-
-    finishFetchingScriptInServer({ job.data().identifier(), job.data().registrationKey(), script, { } });
-}
-
-void SWClientConnection::failedFetchingScript(ServiceWorkerJob& job, const ResourceError& error)
-{
-    ASSERT(m_scheduledJobs.get(job.identifier()) == &job);
-
-    finishFetchingScriptInServer({ job.data().identifier(), job.data().registrationKey(), { }, error });
-}
-
-void SWClientConnection::jobRejectedInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const ExceptionData& exceptionData)
-{
-    auto job = m_scheduledJobs.take(jobDataIdentifier.jobIdentifier);
-    if (!job) {
-        LOG_ERROR("Job %s rejected from server, but was not found", jobDataIdentifier.loggingString().utf8().data());
-        return;
-    }
-
-    job->failedWithException(exceptionData.toException());
-}
-
-void SWClientConnection::registrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerRegistrationData&& registrationData, ShouldNotifyWhenResolved shouldNotifyWhenResolved)
-{
-    auto job = m_scheduledJobs.take(jobDataIdentifier.jobIdentifier);
-    if (!job) {
-        LOG_ERROR("Job %s resolved in server, but was not found", jobDataIdentifier.loggingString().utf8().data());
-        return;
-    }
-
-    auto key = registrationData.key;
-    job->resolvedWithRegistration(WTFMove(registrationData), [this, protectedThis = makeRef(*this), key, shouldNotifyWhenResolved] {
-        if (shouldNotifyWhenResolved == ShouldNotifyWhenResolved::Yes)
-            didResolveRegistrationPromise(key);
-    });
-}
-
-void SWClientConnection::unregistrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, bool unregistrationResult)
-{
-    auto job = m_scheduledJobs.take(jobDataIdentifier.jobIdentifier);
-    if (!job) {
-        LOG_ERROR("Job %s resolved in server, but was not found", jobDataIdentifier.loggingString().utf8().data());
-        return;
-    }
-
-    job->resolvedWithUnregistrationResult(unregistrationResult);
-}
-
-void SWClientConnection::startScriptFetchForServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier)
-{
-    auto job = m_scheduledJobs.get(jobDataIdentifier.jobIdentifier);
-    if (!job) {
-        LOG_ERROR("Job %s instructed to start fetch from server, but job was not found", jobDataIdentifier.loggingString().utf8().data());
-
-        // FIXME: Should message back to the server here to signal failure to fetch,
-        // but we currently need the registration key to do so, and don't have it here.
-        // In the future we'll refactor to have a global, cross-process job identifier that can be used to overcome this.
-
-        return;
-    }
-
-    job->startScriptFetch();
-}
-
-void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData, const String& sourceOrigin)
-{
-    // FIXME: destinationContextIdentifier can only identify a Document at the moment.
-    auto* destinationDocument = Document::allDocumentsMap().get(destinationContextIdentifier);
-    if (!destinationDocument)
-        return;
-
-    auto* container = destinationDocument->serviceWorkerContainer();
-    if (!container)
-        return;
-
-    MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(*destinationDocument, WTFMove(sourceData)) };
-
-    // FIXME: We should pass in ports.
-    auto messageEvent = MessageEvent::create({ }, WTFMove(message), sourceOrigin, { }, WTFMove(source));
-    container->dispatchEvent(messageEvent);
-}
-
-void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData)
-{
-    SWContextManager::singleton().forEachServiceWorkerThread([identifier, state, &serviceWorkerData] (auto& workerThread) {
-        workerThread.thread().runLoop().postTask([identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)](ScriptExecutionContext& context) mutable {
-            if (auto* container = context.serviceWorkerContainer())
-                container->scheduleTaskToUpdateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
-        });
-    });
-
-    for (auto* document : Document::allDocuments()) {
-        if (auto* container = document->serviceWorkerContainer())
-            container->scheduleTaskToUpdateRegistrationState(identifier, state, serviceWorkerData);
-    }
-}
-
-void SWClientConnection::updateWorkerState(ServiceWorkerIdentifier identifier, ServiceWorkerState state)
-{
-    SWContextManager::singleton().forEachServiceWorkerThread([identifier, state] (auto& workerThread) {
-        workerThread.thread().runLoop().postTask([identifier, state](ScriptExecutionContext& context) {
-            if (auto* serviceWorker = context.serviceWorker(identifier))
-                serviceWorker->scheduleTaskToUpdateState(state);
-        });
-    });
-
-    for (auto* document : Document::allDocuments()) {
-        if (auto* serviceWorker = document->serviceWorker(identifier))
-            serviceWorker->scheduleTaskToUpdateState(state);
-    }
-}
-
-void SWClientConnection::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
-{
-    SWContextManager::singleton().forEachServiceWorkerThread([identifier] (auto& workerThread) {
-        workerThread.thread().runLoop().postTask([identifier](ScriptExecutionContext& context) {
-            if (auto* container = context.serviceWorkerContainer())
-                container->scheduleTaskToFireUpdateFoundEvent(identifier);
-        });
-    });
-
-    for (auto* document : Document::allDocuments()) {
-        if (auto* container = document->serviceWorkerContainer())
-            container->scheduleTaskToFireUpdateFoundEvent(identifier);
-    }
-}
-
-void SWClientConnection::notifyClientsOfControllerChange(const HashSet<DocumentIdentifier>& contextIdentifiers, ServiceWorkerData&& newController)
-{
-    ASSERT(!contextIdentifiers.isEmpty());
-
-    for (auto& clientIdentifier : contextIdentifiers) {
-        // FIXME: Support worker contexts.
-        auto* client = Document::allDocumentsMap().get(clientIdentifier);
-        if (!client)
-            continue;
-
-        ASSERT(client->activeServiceWorker());
-        ASSERT(client->activeServiceWorker()->identifier() != newController.identifier);
-        client->setActiveServiceWorker(ServiceWorker::getOrCreate(*client, ServiceWorkerData { newController }));
-        if (auto* container = client->serviceWorkerContainer())
-            container->scheduleTaskToFireControllerChangeEvent();
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)

Deleted: trunk/Source/WebCore/workers/service/server/SWClientConnection.h (225354 => 225355)


--- trunk/Source/WebCore/workers/service/server/SWClientConnection.h	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.h	2017-11-30 23:06:34 UTC (rev 225355)
@@ -1,104 +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 "DocumentIdentifier.h"
-#include "ServiceWorkerJob.h"
-#include "ServiceWorkerTypes.h"
-#include <wtf/HashMap.h>
-#include <wtf/ThreadSafeRefCounted.h>
-
-namespace WebCore {
-
-class ResourceError;
-class SecurityOrigin;
-class SerializedScriptValue;
-class ServiceWorkerContainer;
-class ServiceWorkerRegistration;
-class SharedBuffer;
-enum class ServiceWorkerRegistrationState;
-enum class ServiceWorkerState;
-enum class ShouldNotifyWhenResolved;
-struct ExceptionData;
-struct ServiceWorkerClientData;
-struct ServiceWorkerData;
-struct ServiceWorkerFetchResult;
-struct ServiceWorkerRegistrationData;
-
-class SWClientConnection : public ThreadSafeRefCounted<SWClientConnection> {
-public:
-    WEBCORE_EXPORT virtual ~SWClientConnection();
-
-    using RegistrationCallback = WTF::CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>;
-    virtual void matchRegistration(const SecurityOrigin& topOrigin, const URL& clientURL, RegistrationCallback&&) = 0;
-
-    using GetRegistrationsCallback = WTF::CompletionHandler<void(Vector<ServiceWorkerRegistrationData>&&)>;
-    virtual void getRegistrations(const SecurityOrigin& topOrigin, const URL& clientURL, GetRegistrationsCallback&&) = 0;
-
-    virtual void addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier) = 0;
-    virtual void removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier) = 0;
-
-    void scheduleJob(ServiceWorkerJob&);
-    void finishedFetchingScript(ServiceWorkerJob&, const String&);
-    void failedFetchingScript(ServiceWorkerJob&, const ResourceError&);
-
-    virtual void didResolveRegistrationPromise(const ServiceWorkerRegistrationKey&) = 0;
-
-    virtual void postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&&, DocumentIdentifier sourceContextIdentifier, ServiceWorkerClientData&& source) = 0;
-    virtual SWServerConnectionIdentifier serverConnectionIdentifier() const = 0;
-    virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
-
-    virtual void serviceWorkerStartedControllingClient(ServiceWorkerIdentifier, ServiceWorkerRegistrationIdentifier, DocumentIdentifier) = 0;
-    virtual void serviceWorkerStoppedControllingClient(ServiceWorkerIdentifier, ServiceWorkerRegistrationIdentifier, DocumentIdentifier) = 0;
-
-    virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, DocumentIdentifier, const ServiceWorkerClientData&) = 0;
-    virtual void unregisterServiceWorkerClient(DocumentIdentifier) = 0;
-
-protected:
-    WEBCORE_EXPORT SWClientConnection();
-
-    WEBCORE_EXPORT void jobRejectedInServer(const ServiceWorkerJobDataIdentifier&, const ExceptionData&);
-    WEBCORE_EXPORT void registrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier&, ServiceWorkerRegistrationData&&, ShouldNotifyWhenResolved);
-    WEBCORE_EXPORT void unregistrationJobResolvedInServer(const ServiceWorkerJobDataIdentifier&, bool unregistrationResult);
-    WEBCORE_EXPORT void startScriptFetchForServer(const ServiceWorkerJobDataIdentifier&);
-    WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& source, const String& sourceOrigin);
-    WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&);
-    WEBCORE_EXPORT void updateWorkerState(ServiceWorkerIdentifier, ServiceWorkerState);
-    WEBCORE_EXPORT void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);
-    WEBCORE_EXPORT void notifyClientsOfControllerChange(const HashSet<DocumentIdentifier>& contextIdentifiers, ServiceWorkerData&& newController);
-
-private:
-    virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
-    virtual void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) = 0;
-
-    HashMap<ServiceWorkerJobIdentifier, RefPtr<ServiceWorkerJob>> m_scheduledJobs;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebCore/workers/service/server/SWOriginStore.cpp (225354 => 225355)


--- trunk/Source/WebCore/workers/service/server/SWOriginStore.cpp	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/workers/service/server/SWOriginStore.cpp	2017-11-30 23:06:34 UTC (rev 225355)
@@ -29,7 +29,6 @@
 #if ENABLE(SERVICE_WORKER)
 
 #include "SecurityOrigin.h"
-#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/workers/service/server/SWOriginStore.h (225354 => 225355)


--- trunk/Source/WebCore/workers/service/server/SWOriginStore.h	2017-11-30 23:04:36 UTC (rev 225354)
+++ trunk/Source/WebCore/workers/service/server/SWOriginStore.h	2017-11-30 23:06:34 UTC (rev 225355)
@@ -28,6 +28,8 @@
 #if ENABLE(SERVICE_WORKER)
 
 #include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to