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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // the request. | 467 // the request. |
468 if (cross_site_transferring_request_.get() && | 468 if (cross_site_transferring_request_.get() && |
469 cross_site_transferring_request_->request_id() == | 469 cross_site_transferring_request_->request_id() == |
470 entry.transferred_global_request_id()) { | 470 entry.transferred_global_request_id()) { |
471 cross_site_transferring_request_->ReleaseRequest(); | 471 cross_site_transferring_request_->ReleaseRequest(); |
472 | 472 |
473 // The navigating RenderFrameHost should take ownership of the | 473 // The navigating RenderFrameHost should take ownership of the |
474 // NavigationHandle that came from the transferring RenderFrameHost. | 474 // NavigationHandle that came from the transferring RenderFrameHost. |
475 DCHECK(transfer_navigation_handle_); | 475 DCHECK(transfer_navigation_handle_); |
476 dest_render_frame_host->SetNavigationHandle( | 476 dest_render_frame_host->SetNavigationHandle( |
477 transfer_navigation_handle_.Pass()); | 477 std::move(transfer_navigation_handle_)); |
478 } | 478 } |
479 DCHECK(!transfer_navigation_handle_); | 479 DCHECK(!transfer_navigation_handle_); |
480 | 480 |
481 return dest_render_frame_host; | 481 return dest_render_frame_host; |
482 } | 482 } |
483 | 483 |
484 void RenderFrameHostManager::Stop() { | 484 void RenderFrameHostManager::Stop() { |
485 render_frame_host_->Stop(); | 485 render_frame_host_->Stop(); |
486 | 486 |
487 // If a cross-process navigation is happening, the pending RenderFrameHost | 487 // If a cross-process navigation is happening, the pending RenderFrameHost |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 | 610 |
611 // A transfer should only have come from our pending or current RFH. | 611 // A transfer should only have come from our pending or current RFH. |
612 // TODO(creis): We need to handle the case that the pending RFH has changed | 612 // TODO(creis): We need to handle the case that the pending RFH has changed |
613 // in the mean time, while this was being posted from the IO thread. We | 613 // in the mean time, while this was being posted from the IO thread. We |
614 // should probably cancel the request in that case. | 614 // should probably cancel the request in that case. |
615 DCHECK(pending_render_frame_host == pending_render_frame_host_.get() || | 615 DCHECK(pending_render_frame_host == pending_render_frame_host_.get() || |
616 pending_render_frame_host == render_frame_host_.get()); | 616 pending_render_frame_host == render_frame_host_.get()); |
617 | 617 |
618 // Store the transferring request so that we can release it if the transfer | 618 // Store the transferring request so that we can release it if the transfer |
619 // navigation matches. | 619 // navigation matches. |
620 cross_site_transferring_request_ = cross_site_transferring_request.Pass(); | 620 cross_site_transferring_request_ = std::move(cross_site_transferring_request); |
621 | 621 |
622 // Store the NavigationHandle to give it to the appropriate RenderFrameHost | 622 // Store the NavigationHandle to give it to the appropriate RenderFrameHost |
623 // after it started navigating. | 623 // after it started navigating. |
624 transfer_navigation_handle_ = | 624 transfer_navigation_handle_ = |
625 pending_render_frame_host->PassNavigationHandleOwnership(); | 625 pending_render_frame_host->PassNavigationHandleOwnership(); |
626 DCHECK(transfer_navigation_handle_); | 626 DCHECK(transfer_navigation_handle_); |
627 | 627 |
628 // Sanity check that the params are for the correct frame and process. | 628 // Sanity check that the params are for the correct frame and process. |
629 // These should match the RenderFrameHost that made the request. | 629 // These should match the RenderFrameHost that made the request. |
630 // If it started as a cross-process navigation via OpenURL, this is the | 630 // If it started as a cross-process navigation via OpenURL, this is the |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 // a proxy. | 851 // a proxy. |
852 size_t active_frame_count = | 852 size_t active_frame_count = |
853 old_render_frame_host->GetSiteInstance()->active_frame_count(); | 853 old_render_frame_host->GetSiteInstance()->active_frame_count(); |
854 if (active_frame_count <= 1) { | 854 if (active_frame_count <= 1) { |
855 // Clear out any proxies from this SiteInstance, in case this was the | 855 // Clear out any proxies from this SiteInstance, in case this was the |
856 // last one keeping other proxies alive. | 856 // last one keeping other proxies alive. |
857 ShutdownProxiesIfLastActiveFrameInSiteInstance(old_render_frame_host.get()); | 857 ShutdownProxiesIfLastActiveFrameInSiteInstance(old_render_frame_host.get()); |
858 | 858 |
859 // Tell the old RenderFrameHost to swap out, with no proxy to replace it. | 859 // Tell the old RenderFrameHost to swap out, with no proxy to replace it. |
860 old_render_frame_host->SwapOut(nullptr, true); | 860 old_render_frame_host->SwapOut(nullptr, true); |
861 MoveToPendingDeleteHosts(old_render_frame_host.Pass()); | 861 MoveToPendingDeleteHosts(std::move(old_render_frame_host)); |
862 return; | 862 return; |
863 } | 863 } |
864 | 864 |
865 // Otherwise there are active views and we need a proxy for the old RFH. | 865 // Otherwise there are active views and we need a proxy for the old RFH. |
866 // (There should not be one yet.) | 866 // (There should not be one yet.) |
867 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( | 867 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( |
868 old_render_frame_host->GetSiteInstance(), | 868 old_render_frame_host->GetSiteInstance(), |
869 old_render_frame_host->render_view_host(), frame_tree_node_); | 869 old_render_frame_host->render_view_host(), frame_tree_node_); |
870 proxy_hosts_->Add(old_site_instance_id, make_scoped_ptr(proxy)); | 870 proxy_hosts_->Add(old_site_instance_id, make_scoped_ptr(proxy)); |
871 | 871 |
872 // Tell the old RenderFrameHost to swap out and be replaced by the proxy. | 872 // Tell the old RenderFrameHost to swap out and be replaced by the proxy. |
873 old_render_frame_host->SwapOut(proxy, true); | 873 old_render_frame_host->SwapOut(proxy, true); |
874 | 874 |
875 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized. | 875 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized. |
876 proxy->set_render_frame_proxy_created(true); | 876 proxy->set_render_frame_proxy_created(true); |
877 | 877 |
878 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 878 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { |
879 // In --site-per-process, frames delete their RFH rather than storing it | 879 // In --site-per-process, frames delete their RFH rather than storing it |
880 // in the proxy. Schedule it for deletion once the SwapOutACK comes in. | 880 // in the proxy. Schedule it for deletion once the SwapOutACK comes in. |
881 // TODO(creis): This will be the default when we remove swappedout://. | 881 // TODO(creis): This will be the default when we remove swappedout://. |
882 MoveToPendingDeleteHosts(old_render_frame_host.Pass()); | 882 MoveToPendingDeleteHosts(std::move(old_render_frame_host)); |
883 } else { | 883 } else { |
884 // We shouldn't get here for subframes, since we only swap subframes when | 884 // We shouldn't get here for subframes, since we only swap subframes when |
885 // --site-per-process is used. | 885 // --site-per-process is used. |
886 DCHECK(frame_tree_node_->IsMainFrame()); | 886 DCHECK(frame_tree_node_->IsMainFrame()); |
887 | 887 |
888 // The old RenderFrameHost will stay alive inside the proxy so that existing | 888 // The old RenderFrameHost will stay alive inside the proxy so that existing |
889 // JavaScript window references to it stay valid. | 889 // JavaScript window references to it stay valid. |
890 proxy->TakeFrameHostOwnership(old_render_frame_host.Pass()); | 890 proxy->TakeFrameHostOwnership(std::move(old_render_frame_host)); |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 void RenderFrameHostManager::DiscardUnusedFrame( | 894 void RenderFrameHostManager::DiscardUnusedFrame( |
895 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 895 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
896 // TODO(carlosk): this code is very similar to what can be found in | 896 // TODO(carlosk): this code is very similar to what can be found in |
897 // SwapOutOldFrame and we should see that these are unified at some point. | 897 // SwapOutOldFrame and we should see that these are unified at some point. |
898 | 898 |
899 // If the SiteInstance for the pending RFH is being used by others don't | 899 // If the SiteInstance for the pending RFH is being used by others don't |
900 // delete the RFH. Just swap it out and it can be reused at a later point. | 900 // delete the RFH. Just swap it out and it can be reused at a later point. |
(...skipping 21 matching lines...) Expand all Loading... |
922 DCHECK(frame_tree_node_->IsMainFrame()); | 922 DCHECK(frame_tree_node_->IsMainFrame()); |
923 | 923 |
924 // When using swapped out RenderFrameHosts, it is possible for the pending | 924 // When using swapped out RenderFrameHosts, it is possible for the pending |
925 // RenderFrameHost to be an existing one in swapped out state. Since it | 925 // RenderFrameHost to be an existing one in swapped out state. Since it |
926 // has been used to start a navigation, it could have committed a | 926 // has been used to start a navigation, it could have committed a |
927 // document. Check if |render_frame_host| is already swapped out, to avoid | 927 // document. Check if |render_frame_host| is already swapped out, to avoid |
928 // swapping it out again. | 928 // swapping it out again. |
929 if (!render_frame_host->is_swapped_out()) | 929 if (!render_frame_host->is_swapped_out()) |
930 render_frame_host->SwapOut(proxy, false); | 930 render_frame_host->SwapOut(proxy, false); |
931 | 931 |
932 proxy->TakeFrameHostOwnership(render_frame_host.Pass()); | 932 proxy->TakeFrameHostOwnership(std::move(render_frame_host)); |
933 } | 933 } |
934 } | 934 } |
935 | 935 |
936 if (render_frame_host) { | 936 if (render_frame_host) { |
937 // We won't be coming back, so delete this one. | 937 // We won't be coming back, so delete this one. |
938 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); | 938 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); |
939 render_frame_host.reset(); | 939 render_frame_host.reset(); |
940 } | 940 } |
941 } | 941 } |
942 | 942 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 render_frame_host_->ClearPendingWebUI(); | 1134 render_frame_host_->ClearPendingWebUI(); |
1135 if (speculative_render_frame_host_) | 1135 if (speculative_render_frame_host_) |
1136 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); | 1136 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); |
1137 } | 1137 } |
1138 | 1138 |
1139 // PlzNavigate | 1139 // PlzNavigate |
1140 scoped_ptr<RenderFrameHostImpl> | 1140 scoped_ptr<RenderFrameHostImpl> |
1141 RenderFrameHostManager::UnsetSpeculativeRenderFrameHost() { | 1141 RenderFrameHostManager::UnsetSpeculativeRenderFrameHost() { |
1142 CHECK(IsBrowserSideNavigationEnabled()); | 1142 CHECK(IsBrowserSideNavigationEnabled()); |
1143 speculative_render_frame_host_->GetProcess()->RemovePendingView(); | 1143 speculative_render_frame_host_->GetProcess()->RemovePendingView(); |
1144 return speculative_render_frame_host_.Pass(); | 1144 return std::move(speculative_render_frame_host_); |
1145 } | 1145 } |
1146 | 1146 |
1147 void RenderFrameHostManager::OnDidStartLoading() { | 1147 void RenderFrameHostManager::OnDidStartLoading() { |
1148 for (const auto& pair : *proxy_hosts_) { | 1148 for (const auto& pair : *proxy_hosts_) { |
1149 pair.second->Send( | 1149 pair.second->Send( |
1150 new FrameMsg_DidStartLoading(pair.second->GetRoutingID())); | 1150 new FrameMsg_DidStartLoading(pair.second->GetRoutingID())); |
1151 } | 1151 } |
1152 } | 1152 } |
1153 | 1153 |
1154 void RenderFrameHostManager::OnDidStopLoading() { | 1154 void RenderFrameHostManager::OnDidStopLoading() { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 // Delete the proxy. If it is for a main frame (and thus the RFH is stored | 1212 // Delete the proxy. If it is for a main frame (and thus the RFH is stored |
1213 // in the proxy) and it was still pending swap out, move the RFH to the | 1213 // in the proxy) and it was still pending swap out, move the RFH to the |
1214 // pending deletion list first. | 1214 // pending deletion list first. |
1215 if (node->IsMainFrame() && | 1215 if (node->IsMainFrame() && |
1216 proxy->render_frame_host() && | 1216 proxy->render_frame_host() && |
1217 proxy->render_frame_host()->rfh_state() == | 1217 proxy->render_frame_host()->rfh_state() == |
1218 RenderFrameHostImpl::STATE_PENDING_SWAP_OUT) { | 1218 RenderFrameHostImpl::STATE_PENDING_SWAP_OUT) { |
1219 DCHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); | 1219 DCHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); |
1220 scoped_ptr<RenderFrameHostImpl> swapped_out_rfh = | 1220 scoped_ptr<RenderFrameHostImpl> swapped_out_rfh = |
1221 proxy->PassFrameHostOwnership(); | 1221 proxy->PassFrameHostOwnership(); |
1222 node->render_manager()->MoveToPendingDeleteHosts(swapped_out_rfh.Pass()); | 1222 node->render_manager()->MoveToPendingDeleteHosts( |
| 1223 std::move(swapped_out_rfh)); |
1223 } | 1224 } |
1224 node->render_manager()->proxy_hosts_->Remove(site_instance_id); | 1225 node->render_manager()->proxy_hosts_->Remove(site_instance_id); |
1225 } | 1226 } |
1226 | 1227 |
1227 return true; | 1228 return true; |
1228 } | 1229 } |
1229 | 1230 |
1230 // static. | 1231 // static. |
1231 bool RenderFrameHostManager::ResetProxiesInSiteInstance( | 1232 bool RenderFrameHostManager::ResetProxiesInSiteInstance( |
1232 int32_t site_instance_id, | 1233 int32_t site_instance_id, |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 | 1874 |
1874 // Prevent the process from exiting while we're trying to navigate in it. | 1875 // Prevent the process from exiting while we're trying to navigate in it. |
1875 // Otherwise, if the new RFH is swapped out already, store it. | 1876 // Otherwise, if the new RFH is swapped out already, store it. |
1876 if (!swapped_out) { | 1877 if (!swapped_out) { |
1877 new_render_frame_host->GetProcess()->AddPendingView(); | 1878 new_render_frame_host->GetProcess()->AddPendingView(); |
1878 } else { | 1879 } else { |
1879 proxy = new RenderFrameProxyHost( | 1880 proxy = new RenderFrameProxyHost( |
1880 new_render_frame_host->GetSiteInstance(), | 1881 new_render_frame_host->GetSiteInstance(), |
1881 new_render_frame_host->render_view_host(), frame_tree_node_); | 1882 new_render_frame_host->render_view_host(), frame_tree_node_); |
1882 proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy)); | 1883 proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy)); |
1883 proxy->TakeFrameHostOwnership(new_render_frame_host.Pass()); | 1884 proxy->TakeFrameHostOwnership(std::move(new_render_frame_host)); |
1884 } | 1885 } |
1885 | 1886 |
1886 if (frame_tree_node_->IsMainFrame()) { | 1887 if (frame_tree_node_->IsMainFrame()) { |
1887 success = InitRenderView(render_view_host, proxy); | 1888 success = InitRenderView(render_view_host, proxy); |
1888 | 1889 |
1889 // If we are reusing the RenderViewHost and it doesn't already have a | 1890 // If we are reusing the RenderViewHost and it doesn't already have a |
1890 // RenderWidgetHostView, we need to create one if this is the main frame. | 1891 // RenderWidgetHostView, we need to create one if this is the main frame. |
1891 if (!swapped_out && !render_view_host->GetWidget()->GetView()) | 1892 if (!swapped_out && !render_view_host->GetWidget()->GetView()) |
1892 delegate_->CreateRenderWidgetHostViewForRenderManager(render_view_host); | 1893 delegate_->CreateRenderWidgetHostViewForRenderManager(render_view_host); |
1893 } else { | 1894 } else { |
(...skipping 22 matching lines...) Expand all Loading... |
1916 | 1917 |
1917 if (success) { | 1918 if (success) { |
1918 if (view_routing_id_ptr) | 1919 if (view_routing_id_ptr) |
1919 *view_routing_id_ptr = render_view_host->GetRoutingID(); | 1920 *view_routing_id_ptr = render_view_host->GetRoutingID(); |
1920 } | 1921 } |
1921 } | 1922 } |
1922 | 1923 |
1923 // Returns the new RFH if it isn't swapped out. | 1924 // Returns the new RFH if it isn't swapped out. |
1924 if (success && !swapped_out) { | 1925 if (success && !swapped_out) { |
1925 DCHECK(new_render_frame_host->GetSiteInstance() == instance); | 1926 DCHECK(new_render_frame_host->GetSiteInstance() == instance); |
1926 return new_render_frame_host.Pass(); | 1927 return new_render_frame_host; |
1927 } | 1928 } |
1928 return nullptr; | 1929 return nullptr; |
1929 } | 1930 } |
1930 | 1931 |
1931 int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) { | 1932 int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) { |
1932 // A RenderFrameProxyHost should never be created in the same SiteInstance as | 1933 // A RenderFrameProxyHost should never be created in the same SiteInstance as |
1933 // the current RFH. | 1934 // the current RFH. |
1934 CHECK(instance); | 1935 CHECK(instance); |
1935 CHECK_NE(instance, render_frame_host_->GetSiteInstance()); | 1936 CHECK_NE(instance, render_frame_host_->GetSiteInstance()); |
1936 | 1937 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 | 2165 |
2165 // While the old frame is still current, remove its children from the tree. | 2166 // While the old frame is still current, remove its children from the tree. |
2166 frame_tree_node_->ResetForNewProcess(); | 2167 frame_tree_node_->ResetForNewProcess(); |
2167 | 2168 |
2168 // Swap in the pending or speculative frame and make it active. Also ensure | 2169 // Swap in the pending or speculative frame and make it active. Also ensure |
2169 // the FrameTree stays in sync. | 2170 // the FrameTree stays in sync. |
2170 scoped_ptr<RenderFrameHostImpl> old_render_frame_host; | 2171 scoped_ptr<RenderFrameHostImpl> old_render_frame_host; |
2171 if (!IsBrowserSideNavigationEnabled()) { | 2172 if (!IsBrowserSideNavigationEnabled()) { |
2172 DCHECK(!speculative_render_frame_host_); | 2173 DCHECK(!speculative_render_frame_host_); |
2173 old_render_frame_host = | 2174 old_render_frame_host = |
2174 SetRenderFrameHost(pending_render_frame_host_.Pass()); | 2175 SetRenderFrameHost(std::move(pending_render_frame_host_)); |
2175 } else { | 2176 } else { |
2176 // PlzNavigate | 2177 // PlzNavigate |
2177 DCHECK(speculative_render_frame_host_); | 2178 DCHECK(speculative_render_frame_host_); |
2178 old_render_frame_host = | 2179 old_render_frame_host = |
2179 SetRenderFrameHost(speculative_render_frame_host_.Pass()); | 2180 SetRenderFrameHost(std::move(speculative_render_frame_host_)); |
2180 } | 2181 } |
2181 | 2182 |
2182 // The process will no longer try to exit, so we can decrement the count. | 2183 // The process will no longer try to exit, so we can decrement the count. |
2183 render_frame_host_->GetProcess()->RemovePendingView(); | 2184 render_frame_host_->GetProcess()->RemovePendingView(); |
2184 | 2185 |
2185 // Show the new view (or a sad tab) if necessary. | 2186 // Show the new view (or a sad tab) if necessary. |
2186 bool new_rfh_has_view = !!render_frame_host_->GetView(); | 2187 bool new_rfh_has_view = !!render_frame_host_->GetView(); |
2187 if (!delegate_->IsHidden() && new_rfh_has_view) { | 2188 if (!delegate_->IsHidden() && new_rfh_has_view) { |
2188 // In most cases, we need to show the new view. | 2189 // In most cases, we need to show the new view. |
2189 render_frame_host_->GetView()->Show(); | 2190 render_frame_host_->GetView()->Show(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2237 old_render_frame_host->render_view_host()->set_main_frame_routing_id( | 2238 old_render_frame_host->render_view_host()->set_main_frame_routing_id( |
2238 MSG_ROUTING_NONE); | 2239 MSG_ROUTING_NONE); |
2239 } | 2240 } |
2240 | 2241 |
2241 // Swap out the old frame now that the new one is visible. | 2242 // Swap out the old frame now that the new one is visible. |
2242 // This will swap it out and then put it on the proxy list (if there are other | 2243 // This will swap it out and then put it on the proxy list (if there are other |
2243 // active views in its SiteInstance) or schedule it for deletion when the swap | 2244 // active views in its SiteInstance) or schedule it for deletion when the swap |
2244 // out ack arrives (or immediately if the process isn't live). | 2245 // out ack arrives (or immediately if the process isn't live). |
2245 // In the --site-per-process case, old subframe RFHs are not kept alive inside | 2246 // In the --site-per-process case, old subframe RFHs are not kept alive inside |
2246 // the proxy. | 2247 // the proxy. |
2247 SwapOutOldFrame(old_render_frame_host.Pass()); | 2248 SwapOutOldFrame(std::move(old_render_frame_host)); |
2248 | 2249 |
2249 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 2250 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { |
2250 // Since the new RenderFrameHost is now committed, there must be no proxies | 2251 // Since the new RenderFrameHost is now committed, there must be no proxies |
2251 // for its SiteInstance. Delete any existing ones. | 2252 // for its SiteInstance. Delete any existing ones. |
2252 proxy_hosts_->Remove(render_frame_host_->GetSiteInstance()->GetId()); | 2253 proxy_hosts_->Remove(render_frame_host_->GetSiteInstance()->GetId()); |
2253 } | 2254 } |
2254 | 2255 |
2255 // If this is a subframe, it should have a CrossProcessFrameConnector | 2256 // If this is a subframe, it should have a CrossProcessFrameConnector |
2256 // created already. Use it to link the new RFH's view to the proxy that | 2257 // created already. Use it to link the new RFH's view to the proxy that |
2257 // belongs to the parent frame's SiteInstance. If this navigation causes | 2258 // belongs to the parent frame's SiteInstance. If this navigation causes |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 void RenderFrameHostManager::CancelPending() { | 2484 void RenderFrameHostManager::CancelPending() { |
2484 TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending", | 2485 TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending", |
2485 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); | 2486 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); |
2486 render_frame_host_->ClearPendingWebUI(); | 2487 render_frame_host_->ClearPendingWebUI(); |
2487 DiscardUnusedFrame(UnsetPendingRenderFrameHost()); | 2488 DiscardUnusedFrame(UnsetPendingRenderFrameHost()); |
2488 } | 2489 } |
2489 | 2490 |
2490 scoped_ptr<RenderFrameHostImpl> | 2491 scoped_ptr<RenderFrameHostImpl> |
2491 RenderFrameHostManager::UnsetPendingRenderFrameHost() { | 2492 RenderFrameHostManager::UnsetPendingRenderFrameHost() { |
2492 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host = | 2493 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host = |
2493 pending_render_frame_host_.Pass(); | 2494 std::move(pending_render_frame_host_); |
2494 | 2495 |
2495 RenderFrameDevToolsAgentHost::OnCancelPendingNavigation( | 2496 RenderFrameDevToolsAgentHost::OnCancelPendingNavigation( |
2496 pending_render_frame_host.get(), | 2497 pending_render_frame_host.get(), |
2497 render_frame_host_.get()); | 2498 render_frame_host_.get()); |
2498 | 2499 |
2499 // We no longer need to prevent the process from exiting. | 2500 // We no longer need to prevent the process from exiting. |
2500 pending_render_frame_host->GetProcess()->RemovePendingView(); | 2501 pending_render_frame_host->GetProcess()->RemovePendingView(); |
2501 | 2502 |
2502 return pending_render_frame_host.Pass(); | 2503 return pending_render_frame_host; |
2503 } | 2504 } |
2504 | 2505 |
2505 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::SetRenderFrameHost( | 2506 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::SetRenderFrameHost( |
2506 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 2507 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
2507 // Swap the two. | 2508 // Swap the two. |
2508 scoped_ptr<RenderFrameHostImpl> old_render_frame_host = | 2509 scoped_ptr<RenderFrameHostImpl> old_render_frame_host = |
2509 render_frame_host_.Pass(); | 2510 std::move(render_frame_host_); |
2510 render_frame_host_ = render_frame_host.Pass(); | 2511 render_frame_host_ = std::move(render_frame_host); |
2511 | 2512 |
2512 if (frame_tree_node_->IsMainFrame()) { | 2513 if (frame_tree_node_->IsMainFrame()) { |
2513 // Update the count of top-level frames using this SiteInstance. All | 2514 // Update the count of top-level frames using this SiteInstance. All |
2514 // subframes are in the same BrowsingInstance as the main frame, so we only | 2515 // subframes are in the same BrowsingInstance as the main frame, so we only |
2515 // count top-level ones. This makes the value easier for consumers to | 2516 // count top-level ones. This makes the value easier for consumers to |
2516 // interpret. | 2517 // interpret. |
2517 if (render_frame_host_) { | 2518 if (render_frame_host_) { |
2518 render_frame_host_->GetSiteInstance()-> | 2519 render_frame_host_->GetSiteInstance()-> |
2519 IncrementRelatedActiveContentsCount(); | 2520 IncrementRelatedActiveContentsCount(); |
2520 } | 2521 } |
2521 if (old_render_frame_host) { | 2522 if (old_render_frame_host) { |
2522 old_render_frame_host->GetSiteInstance()-> | 2523 old_render_frame_host->GetSiteInstance()-> |
2523 DecrementRelatedActiveContentsCount(); | 2524 DecrementRelatedActiveContentsCount(); |
2524 } | 2525 } |
2525 } | 2526 } |
2526 | 2527 |
2527 return old_render_frame_host.Pass(); | 2528 return old_render_frame_host; |
2528 } | 2529 } |
2529 | 2530 |
2530 bool RenderFrameHostManager::IsRVHOnSwappedOutList( | 2531 bool RenderFrameHostManager::IsRVHOnSwappedOutList( |
2531 RenderViewHostImpl* rvh) const { | 2532 RenderViewHostImpl* rvh) const { |
2532 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost( | 2533 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost( |
2533 rvh->GetSiteInstance()); | 2534 rvh->GetSiteInstance()); |
2534 if (!proxy) | 2535 if (!proxy) |
2535 return false; | 2536 return false; |
2536 // If there is a proxy without RFH, it is for a subframe in the SiteInstance | 2537 // If there is a proxy without RFH, it is for a subframe in the SiteInstance |
2537 // of |rvh|. Subframes should be ignored in this case. | 2538 // of |rvh|. Subframes should be ignored in this case. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2682 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2683 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2683 if (!frame_tree_node_->opener()) | 2684 if (!frame_tree_node_->opener()) |
2684 return MSG_ROUTING_NONE; | 2685 return MSG_ROUTING_NONE; |
2685 | 2686 |
2686 return frame_tree_node_->opener() | 2687 return frame_tree_node_->opener() |
2687 ->render_manager() | 2688 ->render_manager() |
2688 ->GetRoutingIdForSiteInstance(instance); | 2689 ->GetRoutingIdForSiteInstance(instance); |
2689 } | 2690 } |
2690 | 2691 |
2691 } // namespace content | 2692 } // namespace content |
OLD | NEW |