Changeset 249801 in webkit
- Timestamp:
- Sep 12, 2019 1:18:15 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r249798 r249801 1 2019-09-12 Youenn Fablet <youenn@apple.com> 2 3 Use WebProcess processIdentifier to identify Service Worker connections 4 https://bugs.webkit.org/show_bug.cgi?id=201459 5 6 Reviewed by Chris Dumez. 7 8 No observable change of behavior. 9 10 * workers/service/ServiceWorkerClient.cpp: 11 (WebCore::ServiceWorkerClient::postMessage): 12 Pass sessionID to ease NetworkProcess selection of the client process connection. 13 * workers/service/ServiceWorkerTypes.h: 14 Mark server connection identifier be process identifier based. 15 * workers/service/context/SWContextManager.h: 16 * workers/service/server/SWServer.cpp: 17 (WebCore::SWServer::Connection::Connection): 18 * workers/service/server/SWServer.h: 19 Let connection identifier be set in constructor instead of generated. 20 1 21 2019-09-11 Youenn Fablet <youenn@apple.com> 2 22 -
trunk/Source/WebCore/PAL/ChangeLog
r249684 r249801 1 2019-09-12 Youenn Fablet <youenn@apple.com> 2 3 Use WebProcess processIdentifier to identify Service Worker connections 4 https://bugs.webkit.org/show_bug.cgi?id=201459 5 6 Reviewed by Chris Dumez. 7 8 * pal/SessionID.h: 9 (PAL::SessionID::SessionID): 10 1 11 2019-09-09 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Source/WebCore/PAL/pal/SessionID.h
r248854 r249801 56 56 } 57 57 58 explicit SessionID(uint64_t identifier) 59 : m_identifier(identifier) 60 { 61 } 62 58 63 PAL_EXPORT static SessionID generateEphemeralSessionID(); 59 64 PAL_EXPORT static SessionID generatePersistentSessionID(); … … 77 82 78 83 private: 79 explicit SessionID(uint64_t identifier)80 : m_identifier(identifier)81 {82 }83 84 84 static bool isValidSessionIDValue(uint64_t sessionID) { return sessionID != HashTableEmptyValueID && sessionID != HashTableDeletedValueID; } 85 85 -
trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp
r227425 r249801 100 100 MessageWithMessagePorts message = { messageData.releaseReturnValue(), portsOrException.releaseReturnValue() }; 101 101 auto sourceIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier(); 102 callOnMainThread([ message = WTFMove(message), destinationIdentifier = identifier(), sourceIdentifier, sourceOrigin = context.origin().isolatedCopy()] () mutable {102 callOnMainThread([sessionID = context.sessionID(), message = WTFMove(message), destinationIdentifier = identifier(), sourceIdentifier, sourceOrigin = context.origin().isolatedCopy()] () mutable { 103 103 if (auto* connection = SWContextManager::singleton().connection()) 104 connection->postMessageToServiceWorkerClient( destinationIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin);104 connection->postMessageToServiceWorkerClient(sessionID, destinationIdentifier, message, sourceIdentifier, sourceOrigin); 105 105 }); 106 106 -
trunk/Source/WebCore/workers/service/ServiceWorkerTypes.h
r237110 r249801 29 29 30 30 #include "DocumentIdentifier.h" 31 #include "ProcessIdentifier.h" 31 32 #include "ServiceWorkerIdentifier.h" 32 33 #include <wtf/ObjectIdentifier.h> … … 71 72 using SWServerToContextConnectionIdentifier = ObjectIdentifier<SWServerToContextConnectionIdentifierType>; 72 73 73 enum SWServerConnectionIdentifierType { };74 using SWServerConnectionIdentifierType = ProcessIdentifierType; 74 75 using SWServerConnectionIdentifier = ObjectIdentifier<SWServerConnectionIdentifierType>; 75 76 -
trunk/Source/WebCore/workers/service/context/SWContextManager.h
r249287 r249801 50 50 virtual ~Connection() { } 51 51 52 virtual void postMessageToServiceWorkerClient( const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&&, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0;52 virtual void postMessageToServiceWorkerClient(PAL::SessionID, const ServiceWorkerClientIdentifier& destinationIdentifier, const MessageWithMessagePorts&, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0; 53 53 virtual void serviceWorkerStarted(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool doesHandleFetch) = 0; 54 54 virtual void serviceWorkerFailedToStart(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& message) = 0; -
trunk/Source/WebCore/workers/service/server/SWServer.cpp
r249781 r249801 51 51 static Seconds terminationDelay { 10_s }; 52 52 53 SWServer::Connection::Connection(SWServer& server )53 SWServer::Connection::Connection(SWServer& server, Identifier identifier) 54 54 : m_server(server) 55 , m_identifier( SWServerConnectionIdentifier::generate())55 , m_identifier(identifier) 56 56 { 57 57 } -
trunk/Source/WebCore/workers/service/server/SWServer.h
r249627 r249801 57 57 enum class ServiceWorkerState : uint8_t; 58 58 struct ExceptionData; 59 struct MessageWithMessagePorts; 59 60 struct ServiceWorkerClientQueryOptions; 60 61 struct ServiceWorkerContextData; … … 87 88 virtual void notifyClientsOfControllerChange(const HashSet<DocumentIdentifier>& contextIdentifiers, const ServiceWorkerData& newController) = 0; 88 89 virtual void registrationReady(uint64_t registrationReadyRequestIdentifier, ServiceWorkerRegistrationData&&) = 0; 90 virtual void postMessageToServiceWorkerClient(DocumentIdentifier, const MessageWithMessagePorts&, ServiceWorkerIdentifier, const String& sourceOrigin) = 0; 89 91 90 92 virtual void serverToContextConnectionCreated(SWServerToContextConnection&) = 0; … … 94 96 95 97 protected: 96 WEBCORE_EXPORT explicit Connection(SWServer&);98 WEBCORE_EXPORT Connection(SWServer&, Identifier); 97 99 98 100 WEBCORE_EXPORT void finishFetchingScriptInServer(const ServiceWorkerFetchResult&); -
trunk/Source/WebKit/ChangeLog
r249795 r249801 1 2019-09-12 Youenn Fablet <youenn@apple.com> 2 3 Use WebProcess processIdentifier to identify Service Worker connections 4 https://bugs.webkit.org/show_bug.cgi?id=201459 5 6 Reviewed by Chris Dumez. 7 8 Make WebSWServerConnection be stored in NetworkConnectionToWebProcess. 9 They are now keyed by session IDs hence why WebSWClientConnection is using the session ID as message connection ID. 10 Creation no longer requires a sync IPC since the connection is uniquely identified by its session ID and its process ID. 11 These IDs are stable over network process crash. 12 Within NetworkProcess, a server connection is managed by a SWServer which is session ID specific. 13 In that case, the process identifier uniquely identifies the connection. 14 15 Move WebSWServerToContextConnection be owned by NetworkConnectionToWebProcess. 16 Instead of creating it when webprocess is connecting to network process, use a dedicated IPC message. 17 This is similar to WebSWServerConnection once WebProcess asks to create it. 18 This will allow existing WebProcess, in cache or running pages, to run service workers as well. 19 A context connection map is kept in Network Process to reuse context connections since these connections are not sessionID specific. 20 21 Migrate from a single boolean to a HashSet to track whether some connections are in the process of being created. 22 Previously if two requests to create connections were done shortly one after the other on different registrable 23 domains, the second request would not be processed. 24 25 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 26 (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): 27 (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): 28 (WebKit::NetworkConnectionToWebProcess::didClose): 29 (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection): 30 (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection): 31 * NetworkProcess/NetworkConnectionToWebProcess.h: 32 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 33 * NetworkProcess/NetworkProcess.cpp: 34 (WebKit::NetworkProcess::didReceiveMessage): 35 (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): 36 (WebKit::NetworkProcess::forEachSWServer): 37 (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const): 38 (WebKit::NetworkProcess::createServerToContextConnection): 39 (WebKit::NetworkProcess::postMessageToServiceWorkerClient): 40 (WebKit::NetworkProcess::registerSWServerConnection): 41 (WebKit::NetworkProcess::unregisterSWServerConnection): 42 (WebKit::NetworkProcess::registerSWContextConnection): 43 (WebKit::NetworkProcess::unregisterSWContextConnection): 44 * NetworkProcess/NetworkProcess.h: 45 * NetworkProcess/NetworkProcess.messages.in: 46 * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: 47 (WebKit::WebSWServerConnection::WebSWServerConnection): 48 (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient): 49 * NetworkProcess/ServiceWorker/WebSWServerConnection.h: 50 * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: 51 (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection): 52 (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection): 53 (WebKit::WebSWServerToContextConnection::postMessageToServiceWorkerClient): 54 (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded): 55 * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: 56 * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: 57 * UIProcess/Network/NetworkProcessProxy.cpp: 58 (WebKit::NetworkProcessProxy::openNetworkProcessConnection): 59 (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess): 60 * UIProcess/Network/NetworkProcessProxy.h: 61 * UIProcess/Network/NetworkProcessProxy.messages.in: 62 * UIProcess/WebProcessPool.cpp: 63 (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): 64 * UIProcess/WebProcessPool.h: 65 * UIProcess/WebProcessProxy.cpp: 66 (WebKit::WebProcessProxy::establishServiceWorkerContext): 67 * UIProcess/WebProcessProxy.h: 68 * WebProcess/Network/NetworkProcessConnection.cpp: 69 (WebKit::NetworkProcessConnection::didReceiveMessage): 70 (WebKit::NetworkProcessConnection::didClose): 71 (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession): 72 * WebProcess/Network/NetworkProcessConnection.h: 73 * WebProcess/Storage/WebSWClientConnection.cpp: 74 (WebKit::WebSWClientConnection::WebSWClientConnection): 75 (WebKit::WebSWClientConnection::~WebSWClientConnection): 76 (WebKit::WebSWClientConnection::messageSenderConnection const): 77 (WebKit::WebSWClientConnection::scheduleJobInServer): 78 (WebKit::WebSWClientConnection::finishFetchingScriptInServer): 79 (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer): 80 (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer): 81 (WebKit::WebSWClientConnection::postMessageToServiceWorker): 82 (WebKit::WebSWClientConnection::registerServiceWorkerClient): 83 (WebKit::WebSWClientConnection::unregisterServiceWorkerClient): 84 (WebKit::WebSWClientConnection::didResolveRegistrationPromise): 85 (WebKit::WebSWClientConnection::matchRegistration): 86 (WebKit::WebSWClientConnection::runOrDelayTaskForImport): 87 (WebKit::WebSWClientConnection::whenRegistrationReady): 88 (WebKit::WebSWClientConnection::getRegistrations): 89 (WebKit::WebSWClientConnection::startFetch): 90 (WebKit::WebSWClientConnection::cancelFetch): 91 (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse): 92 (WebKit::WebSWClientConnection::connectionToServerLost): 93 (WebKit::WebSWClientConnection::clear): 94 (WebKit::WebSWClientConnection::syncTerminateWorker): 95 (WebKit::WebSWClientConnection::updateThrottleState): 96 (WebKit::WebSWClientConnection::storeRegistrationsOnDiskForTesting): 97 * WebProcess/Storage/WebSWClientConnection.h: 98 * WebProcess/Storage/WebSWContextManagerConnection.cpp: 99 (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection): 100 (WebKit::m_userAgent): 101 (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient): 102 * WebProcess/Storage/WebSWContextManagerConnection.h: 103 * WebProcess/WebProcess.cpp: 104 (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess): 105 * WebProcess/WebProcess.h: 106 * WebProcess/WebProcess.messages.in: 107 1 108 2019-09-11 Keith Rollin <krollin@apple.com> 2 109 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r249640 r249801 214 214 #if ENABLE(SERVICE_WORKER) 215 215 if (decoder.messageReceiverName() == Messages::WebSWServerConnection::messageReceiverName()) { 216 if (auto swConnection = m_swConnections.get( makeObjectIdentifier<SWServerConnectionIdentifierType>(decoder.destinationID())))216 if (auto swConnection = m_swConnections.get(PAL::SessionID { decoder.destinationID() })) 217 217 swConnection->didReceiveMessage(connection, decoder); 218 218 return; 219 219 } 220 221 220 if (decoder.messageReceiverName() == Messages::WebSWServerToContextConnection::messageReceiverName()) { 222 if (auto* contextConnection = m_networkProcess->connectionToContextProcessFromIPCConnection(connection)) { 223 contextConnection->didReceiveMessage(connection, decoder); 221 ASSERT(m_swContextConnection); 222 if (m_swContextConnection) { 223 m_swContextConnection->didReceiveMessage(connection, decoder); 224 224 return; 225 225 } … … 227 227 228 228 if (decoder.messageReceiverName() == Messages::ServiceWorkerFetchTask::messageReceiverName()) { 229 if (auto* contextConnection = m_networkProcess->connectionToContextProcessFromIPCConnection(connection)) { 230 contextConnection->didReceiveFetchTaskMessage(connection, decoder); 229 ASSERT(m_swContextConnection); 230 if (m_swContextConnection) { 231 m_swContextConnection->didReceiveFetchTaskMessage(connection, decoder); 231 232 return; 232 233 } … … 269 270 #if ENABLE(SERVICE_WORKER) 270 271 if (decoder.messageReceiverName() == Messages::WebSWServerConnection::messageReceiverName()) { 271 if (auto swConnection = m_swConnections.get( makeObjectIdentifier<SWServerConnectionIdentifierType>(decoder.destinationID())))272 if (auto swConnection = m_swConnections.get(PAL::SessionID { decoder.destinationID() })) 272 273 swConnection->didReceiveSyncMessage(connection, decoder, reply); 273 274 return; … … 286 287 { 287 288 #if ENABLE(SERVICE_WORKER) 288 if (RefPtr<WebSWServerToContextConnection> serverToContextConnection = m_networkProcess->connectionToContextProcessFromIPCConnection(connection)) { 289 // Service Worker process exited. 290 m_networkProcess->connectionToContextProcessWasClosed(serverToContextConnection.releaseNonNull()); 291 return; 289 if (m_swContextConnection) { 290 auto& registrableDomain = m_swContextConnection->registrableDomain(); 291 292 m_swContextConnection->connectionClosed(); 293 294 Optional<PAL::SessionID> sessionID; 295 m_networkProcess->forEachSWServer([&](auto& server) { 296 server.markAllWorkersForRegistrableDomainAsTerminated(registrableDomain); 297 if (server.needsServerToContextConnectionForRegistrableDomain(registrableDomain)) 298 sessionID = server.sessionID(); 299 }); 300 if (sessionID) 301 m_networkProcess->createServerToContextConnection(registrableDomain, *sessionID); 292 302 } 293 303 #else … … 869 879 } 870 880 871 void NetworkConnectionToWebProcess::establishSWServerConnection(PAL::SessionID sessionID , CompletionHandler<void(WebCore::SWServerConnectionIdentifier&&)>&& completionHandler)881 void NetworkConnectionToWebProcess::establishSWServerConnection(PAL::SessionID sessionID) 872 882 { 873 883 auto& server = m_networkProcess->swServerForSession(sessionID); 874 auto connection = makeUnique<WebSWServerConnection>(m_networkProcess, server, m_connection.get(), sessionID); 875 876 SWServerConnectionIdentifier serverConnectionIdentifier = connection->identifier(); 877 LOG(ServiceWorker, "NetworkConnectionToWebProcess::establishSWServerConnection - %s", serverConnectionIdentifier.loggingString().utf8().data()); 878 879 ASSERT(!m_swConnections.contains(serverConnectionIdentifier)); 880 m_swConnections.add(serverConnectionIdentifier, makeWeakPtr(*connection)); 884 auto connection = makeUnique<WebSWServerConnection>(m_networkProcess, server, m_connection.get(), m_webProcessIdentifier, sessionID); 885 886 ASSERT(!m_swConnections.contains(sessionID)); 887 m_swConnections.add(sessionID, makeWeakPtr(*connection)); 881 888 server.addConnection(WTFMove(connection)); 882 completionHandler(WTFMove(serverConnectionIdentifier)); 889 } 890 891 void NetworkConnectionToWebProcess::establishSWContextConnection(RegistrableDomain&& registrableDomain) 892 { 893 m_swContextConnection = WebSWServerToContextConnection::create(m_networkProcess, registrableDomain, m_connection.get()); 894 895 m_networkProcess->forEachSWServer([&](auto& server) { 896 server.serverToContextConnectionCreated(*m_swContextConnection); 897 }); 883 898 } 884 899 #endif -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
r249640 r249801 69 69 class WebIDBConnectionToClient; 70 70 class WebSWServerConnection; 71 class WebSWServerToContextConnection; 71 72 typedef uint64_t ResourceLoadIdentifier; 72 73 … … 209 210 210 211 #if ENABLE(SERVICE_WORKER) 211 void establishSWServerConnection(PAL::SessionID, CompletionHandler<void(WebCore::SWServerConnectionIdentifier&&)>&&); 212 void establishSWServerConnection(PAL::SessionID); 213 void establishSWContextConnection(WebCore::RegistrableDomain&&); 212 214 void unregisterSWConnections(); 213 215 #endif … … 320 322 321 323 #if ENABLE(SERVICE_WORKER) 322 HashMap<WebCore::SWServerConnectionIdentifier, WeakPtr<WebSWServerConnection>> m_swConnections; 324 HashMap<PAL::SessionID, WeakPtr<WebSWServerConnection>> m_swConnections; 325 RefPtr<WebSWServerToContextConnection> m_swContextConnection; 323 326 #endif 324 327 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r249640 r249801 82 82 83 83 #if ENABLE(SERVICE_WORKER) 84 EstablishSWServerConnection(PAL::SessionID sessionID) -> (WebCore::SWServerConnectionIdentifier serverConnectionIdentifier) Synchronous 84 EstablishSWServerConnection(PAL::SessionID sessionID) 85 EstablishSWContextConnection(WebCore::RegistrableDomain domain) 85 86 #endif 86 87 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r249671 r249801 229 229 #endif 230 230 231 #if ENABLE(SERVICE_WORKER)232 if (decoder.messageReceiverName() == Messages::WebSWServerToContextConnection::messageReceiverName()) {233 ASSERT(parentProcessHasServiceWorkerEntitlement());234 if (!parentProcessHasServiceWorkerEntitlement())235 return;236 if (auto* webSWConnection = connectionToContextProcessFromIPCConnection(connection)) {237 webSWConnection->didReceiveMessage(connection, decoder);238 return;239 }240 }241 #endif242 231 didReceiveNetworkProcessMessage(connection, decoder); 243 232 } … … 430 419 } 431 420 432 void NetworkProcess::createNetworkConnectionToWebProcess(ProcessIdentifier identifier, bool isServiceWorkerProcess, WebCore::RegistrableDomain&& registrableDomain,CompletionHandler<void(Optional<IPC::Attachment>&&)>&& completionHandler)421 void NetworkProcess::createNetworkConnectionToWebProcess(ProcessIdentifier identifier, CompletionHandler<void(Optional<IPC::Attachment>&&)>&& completionHandler) 433 422 { 434 423 auto ipcConnection = createIPCConnectionToWebProcess(); … … 447 436 448 437 connection.setOnLineState(NetworkStateNotifier::singleton().onLine()); 449 450 #if ENABLE(SERVICE_WORKER)451 if (isServiceWorkerProcess) {452 ASSERT(parentProcessHasServiceWorkerEntitlement());453 ASSERT(m_waitingForServerToContextProcessConnection);454 auto contextConnection = WebSWServerToContextConnection::create(*this, registrableDomain, connection.connection());455 auto addResult = m_serverToContextConnections.add(WTFMove(registrableDomain), contextConnection.copyRef());456 ASSERT_UNUSED(addResult, addResult.isNewEntry);457 458 m_waitingForServerToContextProcessConnection = false;459 460 for (auto* server : SWServer::allServers())461 server->serverToContextConnectionCreated(contextConnection);462 }463 #else464 UNUSED_PARAM(isServiceWorkerProcess);465 UNUSED_PARAM(registrableDomain);466 #endif467 438 468 439 m_storageManagerSet->addConnection(connection.connection()); … … 2402 2373 2403 2374 #if ENABLE(SERVICE_WORKER) 2404 WebSWServerToContextConnection* NetworkProcess::connectionToContextProcessFromIPCConnection(IPC::Connection& connection) 2405 { 2406 for (auto& serverToContextConnection : m_serverToContextConnections.values()) { 2407 if (serverToContextConnection->ipcConnection() == &connection) 2408 return serverToContextConnection.get(); 2409 } 2410 return nullptr; 2411 } 2412 2413 void NetworkProcess::connectionToContextProcessWasClosed(Ref<WebSWServerToContextConnection>&& serverToContextConnection) 2414 { 2415 auto& registrableDomain = serverToContextConnection->registrableDomain(); 2416 2417 serverToContextConnection->connectionClosed(); 2418 m_serverToContextConnections.remove(registrableDomain); 2419 2420 for (auto& swServer : m_swServers.values()) 2421 swServer->markAllWorkersForRegistrableDomainAsTerminated(registrableDomain); 2422 2423 if (needsServerToContextConnectionForRegistrableDomain(registrableDomain)) { 2424 RELEASE_LOG(ServiceWorker, "Connection to service worker process was closed but is still needed, relaunching it"); 2425 createServerToContextConnection(registrableDomain, WTF::nullopt); 2426 } 2427 } 2428 2429 bool NetworkProcess::needsServerToContextConnectionForRegistrableDomain(const RegistrableDomain& registrableDomain) const 2430 { 2431 return WTF::anyOf(m_swServers.values(), [&](auto& swServer) { 2432 return swServer->needsServerToContextConnectionForRegistrableDomain(registrableDomain); 2433 }); 2375 void NetworkProcess::forEachSWServer(const Function<void(SWServer&)>& callback) 2376 { 2377 for (auto& server : m_swServers.values()) 2378 callback(*server); 2434 2379 } 2435 2380 … … 2459 2404 } 2460 2405 2406 bool NetworkProcess::needsServerToContextConnectionForRegistrableDomain(const RegistrableDomain& registrableDomain) const 2407 { 2408 return WTF::anyOf(m_swServers.values(), [&](auto& swServer) { 2409 return swServer->needsServerToContextConnectionForRegistrableDomain(registrableDomain); 2410 }); 2411 } 2412 2461 2413 WebSWServerToContextConnection* NetworkProcess::serverToContextConnectionForRegistrableDomain(const RegistrableDomain& registrableDomain) 2462 2414 { … … 2464 2416 } 2465 2417 2466 void NetworkProcess::createServerToContextConnection(const RegistrableDomain& registrableDomain, Optional<PAL::SessionID>sessionID)2467 { 2468 if (m_ waitingForServerToContextProcessConnection)2418 void NetworkProcess::createServerToContextConnection(const RegistrableDomain& registrableDomain, PAL::SessionID sessionID) 2419 { 2420 if (m_pendingConnectionDomains.contains(registrableDomain)) 2469 2421 return; 2470 2471 m_waitingForServerToContextProcessConnection = true; 2472 if (sessionID) 2473 parentProcessConnection()->send(Messages::NetworkProcessProxy::EstablishWorkerContextConnectionToNetworkProcessForExplicitSession(registrableDomain, *sessionID), 0); 2474 else 2475 parentProcessConnection()->send(Messages::NetworkProcessProxy::EstablishWorkerContextConnectionToNetworkProcess(registrableDomain), 0); 2476 } 2477 2478 void NetworkProcess::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) 2479 { 2480 if (auto connection = m_swServerConnections.get(destinationIdentifier.serverConnectionIdentifier)) 2422 2423 m_pendingConnectionDomains.add(registrableDomain); 2424 parentProcessConnection()->send(Messages::NetworkProcessProxy::EstablishWorkerContextConnectionToNetworkProcess { registrableDomain, sessionID }, 0); 2425 } 2426 2427 void NetworkProcess::postMessageToServiceWorkerClient(PAL::SessionID sessionID, const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) 2428 { 2429 if (auto* connection = swServerForSession(sessionID).connection(destinationIdentifier.serverConnectionIdentifier)) 2481 2430 connection->postMessageToServiceWorkerClient(destinationIdentifier.contextIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin); 2482 2431 } 2483 2432 2484 void NetworkProcess::postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&& message, const WebCore::ServiceWorkerOrClientIdentifier& source, SWServerConnectionIdentifier connectionIdentifier)2485 {2486 if (auto connection = m_swServerConnections.get(connectionIdentifier))2487 connection->postMessageToServiceWorker(destination, WTFMove(message), source);2488 }2489 2490 2433 void NetworkProcess::registerSWServerConnection(WebSWServerConnection& connection) 2491 2434 { 2492 2435 ASSERT(parentProcessHasServiceWorkerEntitlement()); 2493 ASSERT(!m_swServerConnections.contains(connection.identifier()));2494 m_swServerConnections.add(connection.identifier(), makeWeakPtr(connection));2495 2436 auto* store = existingSWOriginStoreForSession(connection.sessionID()); 2496 2437 ASSERT(store); … … 2501 2442 void NetworkProcess::unregisterSWServerConnection(WebSWServerConnection& connection) 2502 2443 { 2503 ASSERT(m_swServerConnections.get(connection.identifier()).get() == &connection);2504 m_swServerConnections.remove(connection.identifier());2505 2444 if (auto* store = existingSWOriginStoreForSession(connection.sessionID())) 2506 2445 store->unregisterSWServerConnection(connection); 2507 2446 } 2508 2447 2509 void NetworkProcess::swContextConnectionMayNoLongerBeNeeded(WebSWServerToContextConnection& serverToContextConnection) 2510 { 2511 auto& registrableDomain = serverToContextConnection.registrableDomain(); 2512 if (needsServerToContextConnectionForRegistrableDomain(registrableDomain)) 2513 return; 2514 2515 RELEASE_LOG(ServiceWorker, "Service worker process is no longer needed, terminating it"); 2516 serverToContextConnection.terminate(); 2517 2518 for (auto& swServer : m_swServers.values()) 2519 swServer->markAllWorkersForRegistrableDomainAsTerminated(registrableDomain); 2520 2521 serverToContextConnection.connectionClosed(); 2522 m_serverToContextConnections.remove(registrableDomain); 2448 void NetworkProcess::registerSWContextConnection(WebSWServerToContextConnection& connection) 2449 { 2450 ASSERT(!m_serverToContextConnections.contains(connection.registrableDomain())); 2451 m_pendingConnectionDomains.remove(connection.registrableDomain()); 2452 m_serverToContextConnections.add(connection.registrableDomain(), &connection); 2453 } 2454 2455 void NetworkProcess::unregisterSWContextConnection(WebSWServerToContextConnection& connection) 2456 { 2457 ASSERT(m_serverToContextConnections.get(connection.registrableDomain()) == &connection); 2458 m_serverToContextConnections.remove(connection.registrableDomain()); 2523 2459 } 2524 2460 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r249671 r249801 299 299 #if ENABLE(SERVICE_WORKER) 300 300 WebSWServerToContextConnection* serverToContextConnectionForRegistrableDomain(const WebCore::RegistrableDomain&); 301 void createServerToContextConnection(const WebCore::RegistrableDomain&, Optional<PAL::SessionID>);301 void createServerToContextConnection(const WebCore::RegistrableDomain&, PAL::SessionID); 302 302 303 303 WebCore::SWServer& swServerForSession(PAL::SessionID); … … 305 305 void unregisterSWServerConnection(WebSWServerConnection&); 306 306 307 void swContextConnectionMayNoLongerBeNeeded(WebSWServerToContextConnection&); 308 309 WebSWServerToContextConnection* connectionToContextProcessFromIPCConnection(IPC::Connection&); 310 void connectionToContextProcessWasClosed(Ref<WebSWServerToContextConnection>&&); 307 void registerSWContextConnection(WebSWServerToContextConnection&); 308 void unregisterSWContextConnection(WebSWServerToContextConnection&); 309 310 bool needsServerToContextConnectionForRegistrableDomain(const WebCore::RegistrableDomain&) const; 311 void forEachSWServer(const Function<void(WebCore::SWServer&)>&); 311 312 #endif 312 313 … … 394 395 void didReceiveSyncNetworkProcessMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&); 395 396 void initializeNetworkProcess(NetworkProcessCreationParameters&&); 396 void createNetworkConnectionToWebProcess(WebCore::ProcessIdentifier, bool isServiceWorkerProcess, WebCore::RegistrableDomain&&,CompletionHandler<void(Optional<IPC::Attachment>&&)>&&);397 void createNetworkConnectionToWebProcess(WebCore::ProcessIdentifier, CompletionHandler<void(Optional<IPC::Attachment>&&)>&&); 397 398 398 399 void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, uint64_t callbackID); … … 463 464 void didCreateWorkerContextProcessConnection(const IPC::Attachment&); 464 465 465 void postMessageToServiceWorkerClient( const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin);466 void postMessageToServiceWorker( WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source, WebCore::SWServerConnectionIdentifier);466 void postMessageToServiceWorkerClient(PAL::SessionID, const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin); 467 void postMessageToServiceWorker(PAL::SessionID, WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source, WebCore::SWServerConnectionIdentifier); 467 468 468 469 void disableServiceWorkerProcessTerminationDelay(); 469 470 470 471 WebSWOriginStore* existingSWOriginStoreForSession(PAL::SessionID) const; 471 bool needsServerToContextConnectionForRegistrableDomain(const WebCore::RegistrableDomain&) const;472 472 473 473 void addServiceWorkerSession(PAL::SessionID, String& serviceWorkerRegistrationDirectory, const SandboxExtension::Handle&); … … 540 540 541 541 #if ENABLE(SERVICE_WORKER) 542 HashMap<WebCore::RegistrableDomain, RefPtr<WebSWServerToContextConnection>> m_serverToContextConnections; 543 bool m_waitingForServerToContextProcessConnection { false }; 542 HashMap<WebCore::RegistrableDomain, WebSWServerToContextConnection*> m_serverToContextConnections; 544 543 bool m_shouldDisableServiceWorkerProcessTerminationDelay { false }; 545 544 HashMap<PAL::SessionID, String> m_swDatabasePaths; 546 545 HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers; 547 Hash Map<WebCore::SWServerConnectionIdentifier, WeakPtr<WebSWServerConnection>> m_swServerConnections;546 HashSet<WebCore::RegistrableDomain> m_pendingConnectionDomains; 548 547 #endif 549 548 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r249671 r249801 26 26 27 27 # Creates a connection for communication with a WebProcess 28 CreateNetworkConnectionToWebProcess(WebCore::ProcessIdentifier processIdentifier , bool isServiceWorkerProcess, WebCore::RegistrableDomain registrableDomain) -> (Optional<IPC::Attachment> connectionIdentifier) Async28 CreateNetworkConnectionToWebProcess(WebCore::ProcessIdentifier processIdentifier) -> (Optional<IPC::Attachment> connectionIdentifier) Async 29 29 30 30 #if USE(SOUP) … … 152 152 153 153 #if ENABLE(SERVICE_WORKER) 154 PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin) 155 156 PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerOrClientIdentifier source, WebCore::SWServerConnectionIdentifier connectionIdentifier) 157 154 PostMessageToServiceWorkerClient(PAL::SessionID sessionID, struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin) 158 155 DisableServiceWorkerProcessTerminationDelay() 159 156 #endif -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
r249287 r249801 62 62 #define SWSERVERCONNECTION_RELEASE_LOG_ERROR_IF_ALLOWED(fmt, ...) RELEASE_LOG_ERROR_IF(m_sessionID.isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - WebSWServerConnection::" fmt, this, ##__VA_ARGS__) 63 63 64 WebSWServerConnection::WebSWServerConnection(NetworkProcess& networkProcess, SWServer& server, IPC::Connection& connection, SessionID sessionID)65 : SWServer::Connection(server )64 WebSWServerConnection::WebSWServerConnection(NetworkProcess& networkProcess, SWServer& server, IPC::Connection& connection, ProcessIdentifier processIdentifier, SessionID sessionID) 65 : SWServer::Connection(server, processIdentifier) 66 66 , m_sessionID(sessionID) 67 67 , m_contentConnection(connection) … … 254 254 } 255 255 256 void WebSWServerConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)256 void WebSWServerConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, const MessageWithMessagePorts& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) 257 257 { 258 258 auto* sourceServiceWorker = server().workerByID(sourceIdentifier); … … 260 260 return; 261 261 262 send(Messages::WebSWClientConnection::PostMessageToServiceWorkerClient { destinationContextIdentifier, WTFMove(message), sourceServiceWorker->data(), sourceOrigin });262 send(Messages::WebSWClientConnection::PostMessageToServiceWorkerClient { destinationContextIdentifier, message, sourceServiceWorker->data(), sourceOrigin }); 263 263 } 264 264 -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h
r245299 r249801 32 32 #include "ServiceWorkerFetchTask.h" 33 33 #include <WebCore/FetchIdentifier.h> 34 #include <WebCore/ProcessIdentifier.h> 34 35 #include <WebCore/SWServer.h> 35 36 #include <pal/SessionID.h> … … 54 55 class WebSWServerConnection : public WebCore::SWServer::Connection, public IPC::MessageSender, public IPC::MessageReceiver { 55 56 public: 56 WebSWServerConnection(NetworkProcess&, WebCore::SWServer&, IPC::Connection&, PAL::SessionID);57 WebSWServerConnection(NetworkProcess&, WebCore::SWServer&, IPC::Connection&, WebCore::ProcessIdentifier, PAL::SessionID); 57 58 WebSWServerConnection(const WebSWServerConnection&) = delete; 58 59 ~WebSWServerConnection() final; … … 64 65 65 66 PAL::SessionID sessionID() const { return m_sessionID; } 66 67 void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceServiceWorkerIdentifier, const String& sourceOrigin);68 void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source);69 67 70 68 private: … … 95 93 void syncTerminateWorkerFromClient(WebCore::ServiceWorkerIdentifier&&, CompletionHandler<void()>&&); 96 94 95 void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, const WebCore::MessageWithMessagePorts&, WebCore::ServiceWorkerIdentifier sourceServiceWorkerIdentifier, const String& sourceOrigin) final; 96 97 97 void serverToContextConnectionCreated(WebCore::SWServerToContextConnection&) final; 98 98 … … 103 103 void updateThrottleState(); 104 104 105 void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source); 106 105 107 IPC::Connection* messageSenderConnection() const final { return m_contentConnection.ptr(); } 106 uint64_t messageSenderDestinationID() const final { return identifier().toUInt64(); }108 uint64_t messageSenderDestinationID() const final { return m_sessionID.toUInt64(); } 107 109 108 110 template<typename U> static void sendToContextProcess(WebCore::SWServerToContextConnection&, U&& message); -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp
r249287 r249801 30 30 31 31 #include "FormDataReference.h" 32 #include "Logging.h" 32 33 #include "NetworkProcess.h" 33 34 #include "ServiceWorkerFetchTask.h" … … 35 36 #include "WebCoreArgumentCoders.h" 36 37 #include "WebSWContextManagerConnectionMessages.h" 38 #include <WebCore/SWServer.h> 37 39 #include <WebCore/ServiceWorkerContextData.h> 38 40 … … 45 47 , m_networkProcess(networkProcess) 46 48 { 47 } 48 49 WebSWServerToContextConnection::~WebSWServerToContextConnection() = default; 49 m_networkProcess->registerSWContextConnection(*this); 50 } 51 52 WebSWServerToContextConnection::~WebSWServerToContextConnection() 53 { 54 m_networkProcess->unregisterSWContextConnection(*this); 55 } 50 56 51 57 IPC::Connection* WebSWServerToContextConnection::messageSenderConnection() const … … 66 72 } 67 73 74 void WebSWServerToContextConnection::postMessageToServiceWorkerClient(PAL::SessionID sessionID, const ServiceWorkerClientIdentifier& destinationIdentifier, const MessageWithMessagePorts& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) 75 { 76 if (auto* connection = m_networkProcess->swServerForSession(sessionID).connection(destinationIdentifier.serverConnectionIdentifier)) 77 connection->postMessageToServiceWorkerClient(destinationIdentifier.contextIdentifier, message, sourceIdentifier, sourceOrigin); 78 } 79 68 80 void WebSWServerToContextConnection::installServiceWorkerContext(const ServiceWorkerContextData& data, PAL::SessionID sessionID, const String& userAgent) 69 81 { … … 118 130 void WebSWServerToContextConnection::connectionMayNoLongerBeNeeded() 119 131 { 120 m_networkProcess->swContextConnectionMayNoLongerBeNeeded(*this); 132 if (m_networkProcess->needsServerToContextConnectionForRegistrableDomain(registrableDomain())) 133 return; 134 135 RELEASE_LOG(ServiceWorker, "Service worker process is no longer needed, terminating it"); 136 terminate(); 137 138 m_networkProcess->forEachSWServer([&](auto& server) { 139 server.markAllWorkersForRegistrableDomainAsTerminated(registrableDomain()); 140 }); 141 142 connectionClosed(); 121 143 } 122 144 -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h
r249287 r249801 35 35 namespace WebCore { 36 36 struct FetchOptions; 37 struct MessageWithMessagePorts; 37 38 class ResourceRequest; 38 39 } … … 83 84 uint64_t messageSenderDestinationID() const final; 84 85 86 void postMessageToServiceWorkerClient(PAL::SessionID, const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const WebCore::MessageWithMessagePorts&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin); 87 85 88 // Messages to the SW host WebProcess 86 89 void installServiceWorkerContext(const WebCore::ServiceWorkerContextData&, PAL::SessionID, const String& userAgent) final; -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in
r249287 r249801 37 37 Claim(uint64_t claimRequestIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier); 38 38 SetScriptResource(WebCore::ServiceWorkerIdentifier identifier, URL scriptURL, String script, URL responseURL, String mimeType); 39 PostMessageToServiceWorkerClient(PAL::SessionID sessionID, struct WebCore::ServiceWorkerClientIdentifier destination, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerIdentifier source, String sourceOrigin) 39 40 } 40 41 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r249778 r249801 143 143 void NetworkProcessProxy::openNetworkProcessConnection(uint64_t connectionRequestIdentifier, WebProcessProxy& webProcessProxy) 144 144 { 145 bool isServiceWorkerProcess = false; 146 RegistrableDomain registrableDomain; 147 #if ENABLE(SERVICE_WORKER) 148 if (webProcessProxy.isRunningServiceWorkers()) { 149 isServiceWorkerProcess = true; 150 registrableDomain = webProcessProxy.registrableDomain(); 151 } 152 #endif 153 154 connection()->sendWithAsyncReply(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess { webProcessProxy.coreProcessIdentifier(), isServiceWorkerProcess, registrableDomain }, [this, weakThis = makeWeakPtr(this), webProcessProxy = makeWeakPtr(webProcessProxy), connectionRequestIdentifier](auto&& connectionIdentifier) mutable { 145 connection()->sendWithAsyncReply(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess { webProcessProxy.coreProcessIdentifier() }, [this, weakThis = makeWeakPtr(this), webProcessProxy = makeWeakPtr(webProcessProxy), connectionRequestIdentifier](auto&& connectionIdentifier) mutable { 155 146 if (!weakThis) 156 147 return; … … 1210 1201 1211 1202 #if ENABLE(SERVICE_WORKER) 1212 void NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess(RegistrableDomain&& registrableDomain) 1213 { 1214 m_processPool.establishWorkerContextConnectionToNetworkProcess(*this, WTFMove(registrableDomain), WTF::nullopt); 1215 } 1216 1217 void NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession(RegistrableDomain&& registrableDomain, PAL::SessionID sessionID) 1203 void NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess(RegistrableDomain&& registrableDomain, PAL::SessionID sessionID) 1218 1204 { 1219 1205 m_processPool.establishWorkerContextConnectionToNetworkProcess(*this, WTFMove(registrableDomain), sessionID); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r249778 r249801 239 239 240 240 #if ENABLE(SERVICE_WORKER) 241 void establishWorkerContextConnectionToNetworkProcess(WebCore::RegistrableDomain&&); 242 void establishWorkerContextConnectionToNetworkProcessForExplicitSession(WebCore::RegistrableDomain&&, PAL::SessionID); 241 void establishWorkerContextConnectionToNetworkProcess(WebCore::RegistrableDomain&&, PAL::SessionID); 243 242 #endif 244 243 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r249501 r249801 62 62 63 63 #if ENABLE(SERVICE_WORKER) 64 EstablishWorkerContextConnectionToNetworkProcess(WebCore::RegistrableDomain registrableDomain) 65 EstablishWorkerContextConnectionToNetworkProcessForExplicitSession(WebCore::RegistrableDomain registrableDomain, PAL::SessionID explicitSession) 64 EstablishWorkerContextConnectionToNetworkProcess(WebCore::RegistrableDomain registrableDomain, PAL::SessionID sessionID) 66 65 #endif 67 66 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r249778 r249801 688 688 689 689 #if ENABLE(SERVICE_WORKER) 690 void WebProcessPool::establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy& proxy, RegistrableDomain&& registrableDomain, Optional<PAL::SessionID>sessionID)690 void WebProcessPool::establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy& proxy, RegistrableDomain&& registrableDomain, PAL::SessionID sessionID) 691 691 { 692 692 ASSERT_UNUSED(proxy, &proxy == m_networkProcess.get()); 693 693 694 if (m_serviceWorkerProcesses.contains(registrableDomain))695 return;696 697 694 m_mayHaveRegisteredServiceWorkers.clear(); 698 695 699 WebsiteDataStore* websiteDataStore = nullptr; 700 if (sessionID) 701 websiteDataStore = WebsiteDataStore::existingNonDefaultDataStoreForSessionID(*sessionID); 696 auto* websiteDataStore = WebsiteDataStore::existingNonDefaultDataStoreForSessionID(sessionID); 702 697 703 698 if (!websiteDataStore) { … … 707 702 } 708 703 704 if (m_serviceWorkerProcesses.contains(registrableDomain)) 705 return; 706 709 707 if (m_serviceWorkerProcesses.isEmpty()) 710 708 sendToAllProcesses(Messages::WebProcess::RegisterServiceWorkerClients { }); … … 719 717 m_processes.append(WTFMove(serviceWorkerProcessProxy)); 720 718 721 serviceWorkerProcessProxyPtr->establishServiceWorkerContext(m_serviceWorkerPreferences ? m_serviceWorkerPreferences.value() : m_defaultPageGroup->preferences().store() , sessionID.valueOr(PAL::SessionID::defaultSessionID()));719 serviceWorkerProcessProxyPtr->establishServiceWorkerContext(m_serviceWorkerPreferences ? m_serviceWorkerPreferences.value() : m_defaultPageGroup->preferences().store()); 722 720 if (!m_serviceWorkerUserAgent.isNull()) 723 721 serviceWorkerProcessProxyPtr->setServiceWorkerUserAgent(m_serviceWorkerUserAgent); -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r249778 r249801 382 382 bool isServiceWorkerPageID(WebPageProxyIdentifier) const; 383 383 #if ENABLE(SERVICE_WORKER) 384 void establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy&, WebCore::RegistrableDomain&&, Optional<PAL::SessionID>);384 void establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy&, WebCore::RegistrableDomain&&, PAL::SessionID); 385 385 const HashMap<WebCore::RegistrableDomain, WebProcessProxy*>& serviceWorkerProxies() const { return m_serviceWorkerProcesses; } 386 386 void setAllowsAnySSLCertificateForServiceWorker(bool allows) { m_allowsAnySSLCertificateForServiceWorker = allows; } -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r249647 r249801 1494 1494 1495 1495 #if ENABLE(SERVICE_WORKER) 1496 void WebProcessProxy::establishServiceWorkerContext(const WebPreferencesStore& store , PAL::SessionID sessionID)1497 { 1498 send(Messages::WebProcess::EstablishWorkerContextConnectionToNetworkProcess { processPool().defaultPageGroup().pageGroupID(), m_serviceWorkerInformation->serviceWorkerPageProxyID, m_serviceWorkerInformation->serviceWorkerPageID, store, sessionID}, 0);1496 void WebProcessProxy::establishServiceWorkerContext(const WebPreferencesStore& store) 1497 { 1498 send(Messages::WebProcess::EstablishWorkerContextConnectionToNetworkProcess { processPool().defaultPageGroup().pageGroupID(), m_serviceWorkerInformation->serviceWorkerPageProxyID, m_serviceWorkerInformation->serviceWorkerPageID, store, *m_registrableDomain, m_websiteDataStore->sessionID() }, 0); 1499 1499 } 1500 1500 -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r249647 r249801 314 314 315 315 #if ENABLE(SERVICE_WORKER) 316 void establishServiceWorkerContext(const WebPreferencesStore&, PAL::SessionID); 317 void startForServiceWorkers(const WebPreferencesStore&, PAL::SessionID); 316 void establishServiceWorkerContext(const WebPreferencesStore&); 318 317 void setServiceWorkerUserAgent(const String&); 319 318 void updateServiceWorkerPreferencesStore(const WebPreferencesStore&); -
trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp
r249640 r249801 138 138 #if ENABLE(SERVICE_WORKER) 139 139 if (decoder.messageReceiverName() == Messages::WebSWClientConnection::messageReceiverName()) { 140 auto serviceWorkerConnection = m_swConnectionsBy Identifier.get(makeObjectIdentifier<SWServerConnectionIdentifierType>(decoder.destinationID()));140 auto serviceWorkerConnection = m_swConnectionsBySession.get(PAL::SessionID { decoder.destinationID() }); 141 141 if (serviceWorkerConnection) 142 142 serviceWorkerConnection->didReceiveMessage(connection, decoder); … … 201 201 202 202 #if ENABLE(SERVICE_WORKER) 203 auto swConnections = std::exchange(m_swConnectionsBy Identifier, { });203 auto swConnections = std::exchange(m_swConnectionsBySession, { }); 204 204 for (auto& connection : swConnections.values()) 205 205 connection->connectionToServerLost(); … … 265 265 }).iterator->value; 266 266 } 267 268 void NetworkProcessConnection::removeSWClientConnection(WebSWClientConnection& connection)269 {270 ASSERT(m_swConnectionsByIdentifier.contains(connection.serverConnectionIdentifier()));271 m_swConnectionsByIdentifier.remove(connection.serverConnectionIdentifier());272 }273 274 SWServerConnectionIdentifier NetworkProcessConnection::initializeSWClientConnection(WebSWClientConnection& connection)275 {276 ASSERT(connection.sessionID().isValid());277 SWServerConnectionIdentifier identifier;278 bool result = m_connection->sendSync(Messages::NetworkConnectionToWebProcess::EstablishSWServerConnection(connection.sessionID()), Messages::NetworkConnectionToWebProcess::EstablishSWServerConnection::Reply(identifier), 0);279 ASSERT_UNUSED(result, result);280 281 ASSERT(!m_swConnectionsByIdentifier.contains(identifier));282 m_swConnectionsByIdentifier.add(identifier, &connection);283 284 return identifier;285 }286 267 #endif 287 268 -
trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h
r249640 r249801 79 79 WebSWClientConnection* existingServiceWorkerConnectionForSession(PAL::SessionID sessionID) { return m_swConnectionsBySession.get(sessionID); } 80 80 WebSWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID); 81 82 WebCore::SWServerConnectionIdentifier initializeSWClientConnection(WebSWClientConnection&);83 void removeSWClientConnection(WebSWClientConnection&);84 81 #endif 85 82 … … 114 111 #if ENABLE(SERVICE_WORKER) 115 112 HashMap<PAL::SessionID, RefPtr<WebSWClientConnection>> m_swConnectionsBySession; 116 HashMap<WebCore::SWServerConnectionIdentifier, WebSWClientConnection*> m_swConnectionsByIdentifier;117 113 #endif 118 114 }; -
trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
r249526 r249801 32 32 #include "FormDataReference.h" 33 33 #include "Logging.h" 34 #include "NetworkConnectionToWebProcessMessages.h" 34 35 #include "NetworkProcessConnection.h" 35 36 #include "NetworkProcessMessages.h" … … 41 42 #include "WebSWServerConnectionMessages.h" 42 43 #include <WebCore/Document.h> 44 #include <WebCore/ProcessIdentifier.h> 43 45 #include <WebCore/SecurityOrigin.h> 44 46 #include <WebCore/SerializedScriptValue.h> … … 56 58 WebSWClientConnection::WebSWClientConnection(SessionID sessionID) 57 59 : m_sessionID(sessionID) 60 , m_identifier(Process::identifier()) 58 61 , m_swOriginTable(makeUniqueRef<WebSWOriginTable>()) 59 62 { 60 63 ASSERT(m_sessionID.isValid()); 61 initializeConnectionIfNeeded();64 send(Messages::NetworkConnectionToWebProcess::EstablishSWServerConnection { sessionID }); 62 65 } 63 66 64 67 WebSWClientConnection::~WebSWClientConnection() 65 68 { 66 if (m_connection) 67 WebProcess::singleton().ensureNetworkProcessConnection().removeSWClientConnection(*this); 68 } 69 70 void WebSWClientConnection::initializeConnectionIfNeeded() 71 { 72 if (m_connection) 73 return; 74 75 auto& networkProcessConnection = WebProcess::singleton().ensureNetworkProcessConnection(); 76 77 m_connection = &networkProcessConnection.connection(); 78 m_identifier = networkProcessConnection.initializeSWClientConnection(*this); 79 80 updateThrottleState(); 81 } 82 83 template<typename U> 84 void WebSWClientConnection::ensureConnectionAndSend(const U& message) 85 { 86 initializeConnectionIfNeeded(); 87 if (m_connection) 88 send(message); 69 clear(); 70 } 71 72 IPC::Connection* WebSWClientConnection::messageSenderConnection() const 73 { 74 return &WebProcess::singleton().ensureNetworkProcessConnection().connection(); 89 75 } 90 76 91 77 void WebSWClientConnection::scheduleJobInServer(const ServiceWorkerJobData& jobData) 92 78 { 93 ensureConnectionAndSend(Messages::WebSWServerConnection::ScheduleJobInServer(jobData));79 send(Messages::WebSWServerConnection::ScheduleJobInServer { jobData }); 94 80 } 95 81 96 82 void WebSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result) 97 83 { 98 ensureConnectionAndSend(Messages::WebSWServerConnection::FinishFetchingScriptInServer(result));84 send(Messages::WebSWServerConnection::FinishFetchingScriptInServer { result }); 99 85 } 100 86 101 87 void WebSWClientConnection::addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier) 102 88 { 103 ensureConnectionAndSend(Messages::WebSWServerConnection::AddServiceWorkerRegistrationInServer(identifier));89 send(Messages::WebSWServerConnection::AddServiceWorkerRegistrationInServer { identifier }); 104 90 } 105 91 106 92 void WebSWClientConnection::removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier) 107 93 { 108 ensureConnectionAndSend(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer(identifier));94 send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer { identifier }); 109 95 } 110 96 111 97 void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, MessageWithMessagePorts&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier) 112 98 { 113 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkProcess::PostMessageToServiceWorker { destinationIdentifier, WTFMove(message), sourceIdentifier, serverConnectionIdentifier() }, 0);99 send(Messages::WebSWServerConnection::PostMessageToServiceWorker { destinationIdentifier, WTFMove(message), sourceIdentifier }); 114 100 } 115 101 116 102 void WebSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData& data, const Optional<WebCore::ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier, const String& userAgent) 117 103 { 118 ensureConnectionAndSend(Messages::WebSWServerConnection::RegisterServiceWorkerClient { topOrigin.data(), data, controllingServiceWorkerRegistrationIdentifier, userAgent });104 send(Messages::WebSWServerConnection::RegisterServiceWorkerClient { topOrigin.data(), data, controllingServiceWorkerRegistrationIdentifier, userAgent }); 119 105 } 120 106 121 107 void WebSWClientConnection::unregisterServiceWorkerClient(DocumentIdentifier contextIdentifier) 122 108 { 123 ensureConnectionAndSend(Messages::WebSWServerConnection::UnregisterServiceWorkerClient { ServiceWorkerClientIdentifier { serverConnectionIdentifier(), contextIdentifier } });109 send(Messages::WebSWServerConnection::UnregisterServiceWorkerClient { ServiceWorkerClientIdentifier { serverConnectionIdentifier(), contextIdentifier } }); 124 110 } 125 111 126 112 void WebSWClientConnection::didResolveRegistrationPromise(const ServiceWorkerRegistrationKey& key) 127 113 { 128 ensureConnectionAndSend(Messages::WebSWServerConnection::DidResolveRegistrationPromise(key));114 send(Messages::WebSWServerConnection::DidResolveRegistrationPromise { key }); 129 115 } 130 116 … … 177 163 uint64_t callbackID = ++m_previousCallbackIdentifier; 178 164 m_ongoingMatchRegistrationTasks.add(callbackID, WTFMove(callback)); 179 ensureConnectionAndSend(Messages::WebSWServerConnection::MatchRegistration(callbackID, topOrigin, clientURL));165 send(Messages::WebSWServerConnection::MatchRegistration(callbackID, topOrigin, clientURL)); 180 166 }); 181 167 } 182 168 183 void WebSWClientConnection::runOrDelayTaskForImport( WTF::Function<void()>&& task)169 void WebSWClientConnection::runOrDelayTaskForImport(Function<void()>&& task) 184 170 { 185 171 if (m_swOriginTable->isImported()) { … … 188 174 } 189 175 m_tasksPendingOriginImport.append(WTFMove(task)); 190 initializeConnectionIfNeeded();191 176 } 192 177 … … 195 180 uint64_t callbackID = ++m_previousCallbackIdentifier; 196 181 m_ongoingRegistrationReadyTasks.add(callbackID, WTFMove(callback)); 197 ensureConnectionAndSend(Messages::WebSWServerConnection::WhenRegistrationReady(callbackID, topOrigin, clientURL));182 send(Messages::WebSWServerConnection::WhenRegistrationReady(callbackID, topOrigin, clientURL)); 198 183 } 199 184 … … 217 202 uint64_t callbackID = ++m_previousCallbackIdentifier; 218 203 m_ongoingGetRegistrationsTasks.add(callbackID, WTFMove(callback)); 219 ensureConnectionAndSend(Messages::WebSWServerConnection::GetRegistrations(callbackID, topOrigin, clientURL));204 send(Messages::WebSWServerConnection::GetRegistrations { callbackID, topOrigin, clientURL }); 220 205 }); 221 206 } … … 223 208 void WebSWClientConnection::startFetch(FetchIdentifier fetchIdentifier, ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier, const ResourceRequest& request, const FetchOptions& options, const String& referrer) 224 209 { 225 ensureConnectionAndSend(Messages::WebSWServerConnection::StartFetch { serviceWorkerRegistrationIdentifier, fetchIdentifier, request, options, IPC::FormDataReference { request.httpBody() }, referrer });210 send(Messages::WebSWServerConnection::StartFetch { serviceWorkerRegistrationIdentifier, fetchIdentifier, request, options, IPC::FormDataReference { request.httpBody() }, referrer }); 226 211 } 227 212 228 213 void WebSWClientConnection::cancelFetch(FetchIdentifier fetchIdentifier, ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier) 229 214 { 230 ensureConnectionAndSend(Messages::WebSWServerConnection::CancelFetch { serviceWorkerRegistrationIdentifier, fetchIdentifier });215 send(Messages::WebSWServerConnection::CancelFetch { serviceWorkerRegistrationIdentifier, fetchIdentifier }); 231 216 } 232 217 233 218 void WebSWClientConnection::continueDidReceiveFetchResponse(FetchIdentifier fetchIdentifier, ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier) 234 219 { 235 ensureConnectionAndSend(Messages::WebSWServerConnection::ContinueDidReceiveFetchResponse { serviceWorkerRegistrationIdentifier, fetchIdentifier });220 send(Messages::WebSWServerConnection::ContinueDidReceiveFetchResponse { serviceWorkerRegistrationIdentifier, fetchIdentifier }); 236 221 } 237 222 238 223 void WebSWClientConnection::connectionToServerLost() 239 224 { 240 m_connection = nullptr; 241 225 clear(); 226 } 227 228 void WebSWClientConnection::clear() 229 { 242 230 auto registrationTasks = WTFMove(m_ongoingMatchRegistrationTasks); 243 231 for (auto& callback : registrationTasks.values()) … … 248 236 callback({ }); 249 237 238 auto registrationReadyTasks = WTFMove(m_ongoingRegistrationReadyTasks); 239 for (auto& callback : registrationReadyTasks.values()) 240 callback({ }); 241 250 242 clearPendingJobs(); 251 243 } … … 253 245 void WebSWClientConnection::syncTerminateWorker(ServiceWorkerIdentifier identifier) 254 246 { 255 initializeConnectionIfNeeded(); 256 257 sendSync(Messages::WebSWServerConnection::SyncTerminateWorkerFromClient(identifier), Messages::WebSWServerConnection::SyncTerminateWorkerFromClient::Reply()); 258 } 259 260 WebCore::SWServerConnectionIdentifier WebSWClientConnection::serverConnectionIdentifier() const 261 { 262 const_cast<WebSWClientConnection*>(this)->initializeConnectionIfNeeded(); 263 return m_identifier; 247 sendSync(Messages::WebSWServerConnection::SyncTerminateWorkerFromClient { identifier }, Messages::WebSWServerConnection::SyncTerminateWorkerFromClient::Reply()); 264 248 } 265 249 … … 267 251 { 268 252 m_isThrottleable = WebProcess::singleton().areAllPagesThrottleable(); 269 ensureConnectionAndSend(Messages::WebSWServerConnection::SetThrottleState { m_isThrottleable });253 send(Messages::WebSWServerConnection::SetThrottleState { m_isThrottleable }); 270 254 } 271 255 272 256 void WebSWClientConnection::storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&& callback) 273 257 { 274 initializeConnectionIfNeeded();275 258 sendWithAsyncReply(Messages::WebSWServerConnection::StoreRegistrationsOnDisk { }, WTFMove(callback)); 276 259 } -
trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h
r249526 r249801 53 53 ~WebSWClientConnection(); 54 54 55 WebCore::SWServerConnectionIdentifier serverConnectionIdentifier() const final ;55 WebCore::SWServerConnectionIdentifier serverConnectionIdentifier() const final { return m_identifier; } 56 56 57 57 void addServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier) final; … … 74 74 private: 75 75 explicit WebSWClientConnection(PAL::SessionID); 76 77 void initializeConnectionIfNeeded();78 76 79 77 void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final; … … 98 96 void scheduleStorageJob(const WebCore::ServiceWorkerJobData&); 99 97 100 void runOrDelayTaskForImport( WTF::Function<void()>&& task);98 void runOrDelayTaskForImport(Function<void()>&& task); 101 99 102 IPC::Connection* messageSenderConnection() const final { return m_connection.get(); }103 uint64_t messageSenderDestinationID() const final { return m_ identifier.toUInt64(); }100 IPC::Connection* messageSenderConnection() const final; 101 uint64_t messageSenderDestinationID() const final { return m_sessionID.toUInt64(); } 104 102 105 103 void setSWOriginTableSharedMemory(const SharedMemory::Handle&); 106 104 void setSWOriginTableIsImported(); 107 105 108 template<typename U> void ensureConnectionAndSend(const U& message);106 void clear(); 109 107 110 108 PAL::SessionID m_sessionID; 111 109 WebCore::SWServerConnectionIdentifier m_identifier; 112 110 113 RefPtr<IPC::Connection> m_connection;114 111 UniqueRef<WebSWOriginTable> m_swOriginTable; 115 112 … … 118 115 HashMap<uint64_t, GetRegistrationsCallback> m_ongoingGetRegistrationsTasks; 119 116 HashMap<uint64_t, WhenRegistrationReadyCallback> m_ongoingRegistrationReadyTasks; 120 Deque< WTF::Function<void()>> m_tasksPendingOriginImport;117 Deque<Function<void()>> m_tasksPendingOriginImport; 121 118 bool m_isThrottleable { true }; 122 119 }; // class WebSWServerConnection -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
r249626 r249801 32 32 #include "FormDataReference.h" 33 33 #include "Logging.h" 34 #include "NetworkConnectionToWebProcessMessages.h" 34 35 #include "NetworkProcessMessages.h" 35 36 #include "ServiceWorkerFetchTaskMessages.h" … … 87 88 } 88 89 89 WebSWContextManagerConnection::WebSWContextManagerConnection(Ref<IPC::Connection>&& connection, uint64_t pageGroupID, WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, const WebPreferencesStore& store)90 WebSWContextManagerConnection::WebSWContextManagerConnection(Ref<IPC::Connection>&& connection, WebCore::RegistrableDomain&& registrableDomain, uint64_t pageGroupID, WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, const WebPreferencesStore& store) 90 91 : m_connectionToNetworkProcess(WTFMove(connection)) 92 , m_registrableDomain(WTFMove(registrableDomain)) 91 93 , m_pageGroupID(pageGroupID) 92 94 , m_webPageProxyID(webPageProxyID) … … 99 101 { 100 102 updatePreferencesStore(store); 103 m_connectionToNetworkProcess->send(Messages::NetworkConnectionToWebProcess::EstablishSWContextConnection { m_registrableDomain }, 0); 101 104 } 102 105 … … 261 264 } 262 265 263 void WebSWContextManagerConnection::postMessageToServiceWorkerClient( const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)264 { 265 m_connectionToNetworkProcess->send(Messages:: NetworkProcess::PostMessageToServiceWorkerClient(destinationIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin), 0);266 void WebSWContextManagerConnection::postMessageToServiceWorkerClient(PAL::SessionID sessionID, const ServiceWorkerClientIdentifier& destinationIdentifier, const MessageWithMessagePorts& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) 267 { 268 m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::PostMessageToServiceWorkerClient(sessionID, destinationIdentifier, message, sourceIdentifier, sourceOrigin), 0); 266 269 } 267 270 -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
r249501 r249801 54 54 class WebSWContextManagerConnection final : public WebCore::SWContextManager::Connection, public IPC::MessageReceiver { 55 55 public: 56 WebSWContextManagerConnection(Ref<IPC::Connection>&&, uint64_t pageGroupID, WebPageProxyIdentifier, WebCore::PageIdentifier, const WebPreferencesStore&);56 WebSWContextManagerConnection(Ref<IPC::Connection>&&, WebCore::RegistrableDomain&&, uint64_t pageGroupID, WebPageProxyIdentifier, WebCore::PageIdentifier, const WebPreferencesStore&); 57 57 ~WebSWContextManagerConnection(); 58 58 … … 66 66 67 67 // WebCore::SWContextManager::Connection. 68 void postMessageToServiceWorkerClient( const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;68 void postMessageToServiceWorkerClient(PAL::SessionID, const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const WebCore::MessageWithMessagePorts&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final; 69 69 void didFinishInstall(Optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final; 70 70 void didFinishActivation(WebCore::ServiceWorkerIdentifier) final; … … 100 100 101 101 Ref<IPC::Connection> m_connectionToNetworkProcess; 102 WebCore::RegistrableDomain m_registrableDomain; 102 103 uint64_t m_pageGroupID; 103 104 WebPageProxyIdentifier m_webPageProxyID; -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r249640 r249801 1812 1812 1813 1813 #if ENABLE(SERVICE_WORKER) 1814 void WebProcess::establishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, const WebPreferencesStore& store, PAL::SessionID initialSessionID)1814 void WebProcess::establishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, const WebPreferencesStore& store, RegistrableDomain&& registrableDomain, PAL::SessionID initialSessionID) 1815 1815 { 1816 1816 // We are in the Service Worker context process and the call below establishes our connection to the Network Process … … 1818 1818 // NetworkProcessConnection for synchronization purposes. 1819 1819 auto& ipcConnection = ensureNetworkProcessConnection().connection(); 1820 SWContextManager::singleton().setConnection(makeUnique<WebSWContextManagerConnection>(ipcConnection, pageGroupID, webPageProxyID, pageID, store));1820 SWContextManager::singleton().setConnection(makeUnique<WebSWContextManagerConnection>(ipcConnection, WTFMove(registrableDomain), pageGroupID, webPageProxyID, pageID, store)); 1821 1821 } 1822 1822 -
trunk/Source/WebKit/WebProcess/WebProcess.h
r249501 r249801 366 366 367 367 #if ENABLE(SERVICE_WORKER) 368 void establishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebPageProxyIdentifier, WebCore::PageIdentifier, const WebPreferencesStore&, PAL::SessionID);368 void establishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebPageProxyIdentifier, WebCore::PageIdentifier, const WebPreferencesStore&, WebCore::RegistrableDomain&&, PAL::SessionID); 369 369 void registerServiceWorkerClients(); 370 370 #endif -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r249501 r249801 112 112 113 113 #if ENABLE(SERVICE_WORKER) 114 EstablishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebKit::WebPageProxyIdentifier webPageProxyID, WebCore::PageIdentifier pageID, struct WebKit::WebPreferencesStore store, PAL::SessionID initialSessionID)114 EstablishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebKit::WebPageProxyIdentifier webPageProxyID, WebCore::PageIdentifier pageID, struct WebKit::WebPreferencesStore store, WebCore::RegistrableDomain domain, PAL::SessionID initialSessionID) 115 115 RegisterServiceWorkerClients() 116 116 #endif
Note: See TracChangeset
for help on using the changeset viewer.