[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:31:09 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 86d9ea91a7b0d1cc818f0559a45184fbd6b6a508
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 17 22:48:42 2010 +0000

    CoreIPC argument coder improvements
    https://bugs.webkit.org/show_bug.cgi?id=45999
    
    Reviewed by Sam Weinig.
    
    * Platform/CoreIPC/ArgumentCoders.h:
    Add explicit specialization for a vector of bytes.
    
    * Platform/CoreIPC/Arguments.h:
    (CoreIPC::Arguments1::decode):
    (CoreIPC::Arguments2::decode):
    (CoreIPC::Arguments3::decode):
    (CoreIPC::Arguments4::decode):
    (CoreIPC::Arguments5::decode):
    (CoreIPC::Arguments6::decode):
    Use the injected class name for less typing.
    
    (CoreIPC::Arguments7::Arguments7):
    (CoreIPC::Arguments7::encode):
    (CoreIPC::Arguments7::decode):
    (CoreIPC::In):
    (CoreIPC::Out):
    Add Arguments7 class.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a4d0a76..cd4abb5 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,29 @@
+2010-09-17  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        CoreIPC argument coder improvements
+        https://bugs.webkit.org/show_bug.cgi?id=45999
+
+        * Platform/CoreIPC/ArgumentCoders.h:
+        Add explicit specialization for a vector of bytes.
+
+        * Platform/CoreIPC/Arguments.h:
+        (CoreIPC::Arguments1::decode):
+        (CoreIPC::Arguments2::decode):
+        (CoreIPC::Arguments3::decode):
+        (CoreIPC::Arguments4::decode):
+        (CoreIPC::Arguments5::decode):
+        (CoreIPC::Arguments6::decode):
+        Use the injected class name for less typing.
+
+        (CoreIPC::Arguments7::Arguments7):
+        (CoreIPC::Arguments7::encode):
+        (CoreIPC::Arguments7::decode):
+        (CoreIPC::In):
+        (CoreIPC::Out):
+        Add Arguments7 class.
+
 2010-09-17  Andy Estes  <aestes at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/WebKit2/Platform/CoreIPC/ArgumentCoders.h
index 2668439..6df8424 100644
--- a/WebKit2/Platform/CoreIPC/ArgumentCoders.h
+++ b/WebKit2/Platform/CoreIPC/ArgumentCoders.h
@@ -29,6 +29,7 @@
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
 #include <utility>
+#include <wtf/HashMap.h>
 #include <wtf/Vector.h>
 
 namespace CoreIPC {
@@ -103,7 +104,57 @@ template<typename T> struct ArgumentCoder<Vector<T> > {
         return true;
     }
 };
-    
+
+// Specialization for Vector<uint8_t>
+template<> struct ArgumentCoder<Vector<uint8_t> > {
+    static void encode(ArgumentEncoder* encoder, const Vector<uint8_t>& vector)
+    {
+        encoder->encodeBytes(vector.data(), vector.size());
+    }
+
+    static bool decode(ArgumentDecoder* decoder, Vector<uint8_t>& vector)
+    {
+        return decoder->decodeBytes(vector);
+    }
+};
+
+template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> struct ArgumentCoder<HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> > {
+    typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType;
+
+    static void encode(ArgumentEncoder* encoder, const HashMapType& hashMap)
+    {
+        encoder->encodeUInt64(hashMap.size());
+        for (typename HashMapType::const_iterator it = hashMap.begin(), end = hashMap.end(); it != end; ++it)
+            encoder->encode(*it);
+    }
+
+    static bool decode(ArgumentDecoder* decoder, HashMapType& hashMap)
+    {
+        uint64_t hashMapSize;
+        if (!decoder->decode(hashMapSize))
+            return false;
+
+        HashMapType tempHashMap;
+        for (uint64_t i = 0; i < hashMapSize; ++i) {
+            KeyArg key;
+            MappedArg value;
+            if (!decoder->decode(key))
+                return false;
+            if (!decoder->decode(value))
+                return false;
+
+            if (!tempHashMap.add(key, value).second) {
+                // The hash map already has the specified key, bail.
+                decoder->markInvalid();
+                return false;
+            }
+        }
+
+        hashMap.swap(tempHashMap);
+        return true;
+    }
+};
+
 } // namespace CoreIPC
 
 #endif // SimpleArgumentCoder_h
