Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (220976 => 220977)
--- trunk/Source/WebCore/CMakeLists.txt 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-08-21 20:02:42 UTC (rev 220977)
@@ -2991,6 +2991,7 @@
workers/service/ServiceWorkerRegistration.cpp
workers/service/ServiceWorkerRegistrationParameters.cpp
+ workers/service/server/SWClientConnection.cpp
workers/service/server/SWServer.cpp
xml/DOMParser.cpp
Modified: trunk/Source/WebCore/ChangeLog (220976 => 220977)
--- trunk/Source/WebCore/ChangeLog 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/ChangeLog 2017-08-21 20:02:42 UTC (rev 220977)
@@ -1,3 +1,50 @@
+2017-08-21 Brady Eidson <beid...@apple.com>
+
+ Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
+ https://bugs.webkit.org/show_bug.cgi?id=175745
+
+ Reviewed by Andy Estes.
+
+ No new tests (No behavior change).
+
+ Each of these has a much different environment that it lives in, so being the same object
+ hinders clean development.
+
+ This split will also make it easier for the WebCore objects to directly handle WK2 messages.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
+ * platform/Logging.h:
+
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::ServiceWorkerContainer::addRegistration):
+ (WebCore::ServiceWorkerContainer::scheduleJob):
+ * workers/service/ServiceWorkerContainer.h:
+
+ * workers/service/ServiceWorkerProvider.h:
+
+ * workers/service/server/SWClientConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServer.cpp.
+ (WebCore::SWClientConnection::SWClientConnection):
+ (WebCore::SWClientConnection::~SWClientConnection):
+ (WebCore::SWClientConnection::scheduleJob):
+ (WebCore::SWClientConnection::jobRejectedInServer):
+ * workers/service/server/SWClientConnection.h: Copied from Source/WebCore/workers/service/server/SWServer.h.
+
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::Connection::Connection):
+ (WebCore::SWServer::Connection::~Connection):
+ (WebCore::SWServer::~SWServer):
+ (WebCore::SWServer::Connection::scheduleJobInServer):
+ (WebCore::SWServer::scheduleJob):
+ (WebCore::SWServer::registerConnection):
+ (WebCore::SWServer::unregisterConnection):
+ (WebCore::SWServer::Connection::scheduleJob): Deleted.
+ (WebCore::SWServer::Connection::jobRejected): Deleted.
+ * workers/service/server/SWServer.h:
+ (WebCore::SWServer::Connection::server):
+ (WebCore::SWServer::Connection::~Connection): Deleted.
+
2017-08-21 Andy Estes <aes...@apple.com>
[Payment Request] Implement the PaymentRequest constructor
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (220976 => 220977)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-08-21 20:02:42 UTC (rev 220977)
@@ -2307,6 +2307,8 @@
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, ); }; };
517A52F11F4754E700DCDC0A /* SWServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A52EF1F47535900DCDC0A /* SWServer.cpp */; };
+ 517A531C1F4B53B100DCDC0A /* SWClientConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A52FE1F478CCE00DCDC0A /* SWClientConnection.cpp */; };
+ 517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A52FF1F478CCE00DCDC0A /* SWClientConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */; };
517A63C41B74318B00E7DCDC /* KeyedEncoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */; };
517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10101,6 +10103,8 @@
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>"; };
517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedDecoderCF.cpp; sourceTree = "<group>"; };
517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedDecoderCF.h; sourceTree = "<group>"; };
517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedEncoderCF.cpp; sourceTree = "<group>"; };
@@ -18687,6 +18691,8 @@
517A52EC1F47532D00DCDC0A /* server */ = {
isa = PBXGroup;
children = (
+ 517A52FE1F478CCE00DCDC0A /* SWClientConnection.cpp */,
+ 517A52FF1F478CCE00DCDC0A /* SWClientConnection.h */,
517A52EF1F47535900DCDC0A /* SWServer.cpp */,
517A52EE1F47535900DCDC0A /* SWServer.h */,
);
@@ -29412,6 +29418,7 @@
5824ABAB1AE849C8009074B7 /* RenderTreePosition.h in Headers */,
E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */,
E48E332C1F47037C00BAB0EF /* RenderTreeUpdaterFirstLetter.h in Headers */,
+ E48E33321F47437300BAB0EF /* RenderTreeUpdaterGeneratedContent.h in Headers */,
E48E332E1F47038000BAB0EF /* RenderTreeUpdaterListItem.h in Headers */,
E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */,
BCEA4868097D93020094C9E4 /* RenderView.h in Headers */,
@@ -29626,7 +29633,6 @@
FD45A94F175D3F3E00C21EC8 /* Shape.h in Headers */,
FD45A95B175D41EE00C21EC8 /* ShapeInterval.h in Headers */,
FD45A952175D3F3E00C21EC8 /* ShapeOutsideInfo.h in Headers */,
- E48E33321F47437300BAB0EF /* RenderTreeUpdaterGeneratedContent.h in Headers */,
FD1AF1501656F15100C6D4F7 /* ShapeValue.h in Headers */,
1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */,
@@ -30031,6 +30037,7 @@
8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */,
B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
+ 517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */,
517A52F01F47535B00DCDC0A /* SWServer.h in Headers */,
E180811716FCF9CB00B80D07 /* SynchronousLoaderClient.h in Headers */,
26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */,
@@ -31275,7 +31282,6 @@
9BD4E91A1C462CFC005065BC /* CustomElementRegistry.cpp in Sources */,
62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */,
97BC6A201505F081001B74AC /* Database.cpp in Sources */,
- E48E33311F47437000BAB0EF /* RenderTreeUpdaterGeneratedContent.cpp in Sources */,
97BC6A231505F081001B74AC /* DatabaseAuthorizer.cpp in Sources */,
97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */,
FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */,
@@ -33305,6 +33311,7 @@
5824ABAA1AE849C8009074B7 /* RenderTreePosition.cpp in Sources */,
E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */,
E48284081F44594C00863AC3 /* RenderTreeUpdaterFirstLetter.cpp in Sources */,
+ E48E33311F47437000BAB0EF /* RenderTreeUpdaterGeneratedContent.cpp in Sources */,
E48E332D1F47038000BAB0EF /* RenderTreeUpdaterListItem.cpp in Sources */,
E44614510CD68A3500FADA75 /* RenderVideo.cpp in Sources */,
BCEA4867097D93020094C9E4 /* RenderView.cpp in Sources */,
@@ -33784,6 +33791,7 @@
8485228A1190173C006EDC7F /* SVGVKernElement.cpp in Sources */,
B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
+ 517A531C1F4B53B100DCDC0A /* SWClientConnection.cpp in Sources */,
517A52F11F4754E700DCDC0A /* SWServer.cpp in Sources */,
E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */,
E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */,
Modified: trunk/Source/WebCore/platform/Logging.h (220976 => 220977)
--- trunk/Source/WebCore/platform/Logging.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/platform/Logging.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -81,6 +81,7 @@
M(ResourceLoadStatistics) \
M(Scrolling) \
M(Services) \
+ M(ServiceWorker) \
M(SpellingAndGrammar) \
M(SQLDatabase) \
M(StorageAPI) \
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (220976 => 220977)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -80,8 +80,8 @@
return;
}
- if (!m_serverConnection)
- m_serverConnection = &ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(context->sessionID());
+ if (!m_swConnection)
+ m_swConnection = &ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(context->sessionID());
if (relativeScriptURL.isEmpty()) {
promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() cannot be called with an empty script URL") });
@@ -120,13 +120,13 @@
void ServiceWorkerContainer::scheduleJob(Ref<ServiceWorkerJob>&& job)
{
- ASSERT(m_serverConnection);
+ ASSERT(m_swConnection);
ServiceWorkerJob& rawJob = job.get();
auto result = m_jobMap.add(rawJob.identifier(), WTFMove(job));
ASSERT_UNUSED(result, result.isNewEntry);
- m_serverConnection->scheduleJob(rawJob);
+ m_swConnection->scheduleJob(rawJob);
}
void ServiceWorkerContainer::getRegistration(const String&, Ref<DeferredPromise>&& promise)
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h (220976 => 220977)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -30,6 +30,7 @@
#include "ActiveDOMObject.h"
#include "DOMPromiseProxy.h"
#include "EventTarget.h"
+#include "SWClientConnection.h"
#include "SWServer.h"
#include "ServiceWorkerJobClient.h"
#include "ServiceWorkerRegistration.h"
@@ -82,7 +83,7 @@
NavigatorBase& m_navigator;
- RefPtr<SWServer::Connection> m_serverConnection;
+ RefPtr<SWClientConnection> m_swConnection;
HashMap<uint64_t, RefPtr<ServiceWorkerJob>> m_jobMap;
#ifndef NDEBUG
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h (220976 => 220977)
--- trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -27,8 +27,6 @@
#if ENABLE(SERVICE_WORKER)
-#include "SWServer.h"
-
namespace PAL {
class SessionID;
}
@@ -35,6 +33,7 @@
namespace WebCore {
+class SWClientConnection;
class ServiceWorkerJob;
class WEBCORE_EXPORT ServiceWorkerProvider {
@@ -44,7 +43,7 @@
WEBCORE_EXPORT static ServiceWorkerProvider& singleton();
WEBCORE_EXPORT static void setSharedProvider(ServiceWorkerProvider&);
- virtual SWServer::Connection& serviceWorkerConnectionForSession(const PAL::SessionID&) = 0;
+ virtual SWClientConnection& serviceWorkerConnectionForSession(const PAL::SessionID&) = 0;
};
} // namespace WebCore
Copied: trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp (from rev 220974, trunk/Source/WebCore/workers/service/server/SWServer.cpp) (0 => 220977)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp (rev 0)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,65 @@
+/*
+ * 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 "ExceptionData.h"
+#include "ServiceWorkerJobData.h"
+
+namespace WebCore {
+
+SWClientConnection::SWClientConnection()
+{
+}
+
+SWClientConnection::~SWClientConnection()
+{
+}
+
+void SWClientConnection::scheduleJob(ServiceWorkerJob& job)
+{
+ auto addResult = m_scheduledJobs.add(job.identifier(), &job);
+ ASSERT_UNUSED(addResult, addResult.isNewEntry);
+
+ scheduleJobInServer(job.data());
+}
+
+void SWClientConnection::jobRejectedInServer(uint64_t jobIdentifier, const ExceptionData& exceptionData)
+{
+ auto job = m_scheduledJobs.take(jobIdentifier);
+ if (!job) {
+ LOG_ERROR("Job %" PRIu64 " rejected from server, but was not found", jobIdentifier);
+ return;
+ }
+
+ job->failedWithException(exceptionData.toException());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebCore/workers/service/server/SWClientConnection.h (from rev 220974, trunk/Source/WebCore/workers/service/server/SWServer.h) (0 => 220977)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.h (rev 0)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,56 @@
+/*
+ * 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 "ServiceWorkerJob.h"
+#include <wtf/HashMap.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+struct ExceptionData;
+
+class SWClientConnection : public ThreadSafeRefCounted<SWClientConnection> {
+public:
+ WEBCORE_EXPORT SWClientConnection();
+ WEBCORE_EXPORT virtual ~SWClientConnection();
+
+ void scheduleJob(ServiceWorkerJob&);
+
+protected:
+ WEBCORE_EXPORT void jobRejectedInServer(uint64_t jobIdentifier, const ExceptionData&);
+
+private:
+ virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
+
+ HashMap<uint64_t, RefPtr<ServiceWorkerJob>> m_scheduledJobs;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (220976 => 220977)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -30,30 +30,53 @@
#include "ExceptionCode.h"
#include "ExceptionData.h"
+#include "Logging.h"
#include "ServiceWorkerJobData.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
-void SWServer::Connection::scheduleJob(ServiceWorkerJob& job)
+SWServer::Connection::Connection(SWServer& server)
+ : m_server(server)
{
- auto addResult = m_scheduledJobs.add(job.identifier(), &job);
- ASSERT_UNUSED(addResult, addResult.isNewEntry);
+ m_server.registerConnection(*this);
+}
- scheduleJob(job.data());
+SWServer::Connection::~Connection()
+{
+ m_server.unregisterConnection(*this);
}
-void SWServer::Connection::jobRejected(uint64_t jobIdentifier, const ExceptionData& exceptionData)
+
+SWServer::~SWServer()
{
- auto job = m_scheduledJobs.take(jobIdentifier);
- if (!job) {
- LOG_ERROR("Job %" PRIu64 " rejected from server, but was not found", jobIdentifier);
- return;
- }
+ RELEASE_ASSERT(m_connections.isEmpty());
+}
- job->failedWithException(exceptionData.toException());
+void SWServer::Connection::scheduleJobInServer(const ServiceWorkerJobData& jobData)
+{
+ LOG(ServiceWorker, "Scheduling ServiceWorker job %" PRIu64 " in server", jobData.identifier);
+ m_server.scheduleJob(*this, jobData);
}
+void SWServer::scheduleJob(Connection& connection, const ServiceWorkerJobData& jobData)
+{
+ // FIXME: For now, all scheduled jobs immediately reject.
+ connection.rejectJobInClient(jobData.identifier, ExceptionData { UnknownError, ASCIILiteral("serviceWorker job scheduling is not yet implemented") });
+}
+
+void SWServer::registerConnection(Connection& connection)
+{
+ auto result = m_connections.add(&connection);
+ ASSERT_UNUSED(result, result.isNewEntry);
+}
+
+void SWServer::unregisterConnection(Connection& connection)
+{
+ ASSERT(!m_connections.contains(&connection));
+ m_connections.remove(&connection);
+}
+
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (220976 => 220977)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -29,6 +29,7 @@
#include "ServiceWorkerJob.h"
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/ThreadSafeRefCounted.h>
namespace WebCore {
@@ -37,20 +38,32 @@
class SWServer {
public:
- class Connection : public ThreadSafeRefCounted<Connection> {
+ class Connection {
+ friend class SWServer;
public:
- virtual ~Connection() { }
- void scheduleJob(ServiceWorkerJob&);
+ WEBCORE_EXPORT virtual ~Connection();
protected:
- WEBCORE_EXPORT void jobRejected(uint64_t jobIdentifier, const ExceptionData&);
+ WEBCORE_EXPORT Connection(SWServer&);
+ SWServer& server() { return m_server; }
+ WEBCORE_EXPORT void scheduleJobInServer(const ServiceWorkerJobData&);
+
private:
- virtual void scheduleJob(const ServiceWorkerJobData&) = 0;
+ virtual void rejectJobInClient(uint64_t jobIdentifier, const ExceptionData&) = 0;
- HashMap<uint64_t, RefPtr<ServiceWorkerJob>> m_scheduledJobs;
+ SWServer& m_server;
};
+ WEBCORE_EXPORT ~SWServer();
+
+ WEBCORE_EXPORT void scheduleJob(Connection&, const ServiceWorkerJobData&);
+
+private:
+ void registerConnection(Connection&);
+ void unregisterConnection(Connection&);
+
+ HashSet<Connection*> m_connections;
};
} // namespace WebCore
Modified: trunk/Source/WebKit/CMakeLists.txt (220976 => 220977)
--- trunk/Source/WebKit/CMakeLists.txt 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/CMakeLists.txt 2017-08-21 20:02:42 UTC (rev 220977)
@@ -30,6 +30,7 @@
"${WEBKIT2_DIR}/Shared/WebsiteData"
"${WEBKIT2_DIR}/StorageProcess"
"${WEBKIT2_DIR}/StorageProcess/IndexedDB"
+ "${WEBKIT2_DIR}/StorageProcess/ServiceWorker"
"${WEBKIT2_DIR}/UIProcess"
"${WEBKIT2_DIR}/UIProcess/API"
"${WEBKIT2_DIR}/UIProcess/API/C"
@@ -273,6 +274,9 @@
StorageProcess/StorageToWebProcessConnection.cpp
StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp
+
+ StorageProcess/ServiceWorker/WebSWServerConnection.cpp
+
UIProcess/BackgroundProcessResponsivenessTimer.cpp
UIProcess/ChildProcessProxy.cpp
UIProcess/DrawingAreaProxy.cpp
@@ -528,7 +532,7 @@
WebProcess/Plugins/Netscape/NetscapePluginNone.cpp
WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
- WebProcess/Storage/WebSWServerConnection.cpp
+ WebProcess/Storage/WebSWClientConnection.cpp
WebProcess/Storage/WebServiceWorkerProvider.cpp
WebProcess/Storage/WebToStorageProcessConnection.cpp
@@ -612,6 +616,8 @@
StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in
+ StorageProcess/ServiceWorker/WebSWServerConnection.messages.in
+
UIProcess/DrawingAreaProxy.messages.in
UIProcess/RemoteWebInspectorProxy.messages.in
UIProcess/VisitedLinkStore.messages.in
@@ -669,7 +675,7 @@
WebProcess/Plugins/PluginProcessConnectionManager.messages.in
WebProcess/Plugins/PluginProxy.messages.in
- WebProcess/Storage/WebSWServerConnection.messages.in
+ WebProcess/Storage/WebSWClientConnection.messages.in
WebProcess/UserContent/WebUserContentController.messages.in
Modified: trunk/Source/WebKit/ChangeLog (220976 => 220977)
--- trunk/Source/WebKit/ChangeLog 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/ChangeLog 2017-08-21 20:02:42 UTC (rev 220977)
@@ -1,3 +1,47 @@
+2017-08-21 Brady Eidson <beid...@apple.com>
+
+ Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
+ https://bugs.webkit.org/show_bug.cgi?id=175745
+
+ Reviewed by Andy Estes.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * WebKit.xcodeproj/project.pbxproj:
+
+ * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp.
+ (WebKit::WebSWServerConnection::WebSWServerConnection):
+ (WebKit::WebSWServerConnection::~WebSWServerConnection):
+ (WebKit::WebSWServerConnection::disconnectedFromWebProcess):
+ (WebKit::WebSWServerConnection::rejectJobInClient):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.h: Copied from Source/WebKit/WebProcess/Storage/WebSWServerConnection.h.
+ (WebKit::WebSWServerConnection::identifier const):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in: Copied from Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in.
+
+ * StorageProcess/StorageToWebProcessConnection.cpp:
+ (WebKit::StorageToWebProcessConnection::didReceiveMessage):
+ (WebKit::StorageToWebProcessConnection::didClose):
+ (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
+ (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
+ * StorageProcess/StorageToWebProcessConnection.h:
+
+ * WebProcess/Storage/WebSWClientConnection.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
+ (WebKit::WebSWClientConnection::WebSWClientConnection):
+ (WebKit::WebSWClientConnection::~WebSWClientConnection):
+ (WebKit::WebSWClientConnection::scheduleJobInServer):
+ * WebProcess/Storage/WebSWClientConnection.h: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.h.
+ (WebKit::WebSWClientConnection::identifier const):
+ * WebProcess/Storage/WebSWClientConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in.
+
+ * WebProcess/Storage/WebServiceWorkerProvider.cpp:
+ (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
+ * WebProcess/Storage/WebServiceWorkerProvider.h:
+
+ * WebProcess/Storage/WebToStorageProcessConnection.cpp:
+ (WebKit::WebToStorageProcessConnection::didReceiveMessage):
+ (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
+ * WebProcess/Storage/WebToStorageProcessConnection.h:
+
2017-08-21 Charlie Turner <ctur...@igalia.com>
MemoryCache::setCapacities assertion failure maxDeadBytes <= totalBytes
Modified: trunk/Source/WebKit/DerivedSources.make (220976 => 220977)
--- trunk/Source/WebKit/DerivedSources.make 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/DerivedSources.make 2017-08-21 20:02:42 UTC (rev 220977)
@@ -36,6 +36,7 @@
$(WebKit2)/Shared/mac \
$(WebKit2)/StorageProcess \
$(WebKit2)/StorageProcess/IndexedDB \
+ $(WebKit2)/StorageProcess/ServiceWorker \
$(WebKit2)/StorageProcess/mac \
$(WebKit2)/WebProcess/ApplePay \
$(WebKit2)/WebProcess/ApplicationCache \
@@ -158,6 +159,7 @@
WebPasteboardProxy \
WebPaymentCoordinator \
WebPaymentCoordinatorProxy \
+ WebSWClientConnection \
WebSWServerConnection \
PlaybackSessionManager \
PlaybackSessionManagerProxy \
Copied: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (from rev 220974, trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp) (0 => 220977)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (rev 0)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,71 @@
+/*
+ * 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 "WebSWServerConnection.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "Logging.h"
+#include "StorageToWebProcessConnectionMessages.h"
+#include "WebProcess.h"
+#include "WebSWClientConnectionMessages.h"
+#include "WebSWServerConnectionMessages.h"
+#include "WebToStorageProcessConnection.h"
+#include <WebCore/ExceptionData.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ServiceWorkerJobData.h>
+#include <wtf/MainThread.h>
+
+using namespace PAL;
+using namespace WebCore;
+
+namespace WebKit {
+
+WebSWServerConnection::WebSWServerConnection(SWServer& server, IPC::Connection& connection, uint64_t connectionIdentifier, const SessionID& sessionID)
+ : SWServer::Connection(server)
+ , m_sessionID(sessionID)
+ , m_identifier(connectionIdentifier)
+ , m_connection(connection)
+{
+}
+
+WebSWServerConnection::~WebSWServerConnection()
+{
+}
+
+void WebSWServerConnection::disconnectedFromWebProcess()
+{
+ notImplemented();
+}
+
+void WebSWServerConnection::rejectJobInClient(uint64_t jobIdentifier, const ExceptionData& exceptionData)
+{
+ send(Messages::WebSWClientConnection::JobRejectedInServer(jobIdentifier, exceptionData));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (from rev 220974, trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.h) (0 => 220977)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (rev 0)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,67 @@
+/*
+ * 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 "MessageReceiver.h"
+#include "MessageSender.h"
+#include <WebCore/SWServer.h>
+#include <pal/SessionID.h>
+
+namespace WebCore {
+struct ExceptionData;
+}
+
+namespace WebKit {
+
+class WebSWServerConnection : public WebCore::SWServer::Connection, public IPC::MessageSender, public IPC::MessageReceiver {
+public:
+ WebSWServerConnection(WebCore::SWServer&, IPC::Connection&, uint64_t connectionIdentifier, const PAL::SessionID&);
+ WebSWServerConnection(const WebSWServerConnection&) = delete;
+ ~WebSWServerConnection() final;
+
+ uint64_t identifier() const { return m_identifier; }
+
+ void disconnectedFromWebProcess();
+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
+
+private:
+ // Implement SWServer::Connection
+ void rejectJobInClient(uint64_t jobIdentifier, const WebCore::ExceptionData&) final;
+
+ IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
+ uint64_t messageSenderDestinationID() final { return m_identifier; }
+
+ PAL::SessionID m_sessionID;
+ uint64_t m_identifier;
+
+ Ref<IPC::Connection> m_connection;
+}; // class WebSWServerConnection
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (from rev 220974, trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in) (0 => 220977)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (rev 0)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,30 @@
+# 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.
+
+#if ENABLE(SERVICE_WORKER)
+
+messages -> WebSWServerConnection {
+ # When possible, these messages can be implemented directly by WebCore::SWClientConnection
+ ScheduleJobInServer(struct WebCore::ServiceWorkerJobData jobData)
+}
+
+#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp (220976 => 220977)
--- trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -35,6 +35,7 @@
#include <wtf/RunLoop.h>
using namespace PAL;
+using namespace WebCore;
namespace WebKit {
@@ -73,8 +74,8 @@
#if ENABLE(SERVICE_WORKER)
if (decoder.messageReceiverName() == Messages::WebSWServerConnection::messageReceiverName()) {
- auto iterator = m_webServiceWorkerConnections.find(decoder.destinationID());
- if (iterator != m_webServiceWorkerConnections.end())
+ auto iterator = m_swConnections.find(decoder.destinationID());
+ if (iterator != m_swConnections.end())
iterator->value->didReceiveMessage(connection, decoder);
return;
}
@@ -104,11 +105,15 @@
#endif
#if ENABLE(SERVICE_WORKER)
- auto serviceWorkerConnections = m_webServiceWorkerConnections;
- for (auto& connection : serviceWorkerConnections.values())
+ Vector<std::unique_ptr<WebSWServerConnection>> connectionVector;
+ connectionVector.reserveInitialCapacity(m_swConnections.size());
+
+ for (auto& connection : m_swConnections.values())
+ connectionVector.uncheckedAppend(WTFMove(connection));
+ for (auto& connection : connectionVector)
connection->disconnectedFromWebProcess();
- m_webServiceWorkerConnections.clear();
+ m_swConnections.clear();
#endif
}
@@ -129,16 +134,22 @@
{
serverConnectionIdentifier = generateConnectionToServerIdentifier();
LOG(ServiceWorker, "StorageToWebProcessConnection::establishSWServerConnection - %" PRIu64, serverConnectionIdentifier);
- ASSERT(!m_webServiceWorkerConnections.contains(serverConnectionIdentifier));
+ ASSERT(!m_swConnections.contains(serverConnectionIdentifier));
- m_webServiceWorkerConnections.set(serverConnectionIdentifier, WebSWServerConnection::create(m_connection.get(), serverConnectionIdentifier, sessionID));
+ auto result = m_swServers.add(sessionID, nullptr);
+ if (result.isNewEntry)
+ result.iterator->value = std::make_unique<SWServer>();
+
+ ASSERT(result.iterator->value);
+
+ m_swConnections.set(serverConnectionIdentifier, std::make_unique<WebSWServerConnection>(*result.iterator->value, m_connection.get(), serverConnectionIdentifier, sessionID));
}
void StorageToWebProcessConnection::removeSWServerConnection(uint64_t serverConnectionIdentifier)
{
- ASSERT(m_webServiceWorkerConnections.contains(serverConnectionIdentifier));
+ ASSERT(m_swConnections.contains(serverConnectionIdentifier));
- auto connection = m_webServiceWorkerConnections.take(serverConnectionIdentifier);
+ auto connection = m_swConnections.take(serverConnectionIdentifier);
connection->disconnectedFromWebProcess();
}
#endif
Modified: trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.h (220976 => 220977)
--- trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -28,6 +28,7 @@
#include "Connection.h"
#include "MessageSender.h"
+#include <WebCore/SWServer.h>
#include <pal/SessionID.h>
#include <wtf/HashMap.h>
@@ -69,7 +70,8 @@
#if ENABLE(SERVICE_WORKER)
void establishSWServerConnection(PAL::SessionID, uint64_t& serverConnectionIdentifier);
void removeSWServerConnection(uint64_t serverConnectionIdentifier);
- HashMap<uint64_t, RefPtr<WebSWServerConnection>> m_webServiceWorkerConnections;
+ HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers;
+ HashMap<uint64_t, std::unique_ptr<WebSWServerConnection>> m_swConnections;
#endif
Ref<IPC::Connection> m_connection;
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (220976 => 220977)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-08-21 20:02:42 UTC (rev 220977)
@@ -1028,6 +1028,12 @@
5179556E162877B300FA43B6 /* NetworkProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 510CC7EB16138E7200D03ED3 /* NetworkProcessProxy.h */; };
517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A52D71F43A9B600DCDC0A /* WebSWServerConnectionMessageReceiver.cpp */; };
517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */; };
+ 517A53041F4793C600DCDC0A /* WebSWClientConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */; };
+ 517A53051F4793C600DCDC0A /* WebSWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */; };
+ 517A530A1F479E3600DCDC0A /* WebSWServerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A53091F479E3100DCDC0A /* WebSWServerConnection.cpp */; };
+ 517A530B1F479E3600DCDC0A /* WebSWServerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53071F479E3100DCDC0A /* WebSWServerConnection.h */; };
+ 517A530F1F47A86200DCDC0A /* WebSWClientConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A530E1F47A84300DCDC0A /* WebSWClientConnectionMessageReceiver.cpp */; };
+ 517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A530D1F47A84300DCDC0A /* WebSWClientConnectionMessages.h */; };
517CF0E3163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */; };
517CF0E3163A486C00C2950D /* WebCacheStorageConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950D /* WebCacheStorageConnectionMessageReceiver.cpp */; };
517CF0E3163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp */; };
@@ -1110,8 +1116,6 @@
51F060E11654318500F3281F /* WebRTCMonitorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */; };
51F060E11654318500F3282C /* WebRTCResolverMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3282C /* WebRTCResolverMessageReceiver.cpp */; };
51F060E11654318500F3282E /* NetworkRTCProviderMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3282E /* NetworkRTCProviderMessageReceiver.cpp */; };
- 51F645881F472E2E00B54DED /* WebSWServerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645861F472E2600B54DED /* WebSWServerConnection.h */; };
- 51F645891F472E2E00B54DED /* WebSWServerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F645871F472E2600B54DED /* WebSWServerConnection.cpp */; };
51F7DC41180CC93600212CA3 /* XPCServiceMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC82839616B47EC400A278FE /* XPCServiceMain.mm */; };
51F7DC43180CC93600212CA3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
51F7DC44180CC93600212CA3 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit.framework */; };
@@ -3307,6 +3311,14 @@
517A33B4130B308C00F80CB5 /* WKApplicationCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKApplicationCacheManager.h; sourceTree = "<group>"; };
517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerConnectionMessages.h; sourceTree = "<group>"; };
517A52D71F43A9B600DCDC0A /* WebSWServerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWServerConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
+ 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWClientConnection.h; sourceTree = "<group>"; };
+ 517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWClientConnection.cpp; sourceTree = "<group>"; };
+ 517A53071F479E3100DCDC0A /* WebSWServerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerConnection.h; sourceTree = "<group>"; };
+ 517A53081F479E3100DCDC0A /* WebSWServerConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWServerConnection.messages.in; sourceTree = "<group>"; };
+ 517A53091F479E3100DCDC0A /* WebSWServerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWServerConnection.cpp; sourceTree = "<group>"; };
+ 517A530C1F479E9700DCDC0A /* WebSWClientConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWClientConnection.messages.in; sourceTree = "<group>"; };
+ 517A530D1F47A84300DCDC0A /* WebSWClientConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWClientConnectionMessages.h; sourceTree = "<group>"; };
+ 517A530E1F47A84300DCDC0A /* WebSWClientConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWClientConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkProcessConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
517CF0E1163A486C00C2950D /* WebCacheStorageConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCacheStorageConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
517CF0E1163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngineConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
@@ -3415,9 +3427,6 @@
51F060DD1654317500F3282C /* WebRTCResolverMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebRTCResolverMessageReceiver.cpp; sourceTree = "<group>"; };
51F060DD1654317500F3282E /* NetworkRTCProviderMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkRTCProviderMessageReceiver.cpp; sourceTree = "<group>"; };
51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoaderMessages.h; sourceTree = "<group>"; };
- 51F645851F472E2600B54DED /* WebSWServerConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWServerConnection.messages.in; sourceTree = "<group>"; };
- 51F645861F472E2600B54DED /* WebSWServerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerConnection.h; sourceTree = "<group>"; };
- 51F645871F472E2600B54DED /* WebSWServerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWServerConnection.cpp; sourceTree = "<group>"; };
51F7DC4A180CC93600212CA3 /* com.apple.WebKit.Storage.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = com.apple.WebKit.Storage.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
51F886A31F2C214A00C193EF /* WKTestingSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKTestingSupport.cpp; sourceTree = "<group>"; };
51F886A41F2C214A00C193EF /* WKTestingSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTestingSupport.h; sourceTree = "<group>"; };
@@ -6075,9 +6084,9 @@
children = (
51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */,
51BEB62A1F3A5ACD005029B9 /* WebServiceWorkerProvider.h */,
- 51F645861F472E2600B54DED /* WebSWServerConnection.h */,
- 51F645871F472E2600B54DED /* WebSWServerConnection.cpp */,
- 51F645851F472E2600B54DED /* WebSWServerConnection.messages.in */,
+ 517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */,
+ 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */,
+ 517A530C1F479E9700DCDC0A /* WebSWClientConnection.messages.in */,
5118E9991F295259003EF9F5 /* WebToStorageProcessConnection.cpp */,
5118E99A1F295259003EF9F5 /* WebToStorageProcessConnection.h */,
);
@@ -6196,6 +6205,16 @@
name = mac;
sourceTree = "<group>";
};
+ 517A53061F479E0F00DCDC0A /* ServiceWorker */ = {
+ isa = PBXGroup;
+ children = (
+ 517A53091F479E3100DCDC0A /* WebSWServerConnection.cpp */,
+ 517A53071F479E3100DCDC0A /* WebSWServerConnection.h */,
+ 517A53081F479E3100DCDC0A /* WebSWServerConnection.messages.in */,
+ );
+ path = ServiceWorker;
+ sourceTree = "<group>";
+ };
517DD5BB180DA7C40081660B /* Storage */ = {
isa = PBXGroup;
children = (
@@ -6297,6 +6316,7 @@
51E351F9180F5CF600E53BE9 /* IndexedDB */,
E1FEF39B190F791C00731658 /* ios */,
517DD5C0180DB7AA0081660B /* mac */,
+ 517A53061F479E0F00DCDC0A /* ServiceWorker */,
51E351FA180F5D0B00E53BE9 /* StorageProcess.cpp */,
51E351FB180F5D0B00E53BE9 /* StorageProcess.h */,
51E351FC180F5D0B00E53BE9 /* StorageProcess.messages.in */,
@@ -8010,10 +8030,12 @@
51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */,
51F060DD1654317500F3282C /* WebRTCResolverMessageReceiver.cpp */,
51F060DD1654317500F3281C /* WebRTCSocketMessageReceiver.cpp */,
+ 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */,
+ 5C0B17771E7C879C00E9123C /* WebSocketStreamMessages.h */,
+ 517A530E1F47A84300DCDC0A /* WebSWClientConnectionMessageReceiver.cpp */,
+ 517A530D1F47A84300DCDC0A /* WebSWClientConnectionMessages.h */,
517A52D71F43A9B600DCDC0A /* WebSWServerConnectionMessageReceiver.cpp */,
517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */,
- 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */,
- 5C0B17771E7C879C00E9123C /* WebSocketStreamMessages.h */,
1AAF08B519269E6D00B6390C /* WebUserContentControllerMessageReceiver.cpp */,
1AAF08B619269E6D00B6390C /* WebUserContentControllerMessages.h */,
7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */,
@@ -8355,7 +8377,6 @@
7C89D2981A6753B2003A5FDE /* APIPageConfiguration.h in Headers */,
1AC1336C18565C7A00F3EC05 /* APIPageHandle.h in Headers */,
1AFDD3151891B54000153970 /* APIPolicyClient.h in Headers */,
- 51F645881F472E2E00B54DED /* WebSWServerConnection.h in Headers */,
7CE4D2201A4914CA00C7F152 /* APIProcessPoolConfiguration.h in Headers */,
F634445612A885C8000612D8 /* APISecurityOrigin.h in Headers */,
1AFDE6621954E9B100C48FFA /* APISessionState.h in Headers */,
@@ -8904,7 +8925,6 @@
7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */,
D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */,
51BEB62C1F3A5AD7005029B9 /* WebServiceWorkerProvider.h in Headers */,
- 517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */,
1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */,
1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
@@ -8911,6 +8931,10 @@
511F7D411EB1BCF500E47B83 /* WebsiteDataStoreParameters.h in Headers */,
836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */,
1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */,
+ 517A53051F4793C600DCDC0A /* WebSWClientConnection.h in Headers */,
+ 517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */,
+ 517A530B1F479E3600DCDC0A /* WebSWServerConnection.h in Headers */,
+ 517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */,
BCC5715B115ADAEF001CCAF9 /* WebSystemInterface.h in Headers */,
5118E99C1F295266003EF9F5 /* WebToStorageProcessConnection.h in Headers */,
BCA0EF7F12331E78007D3CFB /* WebUndoStep.h in Headers */,
@@ -10537,7 +10561,6 @@
7C361D721927FA360036A59D /* WebScriptMessageHandler.cpp in Sources */,
D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */,
51BEB62B1F3A5AD7005029B9 /* WebServiceWorkerProvider.cpp in Sources */,
- 517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */,
1A4832D61A9CDF96008B4DFE /* WebsiteData.cpp in Sources */,
1A4832D91A9D1FD2008B4DFE /* WebsiteDataRecord.cpp in Sources */,
1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */,
@@ -10548,6 +10571,10 @@
5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */,
8360349F1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp in Sources */,
1A52C0F71A38CDC70016160A /* WebStorageNamespaceProvider.cpp in Sources */,
+ 517A53041F4793C600DCDC0A /* WebSWClientConnection.cpp in Sources */,
+ 517A530F1F47A86200DCDC0A /* WebSWClientConnectionMessageReceiver.cpp in Sources */,
+ 517A530A1F479E3600DCDC0A /* WebSWServerConnection.cpp in Sources */,
+ 517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */,
BCC5715C115ADAEF001CCAF9 /* WebSystemInterface.mm in Sources */,
5118E99B1F295266003EF9F5 /* WebToStorageProcessConnection.cpp in Sources */,
C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */,
@@ -10674,7 +10701,6 @@
2D3A65DA1A7C3A1F00CAC637 /* WKNavigationActionRef.cpp in Sources */,
370F34A21829BE1E009027C8 /* WKNavigationData.mm in Sources */,
BCF69FAA1176D1CB00471A52 /* WKNavigationDataRef.cpp in Sources */,
- 51F645891F472E2E00B54DED /* WebSWServerConnection.cpp in Sources */,
2D3A65E21A7C3A9300CAC637 /* WKNavigationRef.cpp in Sources */,
1A1B0EB518A424950038481A /* WKNavigationResponse.mm in Sources */,
2D3A65DE1A7C3A7D00CAC637 /* WKNavigationResponseRef.cpp in Sources */,
Copied: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (from rev 220974, trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp) (0 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,61 @@
+/*
+ * 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 "WebSWClientConnection.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "Logging.h"
+#include "StorageToWebProcessConnectionMessages.h"
+#include "WebSWServerConnectionMessages.h"
+#include <WebCore/ServiceWorkerJobData.h>
+
+using namespace PAL;
+using namespace WebCore;
+
+namespace WebKit {
+
+WebSWClientConnection::WebSWClientConnection(IPC::Connection& connection, const SessionID& sessionID)
+ : m_sessionID(sessionID)
+ , m_connection(connection)
+{
+ bool result = sendSync(Messages::StorageToWebProcessConnection::EstablishSWServerConnection(sessionID), Messages::StorageToWebProcessConnection::EstablishSWServerConnection::Reply(m_identifier));
+
+ ASSERT_UNUSED(result, result);
+}
+
+WebSWClientConnection::~WebSWClientConnection()
+{
+}
+
+void WebSWClientConnection::scheduleJobInServer(const ServiceWorkerJobData& jobData)
+{
+ send(Messages::WebSWServerConnection::ScheduleJobInServer(jobData));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (from rev 220974, trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.h) (0 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,69 @@
+/*
+ * 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 "Connection.h"
+#include "MessageReceiver.h"
+#include "MessageSender.h"
+#include <WebCore/SWClientConnection.h>
+#include <pal/SessionID.h>
+
+namespace WebCore {
+struct ExceptionData;
+}
+
+namespace WebKit {
+
+class WebSWClientConnection : public WebCore::SWClientConnection, public IPC::MessageSender, public IPC::MessageReceiver {
+public:
+ WebSWClientConnection(IPC::Connection&, const PAL::SessionID&);
+ WebSWClientConnection(const WebSWClientConnection&) = delete;
+ ~WebSWClientConnection() final;
+
+ uint64_t identifier() const { return m_identifier; }
+
+ void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final;
+
+ void disconnectedFromWebProcess();
+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
+
+private:
+ void scheduleStorageJob(const WebCore::ServiceWorkerJobData&);
+
+ IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
+ uint64_t messageSenderDestinationID() final { return m_identifier; }
+
+ PAL::SessionID m_sessionID;
+ uint64_t m_identifier;
+
+ Ref<IPC::Connection> m_connection;
+}; // class WebSWServerConnection
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (from rev 220974, trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in) (0 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-08-21 20:02:42 UTC (rev 220977)
@@ -0,0 +1,30 @@
+# 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.
+
+#if ENABLE(SERVICE_WORKER)
+
+messages -> WebSWClientConnection {
+ # When possible, these messages can be implemented directly by WebCore::SWServer::Connection
+ JobRejectedInServer(uint64_t identifier, struct WebCore::ExceptionData exception)
+}
+
+#endif // ENABLE(SERVICE_WORKER)
Deleted: trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -1,88 +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 "WebSWServerConnection.h"
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "Logging.h"
-#include "StorageToWebProcessConnectionMessages.h"
-#include "WebProcess.h"
-#include "WebSWServerConnectionMessages.h"
-#include "WebToStorageProcessConnection.h"
-#include <WebCore/ExceptionData.h>
-#include <WebCore/NotImplemented.h>
-#include <WebCore/ServiceWorkerJobData.h>
-#include <wtf/MainThread.h>
-
-using namespace PAL;
-using namespace WebCore;
-
-namespace WebKit {
-
-WebSWServerConnection::WebSWServerConnection(const SessionID& sessionID)
- : m_sessionID(sessionID)
- , m_connection(WebProcess::singleton().webToStorageProcessConnection()->connection())
-{
- bool result = sendSync(Messages::StorageToWebProcessConnection::EstablishSWServerConnection(sessionID), Messages::StorageToWebProcessConnection::EstablishSWServerConnection::Reply(m_identifier));
-
- ASSERT_UNUSED(result, result);
-}
-
-WebSWServerConnection::WebSWServerConnection(IPC::Connection& connection, uint64_t connectionIdentifier, const SessionID& sessionID)
- : m_sessionID(sessionID)
- , m_identifier(connectionIdentifier)
- , m_connection(connection)
-{
-}
-
-WebSWServerConnection::~WebSWServerConnection()
-{
-}
-
-void WebSWServerConnection::disconnectedFromWebProcess()
-{
- notImplemented();
-}
-
-void WebSWServerConnection::scheduleJob(const ServiceWorkerJobData& jobData)
-{
- LOG(ServiceWorker, "Scheduling ServiceWorker job %" PRIu64 " in storage process", jobData.identifier);
- send(Messages::WebSWServerConnection::ScheduleStorageJob(jobData));
-}
-
-void WebSWServerConnection::scheduleStorageJob(const ServiceWorkerJobData& jobData)
-{
- ASSERT(isMainThread());
- LOG(ServiceWorker, "Received ServiceWorker job %" PRIu64 " in storage process", jobData.identifier);
-
- // FIXME: For now, all scheduled jobs immediately reject.
- send(Messages::WebSWServerConnection::JobRejected(jobData.identifier, ExceptionData { UnknownError, ASCIILiteral("serviceWorker job scheduling is not yet implemented") }));
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)
Deleted: trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.h (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -1,78 +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 "MessageReceiver.h"
-#include "MessageSender.h"
-#include <WebCore/SWServer.h>
-#include <pal/SessionID.h>
-
-namespace WebCore {
-struct ExceptionData;
-}
-
-namespace WebKit {
-
-class WebSWServerConnection : public WebCore::SWServer::Connection, public IPC::MessageSender, public IPC::MessageReceiver {
-public:
- static Ref<WebSWServerConnection> create(const PAL::SessionID& sessionID)
- {
- return adoptRef(*new WebSWServerConnection(sessionID));
- }
- static Ref<WebSWServerConnection> create(IPC::Connection& connection, uint64_t connectionIdentifier, const PAL::SessionID& sessionID)
- {
- return adoptRef(*new WebSWServerConnection(connection, connectionIdentifier, sessionID));
- }
-
- ~WebSWServerConnection() final;
-
- uint64_t identifier() const { return m_identifier; }
-
- void scheduleJob(const WebCore::ServiceWorkerJobData&) final;
-
- void disconnectedFromWebProcess();
- void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
-
-private:
- WebSWServerConnection(const PAL::SessionID&);
- WebSWServerConnection(IPC::Connection&, uint64_t connectionIdentifier, const PAL::SessionID&);
-
- void scheduleStorageJob(const WebCore::ServiceWorkerJobData&);
-
- IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
- uint64_t messageSenderDestinationID() final { return m_identifier; }
-
- PAL::SessionID m_sessionID;
- uint64_t m_identifier;
-
- Ref<IPC::Connection> m_connection;
-}; // class WebSWServerConnection
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)
Deleted: trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in 2017-08-21 20:02:42 UTC (rev 220977)
@@ -1,34 +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.
-
-#if ENABLE(SERVICE_WORKER)
-
-messages -> WebSWServerConnection {
- # Messages targetting the Storage process
- ScheduleStorageJob(struct WebCore::ServiceWorkerJobData jobData)
-
- # Messages targetting the Web process.
- # When possible, they can be implemented directly by WebCore::SWServer::Connection
- JobRejected(uint64_t identifier, struct WebCore::ExceptionData exception)
-}
-
-#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -52,7 +52,7 @@
{
}
-SWServer::Connection& WebServiceWorkerProvider::serviceWorkerConnectionForSession(const SessionID& sessionID)
+WebCore::SWClientConnection& WebServiceWorkerProvider::serviceWorkerConnectionForSession(const SessionID& sessionID)
{
ASSERT(WebProcess::singleton().webToStorageProcessConnection());
return WebProcess::singleton().webToStorageProcessConnection()->serviceWorkerConnectionForSession(sessionID);
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -40,7 +40,7 @@
friend NeverDestroyed<WebServiceWorkerProvider>;
WebServiceWorkerProvider();
- WebCore::SWServer::Connection& serviceWorkerConnectionForSession(const PAL::SessionID&) final;
+ WebCore::SWClientConnection& serviceWorkerConnectionForSession(const PAL::SessionID&) final;
}; // class WebServiceWorkerProvider
Modified: trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp 2017-08-21 20:02:42 UTC (rev 220977)
@@ -30,8 +30,8 @@
#include "StorageToWebProcessConnectionMessages.h"
#include "WebIDBConnectionToServerMessages.h"
#include "WebProcess.h"
-#include "WebSWServerConnection.h"
-#include "WebSWServerConnectionMessages.h"
+#include "WebSWClientConnection.h"
+#include "WebSWClientConnectionMessages.h"
using namespace PAL;
using namespace WebCore;
@@ -60,8 +60,8 @@
#endif
#if ENABLE(SERVICE_WORKER)
- if (decoder.messageReceiverName() == Messages::WebSWServerConnection::messageReceiverName()) {
- auto serviceWorkerConnection = m_serviceWorkerConnectionsByIdentifier.get(decoder.destinationID());
+ if (decoder.messageReceiverName() == Messages::WebSWClientConnection::messageReceiverName()) {
+ auto serviceWorkerConnection = m_swConnectionsByIdentifier.get(decoder.destinationID());
if (serviceWorkerConnection)
serviceWorkerConnection->didReceiveMessage(connection, decoder);
return;
@@ -102,13 +102,13 @@
#endif
#if ENABLE(SERVICE_WORKER)
-WebSWServerConnection& WebToStorageProcessConnection::serviceWorkerConnectionForSession(const SessionID& sessionID)
+WebSWClientConnection& WebToStorageProcessConnection::serviceWorkerConnectionForSession(const SessionID& sessionID)
{
- auto result = m_serviceWorkerConnectionsBySession.add(sessionID, nullptr);
+ auto result = m_swConnectionsBySession.add(sessionID, nullptr);
if (result.isNewEntry) {
- result.iterator->value = WebSWServerConnection::create(sessionID);
- ASSERT(!m_serviceWorkerConnectionsByIdentifier.contains(result.iterator->value->identifier()));
- m_serviceWorkerConnectionsByIdentifier.set(result.iterator->value->identifier(), result.iterator->value);
+ result.iterator->value = std::make_unique<WebSWClientConnection>(m_connection.get(), sessionID);
+ ASSERT(!m_swConnectionsByIdentifier.contains(result.iterator->value->identifier()));
+ m_swConnectionsByIdentifier.set(result.iterator->value->identifier(), result.iterator->value.get());
}
return *result.iterator->value;
Modified: trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h (220976 => 220977)
--- trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h 2017-08-21 19:54:20 UTC (rev 220976)
+++ trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h 2017-08-21 20:02:42 UTC (rev 220977)
@@ -29,6 +29,8 @@
#include "Connection.h"
#include "MessageSender.h"
#include "WebIDBConnectionToServer.h"
+#include "WebSWClientConnection.h"
+#include <WebCore/SWServer.h>
#include <pal/SessionID.h>
#include <wtf/RefCounted.h>
@@ -38,8 +40,6 @@
namespace WebKit {
-class WebSWServerConnection;
-
class WebToStorageProcessConnection : public RefCounted<WebToStorageProcessConnection>, public IPC::Connection::Client, public IPC::MessageSender {
public:
static Ref<WebToStorageProcessConnection> create(IPC::Connection::Identifier connectionIdentifier)
@@ -54,7 +54,7 @@
WebIDBConnectionToServer& idbConnectionToServerForSession(const PAL::SessionID&);
#endif
#if ENABLE(SERVICE_WORKER)
- WebSWServerConnection& serviceWorkerConnectionForSession(const PAL::SessionID&);
+ WebSWClientConnection& serviceWorkerConnectionForSession(const PAL::SessionID&);
#endif
private:
@@ -77,8 +77,8 @@
#endif
#if ENABLE(SERVICE_WORKER)
- HashMap<PAL::SessionID, RefPtr<WebSWServerConnection>> m_serviceWorkerConnectionsBySession;
- HashMap<uint64_t, RefPtr<WebSWServerConnection>> m_serviceWorkerConnectionsByIdentifier;
+ HashMap<PAL::SessionID, std::unique_ptr<WebSWClientConnection>> m_swConnectionsBySession;
+ HashMap<uint64_t, WebSWClientConnection*> m_swConnectionsByIdentifier;
#endif
};