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

weinig at apple.com weinig at apple.com
Wed Dec 22 12:57:32 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 961519ddb126384f7d8ff86e296ea777fedfabd6
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 2 23:57:22 2010 +0000

    Add ability to send WKDictionaryRefs via post message.
    https://bugs.webkit.org/show_bug.cgi?id=45151
    
    Reviewed by Anders Carlsson.
    
    * Shared/ImmutableDictionary.cpp:
    (WebKit::ImmutableDictionary::ImmutableDictionary):
    * Shared/ImmutableDictionary.h:
    (WebKit::ImmutableDictionary::adopt): Remove tag, it wasn't doing anything.
    (WebKit::ImmutableDictionary::isMutable):
    (WebKit::ImmutableDictionary::map): Add accessor of internal
    map for encoder.
    
    * Shared/UserMessageCoders.h:
    (WebKit::UserMessageEncoder::baseEncode):
    (WebKit::UserMessageDecoder::baseDecode):
    Add encoder/decoder.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66693 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index b5a373b..d922b4e 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,26 @@
 
         Reviewed by Anders Carlsson.
 
+        Add ability to send WKDictionaryRefs via post message.
+        https://bugs.webkit.org/show_bug.cgi?id=45151
+
+        * Shared/ImmutableDictionary.cpp:
+        (WebKit::ImmutableDictionary::ImmutableDictionary):
+        * Shared/ImmutableDictionary.h:
+        (WebKit::ImmutableDictionary::adopt): Remove tag, it wasn't doing anything.
+        (WebKit::ImmutableDictionary::isMutable):
+        (WebKit::ImmutableDictionary::map): Add accessor of internal
+        map for encoder.
+
+        * Shared/UserMessageCoders.h:
+        (WebKit::UserMessageEncoder::baseEncode):
+        (WebKit::UserMessageDecoder::baseDecode):
+        Add encoder/decoder.
+
+2010-09-02  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
         Share the common parts of UserMessage coding between both processes.
         https://bugs.webkit.org/show_bug.cgi?id=45139
 
diff --git a/WebKit2/Shared/ImmutableDictionary.cpp b/WebKit2/Shared/ImmutableDictionary.cpp
index 4eb4853..488da2d 100644
--- a/WebKit2/Shared/ImmutableDictionary.cpp
+++ b/WebKit2/Shared/ImmutableDictionary.cpp
@@ -34,7 +34,7 @@ ImmutableDictionary::ImmutableDictionary()
 {
 }
 
-ImmutableDictionary::ImmutableDictionary(MapType& map, AdoptTag)
+ImmutableDictionary::ImmutableDictionary(MapType& map)
 {
     m_map.swap(map);
 }
diff --git a/WebKit2/Shared/ImmutableDictionary.h b/WebKit2/Shared/ImmutableDictionary.h
index 4dc0d5c..d73ed48 100644
--- a/WebKit2/Shared/ImmutableDictionary.h
+++ b/WebKit2/Shared/ImmutableDictionary.h
@@ -50,10 +50,12 @@ public:
     }
     static PassRefPtr<ImmutableDictionary> adopt(MapType& map)
     {
-        return adoptRef(new ImmutableDictionary(map, Adopt));
+        return adoptRef(new ImmutableDictionary(map));
     }
     ~ImmutableDictionary();
 
+    virtual bool isMutable() { return false; }
+
     template<typename T>
     T* get(const String& key)
     {
@@ -76,12 +78,11 @@ public:
 
     size_t size() { return m_map.size(); }
 
-    virtual bool isMutable() { return false; }
+    const MapType& map() { return m_map; }
 
 protected:
     ImmutableDictionary();
-    enum AdoptTag { Adopt };
-    ImmutableDictionary(MapType& map, AdoptTag);
+    ImmutableDictionary(MapType& map);
 
     virtual Type type() const { return APIType; }
 
diff --git a/WebKit2/Shared/UserMessageCoders.h b/WebKit2/Shared/UserMessageCoders.h
index ca6c0b3..6c97872 100644
--- a/WebKit2/Shared/UserMessageCoders.h
+++ b/WebKit2/Shared/UserMessageCoders.h
@@ -23,14 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "ArgumentEncoder.h"
 #include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
 #include "ImmutableArray.h"
+#include "ImmutableDictionary.h"
+#include "WebCoreArgumentCoders.h"
 #include "WebString.h"
 
 namespace WebKit {
 
 //   - Array -> Array
+//   - Dictionary -> Dictionary
 //   - String -> String
 
 template<typename Owner>
@@ -46,6 +49,19 @@ public:
                 encoder->encode(Owner(array->at(i)));
             return true;
         }
+        case APIObject::TypeDictionary: {
+            ImmutableDictionary* dictionary = static_cast<ImmutableDictionary*>(m_root);
+            const ImmutableDictionary::MapType& map = dictionary->map();
+            encoder->encode(static_cast<uint64_t>(map.size()));
+
+            ImmutableDictionary::MapType::const_iterator it = map.begin();
+            ImmutableDictionary::MapType::const_iterator end = map.end();
+            for (; it != end; ++it) {
+                encoder->encode(it->first);
+                encoder->encode(Owner(it->second.get()));
+            }
+            return true;
+        }
         case APIObject::TypeString: {
             WebString* string = static_cast<WebString*>(m_root);
             encoder->encode(string->string());
@@ -70,6 +86,7 @@ protected:
 
 // Handles
 //   - Array -> Array
+//   - Dictionary -> Dictionary
 //   - String -> String
 
 template<typename Owner>
@@ -95,6 +112,30 @@ public:
             coder.m_root = ImmutableArray::adopt(vector);
             break;
         }
+        case APIObject::TypeDictionary: {
+            uint64_t size;
+            if (!decoder->decode(size))
+                return false;
+
+            ImmutableDictionary::MapType map;
+            for (size_t i = 0; i < size; ++i) {
+                String key;
+                if (!decoder->decode(key))
+                    return false;
+
+                RefPtr<APIObject> element;
+                Owner messageCoder(coder, element);
+                if (!decoder->decode(messageCoder))
+                    return false;
+
+                std::pair<ImmutableDictionary::MapType::iterator, bool> result = map.set(key, element.release());
+                if (!result.second)
+                    return false;
+            }
+
+            coder.m_root = ImmutableDictionary::adopt(map);
+            break;
+        }
         case APIObject::TypeString: {
             String string;
             if (!decoder->decode(string))

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list