Title: [241690] releases/WebKitGTK/webkit-2.24/Source/WebKit
Revision
241690
Author
carlo...@webkit.org
Date
2019-02-18 08:14:50 -0800 (Mon, 18 Feb 2019)

Log Message

Merge r241595 - IPC code should support messages with both Delayed and WantsConnection attributes
https://bugs.webkit.org/show_bug.cgi?id=194679

Reviewed by Geoffrey Garen.

* Platform/IPC/HandleMessage.h:
(IPC::callMemberFunctionImpl):
(IPC::callMemberFunction):
(IPC::handleMessageDelayedWantsConnection):
* Scripts/webkit/messages.py:
* UIProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::getValues):
* UIProcess/WebStorage/StorageManager.h:
* UIProcess/WebStorage/StorageManager.messages.in:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog (241689 => 241690)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog	2019-02-18 16:14:44 UTC (rev 241689)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog	2019-02-18 16:14:50 UTC (rev 241690)
@@ -1,3 +1,20 @@
+2019-02-15  Alex Christensen  <achristen...@webkit.org>
+
+        IPC code should support messages with both Delayed and WantsConnection attributes
+        https://bugs.webkit.org/show_bug.cgi?id=194679
+
+        Reviewed by Geoffrey Garen.
+
+        * Platform/IPC/HandleMessage.h:
+        (IPC::callMemberFunctionImpl):
+        (IPC::callMemberFunction):
+        (IPC::handleMessageDelayedWantsConnection):
+        * Scripts/webkit/messages.py:
+        * UIProcess/WebStorage/StorageManager.cpp:
+        (WebKit::StorageManager::getValues):
+        * UIProcess/WebStorage/StorageManager.h:
+        * UIProcess/WebStorage/StorageManager.messages.in:
+
 2019-02-10  Darin Adler  <da...@apple.com>
 
         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/Platform/IPC/HandleMessage.h (241689 => 241690)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/Platform/IPC/HandleMessage.h	2019-02-18 16:14:44 UTC (rev 241689)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/Platform/IPC/HandleMessage.h	2019-02-18 16:14:50 UTC (rev 241690)
@@ -75,6 +75,20 @@
     callMemberFunctionImpl(object, function, WTFMove(completionHandler), std::forward<ArgsTuple>(args), ArgsIndicies());
 }
 
+// Dispatch functions with connection parameter with delayed reply arguments.
+
+template <typename C, typename MF, typename CH, typename ArgsTuple, size_t... ArgsIndex>
+void callMemberFunctionImpl(Connection& connection, C* object, MF function, CompletionHandler<CH>&& completionHandler, ArgsTuple&& args, std::index_sequence<ArgsIndex...>)
+{
+    (object->*function)(connection, std::get<ArgsIndex>(std::forward<ArgsTuple>(args))..., WTFMove(completionHandler));
+}
+
+template<typename C, typename MF, typename CH, typename ArgsTuple, typename ArgsIndicies = std::make_index_sequence<std::tuple_size<ArgsTuple>::value>>
+void callMemberFunction(Connection& connection, ArgsTuple&& args, CompletionHandler<CH>&& completionHandler, C* object, MF function)
+{
+    callMemberFunctionImpl(connection, object, function, WTFMove(completionHandler), std::forward<ArgsTuple>(args), ArgsIndicies());
+}
+
 // Dispatch functions with connection parameter with no reply arguments.
 
 template <typename C, typename MF, typename ArgsTuple, size_t... ArgsIndex>
@@ -188,6 +202,21 @@
 }
 
 template<typename T, typename C, typename MF>
