From 4f4dc2f3fcb01bc6402cbaa83d0935194f992cb5 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Fri, 16 Oct 2009 16:00:32 +0000 Subject: Convert devtools interfaces over to using WebString. Also converts some internal std::string usage to WebCore::String. Note: copying WebString to WebCore::String is very cheap (just increments a reference count). The ugly WebStringToString and StringToWebString calls inside the devtools implementation are temporary. Once this code moves into the WebKit API implementation, those methods will go away. I thought about changing the devtools IPCs to use string16 instead of std::string because that would avoid the UTF8 conversions. I'm not sure if that is worth it though given that UTF16 would increase the amount of data being sent over IPC. I figure this is something that could be studied later. R=pfeldman BUG=24597 TEST=none Review URL: http://codereview.chromium.org/264077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29286 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webdevtoolsagent_impl.cc | 55 +++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'webkit/glue/webdevtoolsagent_impl.cc') diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index 3c37b11..e255b39 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -52,9 +52,10 @@ using WebCore::V8DOMWrapper; using WebCore::V8Proxy; using WebKit::WebDataSource; using WebKit::WebFrame; +using WebKit::WebString; +using WebKit::WebURL; using WebKit::WebURLRequest; - namespace { void InspectorBackendWeakReferenceCallback(v8::Persistent object, @@ -154,13 +155,13 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame( } WebDataSource* ds = frame->dataSource(); const WebURLRequest& request = ds->request(); - GURL url = ds->hasUnreachableURL() ? + WebURL url = ds->hasUnreachableURL() ? ds->unreachableURL() : request.url(); if (webview->mainFrame() == frame) { ResetInspectorFrontendProxy(); tools_agent_delegate_stub_->FrameNavigate( - url.possibly_invalid_spec()); + webkit_glue::WebURLToKURL(url).string()); SetApuAgentEnabledInUtilityContext(utility_context_, apu_agent_enabled_); } UnhideResourcesPanelIfNecessary(); @@ -251,13 +252,18 @@ void WebDevToolsAgentImpl::SetApuAgentEnabled(bool enable) { } void WebDevToolsAgentImpl::DispatchMessageFromClient( - const std::string& class_name, - const std::string& method_name, - const std::string& param1, - const std::string& param2, - const std::string& param3) { + const WebString& class_name, + const WebString& method_name, + const WebString& param1, + const WebString& param2, + const WebString& param3) { if (ToolsAgentDispatch::Dispatch( - this, class_name, method_name, param1, param2, param3)) { + this, + webkit_glue::WebStringToString(class_name), + webkit_glue::WebStringToString(method_name), + webkit_glue::WebStringToString(param1), + webkit_glue::WebStringToString(param2), + webkit_glue::WebStringToString(param3))) { return; } @@ -267,8 +273,12 @@ void WebDevToolsAgentImpl::DispatchMessageFromClient( if (debugger_agent_impl_.get() && DebuggerAgentDispatch::Dispatch( - debugger_agent_impl_.get(), class_name, method_name, - param1, param2, param3)) { + 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))) { return; } } @@ -283,13 +293,17 @@ void WebDevToolsAgentImpl::InspectElement(int x, int y) { } void WebDevToolsAgentImpl::SendRpcMessage( - const std::string& class_name, - const std::string& method_name, - const std::string& param1, - const std::string& param2, - const std::string& param3) { - delegate_->SendMessageToClient(class_name, method_name, param1, param2, - param3); + const String& class_name, + const String& method_name, + const String& param1, + const String& param2, + const String& param3) { + delegate_->SendMessageToClient( + webkit_glue::StringToWebString(class_name), + webkit_glue::StringToWebString(method_name), + webkit_glue::StringToWebString(param1), + webkit_glue::StringToWebString(param2), + webkit_glue::StringToWebString(param3)); } void WebDevToolsAgentImpl::InitDevToolsAgentHost() { @@ -395,9 +409,10 @@ v8::Handle WebDevToolsAgentImpl::JsDispatchToApu( // static void WebDevToolsAgent::ExecuteDebuggerCommand( - const std::string& command, + const WebString& command, int caller_id) { - DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id); + DebuggerAgentManager::ExecuteDebuggerCommand( + webkit_glue::WebStringToString(command), caller_id); } // static -- cgit v1.1