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

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

Issue 1409693009: Fix leaking of RenderFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed frame checking and not detaching for main frames. Created 5 years, 1 month 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
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_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // document. Check if |render_frame_host| is already swapped out, to avoid 916 // document. Check if |render_frame_host| is already swapped out, to avoid
917 // swapping it out again. 917 // swapping it out again.
918 if (!render_frame_host->is_swapped_out()) 918 if (!render_frame_host->is_swapped_out())
919 render_frame_host->SwapOut(proxy, false); 919 render_frame_host->SwapOut(proxy, false);
920 920
921 proxy->TakeFrameHostOwnership(render_frame_host.Pass()); 921 proxy->TakeFrameHostOwnership(render_frame_host.Pass());
922 } 922 }
923 } 923 }
924 924
925 if (render_frame_host) { 925 if (render_frame_host) {
926 if (!frame_tree_node_->IsMainFrame() &&
927 SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
928 // Clean up the unused RenderFrame in the renderer process for any
929 // subframe. The main frame is going to be cleaned up by RenderViewHost
930 // deleting RenderView.
931 render_frame_host->Send(
932 new FrameMsg_Detach(render_frame_host->GetRoutingID()));
933 }
934
926 // We won't be coming back, so delete this one. 935 // We won't be coming back, so delete this one.
927 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); 936 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get());
928 render_frame_host.reset(); 937 render_frame_host.reset();
929 } 938 }
930 } 939 }
931 940
932 void RenderFrameHostManager::MoveToPendingDeleteHosts( 941 void RenderFrameHostManager::MoveToPendingDeleteHosts(
933 scoped_ptr<RenderFrameHostImpl> render_frame_host) { 942 scoped_ptr<RenderFrameHostImpl> render_frame_host) {
934 // If this is the main frame going away and there are no more references to 943 // If this is the main frame going away and there are no more references to
935 // its RenderViewHost, mark it for deletion as well so that we don't try to 944 // its RenderViewHost, mark it for deletion as well so that we don't try to
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2691 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2683 if (!frame_tree_node_->opener()) 2692 if (!frame_tree_node_->opener())
2684 return MSG_ROUTING_NONE; 2693 return MSG_ROUTING_NONE;
2685 2694
2686 return frame_tree_node_->opener() 2695 return frame_tree_node_->opener()
2687 ->render_manager() 2696 ->render_manager()
2688 ->GetRoutingIdForSiteInstance(instance); 2697 ->GetRoutingIdForSiteInstance(instance);
2689 } 2698 }
2690 2699
2691 } // namespace content 2700 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/site_per_process_browsertest.cc » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698