+void handleMessageDelayedWantsConnection(Connection& connection, Decoder& decoder, std::unique_ptr<Encoder>& replyEncoder, C* object, MF function)
+{
+    typename CodingType<typename T::Arguments>::Type arguments;
+    if (!decoder.decode(arguments)) {
+        ASSERT(decoder.isInvalid());
+        return;
+    }
+    
+    typename T::DelayedReply completionHandler = [replyEncoder = WTFMove(replyEncoder), connection = makeRef(connection)] (auto&&... args) mutable {
+        T::send(WTFMove(replyEncoder), WTFMove(connection), args...);
+    };
+    callMemberFunction(connection, WTFMove(arguments), WTFMove(completionHandler), object, function);
+}
+
+template<typename T, typename C, typename MF>
 void handleMessageAsync(Connection& connection, Decoder& decoder, C* object, MF function)
 {
     Optional<uint64_t> listenerID;

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/Scripts/webkit/messages.py (241689 => 241690)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/Scripts/webkit/messages.py	2019-02-18 16:14:44 UTC (rev 241689)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/Scripts/webkit/messages.py	2019-02-18 16:14:50 UTC (rev 241690)
@@ -307,6 +307,8 @@
     dispatch_function = 'handleMessage'
     if message.has_attribute(DELAYED_ATTRIBUTE):
         dispatch_function += 'Delayed'
+        if message.has_attribute(WANTS_CONNECTION_ATTRIBUTE):
+            dispatch_function += 'WantsConnection'
     if message.has_attribute(ASYNC_ATTRIBUTE):
         dispatch_function += 'Async'
     if message.has_attribute(LEGACY_SYNC_ATTRIBUTE):

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.cpp (241689 => 241690)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.cpp	2019-02-18 16:14:44 UTC (rev 241689)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.cpp	2019-02-18 16:14:50 UTC (rev 241690)
@@ -785,15 +785,15 @@
     m_storageAreasByConnection.remove(connectionAndStorageMapIDPair);
 }
 
-void StorageManager::getValues(IPC::Connection& connection, uint64_t storageMapID, uint64_t storageMapSeed, HashMap<String, String>& values)
+void StorageManager::getValues(IPC::Connection& connection, uint64_t storageMapID, uint64_t storageMapSeed, CompletionHandler<void(const HashMap<String, String>&)>&& completionHandler)
 {
     StorageArea* storageArea = findStorageArea(connection, storageMapID);
     if (!storageArea) {
         // This is a session storage area for a page that has already been closed. Ignore it.
-        return;
+        return completionHandler({ });
     }
 
-    values = storageArea->items();
+    completionHandler(storageArea->items());
     connection.send(Messages::StorageAreaMap::DidGetValues(storageMapSeed), storageMapID);
 }
 

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.h (241689 => 241690)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.h	2019-02-18 16:14:44 UTC (rev 241689)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.h	2019-02-18 16:14:50 UTC (rev 241690)
@@ -81,7 +81,7 @@
     void createSessionStorageMap(IPC::Connection&, uint64_t storageMapID, uint64_t storageNamespaceID, WebCore::SecurityOriginData&&);
     void destroyStorageMap(IPC::Connection&, uint64_t storageMapID);
 
-    void getValues(IPC::Connection&, uint64_t storageMapID, uint64_t storageMapSeed, HashMap<String, String>& values);
+    void getValues(IPC::Connection&, uint64_t storageMapID, uint64_t storageMapSeed, CompletionHandler<void(const HashMap<String, String>&)>&&);
     void setItem(IPC::Connection&, uint64_t storageAreaID, uint64_t sourceStorageAreaID, uint64_t storageMapSeed, const String& key, const String& value, const String& urlString);
     void removeItem(IPC::Connection&, uint64_t storageMapID, uint64_t sourceStorageAreaID, uint64_t storageMapSeed, const String& key, const String& urlString);
     void clear(IPC::Connection&, uint64_t storageMapID, uint64_t sourceStorageAreaID, uint64_t storageMapSeed, const String& urlString);

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.messages.in (241689 => 241690)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.messages.in	2019-02-18 16:14:44 UTC (rev 241689)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebStorage/StorageManager.messages.in	2019-02-18 16:14:50 UTC (rev 241690)
@@ -26,7 +26,7 @@
     CreateSessionStorageMap(uint64_t storageMapID, uint64_t storageNamespaceID, struct WebCore::SecurityOriginData securityOriginData) WantsConnection
     DestroyStorageMap(uint64_t storageMapID) WantsConnection
 
-    GetValues(uint64_t storageMapID, uint64_t storageMapSeed) -> (HashMap<String, String> values) LegacySync WantsConnection
+    GetValues(uint64_t storageMapID, uint64_t storageMapSeed) -> (HashMap<String, String> values) Delayed WantsConnection
 
     SetItem(uint64_t storageMapID, uint64_t sourceStorageAreaID, uint64_t storageMapSeed, String key, String value, String urlString) WantsConnection
     RemoveItem(uint64_t storageMapID, uint64_t sourceStorageAreaID, uint64_t storageMapSeed, String key, String urlString) WantsConnection
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to