Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(800)

Unified Diff: content/browser/devtools/render_view_devtools_agent_host.cc

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cleanup crashes. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698