Changeset 239701 in webkit
- Timestamp:
- Jan 7, 2019, 2:31:41 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r239700 r239701 1 2019-01-07 Alex Christensen <achristensen@webkit.org> 2 3 Remove use of NetworkProcess::singleton in ServiceWorker code 4 https://bugs.webkit.org/show_bug.cgi?id=193209 5 6 Reviewed by Megan Gardner. 7 8 Use a member Ref<NetworkProcess> instead to avoid global singleton use. 9 10 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 11 (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection): 12 * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: 13 (WebKit::WebSWServerConnection::WebSWServerConnection): 14 (WebKit::WebSWServerConnection::~WebSWServerConnection): 15 (WebKit::WebSWServerConnection::startFetch): 16 (WebKit::WebSWServerConnection::postMessageToServiceWorker): 17 (WebKit::WebSWServerConnection::scheduleJobInServer): 18 * NetworkProcess/ServiceWorker/WebSWServerConnection.h: 19 1 20 2019-01-07 Alex Christensen <achristensen@webkit.org> 2 21 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r239680 r239701 728 728 { 729 729 auto& server = m_networkProcess->swServerForSession(sessionID); 730 auto connection = std::make_unique<WebSWServerConnection>( server, m_connection.get(), sessionID);730 auto connection = std::make_unique<WebSWServerConnection>(m_networkProcess, server, m_connection.get(), sessionID); 731 731 732 732 serverConnectionIdentifier = connection->identifier(); -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
r239534 r239701 61 61 #define SWSERVERCONNECTION_RELEASE_LOG_ERROR_IF_ALLOWED(fmt, ...) RELEASE_LOG_ERROR_IF(m_sessionID.isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - WebSWServerConnection::" fmt, this, ##__VA_ARGS__) 62 62 63 WebSWServerConnection::WebSWServerConnection( SWServer& server, IPC::Connection& connection, SessionID sessionID)63 WebSWServerConnection::WebSWServerConnection(NetworkProcess& networkProcess, SWServer& server, IPC::Connection& connection, SessionID sessionID) 64 64 : SWServer::Connection(server) 65 65 , m_sessionID(sessionID) 66 66 , m_contentConnection(connection) 67 { 68 NetworkProcess::singleton().registerSWServerConnection(*this); 67 , m_networkProcess(networkProcess) 68 { 69 networkProcess.registerSWServerConnection(*this); 69 70 } 70 71 71 72 WebSWServerConnection::~WebSWServerConnection() 72 73 { 73 NetworkProcess::singleton().unregisterSWServerConnection(*this);74 m_networkProcess->unregisterSWServerConnection(*this); 74 75 for (const auto& keyValue : m_clientOrigins) 75 76 server().unregisterServiceWorkerClient(keyValue.value, keyValue.key); … … 166 167 167 168 if (!worker->contextConnection()) 168 NetworkProcess::singleton().createServerToContextConnection(worker->securityOrigin(), server().sessionID());169 m_networkProcess->createServerToContextConnection(worker->securityOrigin(), server().sessionID()); 169 170 170 171 server().runServiceWorkerIfNecessary(serviceWorkerIdentifier, [weakThis = WTFMove(weakThis), this, fetchIdentifier, serviceWorkerIdentifier, request = WTFMove(request), options = WTFMove(options), formData = WTFMove(formData), referrer = WTFMove(referrer)](auto* contextConnection) { … … 209 210 210 211 if (!destinationWorker->contextConnection()) 211 NetworkProcess::singleton().createServerToContextConnection(destinationWorker->securityOrigin(), server().sessionID());212 m_networkProcess->createServerToContextConnection(destinationWorker->securityOrigin(), server().sessionID()); 212 213 213 214 // It's possible this specific worker cannot be re-run (e.g. its registration has been removed) … … 221 222 { 222 223 auto securityOrigin = SecurityOriginData::fromURL(jobData.scriptURL); 223 if (! NetworkProcess::singleton().serverToContextConnectionForOrigin(securityOrigin))224 NetworkProcess::singleton().createServerToContextConnection(securityOrigin, server().sessionID());224 if (!m_networkProcess->serverToContextConnectionForOrigin(securityOrigin)) 225 m_networkProcess->createServerToContextConnection(securityOrigin, server().sessionID()); 225 226 226 227 SWSERVERCONNECTION_RELEASE_LOG_IF_ALLOWED("Scheduling ServiceWorker job %s in server", jobData.identifier().loggingString().utf8().data()); -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h
r239534 r239701 49 49 namespace WebKit { 50 50 51 class NetworkProcess; 52 51 53 class WebSWServerConnection : public WebCore::SWServer::Connection, public IPC::MessageSender, public IPC::MessageReceiver { 52 54 public: 53 WebSWServerConnection( WebCore::SWServer&, IPC::Connection&, PAL::SessionID);55 WebSWServerConnection(NetworkProcess&, WebCore::SWServer&, IPC::Connection&, PAL::SessionID); 54 56 WebSWServerConnection(const WebSWServerConnection&) = delete; 55 57 ~WebSWServerConnection() final; … … 104 106 PAL::SessionID m_sessionID; 105 107 Ref<IPC::Connection> m_contentConnection; 108 Ref<NetworkProcess> m_networkProcess; 106 109 HashMap<WebCore::ServiceWorkerClientIdentifier, WebCore::ClientOrigin> m_clientOrigins; 107 110 };
Note:
See TracChangeset
for help on using the changeset viewer.