diff --git a/WebKit2/Platform/CoreIPC/Arguments.h b/WebKit2/Platform/CoreIPC/Arguments.h
index 0533dc5..675a75e 100644
--- a/WebKit2/Platform/CoreIPC/Arguments.h
+++ b/WebKit2/Platform/CoreIPC/Arguments.h
@@ -65,7 +65,7 @@ public:
         encoder->encode(m_value);
     }
 
-    static bool decode(ArgumentDecoder* decoder, Arguments1<T1>& result)
+    static bool decode(ArgumentDecoder* decoder, Arguments1& result)
     {
         return decoder->decode(result.m_value);
     }
@@ -98,7 +98,7 @@ public:
         encoder->encode(m_value);
     }
 
-    static bool decode(ArgumentDecoder* decoder, Arguments2<T1, T2>& result)
+    static bool decode(ArgumentDecoder* decoder, Arguments2& result)
     {
         if (!Arguments1<T1>::decode(decoder, result))
             return false;
@@ -134,7 +134,7 @@ public:
         encoder->encode(m_value);
     }
 
-    static bool decode(ArgumentDecoder* decoder, Arguments3<T1, T2, T3>& result)
+    static bool decode(ArgumentDecoder* decoder, Arguments3& result)
     {
         if (!Arguments2<T1, T2>::decode(decoder, result))
             return false;
@@ -170,7 +170,7 @@ public:
         encoder->encode(m_value);
     }
     
-    static bool decode(ArgumentDecoder* decoder, Arguments4<T1, T2, T3, T4>& result)
+    static bool decode(ArgumentDecoder* decoder, Arguments4& result)
     {
         if (!Arguments3<T1, T2, T3>::decode(decoder, result))
             return false;
@@ -206,7 +206,7 @@ public:
         encoder->encode(m_value);
     }
     
-    static bool decode(ArgumentDecoder* decoder, Arguments5<T1, T2, T3, T4, T5>& result)
+    static bool decode(ArgumentDecoder* decoder, Arguments5& result)
     {
         if (!Arguments4<T1, T2, T3, T4>::decode(decoder, result))
             return false;
@@ -242,7 +242,7 @@ public:
         encoder->encode(m_value);
     }
     
-    static bool decode(ArgumentDecoder* decoder, Arguments6<T1, T2, T3, T4, T5, T6>& result)
+    static bool decode(ArgumentDecoder* decoder, Arguments6& result)
     {
         if (!Arguments5<T1, T2, T3, T4, T5>::decode(decoder, result))
             return false;
@@ -264,6 +264,42 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena
     return Arguments6<T1&, T2&, T3&, T4&, T5&, T6&>(t1, t2, t3, t4, t5, t6);
 }
 
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> class Arguments7 : Arguments6<T1, T2, T3, T4, T5, T6> {
+public:
+    Arguments7(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
+        : Arguments6<T1, T2, T3, T4, T5, T6>(t1, t2, t3, t4, t5, t6)
+        , m_value(t7)
+    {
+    }
+
+    void encode(ArgumentEncoder* encoder) const
+    {
+        Arguments6<T1, T2, T3, T4, T5, T6>::encode(encoder);
+        encoder->encode(m_value);
+    }
+    
+    static bool decode(ArgumentDecoder* decoder, Arguments7& result)
+    {
+        if (!Arguments6<T1, T2, T3, T4, T5, T6>::decode(decoder, result))
+            return false;
+        
+        return decoder->decode(result.m_value);
+    }
+
+private:
+    T7 m_value;
+};
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> Arguments7<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7)
+{
+    return Arguments7<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&>(t1, t2, t3, t4, t5, t6, t7);
+}
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7)
+{
+    return Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&>(t1, t2, t3, t4, t5, t6, t7);
+}
+
 } // namespace CoreIPC
 
 #endif // Arguments_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list