Chromium Code Reviews| Index: content/browser/devtools/render_view_devtools_agent_host.cc |
| diff --git a/content/browser/devtools/render_view_devtools_agent_host.cc b/content/browser/devtools/render_view_devtools_agent_host.cc |
| index 39698d3a308cf5a212747afb66738bcb8d3f17e1..31ca0e5bfda841b8d00de02b9e8e3685d3f2daef 100644 |
| --- a/content/browser/devtools/render_view_devtools_agent_host.cc |
| +++ b/content/browser/devtools/render_view_devtools_agent_host.cc |
| @@ -120,6 +120,38 @@ void DevToolsAgentHost::ConnectRenderViewHost(const std::string& cookie, |
| //static |
| std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() { |
| std::vector<RenderViewHost*> result; |
| + |
| + scoped_ptr<RenderWidgetHost::List> hosts = |
| + RenderWidgetHost::GetRenderWidgetHosts(); |
| + for (RenderWidgetHost::List::const_iterator it = hosts->begin(); |
| + it != hosts->end(); |
| + ++it) { |
| + const RenderWidgetHost* widget = *it; |
| + |
| + // Ignore processes that don't have a connection, such as crashed contents. |
| + if (!widget->GetProcess()->HasConnection()) |
| + continue; |
| + |
| + if (!widget->IsRenderView()) |
| + continue; |
| + |
| + RenderViewHost* rvh = |
| + RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); |
| + // Don't report swapped out views. |
| + if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out()) |
| + continue; |
| + |
| + WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
| + // Don't report a RenderViewHost if it is not the current RenderViewHost |
| + // for some WebContents. |
| + if (!web_contents || rvh != web_contents->GetRenderViewHost()) |
| + continue; |
| + |
| + result.push_back(rvh); |
| + } |
| + |
| + |
| + /* |
|
dcheng
2013/06/11 00:34:58
Nit: Delete this block.
|
| for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); |
| !it.IsAtEnd(); it.Advance()) { |
| RenderProcessHost* render_process_host = it.GetCurrentValue(); |
| @@ -152,6 +184,7 @@ std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() { |
| result.push_back(rvh); |
| } |
| } |
| + */ |
| return result; |
| } |