Title: [170645] trunk/Source/WebKit2
Revision
170645
Author
commit-qu...@webkit.org
Date
2014-07-01 10:14:35 -0700 (Tue, 01 Jul 2014)

Log Message

Add encodeInteger and decodeInteger for remote object encoder and decoder.
https://bugs.webkit.org/show_bug.cgi?id=134453

In 64bit system, encodeInteger/decodeInteger is by default mapped into encodeInt64/decodeInt64.  For
32bit system, they are mapped to encodeInt32/decodeInt32.  However, since we don't have encodeInt32/decodeInt32
implementation in WKRemoteObjectCoder, we could hit crash in 32bit systems.

Patch by Yongjun Zhang <yongjun_zh...@apple.com> on 2014-07-01
Reviewed by Sam Weinig.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(-[WKRemoteObjectEncoder encodeInteger:forKey:]): Instead of creating a new number type UInt32, use encodeInt64 for
    encoding NSInteger.
(-[WKRemoteObjectDecoder decodeIntegerForKey:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (170644 => 170645)


--- trunk/Source/WebKit2/ChangeLog	2014-07-01 17:04:30 UTC (rev 170644)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-01 17:14:35 UTC (rev 170645)
@@ -1,3 +1,19 @@
+2014-07-01  Yongjun Zhang  <yongjun_zh...@apple.com>
+
+        Add encodeInteger and decodeInteger for remote object encoder and decoder.
+        https://bugs.webkit.org/show_bug.cgi?id=134453
+
+        In 64bit system, encodeInteger/decodeInteger is by default mapped into encodeInt64/decodeInt64.  For
+        32bit system, they are mapped to encodeInt32/decodeInt32.  However, since we don't have encodeInt32/decodeInt32
+        implementation in WKRemoteObjectCoder, we could hit crash in 32bit systems.
+
+        Reviewed by Sam Weinig.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (-[WKRemoteObjectEncoder encodeInteger:forKey:]): Instead of creating a new number type UInt32, use encodeInt64 for
+            encoding NSInteger.
+        (-[WKRemoteObjectDecoder decodeIntegerForKey:]):
+
 2014-06-30  Anders Carlsson  <ander...@apple.com>
 
         Use an std::function for filtering session state data

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


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2014-07-01 17:04:30 UTC (rev 170644)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2014-07-01 17:14:35 UTC (rev 170645)
@@ -295,6 +295,11 @@
     _currentDictionary->set(escapeKey(key), API::UInt64::create(value));
 }
 
+- (void)encodeInteger:(NSInteger)intv forKey:(NSString *)key
+{
+    return [self encodeInt64:intv forKey:key];
+}
+
 - (void)encodeDouble:(double)value forKey:(NSString *)key
 {
     _currentDictionary->set(escapeKey(key), API::Double::create(value));
@@ -575,6 +580,11 @@
     return value->value();
 }
 
+- (NSInteger)decodeIntegerForKey:(NSString *)key
+{
+    return [self decodeInt64ForKey:key];
+}
+
 - (double)decodeDoubleForKey:(NSString *)key
 {
     const API::Double* value = _currentDictionary->get<API::Double>(escapeKey(key));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to