[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 15:48:30 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b6ba463e4560625017c7183966289f3318afcf29
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 12 18:52:08 2010 +0000

    CoreIPC cleanup
    https://bugs.webkit.org/show_bug.cgi?id=49455
    
    Reviewed by Sam Weinig.
    
    Add a static create function to ArgumentEncoder.
    Factor sync message argument encoder creation out into a new function,
    createSyncMessageArgumentEncoder.
    
    * Platform/CoreIPC/ArgumentEncoder.cpp:
    (CoreIPC::ArgumentEncoder::create):
    * Platform/CoreIPC/ArgumentEncoder.h:
    * Platform/CoreIPC/Connection.cpp:
    (CoreIPC::Connection::createSyncMessageArgumentEncoder):
    (CoreIPC::Connection::dispatchSyncMessage):
    * Platform/CoreIPC/Connection.h:
    (CoreIPC::Connection::send):
    (CoreIPC::Connection::sendSync):
    * UIProcess/WebProcessProxy.h:
    (WebKit::WebProcessProxy::send):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71931 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 83bfb99..b6c8fcd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,26 @@
+2010-11-12  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        CoreIPC cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=49455
+
+        Add a static create function to ArgumentEncoder. 
+        Factor sync message argument encoder creation out into a new function,
+        createSyncMessageArgumentEncoder.
+        
+        * Platform/CoreIPC/ArgumentEncoder.cpp:
+        (CoreIPC::ArgumentEncoder::create):
+        * Platform/CoreIPC/ArgumentEncoder.h:
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::createSyncMessageArgumentEncoder):
+        (CoreIPC::Connection::dispatchSyncMessage):
+        * Platform/CoreIPC/Connection.h:
+        (CoreIPC::Connection::send):
+        (CoreIPC::Connection::sendSync):
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::send):
+
 2010-11-12  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp b/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
index ed3057f..1340c0a 100644
--- a/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
+++ b/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
@@ -30,6 +30,11 @@
 
 namespace CoreIPC {
 
+PassOwnPtr<ArgumentEncoder> ArgumentEncoder::create(uint64_t destinationID)
+{
+    return adoptPtr(new ArgumentEncoder(destinationID));
+}
+
 ArgumentEncoder::ArgumentEncoder(uint64_t destinationID)
     : m_buffer(0)
     , m_bufferPointer(0)
diff --git a/WebKit2/Platform/CoreIPC/ArgumentEncoder.h b/WebKit2/Platform/CoreIPC/ArgumentEncoder.h
index e45aa5d..3af771f 100644
--- a/WebKit2/Platform/CoreIPC/ArgumentEncoder.h
+++ b/WebKit2/Platform/CoreIPC/ArgumentEncoder.h
@@ -28,6 +28,7 @@
 
 #include "ArgumentCoder.h"
 #include "Attachment.h"
+#include <wtf/PassOwnPtr.h>
 #include <wtf/TypeTraits.h>
 #include <wtf/Vector.h>
 
@@ -37,7 +38,7 @@ class ArgumentEncoder;
 
 class ArgumentEncoder {
 public:
-    explicit ArgumentEncoder(uint64_t destinationID);
+    static PassOwnPtr<ArgumentEncoder> create(uint64_t destinationID);
     ~ArgumentEncoder();
 
     void encodeBytes(const uint8_t*, size_t);
@@ -67,6 +68,7 @@ public:
 #endif
 
 private:
+    explicit ArgumentEncoder(uint64_t destinationID);
     uint8_t* grow(unsigned alignment, size_t size);
     
     uint8_t* m_buffer;
diff --git a/WebKit2/Platform/CoreIPC/Connection.cpp b/WebKit2/Platform/CoreIPC/Connection.cpp
index 931a78d..f9a808c 100644
--- a/WebKit2/Platform/CoreIPC/Connection.cpp
+++ b/WebKit2/Platform/CoreIPC/Connection.cpp
@@ -78,6 +78,17 @@ void Connection::invalidate()
     m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::platformInvalidate));
 }
 
