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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 | 1060 |
1061 // We are creating a pending or swapped out RFH here. We should never create | 1061 // We are creating a pending or swapped out RFH here. We should never create |
1062 // it in the same SiteInstance as our current RFH. | 1062 // it in the same SiteInstance as our current RFH. |
1063 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); | 1063 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); |
1064 | 1064 |
1065 // Check if we've already created an RFH for this SiteInstance. If so, try | 1065 // Check if we've already created an RFH for this SiteInstance. If so, try |
1066 // to re-use the existing one, which has already been initialized. We'll | 1066 // to re-use the existing one, which has already been initialized. We'll |
1067 // remove it from the list of proxy hosts below if it will be active. | 1067 // remove it from the list of proxy hosts below if it will be active. |
1068 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); | 1068 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
1069 | 1069 |
1070 if (proxy) { | 1070 if (proxy && proxy->render_frame_host()) { |
1071 routing_id = proxy->GetRenderViewHost()->GetRoutingID(); | 1071 routing_id = proxy->GetRenderViewHost()->GetRoutingID(); |
1072 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost. | 1072 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost. |
1073 // Prevent the process from exiting while we're trying to use it. | 1073 // Prevent the process from exiting while we're trying to use it. |
1074 if (!swapped_out) { | 1074 if (!swapped_out) { |
1075 new_render_frame_host = proxy->PassFrameHostOwnership(); | 1075 new_render_frame_host = proxy->PassFrameHostOwnership(); |
1076 new_render_frame_host->GetProcess()->AddPendingView(); | 1076 new_render_frame_host->GetProcess()->AddPendingView(); |
1077 | 1077 |
1078 proxy_hosts_.erase(instance->GetId()); | 1078 proxy_hosts_.erase(instance->GetId()); |
1079 delete proxy; | 1079 delete proxy; |
1080 | 1080 |
(...skipping 20 matching lines...) Expand all Loading... |
1101 int proxy_routing_id = MSG_ROUTING_NONE; | 1101 int proxy_routing_id = MSG_ROUTING_NONE; |
1102 | 1102 |
1103 // Prevent the process from exiting while we're trying to navigate in it. | 1103 // Prevent the process from exiting while we're trying to navigate in it. |
1104 // Otherwise, if the new RFH is swapped out already, store it. | 1104 // Otherwise, if the new RFH is swapped out already, store it. |
1105 if (!swapped_out) { | 1105 if (!swapped_out) { |
1106 new_render_frame_host->GetProcess()->AddPendingView(); | 1106 new_render_frame_host->GetProcess()->AddPendingView(); |
1107 } else { | 1107 } else { |
1108 proxy = new RenderFrameProxyHost( | 1108 proxy = new RenderFrameProxyHost( |
1109 new_render_frame_host->GetSiteInstance(), frame_tree_node_); | 1109 new_render_frame_host->GetSiteInstance(), frame_tree_node_); |
1110 proxy_hosts_[instance->GetId()] = proxy; | 1110 proxy_hosts_[instance->GetId()] = proxy; |
1111 proxy->TakeFrameHostOwnership(new_render_frame_host.Pass()); | |
1112 proxy_routing_id = proxy->GetRoutingID(); | 1111 proxy_routing_id = proxy->GetRoutingID(); |
| 1112 if (frame_tree_node_->IsMainFrame()) |
| 1113 proxy->TakeFrameHostOwnership(new_render_frame_host.Pass()); |
1113 } | 1114 } |
1114 | 1115 |
1115 bool success = InitRenderView(render_view_host, | 1116 bool success = InitRenderView(render_view_host, |
1116 opener_route_id, | 1117 opener_route_id, |
1117 proxy_routing_id, | 1118 proxy_routing_id, |
1118 for_main_frame_navigation); | 1119 for_main_frame_navigation); |
1119 if (success) { | 1120 if (success) { |
1120 if (frame_tree_node_->IsMainFrame()) { | 1121 if (frame_tree_node_->IsMainFrame()) { |
1121 // Don't show the main frame's view until we get a DidNavigate from it. | 1122 // Don't show the main frame's view until we get a DidNavigate from it. |
1122 render_view_host->GetView()->Hide(); | 1123 render_view_host->GetView()->Hide(); |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1673 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1673 SiteInstance* instance) { | 1674 SiteInstance* instance) { |
1674 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1675 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1675 if (iter != proxy_hosts_.end()) { | 1676 if (iter != proxy_hosts_.end()) { |
1676 delete iter->second; | 1677 delete iter->second; |
1677 proxy_hosts_.erase(iter); | 1678 proxy_hosts_.erase(iter); |
1678 } | 1679 } |
1679 } | 1680 } |
1680 | 1681 |
1681 } // namespace content | 1682 } // namespace content |
OLD | NEW |