| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 RecordAction( | 157 RecordAction( |
| 158 base::UserMetricsAction("ProcessSwapBindingsMismatch_RVHM")); | 158 base::UserMetricsAction("ProcessSwapBindingsMismatch_RVHM")); |
| 159 pending_web_ui_.reset(); | 159 pending_web_ui_.reset(); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 RenderFrameHostImpl* RenderFrameHostManager::Navigate( | 163 RenderFrameHostImpl* RenderFrameHostManager::Navigate( |
| 164 const NavigationEntryImpl& entry) { | 164 const NavigationEntryImpl& entry) { |
| 165 TRACE_EVENT0("browser", "RenderFrameHostManager:Navigate"); | 165 TRACE_EVENT0("browser", "RenderFrameHostManager:Navigate"); |
| 166 // Create a pending RenderFrameHost to use for the navigation. | 166 // Create a pending RenderFrameHost to use for the navigation. |
| 167 RenderFrameHostImpl* dest_render_frame_host = | 167 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate(entry); |
| 168 UpdateRendererStateForNavigate(entry); | |
| 169 if (!dest_render_frame_host) | 168 if (!dest_render_frame_host) |
| 170 return NULL; // We weren't able to create a pending render frame host. | 169 return NULL; // We weren't able to create a pending render frame host. |
| 171 | 170 |
| 172 // If the current render_frame_host_ isn't live, we should create it so | 171 // If the current render_frame_host_ isn't live, we should create it so |
| 173 // that we don't show a sad tab while the dest_render_frame_host fetches | 172 // that we don't show a sad tab while the dest_render_frame_host fetches |
| 174 // its first page. (Bug 1145340) | 173 // its first page. (Bug 1145340) |
| 175 if (dest_render_frame_host != render_frame_host_ && | 174 if (dest_render_frame_host != render_frame_host_ && |
| 176 !render_frame_host_->render_view_host()->IsRenderViewLive()) { | 175 !render_frame_host_->render_view_host()->IsRenderViewLive()) { |
| 177 // Note: we don't call InitRenderView here because we are navigating away | 176 // Note: we don't call InitRenderView here because we are navigating away |
| 178 // soon anyway, and we don't have the NavigationEntry for this host. | 177 // soon anyway, and we don't have the NavigationEntry for this host. |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 // This deletes all RenderFrameHosts using the |rvh|, which then causes | 1160 // This deletes all RenderFrameHosts using the |rvh|, which then causes |
| 1162 // |rvh| to Shutdown. | 1161 // |rvh| to Shutdown. |
| 1163 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); | 1162 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); |
| 1164 tree->ForEach(base::Bind( | 1163 tree->ForEach(base::Bind( |
| 1165 &RenderFrameHostManager::ClearProxiesInSiteInstance, | 1164 &RenderFrameHostManager::ClearProxiesInSiteInstance, |
| 1166 site_instance_id)); | 1165 site_instance_id)); |
| 1167 } | 1166 } |
| 1168 } | 1167 } |
| 1169 } | 1168 } |
| 1170 | 1169 |
| 1171 RenderFrameHostImpl* RenderFrameHostManager::UpdateRendererStateForNavigate( | 1170 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
| 1172 const NavigationEntryImpl& entry) { | 1171 const NavigationEntryImpl& entry) { |
| 1173 // If we are currently navigating cross-process, we want to get back to normal | 1172 // If we are currently navigating cross-process, we want to get back to normal |
| 1174 // and then navigate as usual. | 1173 // and then navigate as usual. |
| 1175 if (cross_navigation_pending_) { | 1174 if (cross_navigation_pending_) { |
| 1176 if (pending_render_frame_host_) | 1175 if (pending_render_frame_host_) |
| 1177 CancelPending(); | 1176 CancelPending(); |
| 1178 cross_navigation_pending_ = false; | 1177 cross_navigation_pending_ = false; |
| 1179 } | 1178 } |
| 1180 | 1179 |
| 1181 // render_frame_host_'s SiteInstance and new_instance will not be deleted | 1180 // render_frame_host_'s SiteInstance and new_instance will not be deleted |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 SiteInstance* instance) const { | 1424 SiteInstance* instance) const { |
| 1426 RenderFrameProxyHostMap::const_iterator iter = | 1425 RenderFrameProxyHostMap::const_iterator iter = |
| 1427 proxy_hosts_.find(instance->GetId()); | 1426 proxy_hosts_.find(instance->GetId()); |
| 1428 if (iter != proxy_hosts_.end()) | 1427 if (iter != proxy_hosts_.end()) |
| 1429 return iter->second; | 1428 return iter->second; |
| 1430 | 1429 |
| 1431 return NULL; | 1430 return NULL; |
| 1432 } | 1431 } |
| 1433 | 1432 |
| 1434 } // namespace content | 1433 } // namespace content |
| OLD | NEW |