Title: [141814] trunk/Source/WebKit2
Revision
141814
Author
[email protected]
Date
2013-02-04 14:33:55 -0800 (Mon, 04 Feb 2013)

Log Message

Change didReceiveMessageOnConnectionWorkQueue semantics
https://bugs.webkit.org/show_bug.cgi?id=108859

Reviewed by Sam Weinig.

Change didReceiveMessageOnConnectionWorkQueue to take a reference to an
OwnPtr<MessageDecoder>. This lets queue clients handle a message later, on a different
work queue for example. Also, get rid of the didHandleMessage boolean, since taking ownership
of the decoder implicitly means that the message was handled.

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::processIncomingMessage):
* Platform/CoreIPC/Connection.h:
(QueueClient):
* Shared/mac/SecItemShim.cpp:
(WebKit::SecItemShim::didReceiveMessageOnConnectionWorkQueue):
* Shared/mac/SecItemShim.h:
(SecItemShim):
* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::StorageManager):
(WebKit::StorageManager::didReceiveMessageOnConnectionWorkQueue):
* UIProcess/Storage/StorageManager.h:
(WebKit):
(StorageManager):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveMessageOnConnectionWorkQueue):
* UIProcess/WebProcessProxy.h:
(WebProcessProxy):
* UIProcess/mac/SecItemShimProxy.cpp:
(WebKit::SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue):
* UIProcess/mac/SecItemShimProxy.h:
(SecItemShimProxy):
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::didReceiveMessageOnConnectionWorkQueue):
* WebProcess/WebPage/EventDispatcher.h:
(EventDispatcher):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessageOnConnectionWorkQueue):
* WebProcess/WebProcess.h:
(WebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (141813 => 141814)


--- trunk/Source/WebKit2/ChangeLog	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-04 22:33:55 UTC (rev 141814)
@@ -1,3 +1,46 @@
+2013-02-04  Anders Carlsson  <[email protected]>
+
+        Change didReceiveMessageOnConnectionWorkQueue semantics
+        https://bugs.webkit.org/show_bug.cgi?id=108859
+
+        Reviewed by Sam Weinig.
+
+        Change didReceiveMessageOnConnectionWorkQueue to take a reference to an
+        OwnPtr<MessageDecoder>. This lets queue clients handle a message later, on a different
+        work queue for example. Also, get rid of the didHandleMessage boolean, since taking ownership
+        of the decoder implicitly means that the message was handled.
+        
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::processIncomingMessage):
+        * Platform/CoreIPC/Connection.h:
+        (QueueClient):
+        * Shared/mac/SecItemShim.cpp:
+        (WebKit::SecItemShim::didReceiveMessageOnConnectionWorkQueue):
+        * Shared/mac/SecItemShim.h:
+        (SecItemShim):
+        * UIProcess/Storage/StorageManager.cpp:
+        (WebKit::StorageManager::StorageManager):
+        (WebKit::StorageManager::didReceiveMessageOnConnectionWorkQueue):
+        * UIProcess/Storage/StorageManager.h:
+        (WebKit):
+        (StorageManager):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveMessageOnConnectionWorkQueue):
+        * UIProcess/WebProcessProxy.h:
+        (WebProcessProxy):
+        * UIProcess/mac/SecItemShimProxy.cpp:
+        (WebKit::SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue):
+        * UIProcess/mac/SecItemShimProxy.h:
+        (SecItemShimProxy):
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::didReceiveMessageOnConnectionWorkQueue):
+        * WebProcess/WebPage/EventDispatcher.h:
+        (EventDispatcher):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::didReceiveMessageOnConnectionWorkQueue):
+        * WebProcess/WebProcess.h:
+        (WebProcess):
+
 2013-02-04  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/12884778> Sandbox violation due to MediaAccessibility code trying to access ~/Library/Preferences/com.apple.mediaaccessibility.plist

Modified: trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp (141813 => 141814)


--- trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -601,10 +601,8 @@
 
     // Hand off the message to the connection queue clients.
     for (size_t i = 0; i < m_connectionQueueClients.size(); ++i) {
-        bool didHandleMessage = false;
-
-        m_connectionQueueClients[i]->didReceiveMessageOnConnectionWorkQueue(this, *message, didHandleMessage);
-        if (didHandleMessage) {
+        m_connectionQueueClients[i]->didReceiveMessageOnConnectionWorkQueue(this, message);
+        if (!message) {
             // A connection queue client handled the message, our work here is done.
             return;
         }

Modified: trunk/Source/WebKit2/Platform/CoreIPC/Connection.h (141813 => 141814)


--- trunk/Source/WebKit2/Platform/CoreIPC/Connection.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/Platform/CoreIPC/Connection.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -94,7 +94,7 @@
 
     class QueueClient {
     public:
-        virtual void didReceiveMessageOnConnectionWorkQueue(Connection*, MessageDecoder&, bool& didHandleMessage) = 0;
+        virtual void didReceiveMessageOnConnectionWorkQueue(Connection*, OwnPtr<MessageDecoder>&) = 0;
         virtual void didCloseOnConnectionWorkQueue(Connection*) = 0;
 
     protected:

Modified: trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp (141813 => 141814)


--- trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -132,10 +132,13 @@
     func(callbacks);
 }
 
-void SecItemShim::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+void SecItemShim::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)
 {
-    if (decoder.messageReceiverName() == Messages::SecItemShim::messageReceiverName()) {
-        didReceiveSecItemShimMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+    if (decoder->messageReceiverName() == Messages::SecItemShim::messageReceiverName()) {
+        bool didHandleMessage = false;
+        didReceiveSecItemShimMessageOnConnectionWorkQueue(connection, *decoder, didHandleMessage);
+        if (didHandleMessage)
+            decoder = nullptr;
         return;
     }
 }

Modified: trunk/Source/WebKit2/Shared/mac/SecItemShim.h (141813 => 141814)


--- trunk/Source/WebKit2/Shared/mac/SecItemShim.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/Shared/mac/SecItemShim.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -46,7 +46,7 @@
     SecItemShim();
 
     // CoreIPC::Connection::QueueClient
-    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage) OVERRIDE;
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE;
     virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE;
 
     // Implemented in generated SecItemShimMessageReceiver.cpp.

Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp (141813 => 141814)


--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -27,6 +27,7 @@
 #include "StorageManager.h"
 
 #include "StorageManagerMessages.h"
+#include "WorkQueue.h"
 
 namespace WebKit {
 
@@ -36,6 +37,7 @@
 }
 
 StorageManager::StorageManager()
+    : m_queue(WorkQueue::create("com.apple.WebKit.StorageManager"))
 {
 }
 
@@ -43,10 +45,15 @@
 {
 }
 
-void StorageManager::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+void StorageManager::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)
 {
-    if (decoder.messageReceiverName() == Messages::StorageManager::messageReceiverName())
-        didReceiveStorageManagerMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+    if (decoder->messageReceiverName() == Messages::StorageManager::messageReceiverName()) {
+        bool didHandleMessage = false;
+        didReceiveStorageManagerMessageOnConnectionWorkQueue(connection, *decoder, didHandleMessage);
+        if (didHandleMessage)
+            decoder = nullptr;
+        return;
+    }
 }
 
 void StorageManager::didCloseOnConnectionWorkQueue(CoreIPC::Connection*)

Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h (141813 => 141814)


--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -30,7 +30,10 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/ThreadSafeRefCounted.h>
 
+class WorkQueue;
+
 namespace WebKit {
+
 struct SecurityOriginData;
 
 class StorageManager : public ThreadSafeRefCounted<StorageManager>, public CoreIPC::Connection::QueueClient {
@@ -42,7 +45,7 @@
     StorageManager();
 
     // CoreIPC::Connection::QueueClient
-    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage) OVERRIDE;
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE;
     virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE;
 
     void didReceiveStorageManagerMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage);
@@ -50,6 +53,8 @@
     // Message handlers.
     void createStorageArea(CoreIPC::Connection*, uint64_t storageAreaID, uint64_t storageNamespaceID, const SecurityOriginData&);
     void destroyStorageArea(CoreIPC::Connection*, uint64_t storageAreaID);
