summaryrefslogtreecommitdiffstats
path: root/content/browser/debugger
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 15:53:29 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 15:53:29 +0000
commite62de3556162e6b8762c8f28ecf4d448d5146885 (patch)
tree83b89a888ad0215beeebf5ca5898ca72b8c15e3c /content/browser/debugger
parent6e7c156915c1023fb5c2c3d949ec8cb2bc8e7dc1 (diff)
downloadchromium_src-e62de3556162e6b8762c8f28ecf4d448d5146885.zip
chromium_src-e62de3556162e6b8762c8f28ecf4d448d5146885.tar.gz
chromium_src-e62de3556162e6b8762c8f28ecf4d448d5146885.tar.bz2
DevTools: look up client hosts for the given tab contents while navigating.
BUG=110613 Review URL: https://chromiumcodereview.appspot.com/9226016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/debugger')
-rw-r--r--content/browser/debugger/devtools_manager_impl.cc21
-rw-r--r--content/browser/debugger/devtools_manager_impl.h9
-rw-r--r--content/browser/debugger/render_view_devtools_agent_host.cc12
3 files changed, 25 insertions, 17 deletions
diff --git a/content/browser/debugger/devtools_manager_impl.cc b/content/browser/debugger/devtools_manager_impl.cc
index 0f77662b..e60c357 100644
--- a/content/browser/debugger/devtools_manager_impl.cc
+++ b/content/browser/debugger/devtools_manager_impl.cc
@@ -50,6 +50,14 @@ DevToolsClientHost* DevToolsManagerImpl::GetDevToolsClientHostFor(
return NULL;
}
+DevToolsAgentHost* DevToolsManagerImpl::GetDevToolsAgentHostFor(
+ DevToolsClientHost* client_host) {
+ ClientToAgentHostMap::iterator it = client_to_agent_host_.find(client_host);
+ if (it != client_to_agent_host_.end())
+ return it->second;
+ return NULL;
+}
+
void DevToolsManagerImpl::RegisterDevToolsClientHostFor(
DevToolsAgentHost* agent_host,
DevToolsClientHost* client_host) {
@@ -60,7 +68,7 @@ void DevToolsManagerImpl::RegisterDevToolsClientHostFor(
bool DevToolsManagerImpl::DispatchOnInspectorBackend(
DevToolsClientHost* from,
const std::string& message) {
- DevToolsAgentHost* agent_host = GetAgentHost(from);
+ DevToolsAgentHost* agent_host = GetDevToolsAgentHostFor(from);
if (!agent_host)
return false;
@@ -91,7 +99,7 @@ void DevToolsManagerImpl::InspectElement(DevToolsAgentHost* agent_host,
}
void DevToolsManagerImpl::ClientHostClosing(DevToolsClientHost* client_host) {
- DevToolsAgentHost* agent_host = GetAgentHost(client_host);
+ DevToolsAgentHost* agent_host = GetDevToolsAgentHostFor(client_host);
if (!agent_host) {
// It might be in the list of orphan client hosts, remove it from there.
for (OrphanClientHosts::iterator it = orphan_client_hosts_.begin();
@@ -113,15 +121,6 @@ void DevToolsManagerImpl::AgentHostClosing(DevToolsAgentHost* agent_host) {
UnregisterDevToolsClientHostFor(agent_host);
}
-DevToolsAgentHost* DevToolsManagerImpl::GetAgentHost(
- DevToolsClientHost* client_host) {
- ClientHostToInspectedRvhMap::iterator it =
- client_to_agent_host_.find(client_host);
- if (it != client_to_agent_host_.end())
- return it->second;
- return NULL;
-}
-
void DevToolsManagerImpl::UnregisterDevToolsClientHostFor(
DevToolsAgentHost* agent_host) {
DevToolsClientHost* client_host = GetDevToolsClientHostFor(agent_host);
diff --git a/content/browser/debugger/devtools_manager_impl.h b/content/browser/debugger/devtools_manager_impl.h
index 0039b7d..388f8e4 100644
--- a/content/browser/debugger/devtools_manager_impl.h
+++ b/content/browser/debugger/devtools_manager_impl.h
@@ -72,6 +72,8 @@ class CONTENT_EXPORT DevToolsManagerImpl
DevToolsAgentHost* to_agent) OVERRIDE;
virtual DevToolsClientHost* GetDevToolsClientHostFor(
DevToolsAgentHost* agent_host) OVERRIDE;
+ virtual DevToolsAgentHost* GetDevToolsAgentHostFor(
+ DevToolsClientHost* client_host) OVERRIDE;
virtual void RegisterDevToolsClientHostFor(
DevToolsAgentHost* agent_host,
DevToolsClientHost* client_host) OVERRIDE;
@@ -94,9 +96,6 @@ class CONTENT_EXPORT DevToolsManagerImpl
// DevToolsAgentHost::CloseListener implementation.
virtual void AgentHostClosing(DevToolsAgentHost* host) OVERRIDE;
- // Returns DevToolsAgentHost inspected by the DevToolsClientHost.
- DevToolsAgentHost* GetAgentHost(DevToolsClientHost* client_host);
-
void BindClientHost(DevToolsAgentHost* agent_host,
DevToolsClientHost* client_host);
void UnbindClientHost(DevToolsAgentHost* agent_host,
@@ -121,8 +120,8 @@ class CONTENT_EXPORT DevToolsManagerImpl
AgentToClientHostMap agent_to_client_host_;
typedef std::map<DevToolsClientHost*, DevToolsAgentHost*>
- ClientHostToInspectedRvhMap;
- ClientHostToInspectedRvhMap client_to_agent_host_;
+ ClientToAgentHostMap;
+ ClientToAgentHostMap client_to_agent_host_;
typedef std::map<DevToolsAgentHost*, std::string> AgentRuntimeStates;
AgentRuntimeStates agent_runtime_states_;
diff --git a/content/browser/debugger/render_view_devtools_agent_host.cc b/content/browser/debugger/render_view_devtools_agent_host.cc
index 72ffe8f..7aad562 100644
--- a/content/browser/debugger/render_view_devtools_agent_host.cc
+++ b/content/browser/debugger/render_view_devtools_agent_host.cc
@@ -28,7 +28,6 @@ base::LazyInstance<Instances,
g_instances = LAZY_INSTANCE_INITIALIZER;
} // namespace
-
// static
DevToolsAgentHost* DevToolsAgentHostRegistry::GetDevToolsAgentHost(
RenderViewHost* rvh) {
@@ -39,6 +38,17 @@ DevToolsAgentHost* DevToolsAgentHostRegistry::GetDevToolsAgentHost(
}
// static
+RenderViewHost* DevToolsAgentHostRegistry::GetRenderViewHost(
+ DevToolsAgentHost* agent_host) {
+ for (Instances::iterator it = g_instances.Get().begin();
+ it != g_instances.Get().end(); ++it) {
+ if (agent_host == it->second)
+ return it->first;
+ }
+ return NULL;
+}
+
+// static
bool DevToolsAgentHostRegistry::HasDevToolsAgentHost(RenderViewHost* rvh) {
if (g_instances == NULL)
return false;