summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools/devtools_rpc_js.h
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/devtools/devtools_rpc_js.h')
-rw-r--r--webkit/glue/devtools/devtools_rpc_js.h39
1 files changed, 13 insertions, 26 deletions
diff --git a/webkit/glue/devtools/devtools_rpc_js.h b/webkit/glue/devtools/devtools_rpc_js.h
index c4cfc47..761f590 100644
--- a/webkit/glue/devtools/devtools_rpc_js.h
+++ b/webkit/glue/devtools/devtools_rpc_js.h
@@ -33,36 +33,25 @@
#define TOOLS_RPC_JS_STUB_METHOD0(Method) \
static v8::Handle<v8::Value> Js##Method(const v8::Arguments& args) { \
- SendRpcMessage(v8::External::Cast(*args.Data())->Value(), \
- #Method, "", "", ""); \
+ SendRpcMessageFromJs(#Method, args, 0); \
return v8::Undefined(); \
}
#define TOOLS_RPC_JS_STUB_METHOD1(Method, T1) \
static v8::Handle<v8::Value> Js##Method(const v8::Arguments& args) { \
- SendRpcMessage(v8::External::Cast(*args.Data())->Value(), \
- #Method, \
- WebCore::toWebCoreStringWithNullCheck(args[0]), "", ""); \
+ SendRpcMessageFromJs(#Method, args, 1); \
return v8::Undefined(); \
}
#define TOOLS_RPC_JS_STUB_METHOD2(Method, T1, T2) \
static v8::Handle<v8::Value> Js##Method(const v8::Arguments& args) { \
- SendRpcMessage(v8::External::Cast(*args.Data())->Value(), \
- #Method, \
- WebCore::toWebCoreStringWithNullCheck(args[0]), \
- WebCore::toWebCoreStringWithNullCheck(args[1]), \
- ""); \
+ SendRpcMessageFromJs(#Method, args, 2); \
return v8::Undefined(); \
}
#define TOOLS_RPC_JS_STUB_METHOD3(Method, T1, T2, T3) \
static v8::Handle<v8::Value> Js##Method(const v8::Arguments& args) { \
- SendRpcMessage(v8::External::Cast(*args.Data())->Value(), \
- #Method, \
- WebCore::toWebCoreStringWithNullCheck(args[0]), \
- WebCore::toWebCoreStringWithNullCheck(args[1]), \
- WebCore::toWebCoreStringWithNullCheck(args[2])); \
+ SendRpcMessageFromJs(#Method, args, 3); \
return v8::Undefined(); \
}
@@ -92,18 +81,16 @@ class Js##Class##BoundObj : public Class##Stub { \
TOOLS_RPC_JS_STUB_METHOD2, \
TOOLS_RPC_JS_STUB_METHOD3) \
private: \
- static void SendRpcMessage(void* self_ptr, \
- const char* method, \
- const String& param1, \
- const String& param2, \
- const String& param3) { \
+ static void SendRpcMessageFromJs(const char* method, \
+ const v8::Arguments& js_arguments, \
+ size_t args_count) { \
+ Vector<String> args(args_count); \
+ for (size_t i = 0; i < args_count; i++) { \
+ args[i].swap(WebCore::toWebCoreStringWithNullCheck(js_arguments[i])); \
+ } \
+ void* self_ptr = v8::External::Cast(*js_arguments.Data())->Value(); \
Js##Class##BoundObj* self = static_cast<Js##Class##BoundObj*>(self_ptr); \
- self->delegate_->SendRpcMessage( \
- #Class, \
- method, \
- param1, \
- param2, \
- param3); \
+ self->SendRpcMessage(#Class, method, args); \
} \
};