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

Unified Diff: chrome/browser/ui/webui/inspect_ui.cc

Issue 12589003: Remove duplicated code from chrome://inspect implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@targets
Patch Set: Rebase Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/inspect_ui.cc
diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc
index 4176676e0e91a26e5cf55714d0ad7164549091b1..ca492fb59abc808101602f391ffca335db0ef35e 100644
--- a/chrome/browser/ui/webui/inspect_ui.cc
+++ b/chrome/browser/ui/webui/inspect_ui.cc
@@ -32,7 +32,6 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -181,29 +180,13 @@ bool HandleDataRequestCallback(
scoped_ptr<ListValue> rvh_list(new ListValue());
- for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
- !it.IsAtEnd(); it.Advance()) {
- RenderProcessHost* render_process_host = it.GetCurrentValue();
- DCHECK(render_process_host);
+ std::vector<RenderViewHost*> rvh_vector =
+ DevToolsAgentHost::GetValidRenderViewHosts();
- // Ignore processes that don't have a connection, such as crashed tabs.
- if (!render_process_host->HasConnection())
- continue;
-
- RenderProcessHost::RenderWidgetHostsIterator rwit(
- render_process_host->GetRenderWidgetHostsIterator());
- for (; !rwit.IsAtEnd(); rwit.Advance()) {
- const RenderWidgetHost* widget = rwit.GetCurrentValue();
- DCHECK(widget);
- if (!widget || !widget->IsRenderView())
- continue;
-
- RenderViewHost* rvh =
- RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
-
- bool is_tab = tab_rvhs.find(rvh) != tab_rvhs.end();
- rvh_list->Append(BuildTargetDescriptor(rvh, is_tab));
- }
+ for (std::vector<RenderViewHost*>::iterator it(rvh_vector.begin());
+ it != rvh_vector.end(); it++) {
+ bool is_tab = tab_rvhs.find(*it) != tab_rvhs.end();
+ rvh_list->Append(BuildTargetDescriptor(*it, is_tab));
}
BrowserThread::PostTask(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698