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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2563863002: Clear navigation_handle early in RenderFrameHostImpl destructor. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « content/browser/devtools/render_frame_devtools_agent_host.cc ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } else { 376 } else {
377 DCHECK(!render_widget_host_->owned_by_render_frame_host()); 377 DCHECK(!render_widget_host_->owned_by_render_frame_host());
378 } 378 }
379 InputRouterImpl* ir = 379 InputRouterImpl* ir =
380 static_cast<InputRouterImpl*>(render_widget_host_->input_router()); 380 static_cast<InputRouterImpl*>(render_widget_host_->input_router());
381 ir->SetFrameTreeNodeId(frame_tree_node_->frame_tree_node_id()); 381 ir->SetFrameTreeNodeId(frame_tree_node_->frame_tree_node_id());
382 } 382 }
383 } 383 }
384 384
385 RenderFrameHostImpl::~RenderFrameHostImpl() { 385 RenderFrameHostImpl::~RenderFrameHostImpl() {
386 // Destroying navigation handle may call into delegates/observers,
387 // so we do it early while |this| object is still in a sane state.
388 navigation_handle_.reset();
389
386 // Release the WebUI instances before all else as the WebUI may accesses the 390 // Release the WebUI instances before all else as the WebUI may accesses the
387 // RenderFrameHost during cleanup. 391 // RenderFrameHost during cleanup.
388 ClearAllWebUI(); 392 ClearAllWebUI();
389 393
390 GetProcess()->RemoveRoute(routing_id_); 394 GetProcess()->RemoveRoute(routing_id_);
391 g_routing_id_frame_map.Get().erase( 395 g_routing_id_frame_map.Get().erase(
392 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); 396 RenderFrameHostID(GetProcess()->GetID(), routing_id_));
393 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 397 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
394 base::Bind(&NotifyRenderFrameDetachedOnIO, 398 base::Bind(&NotifyRenderFrameDetachedOnIO,
395 GetProcess()->GetID(), routing_id_)); 399 GetProcess()->GetID(), routing_id_));
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3332 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3329 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3333 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3330 return NavigationHandleImpl::Create( 3334 return NavigationHandleImpl::Create(
3331 params.url, frame_tree_node_, is_renderer_initiated, 3335 params.url, frame_tree_node_, is_renderer_initiated,
3332 params.was_within_same_page, base::TimeTicks::Now(), 3336 params.was_within_same_page, base::TimeTicks::Now(),
3333 entry_id_for_data_nav, params.gesture, 3337 entry_id_for_data_nav, params.gesture,
3334 false); // started_from_context_menu 3338 false); // started_from_context_menu
3335 } 3339 }
3336 3340
3337 } // namespace content 3341 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_frame_devtools_agent_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698