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

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

Issue 1383513005: Ensure window reference is valid when navigating cross-process and back. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a nit. Created 5 years, 3 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_browsertest.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_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 1ffbbaa4861f5795c19410c982d11b26da767cdd..79a477d1e020d3b3b20b25c1fb7d121c842a1110 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -912,10 +912,13 @@ void RenderFrameHostManager::DiscardUnusedFrame(
void RenderFrameHostManager::MoveToPendingDeleteHosts(
scoped_ptr<RenderFrameHostImpl> render_frame_host) {
- // If this is the main frame going away, mark the corresponding
- // RenderViewHost for deletion as well so that we don't try to reuse it.
- if (render_frame_host->frame_tree_node()->IsMainFrame())
+ // If this is the main frame going away and there are no more references to
+ // its RenderViewHost, mark it for deletion as well so that we don't try to
+ // reuse it.
+ if (render_frame_host->frame_tree_node()->IsMainFrame() &&
+ render_frame_host->render_view_host()->ref_count() <= 1) {
render_frame_host->render_view_host()->set_pending_deletion();
+ }
// |render_frame_host| will be deleted when its SwapOut ACK is received, or
// when the timer times out, or when the RFHM itself is deleted (whichever
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698