summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/devtools_agent.cc
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 00:51:35 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 00:51:35 +0000
commita862471b184f63a6f39c854e3abe4c26fb1edd1c (patch)
tree15cb15bed9476f80cb7a7b2034e1539d38417055 /chrome/renderer/devtools_agent.cc
parent220d7100e2095b875c401e32c3aab2830d4405e0 (diff)
downloadchromium_src-a862471b184f63a6f39c854e3abe4c26fb1edd1c.zip
chromium_src-a862471b184f63a6f39c854e3abe4c26fb1edd1c.tar.gz
chromium_src-a862471b184f63a6f39c854e3abe4c26fb1edd1c.tar.bz2
DevTools: Make all devtools messages dispatch through debugger interrupt.
Review URL: http://codereview.chromium.org/73002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/devtools_agent.cc')
-rw-r--r--chrome/renderer/devtools_agent.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index 046b755..918bb73 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -9,19 +9,23 @@
#include "chrome/renderer/render_view.h"
#include "webkit/glue/webdevtoolsagent.h"
+// static
+std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_;
+
DevToolsAgent::DevToolsAgent(int routing_id, RenderView* view)
: routing_id_(routing_id),
view_(view) {
+ agent_for_routing_id_[routing_id] = this;
}
DevToolsAgent::~DevToolsAgent() {
+ agent_for_routing_id_.erase(routing_id_);
}
// Called on the Renderer thread.
bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message)
- IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement)
@@ -37,11 +41,18 @@ void DevToolsAgent::SendMessageToClient(const std::string& raw_msg) {
view_->Send(m);
}
-void DevToolsAgent::OnAttach() {
- WebDevToolsAgent* web_agent = GetWebAgent();
- if (web_agent) {
- web_agent->Attach();
+int DevToolsAgent::GetHostId() {
+ return routing_id_;
+}
+
+// static
+DevToolsAgent* DevToolsAgent::FromHostId(int host_id) {
+ std::map<int, DevToolsAgent*>::iterator it =
+ agent_for_routing_id_.find(host_id);
+ if (it != agent_for_routing_id_.end()) {
+ return it->second;
}
+ return NULL;
}
void DevToolsAgent::OnDetach() {