Title: [278409] trunk/Source/WebKit
Revision
278409
Author
cdu...@apple.com
Date
2021-06-03 10:04:44 -0700 (Thu, 03 Jun 2021)

Log Message

StorageArea should be able to send its IPC directly from the background thread
https://bugs.webkit.org/show_bug.cgi?id=226583

Reviewed by Alex Christensen.

Update StorageArea so that it does its IPC sending straight from the storage thread, instead of
hopping to the main thread to do so.

* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::clear):
(WebKit::StorageArea::dispatchEvents const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278408 => 278409)


--- trunk/Source/WebKit/ChangeLog	2021-06-03 15:25:57 UTC (rev 278408)
+++ trunk/Source/WebKit/ChangeLog	2021-06-03 17:04:44 UTC (rev 278409)
@@ -1,3 +1,17 @@
+2021-06-03  Chris Dumez  <cdu...@apple.com>
+
+        StorageArea should be able to send its IPC directly from the background thread
+        https://bugs.webkit.org/show_bug.cgi?id=226583
+
+        Reviewed by Alex Christensen.
+
+        Update StorageArea so that it does its IPC sending straight from the storage thread, instead of
+        hopping to the main thread to do so.
+
+        * NetworkProcess/WebStorage/StorageArea.cpp:
+        (WebKit::StorageArea::clear):
+        (WebKit::StorageArea::dispatchEvents const):
+
 2021-06-03  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GLIB] imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse_mixed_content.html is failing since r277493

Modified: trunk/Source/WebKit/NetworkProcess/WebStorage/StorageArea.cpp (278408 => 278409)


--- trunk/Source/WebKit/NetworkProcess/WebStorage/StorageArea.cpp	2021-06-03 15:25:57 UTC (rev 278408)
+++ trunk/Source/WebKit/NetworkProcess/WebStorage/StorageArea.cpp	2021-06-03 17:04:44 UTC (rev 278409)
@@ -163,12 +163,8 @@
         }
     }
 
-    for (auto it = m_eventListeners.begin(), end = m_eventListeners.end(); it != end; ++it) {
-        RunLoop::main().dispatch([connectionID = *it, destinationStorageAreaID = m_identifier] {
-            if (auto* connection = IPC::Connection::connection(connectionID))
-                connection->send(Messages::StorageAreaMap::ClearCache(), destinationStorageAreaID);
-        });
-    }
+    for (auto& listenerUniqueID : m_eventListeners)
+        IPC::Connection::send(listenerUniqueID, Messages::StorageAreaMap::ClearCache(), m_identifier.toUInt64());
 }
 
 LocalStorageDatabase& StorageArea::ensureDatabase() const
@@ -189,13 +185,9 @@
 {
     ASSERT(!RunLoop::isMain());
     ASSERT(storageAreaImplID);
-    for (auto it = m_eventListeners.begin(), end = m_eventListeners.end(); it != end; ++it) {
-        std::optional<StorageAreaImplIdentifier> optionalStorageAreaImplID = *it == sourceConnection ? std::make_optional(storageAreaImplID) : std::nullopt;
-
-        RunLoop::main().dispatch([connectionID = *it, destinationStorageAreaID = m_identifier, key = key.isolatedCopy(), oldValue = oldValue.isolatedCopy(), newValue = newValue.isolatedCopy(), urlString = urlString.isolatedCopy(), optionalStorageAreaImplID = WTFMove(optionalStorageAreaImplID)] {
-            if (auto* connection = IPC::Connection::connection(connectionID))
-                connection->send(Messages::StorageAreaMap::DispatchStorageEvent(optionalStorageAreaImplID, key, oldValue, newValue, urlString), destinationStorageAreaID);
-        });
+    for (auto& listenerUniqueID : m_eventListeners) {
+        auto optionalStorageAreaImplID = listenerUniqueID == sourceConnection ? std::make_optional(storageAreaImplID) : std::nullopt;
+        IPC::Connection::send(listenerUniqueID, Messages::StorageAreaMap::DispatchStorageEvent(optionalStorageAreaImplID, key, oldValue, newValue, urlString), m_identifier.toUInt64());
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to