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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/render_view_devtools_agent_host.h" 5 #include "content/browser/devtools/render_view_devtools_agent_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/child_process_security_policy_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/devtools/devtools_manager_impl.h" 10 #include "content/browser/devtools/devtools_manager_impl.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (cookie == (*it)->GetId()) { 113 if (cookie == (*it)->GetId()) {
114 (*it)->ConnectRenderViewHost(rvh, true); 114 (*it)->ConnectRenderViewHost(rvh, true);
115 break; 115 break;
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 //static 120 //static
121 std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() { 121 std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() {
122 std::vector<RenderViewHost*> result; 122 std::vector<RenderViewHost*> result;
123
124 scoped_ptr<RenderWidgetHost::List> hosts =
125 RenderWidgetHost::GetRenderWidgetHosts();
126 for (RenderWidgetHost::List::const_iterator it = hosts->begin();
127 it != hosts->end();
128 ++it) {
129 const RenderWidgetHost* widget = *it;
130
131 // Ignore processes that don't have a connection, such as crashed contents.
132 if (!widget->GetProcess()->HasConnection())
133 continue;
134
135 if (!widget->IsRenderView())
136 continue;
137
138 RenderViewHost* rvh =
139 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
140 // Don't report swapped out views.
141 if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out())
142 continue;
143
144 WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
145 // Don't report a RenderViewHost if it is not the current RenderViewHost
146 // for some WebContents.
147 if (!web_contents || rvh != web_contents->GetRenderViewHost())
148 continue;
149
150 result.push_back(rvh);
151 }
152
153
154 /*
dcheng 2013/06/11 00:34:58 Nit: Delete this block.
123 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 155 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
124 !it.IsAtEnd(); it.Advance()) { 156 !it.IsAtEnd(); it.Advance()) {
125 RenderProcessHost* render_process_host = it.GetCurrentValue(); 157 RenderProcessHost* render_process_host = it.GetCurrentValue();
126 DCHECK(render_process_host); 158 DCHECK(render_process_host);
127 159
128 // Ignore processes that don't have a connection, such as crashed contents. 160 // Ignore processes that don't have a connection, such as crashed contents.
129 if (!render_process_host->HasConnection()) 161 if (!render_process_host->HasConnection())
130 continue; 162 continue;
131 163
132 RenderProcessHost::RenderWidgetHostsIterator rwit( 164 RenderProcessHost::RenderWidgetHostsIterator rwit(
(...skipping 12 matching lines...) Expand all
145 177
146 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); 178 WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
147 // Don't report a RenderViewHost if it is not the current RenderViewHost 179 // Don't report a RenderViewHost if it is not the current RenderViewHost
148 // for some WebContents. 180 // for some WebContents.
149 if (!web_contents || rvh != web_contents->GetRenderViewHost()) 181 if (!web_contents || rvh != web_contents->GetRenderViewHost())
150 continue; 182 continue;
151 183
152 result.push_back(rvh); 184 result.push_back(rvh);
153 } 185 }
154 } 186 }
187 */
155 return result; 188 return result;
156 } 189 }
157 190
158 // static 191 // static
159 void RenderViewDevToolsAgentHost::OnCancelPendingNavigation( 192 void RenderViewDevToolsAgentHost::OnCancelPendingNavigation(
160 RenderViewHost* pending, 193 RenderViewHost* pending,
161 RenderViewHost* current) { 194 RenderViewHost* current) {
162 std::string cookie = DevToolsAgentHost::DisconnectRenderViewHost(pending); 195 std::string cookie = DevToolsAgentHost::DisconnectRenderViewHost(pending);
163 if (cookie != std::string()) 196 if (cookie != std::string())
164 DevToolsAgentHost::ConnectRenderViewHost(cookie, current); 197 DevToolsAgentHost::ConnectRenderViewHost(cookie, current);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 if (render_view_host_) 366 if (render_view_host_)
334 GetContentClient()->browser()->ClearCache(render_view_host_); 367 GetContentClient()->browser()->ClearCache(render_view_host_);
335 } 368 }
336 369
337 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { 370 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() {
338 if (render_view_host_) 371 if (render_view_host_)
339 GetContentClient()->browser()->ClearCookies(render_view_host_); 372 GetContentClient()->browser()->ClearCookies(render_view_host_);
340 } 373 }
341 374
342 } // namespace content 375 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698