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

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

Issue 1409693009: Fix leaking of RenderFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on ToT and couple of more nits fixes. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/site_per_process_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_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 64cd0966a3eed33e6184a2dd47137ea816215bd1..f93f87c5e6f98033900f59421fd60cd12bef2cee 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -259,11 +259,20 @@ RenderFrameHostImpl::~RenderFrameHostImpl() {
if (delegate_ && render_frame_created_)
delegate_->RenderFrameDeleted(this);
- // If this was swapped out, it already decremented the active frame count of
- // the SiteInstance it belongs to.
- if (IsRFHStateActive(rfh_state_))
+ bool is_active = IsRFHStateActive(rfh_state_);
+
+ // If this RenderFrameHost is swapped out, it already decremented the active
+ // frame count of the SiteInstance it belongs to.
+ if (is_active)
GetSiteInstance()->decrement_active_frame_count();
+ // 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_)
+ 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.
swapout_event_monitor_timeout_.reset();
« no previous file with comments | « no previous file | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698