[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 13:35:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ce3b35e7940bf1d08953d7776a244860645a9db1
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 23:25:35 2010 +0000

    Add a way to delay sending replies to sync requests
    https://bugs.webkit.org/show_bug.cgi?id=46117
    
    Reviewed by Adam Roben.
    
    Change the didReceiveSyncMessage client message to return a SyncReplyMode. If the SyncReplyMode is
    AutomaticReply, the reply will be sent when the didReceiveSyncMessage function returns. However, if it is
    ManualReply, then the client is handed ownership of the reply ArgumentEncoder and can choose to send it
    at a later time using Connection::sendSyncReply.
    
    * Platform/CoreIPC/Connection.cpp:
    (CoreIPC::Connection::sendSyncReply):
    Send the message as a sync reply.
    
    (CoreIPC::Connection::dispatchMessages):
    Check the return value of didReceiveSyncMessage. If it is AutomaticReply, immediately send the reply.
    
    * Platform/CoreIPC/Connection.h:
    (CoreIPC::Connection::MessageReceiver::didReceiveSyncMessage):
    Change return type.
    
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::didReceiveSyncMessage):
    * UIProcess/WebProcessProxy.h:
    Update for changed return type.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67891 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 196a4f5..c7bade3 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,34 @@
 
         Reviewed by Adam Roben.
 
+        Add a way to delay sending replies to sync requests
+        https://bugs.webkit.org/show_bug.cgi?id=46117
+
+        Change the didReceiveSyncMessage client message to return a SyncReplyMode. If the SyncReplyMode is 
+        AutomaticReply, the reply will be sent when the didReceiveSyncMessage function returns. However, if it is
+        ManualReply, then the client is handed ownership of the reply ArgumentEncoder and can choose to send it 
+        at a later time using Connection::sendSyncReply.
+
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::sendSyncReply):
+        Send the message as a sync reply.
+
+        (CoreIPC::Connection::dispatchMessages):
+        Check the return value of didReceiveSyncMessage. If it is AutomaticReply, immediately send the reply.
+
+        * Platform/CoreIPC/Connection.h:
+        (CoreIPC::Connection::MessageReceiver::didReceiveSyncMessage):
+        Change return type.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveSyncMessage):
+        * UIProcess/WebProcessProxy.h:
+        Update for changed return type.
+
+2010-09-20  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
         Don't use bufferIsLargeEnoughToContain for Vectors with variable sized elements
         https://bugs.webkit.org/show_bug.cgi?id=46109
 
diff --git a/WebKit2/Platform/CoreIPC/Connection.cpp b/WebKit2/Platform/CoreIPC/Connection.cpp
index 1866a85..a2346c2 100644
--- a/WebKit2/Platform/CoreIPC/Connection.cpp
+++ b/WebKit2/Platform/CoreIPC/Connection.cpp
@@ -90,6 +90,11 @@ bool Connection::sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> ar
     return true;
 }
 
+bool Connection::sendSyncReply(PassOwnPtr<ArgumentEncoder> arguments)
+{
+    return sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), arguments);
+}
+
 PassOwnPtr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, uint64_t destinationID, double timeout)
 {
     // First, check if this message is already in the incoming messages queue.
@@ -254,16 +259,21 @@ void Connection::dispatchMessages()
             }
 
             // Create our reply encoder.
-            OwnPtr<ArgumentEncoder> replyEncoder(new ArgumentEncoder(syncRequestID));
+            ArgumentEncoder* replyEncoder = new ArgumentEncoder(syncRequestID);
             
             // Hand off both the decoder and encoder to the client..
-            m_client->didReceiveSyncMessage(this, message.messageID(), arguments.get(), replyEncoder.get());
+            SyncReplyMode syncReplyMode = m_client->didReceiveSyncMessage(this, message.messageID(), arguments.get(), replyEncoder);
             
             // FIXME: If the message was invalid, we should send back a SyncMessageError.
             ASSERT(!arguments->isInvalid());
 
-            // Send the reply.
-            sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), replyEncoder.release());
+            if (syncReplyMode == AutomaticReply) {
+                // Send the reply.
+                sendSyncReply(replyEncoder);
+            } else {
+                // The client will take ownership of the reply encoder and send it at some point in the future.
+                // We won't do anything here.
+            }
         } else
             m_client->didReceiveMessage(this, message.messageID(), arguments.get());
 
