Title: [158784] trunk/Source/WebKit2
Revision
158784
Author
[email protected]
Date
2013-11-06 13:52:54 -0800 (Wed, 06 Nov 2013)

Log Message

Implement more decoding methods
https://bugs.webkit.org/show_bug.cgi?id=123922

Reviewed by Dan Bernstein.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(-[WKRemoteObjectDecoder decodeObjectForKey:]):
Call decodeObjectOfClasses:forKey: passing nil as the classes set.

(-[WKRemoteObjectDecoder decodeInt64ForKey:]):
Try to get a WebUInt64 and return its value.

(-[WKRemoteObjectDecoder decodeDoubleForKey:]):
Try to get a WebDouble and return its value.

(-[WKRemoteObjectDecoder decodeBytesForKey:returnedLength:]):
Move this method next to the other decoding methods.

(-[WKRemoteObjectDecoder requiresSecureCoding]):
Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (158783 => 158784)


--- trunk/Source/WebKit2/ChangeLog	2013-11-06 21:39:17 UTC (rev 158783)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-06 21:52:54 UTC (rev 158784)
@@ -1,3 +1,26 @@
+2013-11-06  Anders Carlsson  <[email protected]>
+
+        Implement more decoding methods
+        https://bugs.webkit.org/show_bug.cgi?id=123922
+
+        Reviewed by Dan Bernstein.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (-[WKRemoteObjectDecoder decodeObjectForKey:]):
+        Call decodeObjectOfClasses:forKey: passing nil as the classes set.
+
+        (-[WKRemoteObjectDecoder decodeInt64ForKey:]):
+        Try to get a WebUInt64 and return its value.
+
+        (-[WKRemoteObjectDecoder decodeDoubleForKey:]):
+        Try to get a WebDouble and return its value.
+
+        (-[WKRemoteObjectDecoder decodeBytesForKey:returnedLength:]):
+        Move this method next to the other decoding methods.
+
+        (-[WKRemoteObjectDecoder requiresSecureCoding]):
+        Ditto.
+
 2013-11-06  Brendan Long  <[email protected]>
 
         [Gtk][EFL] Fix build after r158759

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm (158783 => 158784)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2013-11-06 21:39:17 UTC (rev 158783)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2013-11-06 21:52:54 UTC (rev 158784)
@@ -289,21 +289,11 @@
     return _currentDictionary->map().contains(escapeKey(key));
 }
 
-- (const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)length
+- (id)decodeObjectForKey:(NSString *)key
 {
-    WebData* data = ""
-    if (!data || !data->size())
-        return nullptr;
-
-    *length = data->size();
-    return data->bytes();
+    return [self decodeObjectOfClasses:nil forKey:key];
 }
 
-- (BOOL)requiresSecureCoding
-{
-    return YES;
-}
-
 static id decodeObject(WKRemoteObjectDecoder *decoder, const ImmutableDictionary*);
 
 static id decodeObjectFromObjectStream(WKRemoteObjectDecoder *decoder, NSSet *allowedClasses)
@@ -463,6 +453,37 @@
     return decodeObject(decoder);
 }
 
+- (int64_t)decodeInt64ForKey:(NSString *)key
+{
+    const WebUInt64* value = _currentDictionary->get<WebUInt64>(escapeKey(key));
+    if (!value)
+        return 0;
+    return value->value();
+}
+
+- (double)decodeDoubleForKey:(NSString *)key
+{
+    const WebDouble* value = _currentDictionary->get<WebDouble>(escapeKey(key));
+    if (!value)
+        return 0;
+    return value->value();
+}
+
+- (const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)length
+{
+    WebData* data = ""
+    if (!data || !data->size())
+        return nullptr;
+
+    *length = data->size();
+    return data->bytes();
+}
+
+- (BOOL)requiresSecureCoding
+{
+    return YES;
+}
+
 - (id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key
 {
     TemporaryChange<NSSet *> allowedClassesChange(_allowedClasses, classes);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to