Title: [279081] trunk/Source/WebKitLegacy
Revision
279081
Author
sihui_...@apple.com
Date
2021-06-21 13:55:58 -0700 (Mon, 21 Jun 2021)

Log Message

Make InProcessIDBServer use WorkQueue instead of Thread
https://bugs.webkit.org/show_bug.cgi?id=227225

Reviewed by Chris Dumez.

* Storage/InProcessIDBServer.cpp:
(InProcessIDBServer::~InProcessIDBServer):
(InProcessIDBServer::InProcessIDBServer):
(InProcessIDBServer::dispatchTask):
* Storage/InProcessIDBServer.h:

Modified Paths

Diff

Modified: trunk/Source/WebKitLegacy/ChangeLog (279080 => 279081)


--- trunk/Source/WebKitLegacy/ChangeLog	2021-06-21 20:53:33 UTC (rev 279080)
+++ trunk/Source/WebKitLegacy/ChangeLog	2021-06-21 20:55:58 UTC (rev 279081)
@@ -1,3 +1,16 @@
+2021-06-21  Sihui Liu  <sihui_...@apple.com>
+
+        Make InProcessIDBServer use WorkQueue instead of Thread
+        https://bugs.webkit.org/show_bug.cgi?id=227225
+
+        Reviewed by Chris Dumez.
+
+        * Storage/InProcessIDBServer.cpp:
+        (InProcessIDBServer::~InProcessIDBServer):
+        (InProcessIDBServer::InProcessIDBServer):
+        (InProcessIDBServer::dispatchTask):
+        * Storage/InProcessIDBServer.h:
+
 2021-06-17  Alex Christensen  <achristen...@webkit.org>
 
         Remove empty header WebTypesInternal.h

Modified: trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.cpp (279080 => 279081)


--- trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.cpp	2021-06-21 20:53:33 UTC (rev 279080)
+++ trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.cpp	2021-06-21 20:55:58 UTC (rev 279081)
@@ -25,7 +25,6 @@
 
 #include "InProcessIDBServer.h"
 
-#include "StorageThread.h"
 #include <WebCore/ClientOrigin.h>
 #include <WebCore/IDBConnectionToClient.h>
 #include <WebCore/IDBConnectionToServer.h>
@@ -61,12 +60,14 @@
 {
     BinarySemaphore semaphore;
     dispatchTask([this, &semaphore] {
-        m_server = nullptr;
+        {
+            Locker locker { m_serverLock };
+            m_server = nullptr;
+        }
         m_connectionToClient = nullptr;
         semaphore.signal();
     });
     semaphore.wait();
-    m_thread->terminate();
 }
 
 StorageQuotaManager* InProcessIDBServer::quotaManager(const ClientOrigin& origin)
@@ -89,11 +90,10 @@
 }
 
 InProcessIDBServer::InProcessIDBServer(PAL::SessionID sessionID, const String& databaseDirectoryPath)
-    : m_thread(makeUnique<StorageThread>(StorageThread::Type::IndexedDB))
+    : m_queue(WorkQueue::create("com.apple.WebKit.IndexedDBServer"))
 {
     ASSERT(isMainThread());
     m_connectionToServer = IDBClient::IDBConnectionToServer::create(*this);
-    m_thread->start();
     dispatchTask([this, protectedThis = makeRef(*this), sessionID, directory = databaseDirectoryPath.isolatedCopy(), spaceRequester = storageQuotaManagerSpaceRequester(*this)] () mutable {
         m_connectionToClient = IDBServer::IDBConnectionToClient::create(*this);
 
@@ -500,7 +500,7 @@
 void InProcessIDBServer::dispatchTask(Function<void()>&& function)
 {
     ASSERT(isMainThread());
-    m_thread->dispatch(WTFMove(function));
+    m_queue->dispatch(WTFMove(function));
 }
 
 void InProcessIDBServer::dispatchTaskReply(Function<void()>&& function)

Modified: trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.h (279080 => 279081)


--- trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.h	2021-06-21 20:53:33 UTC (rev 279080)
+++ trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.h	2021-06-21 20:55:58 UTC (rev 279081)
@@ -39,7 +39,6 @@
 namespace WebCore {
 struct ClientOrigin;
 class StorageQuotaManager;
-class StorageThread;
 
 namespace IDBClient {
 class IDBConnectionToServer;
@@ -130,7 +129,7 @@
     std::unique_ptr<WebCore::IDBServer::IDBServer> m_server;
     RefPtr<WebCore::IDBClient::IDBConnectionToServer> m_connectionToServer;
     RefPtr<WebCore::IDBServer::IDBConnectionToClient> m_connectionToClient;
-    std::unique_ptr<WebCore::StorageThread> m_thread;
+    Ref<WorkQueue> m_queue;
 
     HashMap<WebCore::ClientOrigin, RefPtr<WebCore::StorageQuotaManager>> m_quotaManagers;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to