diff --git a/WebKit2/Platform/CoreIPC/Connection.h b/WebKit2/Platform/CoreIPC/Connection.h
index a7e5d0d..2409f2a 100644
--- a/WebKit2/Platform/CoreIPC/Connection.h
+++ b/WebKit2/Platform/CoreIPC/Connection.h
@@ -53,6 +53,11 @@ namespace CoreIPC {
 
 class MessageID;
     
+enum SyncReplyMode {
+    AutomaticReply,
+    ManualReply
+};
+    
 class Connection : public ThreadSafeShared<Connection> {
 public:
     class MessageReceiver {
@@ -61,7 +66,7 @@ public:
 
     public:
         virtual void didReceiveMessage(Connection*, MessageID, ArgumentDecoder*) = 0;
-        virtual void didReceiveSyncMessage(Connection*, MessageID, ArgumentDecoder*, ArgumentEncoder*) { ASSERT_NOT_REACHED(); }
+        virtual SyncReplyMode didReceiveSyncMessage(Connection*, MessageID, ArgumentDecoder*, ArgumentEncoder*) { ASSERT_NOT_REACHED(); return AutomaticReply; }
     };
     
     class Client : public MessageReceiver {
@@ -98,6 +103,8 @@ public:
 
     bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>);
 
+    bool sendSyncReply(PassOwnPtr<ArgumentEncoder>);
+
 private:
     template<typename T> class Message {
     public:
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 2921087..a02426c 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -337,21 +337,21 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
     pageProxy->didReceiveMessage(connection, messageID, arguments);    
 }
 
-void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
+CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
 {
     if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) {
         switch (messageID.get<WebProcessProxyMessage::Kind>()) {
             case WebProcessProxyMessage::GetPlugins: {
                 bool refresh;
                 if (!arguments->decode(refresh))
-                    return;
+                    return CoreIPC::AutomaticReply;
                 
                 // FIXME: We should not do this on the main thread!
                 Vector<PluginInfo> plugins;
                 getPlugins(refresh, plugins);
 
                 reply->encode(plugins);
-                return;
+                return CoreIPC::AutomaticReply;
             }
 
             case WebProcessProxyMessage::GetPluginHostConnection: {
@@ -359,12 +359,12 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
                 String urlString;
                 
                 if (!arguments->decode(CoreIPC::Out(mimeType, urlString)))
-                    return;
+                    return CoreIPC::AutomaticReply;
                 
                 String pluginPath;
                 getPluginHostConnection(mimeType, KURL(ParsedURLString, urlString), pluginPath);
                 reply->encode(CoreIPC::In(pluginPath));
-                return;
+                return CoreIPC::AutomaticReply;
             }
 
             // These are asynchronous messages and should never be handled here.
@@ -376,24 +376,25 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
             case WebProcessProxyMessage::AddVisitedLink:
             case WebProcessProxyMessage::DidDestroyFrame:
                 ASSERT_NOT_REACHED();
-                return;
+                return CoreIPC::AutomaticReply;
         }
     }
 
     if (messageID.is<CoreIPC::MessageClassWebContext>()) {
         m_context->didReceiveSyncMessage(connection, messageID, arguments, reply);    
-        return;
+        return CoreIPC::AutomaticReply;
     }
 
     uint64_t pageID = arguments->destinationID();
     if (!pageID)
-        return;
+        return CoreIPC::AutomaticReply;
     
     WebPageProxy* pageProxy = webPage(pageID);
     if (!pageProxy)
-        return;
+        return CoreIPC::AutomaticReply;
     
     pageProxy->didReceiveSyncMessage(connection, messageID, arguments, reply);
+    return CoreIPC::AutomaticReply;
 }
 
 void WebProcessProxy::didClose(CoreIPC::Connection*)
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 3a0b178..43e966a 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -112,7 +112,7 @@ private:
 
     // CoreIPC::Connection::Client
     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-    void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
+    CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
     void didClose(CoreIPC::Connection*);
     void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID);
         

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list