OLD | NEW |
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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 if (render_frame_host) { | 906 if (render_frame_host) { |
907 // We won't be coming back, so delete this one. | 907 // We won't be coming back, so delete this one. |
908 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); | 908 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); |
909 render_frame_host.reset(); | 909 render_frame_host.reset(); |
910 } | 910 } |
911 } | 911 } |
912 | 912 |
913 void RenderFrameHostManager::MoveToPendingDeleteHosts( | 913 void RenderFrameHostManager::MoveToPendingDeleteHosts( |
914 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 914 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
915 // If this is the main frame going away, mark the corresponding | 915 // If this is the main frame going away and there are no more references to |
916 // RenderViewHost for deletion as well so that we don't try to reuse it. | 916 // its RenderViewHost, mark it for deletion as well so that we don't try to |
917 if (render_frame_host->frame_tree_node()->IsMainFrame()) | 917 // reuse it. |
| 918 if (render_frame_host->frame_tree_node()->IsMainFrame() && |
| 919 render_frame_host->render_view_host()->ref_count() <= 1) { |
918 render_frame_host->render_view_host()->set_pending_deletion(); | 920 render_frame_host->render_view_host()->set_pending_deletion(); |
| 921 } |
919 | 922 |
920 // |render_frame_host| will be deleted when its SwapOut ACK is received, or | 923 // |render_frame_host| will be deleted when its SwapOut ACK is received, or |
921 // when the timer times out, or when the RFHM itself is deleted (whichever | 924 // when the timer times out, or when the RFHM itself is deleted (whichever |
922 // comes first). | 925 // comes first). |
923 pending_delete_hosts_.push_back( | 926 pending_delete_hosts_.push_back( |
924 linked_ptr<RenderFrameHostImpl>(render_frame_host.release())); | 927 linked_ptr<RenderFrameHostImpl>(render_frame_host.release())); |
925 } | 928 } |
926 | 929 |
927 bool RenderFrameHostManager::IsPendingDeletion( | 930 bool RenderFrameHostManager::IsPendingDeletion( |
928 RenderFrameHostImpl* render_frame_host) { | 931 RenderFrameHostImpl* render_frame_host) { |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2595 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2593 if (!frame_tree_node_->opener()) | 2596 if (!frame_tree_node_->opener()) |
2594 return MSG_ROUTING_NONE; | 2597 return MSG_ROUTING_NONE; |
2595 | 2598 |
2596 return frame_tree_node_->opener() | 2599 return frame_tree_node_->opener() |
2597 ->render_manager() | 2600 ->render_manager() |
2598 ->GetRoutingIdForSiteInstance(instance); | 2601 ->GetRoutingIdForSiteInstance(instance); |
2599 } | 2602 } |
2600 | 2603 |
2601 } // namespace content | 2604 } // namespace content |
OLD | NEW |