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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2410153005: Fix RenderView reuse issues when canceling a pending RenderFrameHost. (Closed)
Patch Set: Rebase Created 4 years, 2 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/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 4c85824121dd2d5226eca912974a63cb27227ccd..7b8eddf7eb537f4e0c6be4bef684b1631d55598d 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -370,10 +370,15 @@ RenderFrameHostImpl::~RenderFrameHostImpl() {
// If this RenderFrameHost is swapping with a RenderFrameProxyHost, the
// RenderFrame will already be deleted in the renderer process. Main frame
- // RenderFrames will be cleaned up as part of deleting its RenderView. In all
- // other cases, the RenderFrame should be cleaned up (if it exists).
- if (is_active() && !frame_tree_node_->IsMainFrame() && render_frame_created_)
+ // RenderFrames will be cleaned up as part of deleting its RenderView if the
+ // RenderView isn't in use by other frames. In all other cases, the
+ // RenderFrame should be cleaned up (if it exists).
+ bool will_render_view_clean_up_render_frame =
+ frame_tree_node_->IsMainFrame() && render_view_host_->ref_count() == 1;
+ if (is_active() && render_frame_created_ &&
+ !will_render_view_clean_up_render_frame) {
Send(new FrameMsg_Delete(routing_id_));
+ }
// Null out the swapout timer; in crash dumps this member will be null only if
// the dtor has run. (It may also be null in tests.)
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698