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

Side by Side Diff: content/browser/devtools/render_view_devtools_agent_host.cc

Issue 22824002: Better fix for a redundant call to Reattach in RenderViewDevToolsAgentHost::ConnectRenderViewHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() { 222 RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() {
223 Instances::iterator it = std::find(g_instances.Get().begin(), 223 Instances::iterator it = std::find(g_instances.Get().begin(),
224 g_instances.Get().end(), 224 g_instances.Get().end(),
225 this); 225 this);
226 if (it != g_instances.Get().end()) 226 if (it != g_instances.Get().end())
227 g_instances.Get().erase(it); 227 g_instances.Get().erase(it);
228 } 228 }
229 229
230 void RenderViewDevToolsAgentHost::AboutToNavigateRenderView( 230 void RenderViewDevToolsAgentHost::AboutToNavigateRenderView(
231 RenderViewHost* dest_rvh) { 231 RenderViewHost* dest_rvh) {
232 if (!render_view_host_ || !IsAttached()) 232 if (!render_view_host_)
233 return; 233 return;
234 234
235 if (render_view_host_ == dest_rvh && static_cast<RenderViewHostImpl*>( 235 if (render_view_host_ == dest_rvh && static_cast<RenderViewHostImpl*>(
236 render_view_host_)->render_view_termination_status() == 236 render_view_host_)->render_view_termination_status() ==
237 base::TERMINATION_STATUS_STILL_RUNNING) 237 base::TERMINATION_STATUS_STILL_RUNNING)
238 return; 238 return;
239 DisconnectRenderViewHost(); 239 DisconnectRenderViewHost();
240 ConnectRenderViewHost(dest_rvh); 240 ConnectRenderViewHost(dest_rvh);
241 } 241 }
242 242
(...skipping 23 matching lines...) Expand all
266 ConnectRenderViewHost(web_contents->GetRenderViewHost()); 266 ConnectRenderViewHost(web_contents->GetRenderViewHost());
267 } 267 }
268 268
269 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) { 269 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) {
270 render_view_host_ = rvh; 270 render_view_host_ = rvh;
271 rvh_observer_.reset(new DevToolsAgentHostRvhObserver(rvh, this)); 271 rvh_observer_.reset(new DevToolsAgentHostRvhObserver(rvh, this));
272 } 272 }
273 273
274 void RenderViewDevToolsAgentHost::ConnectRenderViewHost(RenderViewHost* rvh) { 274 void RenderViewDevToolsAgentHost::ConnectRenderViewHost(RenderViewHost* rvh) {
275 SetRenderViewHost(rvh); 275 SetRenderViewHost(rvh);
276 Reattach(state_); 276 if (IsAttached())
277 Reattach(state_);
277 } 278 }
278 279
279 void RenderViewDevToolsAgentHost::DisconnectRenderViewHost() { 280 void RenderViewDevToolsAgentHost::DisconnectRenderViewHost() {
280 OnClientDetached(); 281 OnClientDetached();
281 rvh_observer_.reset(); 282 rvh_observer_.reset();
282 render_view_host_ = NULL; 283 render_view_host_ = NULL;
283 } 284 }
284 285
285 void RenderViewDevToolsAgentHost::RenderViewHostDestroyed( 286 void RenderViewDevToolsAgentHost::RenderViewHostDestroyed(
286 RenderViewHost* rvh) { 287 RenderViewHost* rvh) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 if (render_view_host_) 335 if (render_view_host_)
335 GetContentClient()->browser()->ClearCache(render_view_host_); 336 GetContentClient()->browser()->ClearCache(render_view_host_);
336 } 337 }
337 338
338 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { 339 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() {
339 if (render_view_host_) 340 if (render_view_host_)
340 GetContentClient()->browser()->ClearCookies(render_view_host_); 341 GetContentClient()->browser()->ClearCookies(render_view_host_);
341 } 342 }
342 343
343 } // namespace content 344 } // namespace content
OLDNEW
« 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