Title: [223141] trunk/Source/WebKit
Revision
223141
Author
beid...@apple.com
Date
2017-10-10 14:03:04 -0700 (Tue, 10 Oct 2017)

Log Message

Random StorageProcess and SWServer cleanup.
https://bugs.webkit.org/show_bug.cgi?id=178141

Reviewed by Andy Estes.

-StorageProcess should own the set of SWServers
-Some renaming and cleanup

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::createStorageToWebProcessConnection):
(WebKit::StorageProcess::swServerForSession):
* StorageProcess/StorageProcess.h:
(WebKit::StorageProcess::queue):

* StorageProcess/StorageToWebProcessConnection.cpp:
(WebKit::StorageToWebProcessConnection::establishSWServerConnection):
* StorageProcess/StorageToWebProcessConnection.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (223140 => 223141)


--- trunk/Source/WebKit/ChangeLog	2017-10-10 20:50:20 UTC (rev 223140)
+++ trunk/Source/WebKit/ChangeLog	2017-10-10 21:03:04 UTC (rev 223141)
@@ -1,3 +1,23 @@
+2017-10-10  Brady Eidson  <beid...@apple.com>
+
+        Random StorageProcess and SWServer cleanup.
+        https://bugs.webkit.org/show_bug.cgi?id=178141
+
+        Reviewed by Andy Estes.
+
+        -StorageProcess should own the set of SWServers
+        -Some renaming and cleanup
+
+        * StorageProcess/StorageProcess.cpp:
+        (WebKit::StorageProcess::createStorageToWebProcessConnection):
+        (WebKit::StorageProcess::swServerForSession):
+        * StorageProcess/StorageProcess.h:
+        (WebKit::StorageProcess::queue):
+
+        * StorageProcess/StorageToWebProcessConnection.cpp:
+        (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
+        * StorageProcess/StorageToWebProcessConnection.h:
+
 2017-10-10  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Unreviewed, rolling out r223136.

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (223140 => 223141)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2017-10-10 20:50:20 UTC (rev 223140)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2017-10-10 21:03:04 UTC (rev 223141)
@@ -164,7 +164,7 @@
 {
 #if USE(UNIX_DOMAIN_SOCKETS)
     IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
-    m_databaseToWebProcessConnections.append(StorageToWebProcessConnection::create(socketPair.server));
+    m_storageToWebProcessConnections.append(StorageToWebProcessConnection::create(socketPair.server));
     parentProcessConnection()->send(Messages::StorageProcessProxy::DidCreateStorageToWebProcessConnection(IPC::Attachment(socketPair.client)), 0);
 #elif OS(DARWIN)
     // Create the listening port.
@@ -172,7 +172,7 @@
     mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
 
     // Create a listening connection.
-    m_databaseToWebProcessConnections.append(StorageToWebProcessConnection::create(IPC::Connection::Identifier(listeningPort)));
+    m_storageToWebProcessConnections.append(StorageToWebProcessConnection::create(IPC::Connection::Identifier(listeningPort)));
 
     IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
     parentProcessConnection()->send(Messages::StorageProcessProxy::DidCreateStorageToWebProcessConnection(clientPort), 0);
@@ -306,6 +306,18 @@
 }
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+SWServer& StorageProcess::swServerForSession(PAL::SessionID sessionID)
+{
+    auto result = m_swServers.add(sessionID, nullptr);
+    if (result.isNewEntry)
+        result.iterator->value = std::make_unique<SWServer>();
+
+    ASSERT(result.iterator->value);
+    return *result.iterator->value;
+}
+#endif
+
 #if !PLATFORM(COCOA)
 void StorageProcess::initializeProcess(const ChildProcessInitializationParameters&)
 {

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (223140 => 223141)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.h	2017-10-10 20:50:20 UTC (rev 223140)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h	2017-10-10 21:03:04 UTC (rev 223141)
@@ -35,6 +35,7 @@
 #include <wtf/Function.h>
 
 namespace WebCore {
+class SWServer;
 struct SecurityOriginData;
 }
 
@@ -55,15 +56,12 @@
     static StorageProcess& singleton();
     ~StorageProcess();
 
-#if ENABLE(INDEXED_DATABASE)
-    WebCore::IDBServer::IDBServer& idbServer(PAL::SessionID);
-#endif
-
     WorkQueue& queue() { return m_queue.get(); }
-
     void postStorageTask(CrossThreadTask&&);
 
 #if ENABLE(INDEXED_DATABASE)
+    WebCore::IDBServer::IDBServer& idbServer(PAL::SessionID);
+
     // WebCore::IDBServer::IDBBackingStoreFileHandler
     void prepareForAccessToTemporaryFile(const String& path) final;
     void accessToTemporaryFileComplete(const String& path) final;
@@ -73,6 +71,10 @@
     void getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, WTF::Function<void (SandboxExtension::HandleArray&&)>&& completionHandler);
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+    WebCore::SWServer& swServerForSession(PAL::SessionID);
+#endif
+
 private:
     StorageProcess();
 
@@ -108,7 +110,7 @@
     void performNextStorageTask();
     void ensurePathExists(const String&);
 
-    Vector<RefPtr<StorageToWebProcessConnection>> m_databaseToWebProcessConnections;
+    Vector<RefPtr<StorageToWebProcessConnection>> m_storageToWebProcessConnections;
 
     Ref<WorkQueue> m_queue;
 
@@ -121,6 +123,10 @@
 
     Deque<CrossThreadTask> m_storageTasks;
     Lock m_storageTaskMutex;
+    
+#if ENABLE(SERVICE_WORKER)
+    HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers;
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp (223140 => 223141)


--- trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp	2017-10-10 20:50:20 UTC (rev 223140)
+++ trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp	2017-10-10 21:03:04 UTC (rev 223141)
@@ -27,6 +27,7 @@
 #include "StorageToWebProcessConnection.h"
 
 #include "Logging.h"
+#include "StorageProcess.h"
 #include "StorageToWebProcessConnectionMessages.h"
 #include "WebIDBConnectionToClient.h"
 #include "WebIDBConnectionToClientMessages.h"
@@ -136,13 +137,8 @@
     LOG(ServiceWorker, "StorageToWebProcessConnection::establishSWServerConnection - %" PRIu64, serverConnectionIdentifier);
     ASSERT(!m_swConnections.contains(serverConnectionIdentifier));
 
-    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));
+    auto& server = StorageProcess::singleton().swServerForSession(sessionID);
+    m_swConnections.set(serverConnectionIdentifier, std::make_unique<WebSWServerConnection>(server, m_connection.get(), serverConnectionIdentifier, sessionID));
 }
 
 void StorageToWebProcessConnection::removeSWServerConnection(uint64_t serverConnectionIdentifier)

Modified: trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.h (223140 => 223141)


--- trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.h	2017-10-10 20:50:20 UTC (rev 223140)
+++ trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.h	2017-10-10 21:03:04 UTC (rev 223141)
@@ -70,7 +70,6 @@
 #if ENABLE(SERVICE_WORKER)
     void establishSWServerConnection(PAL::SessionID, uint64_t& serverConnectionIdentifier);
     void removeSWServerConnection(uint64_t serverConnectionIdentifier);
-    HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers;
     HashMap<uint64_t, std::unique_ptr<WebSWServerConnection>> m_swConnections;
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to