+PassOwnPtr<ArgumentEncoder> Connection::createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID)
+{
+    OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID);
+
+    // Encode the sync request ID.
+    syncRequestID = ++m_syncRequestID;
+    argumentEncoder->encode(syncRequestID);
+
+    return argumentEncoder.release();
+}
+
 bool Connection::sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments)
 {
     if (!isValid())
@@ -376,7 +387,7 @@ void Connection::dispatchSyncMessage(MessageID messageID, ArgumentDecoder* argum
     }
 
     // Create our reply encoder.
-    ArgumentEncoder* replyEncoder = new ArgumentEncoder(syncRequestID);
+    ArgumentEncoder* replyEncoder = ArgumentEncoder::create(syncRequestID).leakPtr();
     
     // Hand off both the decoder and encoder to the client..
     SyncReplyMode syncReplyMode = m_client->didReceiveSyncMessage(this, messageID, arguments, replyEncoder);
diff --git a/WebKit2/Platform/CoreIPC/Connection.h b/WebKit2/Platform/CoreIPC/Connection.h
index 0869c92..ca109bd 100644
--- a/WebKit2/Platform/CoreIPC/Connection.h
+++ b/WebKit2/Platform/CoreIPC/Connection.h
@@ -101,19 +101,19 @@ public:
 
     // FIXME: This variant of send is deprecated, all clients should move to the overload that takes a message.
     template<typename E, typename T> bool send(E messageID, uint64_t destinationID, const T& arguments);
-    
+
     template<typename T> bool send(const T& message, uint64_t destinationID);
 
     static const unsigned long long NoTimeout = 10000000000ULL;
-    // FIXME: This variant of send is deprecated, all clients should move to the overload that takes a message.
+    // FIXME: This variant of sendSync is deprecated, all clients should move to the overload that takes a message.
     template<typename E, typename T, typename U> bool sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout = NoTimeout);
 
     template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = NoTimeout);
     
     template<typename E> PassOwnPtr<ArgumentDecoder> waitFor(E messageID, uint64_t destinationID, double timeout);
 
+    PassOwnPtr<ArgumentEncoder> createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID);
     bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>);
-
     bool sendSyncReply(PassOwnPtr<ArgumentEncoder>);
 
 private:
@@ -269,7 +269,7 @@ private:
 template<typename E, typename T>
 bool Connection::send(E messageID, uint64_t destinationID, const T& arguments)
 {
-    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
+    OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID);
     argumentEncoder->encode(arguments);
 
     return sendMessage(MessageID(messageID), argumentEncoder.release());
@@ -277,7 +277,7 @@ bool Connection::send(E messageID, uint64_t destinationID, const T& arguments)
 
 template<typename T> bool Connection::send(const T& message, uint64_t destinationID)
 {
-    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
+    OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID);
     argumentEncoder->encode(message);
     
     return sendMessage(MessageID(T::messageID), argumentEncoder.release());
@@ -286,14 +286,10 @@ template<typename T> bool Connection::send(const T& message, uint64_t destinatio
 template<typename E, typename T, typename U>
 inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout)
 {
-    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
+    uint64_t syncRequestID = 0;
+    OwnPtr<ArgumentEncoder> argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID);
 
-    uint64_t syncRequestID = ++m_syncRequestID;
-    
-    // Encode the sync request ID.
-    argumentEncoder->encode(syncRequestID);
-    
-    // Encode the rest of the input arguments.
+    // Encode the input arguments.
     argumentEncoder->encode(arguments);
     
     // Now send the message and wait for a reply.
@@ -307,12 +303,8 @@ inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& a
 
 template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout)
 {
-    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
-    
-    uint64_t syncRequestID = ++m_syncRequestID;
-
-    // Encode the sync request ID.
-    argumentEncoder->encode(syncRequestID);
+    uint64_t syncRequestID = 0;
+    OwnPtr<ArgumentEncoder> argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID);
     
     // Encode the rest of the input arguments.
     argumentEncoder->encode(message);
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 179578f..f28ec14 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -154,7 +154,7 @@ private:
 template<typename E, typename T>
 bool WebProcessProxy::send(E messageID, uint64_t destinationID, const T& arguments)
 {
-    OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder(new CoreIPC::ArgumentEncoder(destinationID));
+    OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID);
     argumentEncoder->encode(arguments);
 
     return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release());
@@ -163,7 +163,7 @@ bool WebProcessProxy::send(E messageID, uint64_t destinationID, const T& argumen
 template<typename T>
 bool WebProcessProxy::send(const T& message, uint64_t destinationID)
 {
-    OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder(new CoreIPC::ArgumentEncoder(destinationID));
+    OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID);
     argumentEncoder->encode(message);
 
     return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release());

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list