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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
993 // if needed when it no longer breaks OAuth popups (see | 993 // if needed when it no longer breaks OAuth popups (see |
994 // https://crbug.com/440266). | 994 // https://crbug.com/440266). |
995 bool is_main_frame = frame_tree_node_->IsMainFrame(); | 995 bool is_main_frame = frame_tree_node_->IsMainFrame(); |
996 if (current_site_instance == dest_site_instance.get() || | 996 if (current_site_instance == dest_site_instance.get() || |
997 (!request.browser_initiated() && is_main_frame) || | 997 (!request.browser_initiated() && is_main_frame) || |
998 (!is_main_frame && !dest_site_instance->RequiresDedicatedProcess() && | 998 (!is_main_frame && !dest_site_instance->RequiresDedicatedProcess() && |
999 !current_site_instance->RequiresDedicatedProcess())) { | 999 !current_site_instance->RequiresDedicatedProcess())) { |
1000 // Reuse the current RFH if its SiteInstance matches the the navigation's | 1000 // Reuse the current RFH if its SiteInstance matches the the navigation's |
1001 // or if this is a subframe navigation. We only swap RFHs for subframes when | 1001 // or if this is a subframe navigation. We only swap RFHs for subframes when |
1002 // --site-per-process is enabled. | 1002 // --site-per-process is enabled. |
1003 CleanUpNavigation(); | 1003 |
1004 // There might be a pending WebUI in the current RenderFrameHost from a | |
1005 // previous call of this function in the same navigation and it should be | |
1006 // maintained for the next call to UpdatePendingWebUI. So instead of calling | |
clamy
2015/10/22 16:51:39
nit: RenderFrameHostImpl::UpdatePendingWebUI.
carlosk
2015/10/26 10:33:23
Done.
| |
1007 // CleanUpNavigation, only the speculative RenderFrameHost is discarded. | |
clamy
2015/10/22 16:51:39
nit: s/the speculative RenderFrameHost is discarde
carlosk
2015/10/26 10:33:23
Done.
| |
1008 if (speculative_render_frame_host_) | |
1009 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); | |
1010 | |
1004 navigation_rfh = render_frame_host_.get(); | 1011 navigation_rfh = render_frame_host_.get(); |
1005 | 1012 |
1006 // As SiteInstances are the same, make the RFH update its possible pending | 1013 // As SiteInstances are the same, make the RFH update its possible pending |
1007 // WebUI. | 1014 // WebUI. |
1008 render_frame_host_->UpdatePendingWebUI(request.common_params().url, | 1015 render_frame_host_->UpdatePendingWebUI(request.common_params().url, |
1009 request.bindings()); | 1016 request.bindings()); |
1010 DCHECK(speculative_web_ui() == render_frame_host_->pending_web_ui()); | 1017 DCHECK(speculative_web_ui() == render_frame_host_->pending_web_ui()); |
1011 | 1018 |
1012 // If a pending WebUI was set on the current RenderFrameHost (be it a new | 1019 // If a pending WebUI was set on the current RenderFrameHost (be it a new |
1013 // one or the reused current one) and the associated RenderFrame is alive, | 1020 // one or the reused current one) and the associated RenderFrame is alive, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1085 } | 1092 } |
1086 } | 1093 } |
1087 | 1094 |
1088 return navigation_rfh; | 1095 return navigation_rfh; |
1089 } | 1096 } |
1090 | 1097 |
1091 // PlzNavigate | 1098 // PlzNavigate |
1092 void RenderFrameHostManager::CleanUpNavigation() { | 1099 void RenderFrameHostManager::CleanUpNavigation() { |
1093 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 1100 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
1094 switches::kEnableBrowserSideNavigation)); | 1101 switches::kEnableBrowserSideNavigation)); |
1095 // TODO(carlosk): the discarding of the current RFH WebUI and the cleanup of | |
1096 // the speculative RFH should not always happen together. | |
1097 render_frame_host_->DiscardPendingWebUI(); | 1102 render_frame_host_->DiscardPendingWebUI(); |
1098 if (speculative_render_frame_host_) | 1103 if (speculative_render_frame_host_) |
1099 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); | 1104 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); |
1100 } | 1105 } |
1101 | 1106 |
1102 // PlzNavigate | 1107 // PlzNavigate |
1103 scoped_ptr<RenderFrameHostImpl> | 1108 scoped_ptr<RenderFrameHostImpl> |
1104 RenderFrameHostManager::UnsetSpeculativeRenderFrameHost() { | 1109 RenderFrameHostManager::UnsetSpeculativeRenderFrameHost() { |
1105 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 1110 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
1106 switches::kEnableBrowserSideNavigation)); | 1111 switches::kEnableBrowserSideNavigation)); |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2577 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2582 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2578 if (!frame_tree_node_->opener()) | 2583 if (!frame_tree_node_->opener()) |
2579 return MSG_ROUTING_NONE; | 2584 return MSG_ROUTING_NONE; |
2580 | 2585 |
2581 return frame_tree_node_->opener() | 2586 return frame_tree_node_->opener() |
2582 ->render_manager() | 2587 ->render_manager() |
2583 ->GetRoutingIdForSiteInstance(instance); | 2588 ->GetRoutingIdForSiteInstance(instance); |
2584 } | 2589 } |
2585 | 2590 |
2586 } // namespace content | 2591 } // namespace content |
OLD | NEW |