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

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

Issue 1835943003: [DevTools] Use main frame when searching/creating DevToolsAgentHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | content/browser/devtools/site_per_process_devtools_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/render_frame_devtools_agent_host.cc
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc
index c556075c610fad00678d4c23c4877064c55d28e4..d9a1a1c0b0d239fe99429adaab2c4f4a46adb582 100644
--- a/content/browser/devtools/render_frame_devtools_agent_host.cc
+++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -71,17 +71,10 @@ static RenderFrameDevToolsAgentHost* FindAgentHost(
return NULL;
}
-// Returns RenderFrameDevToolsAgentHost attached to any of RenderFrameHost
-// instances associated with |web_contents|
static RenderFrameDevToolsAgentHost* FindAgentHost(WebContents* web_contents) {
- if (g_instances == NULL)
- return NULL;
- for (Instances::iterator it = g_instances.Get().begin();
- it != g_instances.Get().end(); ++it) {
- if ((*it)->GetWebContents() == web_contents)
- return *it;
- }
- return NULL;
+ if (!web_contents->GetMainFrame())
+ return nullptr;
+ return FindAgentHost(web_contents->GetMainFrame());
}
bool ShouldCreateDevToolsFor(RenderFrameHost* rfh) {
@@ -265,16 +258,11 @@ DevToolsAgentHost::GetOrCreateFor(RenderFrameHost* frame_host) {
// static
scoped_refptr<DevToolsAgentHost>
DevToolsAgentHost::GetOrCreateFor(WebContents* web_contents) {
- RenderFrameDevToolsAgentHost* result = FindAgentHost(web_contents);
- if (!result) {
- // TODO(dgozman): this check should not be necessary. See
- // http://crbug.com/489664.
- if (!web_contents->GetMainFrame())
- return nullptr;
- result = new RenderFrameDevToolsAgentHost(
- static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame()));
- }
- return result;
+ // TODO(dgozman): this check should not be necessary. See
+ // http://crbug.com/489664.
+ if (!web_contents->GetMainFrame())
+ return nullptr;
+ return DevToolsAgentHost::GetOrCreateFor(web_contents->GetMainFrame());
}
// static
« no previous file with comments | « no previous file | content/browser/devtools/site_per_process_devtools_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698