diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-11 09:08:17 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-11 09:08:17 +0000 |
commit | 221f4130ad35eb3074ee079dae571157da727a9d (patch) | |
tree | d647bcdd73ef1e35568d4beb3a7a0e3ed4d4b993 /webkit | |
parent | 797f01294b84d46813da707e0ed406dfd27a0f35 (diff) | |
download | chromium_src-221f4130ad35eb3074ee079dae571157da727a9d.zip chromium_src-221f4130ad35eb3074ee079dae571157da727a9d.tar.gz chromium_src-221f4130ad35eb3074ee079dae571157da727a9d.tar.bz2 |
DevTools: use WebDevToolsMessageData for devtools rpc messages
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=34333
Review URL: http://codereview.chromium.org/463065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/devtools_message_data.cc | 31 | ||||
-rw-r--r-- | webkit/glue/devtools/devtools_message_data.h | 25 | ||||
-rw-r--r-- | webkit/glue/devtools/devtools_rpc.h | 80 | ||||
-rw-r--r-- | webkit/glue/devtools/devtools_rpc_js.h | 39 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 84 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.h | 6 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsfrontend_impl.cc | 58 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsfrontend_impl.h | 6 | ||||
-rw-r--r-- | webkit/webkit.gyp | 6 |
9 files changed, 181 insertions, 154 deletions
diff --git a/webkit/glue/devtools/devtools_message_data.cc b/webkit/glue/devtools/devtools_message_data.cc new file mode 100644 index 0000000..68280fb --- /dev/null +++ b/webkit/glue/devtools/devtools_message_data.cc @@ -0,0 +1,31 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" + +#undef LOG + +#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsMessageData.h" +#include "webkit/glue/devtools/devtools_message_data.h" +#include "webkit/glue/glue_util.h" + +DevToolsMessageData::DevToolsMessageData( + const WebKit::WebDevToolsMessageData& data) + : class_name(webkit_glue::WebStringToStdString(data.className)), + method_name(webkit_glue::WebStringToStdString(data.methodName)) { + for (size_t i = 0; i < data.arguments.size(); i++) + arguments.push_back(webkit_glue::WebStringToStdString(data.arguments[i])); +} + +WebKit::WebDevToolsMessageData + DevToolsMessageData::ToWebDevToolsMessageData() const { + WebKit::WebDevToolsMessageData result; + result.className = webkit_glue::StdStringToWebString(class_name); + result.methodName = webkit_glue::StdStringToWebString(method_name); + WebKit::WebVector<WebKit::WebString> web_args(arguments.size()); + for (size_t i = 0; i < arguments.size(); i++) + web_args[i] = webkit_glue::StdStringToWebString(arguments[i]); + result.arguments.swap(web_args); + return result; +}
\ No newline at end of file diff --git a/webkit/glue/devtools/devtools_message_data.h b/webkit/glue/devtools/devtools_message_data.h new file mode 100644 index 0000000..4d28b84 --- /dev/null +++ b/webkit/glue/devtools/devtools_message_data.h @@ -0,0 +1,25 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_MESSAGE_DATA_H_ +#define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_MESSAGE_DATA_H_ + +#include <string> +#include <vector> + +namespace WebKit { +struct WebDevToolsMessageData; +} + +struct DevToolsMessageData { + DevToolsMessageData() {} + explicit DevToolsMessageData(const WebKit::WebDevToolsMessageData&); + WebKit::WebDevToolsMessageData ToWebDevToolsMessageData() const; + + std::string class_name; + std::string method_name; + std::vector<std::string> arguments; +}; + +#endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_MESSAGE_DATA_H_ diff --git a/webkit/glue/devtools/devtools_rpc.h b/webkit/glue/devtools/devtools_rpc.h index 819bd79..b0c60fe 100644 --- a/webkit/glue/devtools/devtools_rpc.h +++ b/webkit/glue/devtools/devtools_rpc.h @@ -51,14 +51,19 @@ #define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_ #include "PlatformString.h" +#include "Vector.h" #include <wtf/Noncopyable.h> +#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsMessageData.h" +#include "webkit/glue/glue_util.h" + namespace WebCore { class String; } using WebCore::String; +using WTF::Vector; /////////////////////////////////////////////////////// // RPC dispatch macro @@ -130,37 +135,35 @@ struct RpcTypeTrait<String> { #define TOOLS_RPC_STUB_METHOD0(Method) \ virtual void Method() { \ - this->delegate_->SendRpcMessage(class_name, #Method); \ + Vector<String> args; \ + this->SendRpcMessage(class_name, #Method, args); \ } #define TOOLS_RPC_STUB_METHOD1(Method, T1) \ virtual void Method(RpcTypeTrait<T1>::ApiType t1) { \ - this->delegate_->SendRpcMessage( \ - class_name, \ - #Method, \ - RpcTypeTrait<T1>::ToString(t1)); \ + Vector<String> args(1); \ + args[0] = RpcTypeTrait<T1>::ToString(t1); \ + this->SendRpcMessage(class_name, #Method, args); \ } #define TOOLS_RPC_STUB_METHOD2(Method, T1, T2) \ virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ RpcTypeTrait<T2>::ApiType t2) { \ - this->delegate_->SendRpcMessage( \ - class_name, \ - #Method, \ - RpcTypeTrait<T1>::ToString(t1), \ - RpcTypeTrait<T2>::ToString(t2)); \ + Vector<String> args(2); \ + args[0] = RpcTypeTrait<T1>::ToString(t1); \ + args[1] = RpcTypeTrait<T2>::ToString(t2); \ + this->SendRpcMessage(class_name, #Method, args); \ } #define TOOLS_RPC_STUB_METHOD3(Method, T1, T2, T3) \ virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ RpcTypeTrait<T2>::ApiType t2, \ RpcTypeTrait<T3>::ApiType t3) { \ - this->delegate_->SendRpcMessage( \ - class_name, \ - #Method, \ - RpcTypeTrait<T1>::ToString(t1), \ - RpcTypeTrait<T2>::ToString(t2), \ - RpcTypeTrait<T3>::ToString(t3)); \ + Vector<String> args(3); \ + args[0] = RpcTypeTrait<T1>::ToString(t1); \ + args[1] = RpcTypeTrait<T2>::ToString(t2); \ + args[2] = RpcTypeTrait<T3>::ToString(t3); \ + this->SendRpcMessage(class_name, #Method, args); \ } /////////////////////////////////////////////////////// @@ -174,15 +177,15 @@ if (method_name == #Method) { \ #define TOOLS_RPC_DISPATCH1(Method, T1) \ if (method_name == #Method) { \ - delegate->Method(RpcTypeTrait<T1>::Parse(p1)); \ + delegate->Method(RpcTypeTrait<T1>::Parse(args[0])); \ return true; \ } #define TOOLS_RPC_DISPATCH2(Method, T1, T2) \ if (method_name == #Method) { \ delegate->Method( \ - RpcTypeTrait<T1>::Parse(p1), \ - RpcTypeTrait<T2>::Parse(p2) \ + RpcTypeTrait<T1>::Parse(args[0]), \ + RpcTypeTrait<T2>::Parse(args[1]) \ ); \ return true; \ } @@ -190,9 +193,9 @@ if (method_name == #Method) { \ #define TOOLS_RPC_DISPATCH3(Method, T1, T2, T3) \ if (method_name == #Method) { \ delegate->Method( \ - RpcTypeTrait<T1>::Parse(p1), \ - RpcTypeTrait<T2>::Parse(p2), \ - RpcTypeTrait<T3>::Parse(p3) \ + RpcTypeTrait<T1>::Parse(args[0]), \ + RpcTypeTrait<T2>::Parse(args[1]), \ + RpcTypeTrait<T3>::Parse(args[2]) \ ); \ return true; \ } @@ -239,14 +242,16 @@ class Class##Dispatch : public Noncopyable { \ virtual ~Class##Dispatch() {} \ \ static bool Dispatch(Class* delegate, \ - const WebCore::String& class_name, \ - const WebCore::String& method_name, \ - const WebCore::String& p1, \ - const WebCore::String& p2, \ - const WebCore::String& p3) { \ + const WebKit::WebDevToolsMessageData& data) { \ + String class_name = webkit_glue::WebStringToString(data.className); \ if (class_name != #Class) { \ return false; \ } \ + String method_name = webkit_glue::WebStringToString(data.methodName); \ + Vector<String> args; \ + for (size_t i = 0; i < data.arguments.size(); i++) { \ + args.append(webkit_glue::WebStringToString(data.arguments[i])); \ + } \ typedef Class CLASS; \ STRUCT( \ TOOLS_RPC_DISPATCH0, \ @@ -265,11 +270,8 @@ class DevToolsRpc { public: Delegate() {} virtual ~Delegate() {} - virtual void SendRpcMessage(const WebCore::String& class_name, - const WebCore::String& method_name, - const WebCore::String& p1 = "", - const WebCore::String& p2 = "", - const WebCore::String& p3 = "") = 0; + virtual void SendRpcMessage( + const WebKit::WebDevToolsMessageData& data) = 0; }; explicit DevToolsRpc(Delegate* delegate) @@ -277,6 +279,20 @@ class DevToolsRpc { virtual ~DevToolsRpc() {}; protected: + void SendRpcMessage(const String& class_name, + const String& method_name, + const Vector<String>& args) { + WebKit::WebVector<WebKit::WebString> web_args(args.size()); + for (size_t i = 0; i < args.size(); i++) { + web_args[i] = webkit_glue::StringToWebString(args[i]); + } + WebKit::WebDevToolsMessageData data; + data.className = webkit_glue::StringToWebString(class_name); + data.methodName = webkit_glue::StringToWebString(method_name); + data.arguments.swap(web_args); + this->delegate_->SendRpcMessage(data); + } + Delegate* delegate_; }; diff --git a/webkit/glue/devtools/devtools_rpc_js.h b/webkit/glue/devtools/devtools_rpc_js.h index c4cfc47..f51d5f6 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] = 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); \ } \ }; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index 24b85bb..42fcbb8 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -30,6 +30,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgentClient.h" +#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsMessageData.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" @@ -68,6 +69,7 @@ using WebCore::V8DOMWrapper; using WebCore::V8Proxy; using WebKit::WebDataSource; using WebKit::WebDevToolsAgentClient; +using WebKit::WebDevToolsMessageData; using WebKit::WebFrame; using WebKit::WebFrameImpl; using WebKit::WebPoint; @@ -117,17 +119,9 @@ class IoRpcDelegate : public DevToolsRpc::Delegate { public: IoRpcDelegate() {} virtual ~IoRpcDelegate() {} - virtual void SendRpcMessage(const String& class_name, - const String& method_name, - const String& p1, - const String& p2, - const String& p3) { - WebDevToolsAgentClient::sendMessageToFrontendOnIOThread( - webkit_glue::StringToWebString(class_name), - webkit_glue::StringToWebString(method_name), - webkit_glue::StringToWebString(p1), - webkit_glue::StringToWebString(p2), - webkit_glue::StringToWebString(p3)); + virtual void SendRpcMessage( + const WebKit::WebDevToolsMessageData& data) { + WebDevToolsAgentClient::sendMessageToFrontendOnIOThread(data); } private: @@ -286,19 +280,20 @@ void WebDevToolsAgentImpl::GetResourceContent( tools_agent_native_delegate_stub_->DidGetResourceContent(call_id, content); } +// TODO(yurys): this method is deprecated and will go away soon, use +// overloaded method with WebDevToolsMessageData argument instead. void WebDevToolsAgentImpl::dispatchMessageFromFrontend( const WebString& class_name, const WebString& method_name, const WebString& param1, const WebString& param2, const WebString& param3) { - if (ToolsAgentDispatch::Dispatch( - this, - webkit_glue::WebStringToString(class_name), - webkit_glue::WebStringToString(method_name), - webkit_glue::WebStringToString(param1), - webkit_glue::WebStringToString(param2), - webkit_glue::WebStringToString(param3))) { + ASSERT_NOT_REACHED(); +} + +void WebDevToolsAgentImpl::dispatchMessageFromFrontend( + const WebDevToolsMessageData& data) { + if (ToolsAgentDispatch::Dispatch(this, data)) { return; } @@ -307,22 +302,11 @@ void WebDevToolsAgentImpl::dispatchMessageFromFrontend( } if (debugger_agent_impl_.get() && - DebuggerAgentDispatch::Dispatch( - debugger_agent_impl_.get(), - webkit_glue::WebStringToString(class_name), - webkit_glue::WebStringToString(method_name), - webkit_glue::WebStringToString(param1), - webkit_glue::WebStringToString(param2), - webkit_glue::WebStringToString(param3))) { + DebuggerAgentDispatch::Dispatch(debugger_agent_impl_.get(), data)) { return; } } -void WebDevToolsAgentImpl::dispatchMessageFromFrontend( - const WebKit::WebDevToolsMessageData& data) { - // Stub. -} - void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) { web_view_impl_->inspectElementAt(point); } @@ -344,17 +328,8 @@ void WebDevToolsAgentImpl::setRuntimeFeatureEnabled(const WebString& wfeature, } void WebDevToolsAgentImpl::SendRpcMessage( - const String& class_name, - const String& method_name, - const String& param1, - const String& param2, - const String& param3) { - client_->sendMessageToFrontend( - webkit_glue::StringToWebString(class_name), - webkit_glue::StringToWebString(method_name), - webkit_glue::StringToWebString(param1), - webkit_glue::StringToWebString(param2), - webkit_glue::StringToWebString(param3)); + const WebKit::WebDevToolsMessageData& data) { + client_->sendMessageToFrontend(data); } void WebDevToolsAgentImpl::InitDevToolsAgentHost() { @@ -640,6 +615,8 @@ void WebDevToolsAgent::setMessageLoopDispatchHandler( DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); } +// TODO(yurys): this method is deprecated and will go away soon, use +// overloaded method with WebDevToolsMessageData argument instead. // static bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread( const WebString& className, @@ -647,16 +624,27 @@ bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread( const WebString& param1, const WebString& param2, const WebString& param3) { + WebKit::WebVector<WebString> arguments(static_cast<size_t>(3)); + arguments[0] = param1; + arguments[1] = param2; + arguments[2] = param3; + + WebDevToolsMessageData data; + data.className = className; + data.methodName = methodName; + data.arguments.swap(arguments); + // Delegate to overloaded method. This method will go away soon. + return WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(data); +} + +// static +bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread( + const WebDevToolsMessageData& data) { IoRpcDelegate transport; ProfilerAgentDelegateStub stub(&transport); ProfilerAgentImpl agent(&stub); - return ProfilerAgentDispatch::Dispatch( - &agent, - webkit_glue::WebStringToString(className), - webkit_glue::WebStringToString(methodName), - webkit_glue::WebStringToString(param1), - webkit_glue::WebStringToString(param2), - webkit_glue::WebStringToString(param3)); + return ProfilerAgentDispatch::Dispatch(&agent, data); } + } // namespace WebKit diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h index 65c7eb3..84c7483 100644 --- a/webkit/glue/webdevtoolsagent_impl.h +++ b/webkit/glue/webdevtoolsagent_impl.h @@ -101,11 +101,7 @@ class WebDevToolsAgentImpl : public WebKit::WebDevToolsAgentPrivate, const WebKit::WebURLError& error); // DevToolsRpc::Delegate implementation. - void SendRpcMessage(const WebCore::String& class_name, - const WebCore::String& method_name, - const WebCore::String& param1, - const WebCore::String& param2, - const WebCore::String& param3); + virtual void SendRpcMessage(const WebKit::WebDevToolsMessageData& data); void ForceRepaint(); diff --git a/webkit/glue/webdevtoolsfrontend_impl.cc b/webkit/glue/webdevtoolsfrontend_impl.cc index 15a50a9..1048a41 100644 --- a/webkit/glue/webdevtoolsfrontend_impl.cc +++ b/webkit/glue/webdevtoolsfrontend_impl.cc @@ -36,6 +36,7 @@ #include "third_party/WebKit/WebKit/chromium/src/WebViewImpl.h" #include "webkit/glue/devtools/bound_object.h" #include "webkit/glue/devtools/debugger_agent.h" +#include "webkit/glue/devtools/devtools_message_data.h" #include "webkit/glue/devtools/devtools_rpc_js.h" #include "webkit/glue/devtools/profiler_agent.h" #include "webkit/glue/devtools/tools_agent.h" @@ -218,28 +219,29 @@ WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() { menu_selection_handler_->disconnect(); } +// TODO(yurys): this method is deprecated and will go away soon, use +// overloaded method with WebDevToolsMessageData argument instead. void WebDevToolsFrontendImpl::dispatchMessageFromAgent( const WebString& class_name, const WebString& method_name, const WebString& param1, const WebString& param2, const WebString& param3) { + ASSERT_NOT_REACHED(); +} + +void WebDevToolsFrontendImpl::dispatchMessageFromAgent( + const WebKit::WebDevToolsMessageData& data) { if (ToolsAgentNativeDelegateDispatch::Dispatch( tools_agent_native_delegate_impl_.get(), - webkit_glue::WebStringToString(class_name), - webkit_glue::WebStringToString(method_name), - webkit_glue::WebStringToString(param1), - webkit_glue::WebStringToString(param2), - webkit_glue::WebStringToString(param3))) { + data)) { return; } - Vector<String> v; - v.append(webkit_glue::WebStringToString(class_name)); - v.append(webkit_glue::WebStringToString(method_name)); - v.append(webkit_glue::WebStringToString(param1)); - v.append(webkit_glue::WebStringToString(param2)); - v.append(webkit_glue::WebStringToString(param3)); + v.append(webkit_glue::WebStringToString(data.className)); + v.append(webkit_glue::WebStringToString(data.methodName)); + for (size_t i = 0; i < data.arguments.size(); i++) + v.append(webkit_glue::WebStringToString(data.arguments[i])); if (!loaded_) { pending_incoming_messages_.append(v); return; @@ -247,11 +249,6 @@ void WebDevToolsFrontendImpl::dispatchMessageFromAgent( ExecuteScript(v); } -void WebDevToolsFrontendImpl::dispatchMessageFromAgent( - const WebKit::WebDevToolsMessageData& data) { - // Stub. -} - void WebDevToolsFrontendImpl::AddResourceSourceToFrame(int resource_id, String mime_type, Node* frame) { @@ -271,15 +268,12 @@ void WebDevToolsFrontendImpl::ExecuteScript(const Vector<String>& v) { v8::Handle<v8::Value> dispatch_function = frame_context->Global()->Get(v8::String::New("devtools$$dispatch")); ASSERT(dispatch_function->IsFunction()); - v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatch_function); - v8::Handle<v8::Value> args[] = { - ToV8String(v.at(0)), - ToV8String(v.at(1)), - ToV8String(v.at(2)), - ToV8String(v.at(3)), - ToV8String(v.at(4)), - }; - function->Call(frame_context->Global(), 5, args); + v8::Handle<v8::Function> function = + v8::Handle<v8::Function>::Cast(dispatch_function); + Vector< v8::Handle<v8::Value> > args; + for (size_t i = 0; i < v.size(); i++) + args.append(ToV8String(v.at(i))); + function->Call(frame_context->Global(), args.size(), args.data()); } void WebDevToolsFrontendImpl::DispatchOnWebInspector( @@ -306,17 +300,9 @@ void WebDevToolsFrontendImpl::DispatchOnWebInspector( } -void WebDevToolsFrontendImpl::SendRpcMessage(const String& class_name, - const String& method_name, - const String& param1, - const String& param2, - const String& param3) { - client_->sendMessageToAgent( - webkit_glue::StringToWebString(class_name), - webkit_glue::StringToWebString(method_name), - webkit_glue::StringToWebString(param1), - webkit_glue::StringToWebString(param2), - webkit_glue::StringToWebString(param3)); +void WebDevToolsFrontendImpl::SendRpcMessage( + const WebKit::WebDevToolsMessageData& data) { + client_->sendMessageToAgent(data); } void WebDevToolsFrontendImpl::ContextMenuItemSelected( diff --git a/webkit/glue/webdevtoolsfrontend_impl.h b/webkit/glue/webdevtoolsfrontend_impl.h index 7557ea1..e60e7d5 100644 --- a/webkit/glue/webdevtoolsfrontend_impl.h +++ b/webkit/glue/webdevtoolsfrontend_impl.h @@ -48,11 +48,7 @@ class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend, virtual ~WebDevToolsFrontendImpl(); // DevToolsRpc::Delegate implementation. - virtual void SendRpcMessage(const String& class_name, - const String& method_name, - const String& param1, - const String& param2, - const String& param3); + virtual void SendRpcMessage(const WebKit::WebDevToolsMessageData& data); // WebDevToolsFrontend implementation. virtual void dispatchMessageFromAgent(const WebKit::WebString& class_name, diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index c2bb0b6..adc6687 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -237,8 +237,6 @@ # those in the test subdirectory and those with unittest in in their # names. 'glue/devtools/apu_agent_delegate.h', - 'glue/devtools/devtools_rpc.h', - 'glue/devtools/devtools_rpc_js.h', 'glue/devtools/bound_object.cc', 'glue/devtools/bound_object.h', 'glue/devtools/debugger_agent.h', @@ -246,6 +244,10 @@ 'glue/devtools/debugger_agent_impl.h', 'glue/devtools/debugger_agent_manager.cc', 'glue/devtools/debugger_agent_manager.h', + 'glue/devtools/devtools_message_data.cc', + 'glue/devtools/devtools_message_data.h', + 'glue/devtools/devtools_rpc.h', + 'glue/devtools/devtools_rpc_js.h', 'glue/devtools/profiler_agent.h', 'glue/devtools/profiler_agent_impl.cc', 'glue/devtools/profiler_agent_impl.h', |