summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authoryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 11:54:39 +0000
committeryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 11:54:39 +0000
commit87b603ad919c43e94758d36fd0ba0d3eca2382d5 (patch)
tree7ae907cbe7bd215324ca8203f605e109aa6e124c /chrome/renderer
parentc13fcbd8fa1d88271f31da179fe920bb08007c55 (diff)
downloadchromium_src-87b603ad919c43e94758d36fd0ba0d3eca2382d5.zip
chromium_src-87b603ad919c43e94758d36fd0ba0d3eca2382d5.tar.gz
chromium_src-87b603ad919c43e94758d36fd0ba0d3eca2382d5.tar.bz2
1. Implemented an agent providing RPC interface to v8 debugger of the inspected page.
2. Introduce new devtools IPC message to distinguish debugger messages and process them on IO thread so that debugger commands can be processed when v8 is stopped on a breakpoint bloking the render thread. 3. Added RPC message to allow devtool client evaluating JS expressions in the context of the inspected page. Review URL: http://codereview.chromium.org/42594 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/devtools_agent.cc13
-rw-r--r--chrome/renderer/devtools_agent.h1
-rw-r--r--chrome/renderer/devtools_client.cc4
-rw-r--r--chrome/renderer/devtools_client.h1
-rw-r--r--chrome/renderer/devtools_messages_internal.h7
5 files changed, 23 insertions, 3 deletions
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index 1a60ed5..e86d58c 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -67,13 +67,13 @@ void DevToolsAgent::SendFromIOThread(IPC::Message* message) {
}
}
-// Called on IO thread.
+// Called on the IO thread.
void DevToolsAgent::OnFilterAdded(IPC::Channel* channel) {
io_loop_ = MessageLoop::current();
channel_ = channel;
}
-// Called on IO thread.
+// Called on the IO thread.
bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
DCHECK(MessageLoop::current() == io_loop_);
@@ -87,13 +87,15 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebugBreak, OnDebugBreak)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebugCommand, OnDebugCommand)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage)
+ IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand,
+ OnDebuggerCommand)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
-// Called on IO thread.
+// Called on the IO thread.
void DevToolsAgent::OnFilterRemoved() {
io_loop_ = NULL;
channel_ = NULL;
@@ -191,6 +193,11 @@ void DevToolsAgent::DispatchRpcMessage(const std::string& raw_msg) {
web_agent->DispatchMessageFromClient(raw_msg);
}
+void DevToolsAgent::OnDebuggerCommand(const std::string& command) {
+ // Debugger commands are handled on the IO thread.
+ WebDevToolsAgent::ExecuteDebuggerCommand(command);
+}
+
void DevToolsAgent::InspectElement(int x, int y) {
if (!view_)
return;
diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h
index 15669df..0e22e5e 100644
--- a/chrome/renderer/devtools_agent.h
+++ b/chrome/renderer/devtools_agent.h
@@ -68,6 +68,7 @@ class DevToolsAgent : public IPC::ChannelProxy::MessageFilter,
void OnDebugBreak(bool force);
void OnDebugCommand(const std::wstring& cmd);
void OnRpcMessage(const std::string& raw_msg);
+ void OnDebuggerCommand(const std::string& command);
void OnInspectElement(int x, int y);
scoped_refptr<DebuggerBridge> debugger_;
diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc
index f3f84b1..240fda3 100644
--- a/chrome/renderer/devtools_client.cc
+++ b/chrome/renderer/devtools_client.cc
@@ -47,6 +47,10 @@ void DevToolsClient::SendMessageToAgent(const std::string& raw_msg) {
Send(DevToolsAgentMsg_RpcMessage(raw_msg));
}
+void DevToolsClient::SendDebuggerCommandToAgent(const std::string& command) {
+ Send(DevToolsAgentMsg_DebuggerCommand(command));
+}
+
void DevToolsClient::OnRpcMessage(const std::string& raw_msg) {
web_tools_client_->DispatchMessageFromAgent(raw_msg);
}
diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h
index 0098eb8..6e85845 100644
--- a/chrome/renderer/devtools_client.h
+++ b/chrome/renderer/devtools_client.h
@@ -35,6 +35,7 @@ class DevToolsClient : public WebDevToolsClientDelegate {
// WebDevToolsClient::Delegate implementation
virtual void SendMessageToAgent(const std::string& raw_msg);
+ virtual void SendDebuggerCommandToAgent(const std::string& command);
private:
void DidDebugAttach();
diff --git a/chrome/renderer/devtools_messages_internal.h b/chrome/renderer/devtools_messages_internal.h
index 685daa3..57af2ae 100644
--- a/chrome/renderer/devtools_messages_internal.h
+++ b/chrome/renderer/devtools_messages_internal.h
@@ -83,6 +83,13 @@ IPC_BEGIN_MESSAGES(DevToolsAgent)
IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_RpcMessage,
std::string /* raw_msg */)
+ // Send debugger command to the debugger agent. Debugger commands should
+ // be handled on IO thread(while all other devtools messages are handled in
+ // the render thread) to allow executing the commands when v8 is on a
+ // breakpoint.
+ IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_DebuggerCommand,
+ std::string /* command */)
+
// Inspect element with the given coordinates.
IPC_MESSAGE_CONTROL2(DevToolsAgentMsg_InspectElement,
int /* x */,