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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 } | 701 } |
702 | 702 |
703 void RenderFrameHostManager::MoveToPendingDeleteHosts( | 703 void RenderFrameHostManager::MoveToPendingDeleteHosts( |
704 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 704 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
705 // |render_frame_host| will be deleted when its SwapOut ACK is received, or | 705 // |render_frame_host| will be deleted when its SwapOut ACK is received, or |
706 // when the timer times out, or when the RFHM itself is deleted (whichever | 706 // when the timer times out, or when the RFHM itself is deleted (whichever |
707 // comes first). | 707 // comes first). |
708 pending_delete_hosts_.push_back(std::move(render_frame_host)); | 708 pending_delete_hosts_.push_back(std::move(render_frame_host)); |
709 } | 709 } |
710 | 710 |
711 bool RenderFrameHostManager::IsPendingDeletion( | |
712 RenderFrameHostImpl* render_frame_host) { | |
713 for (const auto& rfh : pending_delete_hosts_) { | |
714 if (rfh.get() == render_frame_host) | |
715 return true; | |
716 } | |
717 return false; | |
718 } | |
719 | |
720 bool RenderFrameHostManager::IsViewPendingDeletion( | 711 bool RenderFrameHostManager::IsViewPendingDeletion( |
721 RenderViewHostImpl* render_view_host) { | 712 RenderViewHostImpl* render_view_host) { |
722 // Only safe to call this on the main frame. | 713 // Only safe to call this on the main frame. |
723 CHECK(frame_tree_node_->IsMainFrame()); | 714 CHECK(frame_tree_node_->IsMainFrame()); |
724 | 715 |
725 // The view is not pending deletion if more than one frame or proxy references | 716 // The view is not pending deletion if more than one frame or proxy references |
726 // it. | 717 // it. |
727 if (render_view_host->ref_count() > 1) | 718 if (render_view_host->ref_count() > 1) |
728 return false; | 719 return false; |
729 | 720 |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2109 render_frame_host_->routing_id()); | 2100 render_frame_host_->routing_id()); |
2110 old_render_frame_host->render_view_host()->set_main_frame_routing_id( | 2101 old_render_frame_host->render_view_host()->set_main_frame_routing_id( |
2111 MSG_ROUTING_NONE); | 2102 MSG_ROUTING_NONE); |
2112 } | 2103 } |
2113 | 2104 |
2114 // Swap out the old frame now that the new one is visible. | 2105 // Swap out the old frame now that the new one is visible. |
2115 // This will swap it out and then put it on the proxy list (if there are other | 2106 // This will swap it out and then put it on the proxy list (if there are other |
2116 // active views in its SiteInstance) or schedule it for deletion when the swap | 2107 // active views in its SiteInstance) or schedule it for deletion when the swap |
2117 // out ack arrives (or immediately if the process isn't live). | 2108 // out ack arrives (or immediately if the process isn't live). |
2118 // In the --site-per-process case, old subframe RFHs are not kept alive inside | 2109 // In the --site-per-process case, old subframe RFHs are not kept alive inside |
2119 // the proxy. | 2110 // the proxy. |
alexmos
2016/04/04 18:53:57
nit: update this comment?
nasko
2016/04/05 23:49:39
Thanks for the catch! Done.
| |
2120 SwapOutOldFrame(std::move(old_render_frame_host)); | 2111 SwapOutOldFrame(std::move(old_render_frame_host)); |
2121 | 2112 |
2122 // Since the new RenderFrameHost is now committed, there must be no proxies | 2113 // Since the new RenderFrameHost is now committed, there must be no proxies |
2123 // for its SiteInstance. Delete any existing ones. | 2114 // for its SiteInstance. Delete any existing ones. |
2124 DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); | 2115 DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); |
2125 | 2116 |
2126 // If this is a subframe, it should have a CrossProcessFrameConnector | 2117 // If this is a subframe, it should have a CrossProcessFrameConnector |
2127 // created already. Use it to link the new RFH's view to the proxy that | 2118 // created already. Use it to link the new RFH's view to the proxy that |
2128 // belongs to the parent frame's SiteInstance. If this navigation causes | 2119 // belongs to the parent frame's SiteInstance. If this navigation causes |
2129 // an out-of-process frame to return to the same process as its parent, the | 2120 // an out-of-process frame to return to the same process as its parent, the |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2575 } else if (pending_render_frame_host_) { | 2566 } else if (pending_render_frame_host_) { |
2576 send_msg(pending_render_frame_host_.get(), | 2567 send_msg(pending_render_frame_host_.get(), |
2577 pending_render_frame_host_->GetRoutingID(), msg); | 2568 pending_render_frame_host_->GetRoutingID(), msg); |
2578 } | 2569 } |
2579 | 2570 |
2580 msg->set_routing_id(render_frame_host_->GetRoutingID()); | 2571 msg->set_routing_id(render_frame_host_->GetRoutingID()); |
2581 render_frame_host_->Send(msg); | 2572 render_frame_host_->Send(msg); |
2582 } | 2573 } |
2583 | 2574 |
2584 } // namespace content | 2575 } // namespace content |
OLD | NEW |