Title: [192081] trunk/Source/WebKit2
Revision
192081
Author
[email protected]
Date
2015-11-05 14:44:44 -0800 (Thu, 05 Nov 2015)

Log Message

Move invocation argument encoding out to a separate function
https://bugs.webkit.org/show_bug.cgi?id=150950

Reviewed by Tim Horton.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(encodeInvocationArguments):
(encodeInvocation):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (192080 => 192081)


--- trunk/Source/WebKit2/ChangeLog	2015-11-05 22:33:22 UTC (rev 192080)
+++ trunk/Source/WebKit2/ChangeLog	2015-11-05 22:44:44 UTC (rev 192081)
@@ -1,3 +1,14 @@
+2015-11-05  Anders Carlsson  <[email protected]>
+
+        Move invocation argument encoding out to a separate function
+        https://bugs.webkit.org/show_bug.cgi?id=150950
+
+        Reviewed by Tim Horton.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (encodeInvocationArguments):
+        (encodeInvocation):
+
 2015-11-05  Chris Dumez  <[email protected]>
 
         [WK2] Clean up / Modernize NetworkResourceLoader

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


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2015-11-05 22:33:22 UTC (rev 192080)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2015-11-05 22:44:44 UTC (rev 192081)
@@ -111,18 +111,13 @@
     encoder->_objectStream->elements()[position] = encodedObject.release();
 }
 
-static void encodeInvocation(WKRemoteObjectEncoder *encoder, NSInvocation *invocation)
+static void encodeInvocationArguments(WKRemoteObjectEncoder *encoder, NSInvocation *invocation, NSUInteger firstArgument)
 {
     NSMethodSignature *methodSignature = invocation.methodSignature;
-    [encoder encodeObject:methodSignature._typeString forKey:typeStringKey];
-    [encoder encodeObject:NSStringFromSelector(invocation.selector) forKey:selectorKey];
-
     NSUInteger argumentCount = methodSignature.numberOfArguments;
 
-    // The invocation should always have have self and _cmd arguments.
-    ASSERT(argumentCount >= 2);
+    ASSERT(firstArgument <= argumentCount);
 
-    // We ignore self and _cmd.
     for (NSUInteger i = 2; i < argumentCount; ++i) {
         const char* type = [methodSignature getArgumentTypeAtIndex:i];
 
@@ -214,6 +209,15 @@
     }
 }
 
+static void encodeInvocation(WKRemoteObjectEncoder *encoder, NSInvocation *invocation)
+{
+    NSMethodSignature *methodSignature = invocation.methodSignature;
+    [encoder encodeObject:methodSignature._typeString forKey:typeStringKey];
+    [encoder encodeObject:NSStringFromSelector(invocation.selector) forKey:selectorKey];
+
+    encodeInvocationArguments(encoder, invocation, 2);
+}
+
 static void encodeString(WKRemoteObjectEncoder *encoder, NSString *string)
 {
     encoder->_currentDictionary->set(stringKey, API::String::create(string));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to