+
+    RefPtr<WorkQueue> m_queue;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (141813 => 141814)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -455,10 +455,15 @@
     pageProxy->didReceiveSyncMessage(connection, decoder, replyEncoder);
 }
 
-void WebProcessProxy::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+void WebProcessProxy::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)
 {
-    if (decoder.messageReceiverName() == Messages::WebProcessProxy::messageReceiverName())
-        didReceiveWebProcessProxyMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+    if (decoder->messageReceiverName() == Messages::WebProcessProxy::messageReceiverName()) {
+        bool didHandleMessage = false;
+        didReceiveWebProcessProxyMessageOnConnectionWorkQueue(connection, *decoder, didHandleMessage);
+        if (didHandleMessage)
+            decoder = nullptr;
+        return;
+    }
 }
 
 void WebProcessProxy::didCloseOnConnectionWorkQueue(CoreIPC::Connection*)

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (141813 => 141814)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -164,7 +164,7 @@
     virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE;
 
     // CoreIPC::Connection::QueueClient
-    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage) OVERRIDE;
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE;
     virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE;
 
     // ResponsivenessTimer::Client

Modified: trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp (141813 => 141814)


--- trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -106,10 +106,13 @@
     dispatchFunctionOnQueue(keychainWorkQueue, bind(handleSecItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
 }
 
-void SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+void SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)
 {
-    if (decoder.messageReceiverName() == Messages::SecItemShimProxy::messageReceiverName()) {
-        didReceiveSecItemShimProxyMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+    if (decoder->messageReceiverName() == Messages::SecItemShimProxy::messageReceiverName()) {
+        bool didHandleMessage = false;
+        didReceiveSecItemShimProxyMessageOnConnectionWorkQueue(connection, *decoder, didHandleMessage);
+        if (didHandleMessage)
+            decoder = nullptr;
         return;
     }
 }

Modified: trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h (141813 => 141814)


--- trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -43,7 +43,7 @@
     SecItemShimProxy();
 
     // CoreIPC::Connection::QueueClient
-    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage);
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE;
     virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE;
 
     // Implemented in generated SecItemShimProxyMessageReceiver.cpp.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp (141813 => 141814)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -73,10 +73,13 @@
 }
 #endif
 
-void EventDispatcher::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+void EventDispatcher::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)
 {
-    if (decoder.messageReceiverName() == Messages::EventDispatcher::messageReceiverName()) {
-        didReceiveEventDispatcherMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+    if (decoder->messageReceiverName() == Messages::EventDispatcher::messageReceiverName()) {
+        bool didHandleMessage = false;
+        didReceiveEventDispatcherMessageOnConnectionWorkQueue(connection, *decoder, didHandleMessage);
+        if (didHandleMessage)
+            decoder = nullptr;
         return;
     }
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h (141813 => 141814)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -60,7 +60,7 @@
 
 private:
     // CoreIPC::Connection::QueueClient
-    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage) OVERRIDE;
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE;
     virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE;
 
     // Implemented in generated EventDispatcherMessageReceiver.cpp

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (141813 => 141814)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2013-02-04 22:33:55 UTC (rev 141814)
@@ -634,10 +634,13 @@
     // we'll let it slide.
 }
 
-void WebProcess::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+void WebProcess::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)
 {
-    if (decoder.messageReceiverName() == Messages::WebProcess::messageReceiverName()) {
-        didReceiveWebProcessMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+    if (decoder->messageReceiverName() == Messages::WebProcess::messageReceiverName()) {
+        bool didHandleMessage = false;
+        didReceiveWebProcessMessageOnConnectionWorkQueue(connection, *decoder, didHandleMessage);
+        if (didHandleMessage)
+            decoder = nullptr;
         return;
     }
 }

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (141813 => 141814)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2013-02-04 22:28:22 UTC (rev 141813)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2013-02-04 22:33:55 UTC (rev 141814)
@@ -272,7 +272,7 @@
     virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE;
 
     // CoreIPC::Connection::QueueClient
-    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage) OVERRIDE;
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE;
     virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE;
 
     // Implemented in generated WebProcessMessageReceiver.cpp
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to