summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-08 15:05:07 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-08 15:05:07 +0000
commit9f0c93f205ffc12010df25455dc776121fe6da0a (patch)
tree90307212ef56da83a9b9697f569735de5f8f20d5 /chrome/renderer
parent86c3d9ef4fdf6a70869bc9b026bee09c19219b8e (diff)
downloadchromium_src-9f0c93f205ffc12010df25455dc776121fe6da0a.zip
chromium_src-9f0c93f205ffc12010df25455dc776121fe6da0a.tar.gz
chromium_src-9f0c93f205ffc12010df25455dc776121fe6da0a.tar.bz2
Re-apply 34040. Now after 34055 build should succeed.
BUG=28689 TEST=none TBR=pfeldman@chromium.org Review URL: http://codereview.chromium.org/465120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/devtools_agent.cc16
-rw-r--r--chrome/renderer/devtools_agent_filter.cc45
-rw-r--r--chrome/renderer/devtools_agent_filter.h22
3 files changed, 77 insertions, 6 deletions
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index aad6ceb..d1e81e2 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -6,6 +6,7 @@
#include "chrome/common/devtools_messages.h"
#include "chrome/common/render_messages.h"
+#include "chrome/renderer/devtools_agent_filter.h"
#include "chrome/renderer/render_view.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
@@ -151,3 +152,18 @@ WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
return NULL;
return web_view->devToolsAgent();
}
+
+// static
+void WebKit::WebDevToolsAgentClient::sendMessageToFrontendOnIOThread(
+ const WebString& class_name,
+ const WebString& method_name,
+ const WebString& param1,
+ const WebString& param2,
+ const WebString& param3) {
+ DevToolsAgentFilter::SendRpcMessage(
+ class_name.utf8(),
+ method_name.utf8(),
+ param1.utf8(),
+ param2.utf8(),
+ param3.utf8());
+}
diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc
index 93b6c75..375c743 100644
--- a/chrome/renderer/devtools_agent_filter.cc
+++ b/chrome/renderer/devtools_agent_filter.cc
@@ -6,6 +6,7 @@
#include "base/message_loop.h"
#include "chrome/common/devtools_messages.h"
+#include "chrome/common/render_messages.h"
#include "chrome/renderer/devtools_agent.h"
#include "chrome/renderer/plugin_channel_host.h"
#include "chrome/renderer/render_view.h"
@@ -24,8 +25,13 @@ void DevToolsAgentFilter::DispatchMessageLoop() {
current->SetNestableTasksAllowed(old_state);
}
+// static
+IPC::Channel* DevToolsAgentFilter::channel_ = NULL;
+// static
+int DevToolsAgentFilter::current_routing_id_ = 0;
+
DevToolsAgentFilter::DevToolsAgentFilter()
- : current_routing_id_(0) {
+ : message_handled_(false) {
WebDevToolsAgent::setMessageLoopDispatchHandler(
&DevToolsAgentFilter::DispatchMessageLoop);
}
@@ -35,15 +41,16 @@ DevToolsAgentFilter::~DevToolsAgentFilter() {
bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
// Dispatch debugger commands directly from IO.
- bool handled = true;
+ message_handled_ = true;
current_routing_id_ = message.routing_id();
IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerPauseScript,
OnDebuggerPauseScript)
- IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage)
+ IPC_MESSAGE_UNHANDLED(message_handled_ = false)
IPC_END_MESSAGE_MAP()
- return handled;
+ return message_handled_;
}
void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) {
@@ -54,3 +61,33 @@ void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) {
void DevToolsAgentFilter::OnDebuggerPauseScript() {
WebDevToolsAgent::debuggerPauseScript();
}
+
+void DevToolsAgentFilter::OnRpcMessage(const std::string& class_name,
+ const std::string& method_name,
+ const std::string& param1,
+ const std::string& param2,
+ const std::string& param3) {
+ message_handled_ = WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(
+ WebString::fromUTF8(class_name),
+ WebString::fromUTF8(method_name),
+ WebString::fromUTF8(param1),
+ WebString::fromUTF8(param2),
+ WebString::fromUTF8(param3));
+}
+
+// static
+void DevToolsAgentFilter::SendRpcMessage(const std::string& class_name,
+ const std::string& method_name,
+ const std::string& param1,
+ const std::string& param2,
+ const std::string& param3) {
+ IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
+ current_routing_id_,
+ DevToolsClientMsg_RpcMessage(
+ class_name,
+ method_name,
+ param1,
+ param2,
+ param3));
+ channel_->Send(m);
+}
diff --git a/chrome/renderer/devtools_agent_filter.h b/chrome/renderer/devtools_agent_filter.h
index 4bf4460..ac5fd0c 100644
--- a/chrome/renderer/devtools_agent_filter.h
+++ b/chrome/renderer/devtools_agent_filter.h
@@ -22,18 +22,36 @@ class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter {
DevToolsAgentFilter();
virtual ~DevToolsAgentFilter();
+ static void SendRpcMessage(const std::string& class_name,
+ const std::string& method_name,
+ const std::string& param1,
+ const std::string& param2,
+ const std::string& param3);
+
private:
// IPC::ChannelProxy::MessageFilter override. Called on IO thread.
virtual bool OnMessageReceived(const IPC::Message& message);
+ virtual void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; }
+
static void DispatchMessageLoop();
// OnDebuggerCommand will be executed in the IO thread so that we can
// handle debug messages even when v8 is stopped.
void OnDebuggerCommand(const std::string& command);
void OnDebuggerPauseScript();
-
- int current_routing_id_;
+ void OnRpcMessage(const std::string& class_name,
+ const std::string& method_name,
+ const std::string& param1,
+ const std::string& param2,
+ const std::string& param3);
+
+ bool message_handled_;
+
+ // Made static to allow DevToolsAgent to use it for replying directly
+ // from IO thread.
+ static int current_routing_id_;
+ static IPC::Channel* channel_;
DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter);
};