⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278409 in webkit


Ignore:
Timestamp:
Jun 3, 2021, 10:04:44 AM (5 years ago)
Author:
Chris Dumez
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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r278402 r278409  
     12021-06-03  Chris Dumez  <cdumez@apple.com>
     2
     3        StorageArea should be able to send its IPC directly from the background thread
     4        https://bugs.webkit.org/show_bug.cgi?id=226583
     5
     6        Reviewed by Alex Christensen.
     7
     8        Update StorageArea so that it does its IPC sending straight from the storage thread, instead of
     9        hopping to the main thread to do so.
     10
     11        * NetworkProcess/WebStorage/StorageArea.cpp:
     12        (WebKit::StorageArea::clear):
     13        (WebKit::StorageArea::dispatchEvents const):
     14
    1152021-06-03  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WebKit/NetworkProcess/WebStorage/StorageArea.cpp

    r278253 r278409  
    164164    }
    165165
    166     for (auto it = m_eventListeners.begin(), end = m_eventListeners.end(); it != end; ++it) {
    167         RunLoop::main().dispatch([connectionID = *it, destinationStorageAreaID = m_identifier] {
    168             if (auto* connection = IPC::Connection::connection(connectionID))
    169                 connection->send(Messages::StorageAreaMap::ClearCache(), destinationStorageAreaID);
    170         });
    171     }
     166    for (auto& listenerUniqueID : m_eventListeners)
     167        IPC::Connection::send(listenerUniqueID, Messages::StorageAreaMap::ClearCache(), m_identifier.toUInt64());
    172168}
    173169
    … …  
    190186    ASSERT(!RunLoop::isMain());
    191187    ASSERT(storageAreaImplID);
    192     for (auto it = m_eventListeners.begin(), end = m_eventListeners.end(); it != end; ++it) {
    193         std::optional<StorageAreaImplIdentifier> optionalStorageAreaImplID = *it == sourceConnection ? std::make_optional(storageAreaImplID) : std::nullopt;
    194 
    195         RunLoop::main().dispatch([connectionID = *it, destinationStorageAreaID = m_identifier, key = key.isolatedCopy(), oldValue = oldValue.isolatedCopy(), newValue = newValue.isolatedCopy(), urlString = urlString.isolatedCopy(), optionalStorageAreaImplID = WTFMove(optionalStorageAreaImplID)] {
    196             if (auto* connection = IPC::Connection::connection(connectionID))
    197                 connection->send(Messages::StorageAreaMap::DispatchStorageEvent(optionalStorageAreaImplID, key, oldValue, newValue, urlString), destinationStorageAreaID);
    198         });
     188    for (auto& listenerUniqueID : m_eventListeners) {
     189        auto optionalStorageAreaImplID = listenerUniqueID == sourceConnection ? std::make_optional(storageAreaImplID) : std::nullopt;
     190        IPC::Connection::send(listenerUniqueID, Messages::StorageAreaMap::DispatchStorageEvent(optionalStorageAreaImplID, key, oldValue, newValue, urlString), m_identifier.toUInt64());
    199191    }
    200192}
Note: See TracChangeset for help on using the changeset viewer.