Changeset 248665 in webkit
- Timestamp:
- Aug 14, 2019 3:11:11 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r248664 r248665 1 2019-08-14 Youenn Fablet <youenn@apple.com> 2 3 NetworkProcess::m_swServerConnections should use WeakPtr 4 https://bugs.webkit.org/show_bug.cgi?id=200660 5 6 Reviewed by Geoffrey Garen. 7 8 Use WeakPtr for SWServer connections as an extra safety measure. 9 10 * NetworkProcess/NetworkProcess.cpp: 11 (WebKit::NetworkProcess::postMessageToServiceWorkerClient): 12 (WebKit::NetworkProcess::postMessageToServiceWorker): 13 (WebKit::NetworkProcess::registerSWServerConnection): 14 (WebKit::NetworkProcess::unregisterSWServerConnection): 15 * NetworkProcess/NetworkProcess.h: 16 1 17 2019-08-14 Youenn Fablet <youenn@apple.com> 2 18 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r248640 r248665 2485 2485 void NetworkProcess::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) 2486 2486 { 2487 if (auto *connection = m_swServerConnections.get(destinationIdentifier.serverConnectionIdentifier))2487 if (auto connection = m_swServerConnections.get(destinationIdentifier.serverConnectionIdentifier)) 2488 2488 connection->postMessageToServiceWorkerClient(destinationIdentifier.contextIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin); 2489 2489 } … … 2491 2491 void NetworkProcess::postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&& message, const WebCore::ServiceWorkerOrClientIdentifier& source, SWServerConnectionIdentifier connectionIdentifier) 2492 2492 { 2493 if (auto *connection = m_swServerConnections.get(connectionIdentifier))2493 if (auto connection = m_swServerConnections.get(connectionIdentifier)) 2494 2494 connection->postMessageToServiceWorker(destination, WTFMove(message), source); 2495 2495 } … … 2499 2499 ASSERT(parentProcessHasServiceWorkerEntitlement()); 2500 2500 ASSERT(!m_swServerConnections.contains(connection.identifier())); 2501 m_swServerConnections.add(connection.identifier(), &connection);2501 m_swServerConnections.add(connection.identifier(), makeWeakPtr(connection)); 2502 2502 auto* store = existingSWOriginStoreForSession(connection.sessionID()); 2503 2503 ASSERT(store); … … 2508 2508 void NetworkProcess::unregisterSWServerConnection(WebSWServerConnection& connection) 2509 2509 { 2510 ASSERT(m_swServerConnections.get(connection.identifier()) == &connection);2510 ASSERT(m_swServerConnections.get(connection.identifier()).get() == &connection); 2511 2511 m_swServerConnections.remove(connection.identifier()); 2512 2512 if (auto* store = existingSWOriginStoreForSession(connection.sessionID())) -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r248640 r248665 536 536 HashMap<PAL::SessionID, String> m_swDatabasePaths; 537 537 HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers; 538 HashMap<WebCore::SWServerConnectionIdentifier, We bSWServerConnection*> m_swServerConnections;538 HashMap<WebCore::SWServerConnectionIdentifier, WeakPtr<WebSWServerConnection>> m_swServerConnections; 539 539 #endif 540 540
Note: See TracChangeset
for help on using the changeset viewer.