Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 379143002: PlzNavigate: implement RequestNavigation in the no live renderer case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 #include "content/common/view_messages.h" 32 #include "content/common/view_messages.h"
33 #include "content/public/browser/content_browser_client.h" 33 #include "content/public/browser/content_browser_client.h"
34 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
35 #include "content/public/browser/notification_types.h" 35 #include "content/public/browser/notification_types.h"
36 #include "content/public/browser/render_widget_host_iterator.h" 36 #include "content/public/browser/render_widget_host_iterator.h"
37 #include "content/public/browser/render_widget_host_view.h" 37 #include "content/public/browser/render_widget_host_view.h"
38 #include "content/public/browser/user_metrics.h" 38 #include "content/public/browser/user_metrics.h"
39 #include "content/public/browser/web_ui_controller.h" 39 #include "content/public/browser/web_ui_controller.h"
40 #include "content/public/common/content_switches.h" 40 #include "content/public/common/content_switches.h"
41 #include "content/public/common/url_constants.h" 41 #include "content/public/common/url_constants.h"
42 #include "net/base/load_flags.h"
42 43
43 namespace content { 44 namespace content {
44 45
46 namespace {
47
48 FrameHostMsg_BeginNavigation_Params BeginNavigationFromNavigate(
49 const FrameMsg_Navigate_Params& navigate_params) {
50 FrameHostMsg_BeginNavigation_Params begin_navigation_params;
51 begin_navigation_params.method = navigate_params.is_post ?
52 "POST" : "GET";
53 begin_navigation_params.url = navigate_params.url;
54 begin_navigation_params.referrer = navigate_params.referrer.url;
55 begin_navigation_params.referrer_policy = navigate_params.referrer.policy;
56
57 // TODO(clamy): This should be modified to take into account caching policy
58 // requirements (eg for POST reloads).
59 begin_navigation_params.load_flags =
60 net::LOAD_NORMAL | net::LOAD_ENABLE_LOAD_TIMING;
61
62 // TODO(clamy): Post data from the browser should be put in the request body.
63
64 begin_navigation_params.has_user_gesture = false;
65 begin_navigation_params.transition_type = navigate_params.transition;
66 begin_navigation_params.should_replace_current_entry =
67 navigate_params.should_replace_current_entry;
68 begin_navigation_params.allow_download =
69 navigate_params.allow_download;
70 return begin_navigation_params;
71 }
72
73 } // namespace
74
45 RenderFrameHostManager::PendingNavigationParams::PendingNavigationParams( 75 RenderFrameHostManager::PendingNavigationParams::PendingNavigationParams(
46 const GlobalRequestID& global_request_id, 76 const GlobalRequestID& global_request_id,
47 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, 77 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request,
48 const std::vector<GURL>& transfer_url_chain, 78 const std::vector<GURL>& transfer_url_chain,
49 Referrer referrer, 79 Referrer referrer,
50 PageTransition page_transition, 80 PageTransition page_transition,
51 int render_frame_id, 81 int render_frame_id,
52 bool should_replace_current_entry) 82 bool should_replace_current_entry)
53 : global_request_id(global_request_id), 83 : global_request_id(global_request_id),
54 cross_site_transferring_request(cross_site_transferring_request.Pass()), 84 cross_site_transferring_request(cross_site_transferring_request.Pass()),
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 203 }
174 204
175 RenderFrameHostImpl* RenderFrameHostManager::Navigate( 205 RenderFrameHostImpl* RenderFrameHostManager::Navigate(
176 const NavigationEntryImpl& entry) { 206 const NavigationEntryImpl& entry) {
177 TRACE_EVENT0("browser", "RenderFrameHostManager:Navigate"); 207 TRACE_EVENT0("browser", "RenderFrameHostManager:Navigate");
178 // Create a pending RenderFrameHost to use for the navigation. 208 // Create a pending RenderFrameHost to use for the navigation.
179 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate(entry); 209 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate(entry);
180 if (!dest_render_frame_host) 210 if (!dest_render_frame_host)
181 return NULL; // We weren't able to create a pending render frame host. 211 return NULL; // We weren't able to create a pending render frame host.
182 212
183 // If the current render_frame_host_ isn't live, we should create it so 213 // Initialize the destination RFH and the current RFH if they are not live.
nasko 2014/07/17 12:05:08 If they are not alive, then they will be the same,
clamy 2014/07/17 13:07:53 What if the current renderer crashed and we naviga
nasko 2014/07/21 13:02:05 No, we don't. I was thinking initial creation only
184 // that we don't show a sad tab while the dest_render_frame_host fetches 214 if (!InitRenderFrameHostsBeforeNavigation(dest_render_frame_host))
185 // its first page. (Bug 1145340) 215 return NULL;
186 if (dest_render_frame_host != render_frame_host_ &&
187 !render_frame_host_->render_view_host()->IsRenderViewLive()) {
188 // Note: we don't call InitRenderView here because we are navigating away
189 // soon anyway, and we don't have the NavigationEntry for this host.
190 delegate_->CreateRenderViewForRenderManager(
191 render_frame_host_->render_view_host(), MSG_ROUTING_NONE,
192 MSG_ROUTING_NONE, frame_tree_node_->IsMainFrame());
193 }
194
195 // If the renderer crashed, then try to create a new one to satisfy this
196 // navigation request.
197 if (!dest_render_frame_host->render_view_host()->IsRenderViewLive()) {
198 // Recreate the opener chain.
199 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager(
200 dest_render_frame_host->GetSiteInstance());
201 if (!InitRenderView(dest_render_frame_host->render_view_host(),
202 opener_route_id,
203 MSG_ROUTING_NONE,
204 frame_tree_node_->IsMainFrame()))
205 return NULL;
206
207 // Now that we've created a new renderer, be sure to hide it if it isn't
208 // our primary one. Otherwise, we might crash if we try to call Show()
209 // on it later.
210 if (dest_render_frame_host != render_frame_host_ &&
211 dest_render_frame_host->render_view_host()->GetView()) {
212 dest_render_frame_host->render_view_host()->GetView()->Hide();
213 } else {
214 // Notify here as we won't be calling CommitPending (which does the
215 // notify).
216 delegate_->NotifySwappedFromRenderManager(
217 NULL, render_frame_host_.get(), frame_tree_node_->IsMainFrame());
218 }
219 }
220 216
221 // If entry includes the request ID of a request that is being transferred, 217 // If entry includes the request ID of a request that is being transferred,
222 // the destination render frame will take ownership, so release ownership of 218 // the destination render frame will take ownership, so release ownership of
223 // the request. 219 // the request.
224 if (pending_nav_params_ && 220 if (pending_nav_params_ &&
225 pending_nav_params_->global_request_id == 221 pending_nav_params_->global_request_id ==
226 entry.transferred_global_request_id()) { 222 entry.transferred_global_request_id()) {
227 pending_nav_params_->cross_site_transferring_request->ReleaseRequest(); 223 pending_nav_params_->cross_site_transferring_request->ReleaseRequest();
228 } 224 }
229 225
230 return dest_render_frame_host; 226 return dest_render_frame_host;
231 } 227 }
232 228
229 bool RenderFrameHostManager::RequestNavigation(
230 const NavigationEntryImpl& entry,
231 const FrameMsg_Navigate_Params& navigate_params) {
232 if (render_frame_host_->render_view_host()->IsRenderViewLive())
nasko 2014/07/17 12:05:08 Let's put a TODO to put IsLive on RenderFrameHost,
clamy 2014/07/17 13:07:53 Done.
233 // TODO(clamy): send a RequestNavigation IPC.
234 return true;
235
236 // The navigation request is sent directly to the IO thread.
237 OnBeginNavigation(BeginNavigationFromNavigate(navigate_params));
nasko 2014/07/17 12:05:08 There is a comment in OnBeginNavigation to create
clamy 2014/07/17 13:07:53 The comment in OnBeginNavigation had more to do wi
238
239 // Create a new RFH for the navigation if necessary.
240 RenderFrameHostImpl* dest_render_frame_host = render_frame_host_.get();
241 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
242 SiteInstance* new_instance = GetSiteInstanceForNavigation(entry);
243 if (current_instance != new_instance) {
244 // Ensure that we have created RFHs for the new RFH's opener chain if
245 // we are staying in the same BrowsingInstance. This allows the pending RFH
246 // to send cross-process script calls to its opener(s).
247 int opener_route_id = MSG_ROUTING_NONE;
248 if (new_instance->IsRelatedSiteInstance(current_instance)) {
249 opener_route_id =
250 delegate_->CreateOpenerRenderViewsForRenderManager(new_instance);
251 }
252
253 // Create a non-swapped-out speculative RFH with the given opener.
254 int route_id = CreateRenderFrame(new_instance, opener_route_id, false,
255 delegate_->IsHidden(), true);
256 if (route_id == MSG_ROUTING_NONE)
257 return false;
258 dest_render_frame_host = speculative_render_frame_host_.get();
259 }
260 return InitRenderFrameHostsBeforeNavigation(dest_render_frame_host);
nasko 2014/07/17 12:05:08 Do we need to init in the case where we don't crea
clamy 2014/07/17 13:07:53 We are in the case where the current RFH is not li
nasko 2014/07/21 13:02:05 I don't think we need a live current renderer to s
clamy 2014/07/21 13:28:17 So should I let the initialization in place?
261 }
262
233 void RenderFrameHostManager::Stop() { 263 void RenderFrameHostManager::Stop() {
234 render_frame_host_->render_view_host()->Stop(); 264 render_frame_host_->render_view_host()->Stop();
235 265
236 // If we are cross-navigating, we should stop the pending renderers. This 266 // If we are cross-navigating, we should stop the pending renderers. This
237 // will lead to a DidFailProvisionalLoad, which will properly destroy them. 267 // will lead to a DidFailProvisionalLoad, which will properly destroy them.
238 if (cross_navigation_pending_) { 268 if (cross_navigation_pending_) {
239 pending_render_frame_host_->render_view_host()->Send(new ViewMsg_Stop( 269 pending_render_frame_host_->render_view_host()->Send(new ViewMsg_Stop(
240 pending_render_frame_host_->render_view_host()->GetRoutingID())); 270 pending_render_frame_host_->render_view_host()->GetRoutingID()));
241 } 271 }
242 } 272 }
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 frame_tree_node_, 967 frame_tree_node_,
938 frame_routing_id, 968 frame_routing_id,
939 swapped_out).release()); 969 swapped_out).release());
940 return render_frame_host.Pass(); 970 return render_frame_host.Pass();
941 } 971 }
942 972
943 int RenderFrameHostManager::CreateRenderFrame( 973 int RenderFrameHostManager::CreateRenderFrame(
944 SiteInstance* instance, 974 SiteInstance* instance,
945 int opener_route_id, 975 int opener_route_id,
946 bool swapped_out, 976 bool swapped_out,
947 bool hidden) { 977 bool hidden,
978 bool is_speculative) {
948 CHECK(instance); 979 CHECK(instance);
949 DCHECK(!swapped_out || hidden); // Swapped out views should always be hidden. 980 DCHECK(!swapped_out || hidden); // Swapped out views should always be hidden.
nasko 2014/07/17 12:05:08 is_speculative should never be true when swapped_o
clamy 2014/07/17 13:07:53 Done.
950 981
951 scoped_ptr<RenderFrameHostImpl> new_render_frame_host; 982 scoped_ptr<RenderFrameHostImpl> new_render_frame_host;
952 RenderFrameHostImpl* frame_to_announce = NULL; 983 RenderFrameHostImpl* frame_to_announce = NULL;
953 int routing_id = MSG_ROUTING_NONE; 984 int routing_id = MSG_ROUTING_NONE;
954 985
955 // We are creating a pending or swapped out RFH here. We should never create 986 // We are creating a pending or swapped out RFH here. We should never create
956 // it in the same SiteInstance as our current RFH. 987 // it in the same SiteInstance as our current RFH.
957 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); 988 CHECK_NE(render_frame_host_->GetSiteInstance(), instance);
958 989
959 // Check if we've already created an RFH for this SiteInstance. If so, try 990 // Check if we've already created an RFH for this SiteInstance. If so, try
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // Don't show the main frame's view until we get a DidNavigate from it. 1044 // Don't show the main frame's view until we get a DidNavigate from it.
1014 render_view_host->GetView()->Hide(); 1045 render_view_host->GetView()->Hide();
1015 } else if (!swapped_out && pending_render_frame_host_) { 1046 } else if (!swapped_out && pending_render_frame_host_) {
1016 CancelPending(); 1047 CancelPending();
1017 } 1048 }
1018 routing_id = render_view_host->GetRoutingID(); 1049 routing_id = render_view_host->GetRoutingID();
1019 frame_to_announce = new_render_frame_host.get(); 1050 frame_to_announce = new_render_frame_host.get();
1020 } 1051 }
1021 1052
1022 // Use this as our new pending RFH if it isn't swapped out. 1053 // Use this as our new pending RFH if it isn't swapped out.
1023 if (!swapped_out) 1054 if (!swapped_out) {
1024 pending_render_frame_host_ = new_render_frame_host.Pass(); 1055 if (is_speculative)
1056 speculative_render_frame_host_ = new_render_frame_host.Pass();
1057 else
1058 pending_render_frame_host_ = new_render_frame_host.Pass();
1059 }
1025 1060
1026 // If a brand new RFH was created, announce it to observers. 1061 // If a brand new RFH was created, announce it to observers.
1027 if (frame_to_announce) 1062 if (frame_to_announce)
1028 render_frame_delegate_->RenderFrameCreated(frame_to_announce); 1063 render_frame_delegate_->RenderFrameCreated(frame_to_announce);
1029 1064
1030 return routing_id; 1065 return routing_id;
1031 } 1066 }
1032 1067
1033 bool RenderFrameHostManager::InitRenderView(RenderViewHost* render_view_host, 1068 bool RenderFrameHostManager::InitRenderView(RenderViewHost* render_view_host,
1034 int opener_route_id, 1069 int opener_route_id,
(...skipping 16 matching lines...) Expand all
1051 if (!rvh_impl->IsSwappedOut()) { 1086 if (!rvh_impl->IsSwappedOut()) {
1052 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( 1087 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
1053 render_view_host->GetProcess()->GetID())); 1088 render_view_host->GetProcess()->GetID()));
1054 } 1089 }
1055 } 1090 }
1056 1091
1057 return delegate_->CreateRenderViewForRenderManager( 1092 return delegate_->CreateRenderViewForRenderManager(
1058 render_view_host, opener_route_id, proxy_routing_id, for_main_frame); 1093 render_view_host, opener_route_id, proxy_routing_id, for_main_frame);
1059 } 1094 }
1060 1095
1096 bool RenderFrameHostManager::InitRenderFrameHostsBeforeNavigation(
1097 RenderFrameHostImpl* dest_render_frame_host) {
1098 // If the current render_frame_host_ isn't live, we should create it so
1099 // that we don't show a sad tab while the dest_render_frame_host fetches
1100 // its first page. (Bug 1145340)
nasko 2014/07/17 12:05:08 nit: convert this to a crbug link.
clamy 2014/07/17 13:07:53 Done.
1101 if (dest_render_frame_host != render_frame_host_ &&
1102 !render_frame_host_->render_view_host()->IsRenderViewLive()) {
1103 // Note: we don't call InitRenderView here because we are navigating away
1104 // soon anyway, and we don't have the NavigationEntry for this host.
1105 delegate_->CreateRenderViewForRenderManager(
1106 render_frame_host_->render_view_host(), MSG_ROUTING_NONE,
1107 MSG_ROUTING_NONE, frame_tree_node_->IsMainFrame());
1108 }
1109
1110 // If the renderer crashed, then try to create a new one to satisfy this
1111 // navigation request.
1112 if (!dest_render_frame_host->render_view_host()->IsRenderViewLive()) {
1113 // Recreate the opener chain.
1114 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager(
1115 dest_render_frame_host->GetSiteInstance());
1116 if (!InitRenderView(dest_render_frame_host->render_view_host(),
1117 opener_route_id,
1118 MSG_ROUTING_NONE,
1119 frame_tree_node_->IsMainFrame()))
1120 return false;
1121
1122 // Now that we've created a new renderer, be sure to hide it if it isn't
1123 // our primary one. Otherwise, we might crash if we try to call Show()
1124 // on it later.
1125 if (dest_render_frame_host != render_frame_host_ &&
1126 dest_render_frame_host->render_view_host()->GetView()) {
1127 dest_render_frame_host->render_view_host()->GetView()->Hide();
1128 } else {
1129 // Notify here as we won't be calling CommitPending (which does the
1130 // notify).
1131 delegate_->NotifySwappedFromRenderManager(
1132 NULL, render_frame_host_.get(), frame_tree_node_->IsMainFrame());
1133 }
1134 }
1135 return true;
1136 }
1137
1138 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation(
1139 const NavigationEntryImpl& entry) {
1140 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
1141 SiteInstance* new_instance = current_instance;
1142
1143 // We do not currently swap processes for navigations in webview tag guests.
1144 bool is_guest_scheme = current_instance->GetSiteURL().SchemeIs(kGuestScheme);
1145
1146 // Determine if we need a new BrowsingInstance for this entry. If true, this
1147 // implies that it will get a new SiteInstance (and likely process), and that
1148 // other tabs in the current BrowsingInstance will be unable to script it.
1149 // This is used for cases that require a process swap even in the
1150 // process-per-tab model, such as WebUI pages.
1151 const NavigationEntry* current_entry =
1152 delegate_->GetLastCommittedNavigationEntryForRenderManager();
1153 bool force_swap = !is_guest_scheme &&
1154 ShouldSwapBrowsingInstancesForNavigation(current_entry, &entry);
1155 if (!is_guest_scheme && (ShouldTransitionCrossSite() || force_swap))
1156 new_instance = GetSiteInstanceForEntry(entry, current_instance, force_swap);
1157
1158 // If force_swap is true, we must use a different SiteInstance. If we didn't,
1159 // we would have two RenderFrameHosts in the same SiteInstance and the same
1160 // frame, resulting in page_id conflicts for their NavigationEntries.
1161 if (force_swap)
1162 CHECK_NE(new_instance, current_instance);
1163
1164 return new_instance;
1165 }
1166
1061 void RenderFrameHostManager::CommitPending() { 1167 void RenderFrameHostManager::CommitPending() {
1062 // First check whether we're going to want to focus the location bar after 1168 // First check whether we're going to want to focus the location bar after
1063 // this commit. We do this now because the navigation hasn't formally 1169 // this commit. We do this now because the navigation hasn't formally
1064 // committed yet, so if we've already cleared |pending_web_ui_| the call chain 1170 // committed yet, so if we've already cleared |pending_web_ui_| the call chain
1065 // this triggers won't be able to figure out what's going on. 1171 // this triggers won't be able to figure out what's going on.
1066 bool will_focus_location_bar = delegate_->FocusLocationBarByDefault(); 1172 bool will_focus_location_bar = delegate_->FocusLocationBarByDefault();
1067 1173
1068 // We expect SwapOutOldPage to have canceled any modal dialogs and told the 1174 // We expect SwapOutOldPage to have canceled any modal dialogs and told the
1069 // renderer to suppress any further dialogs until it is swapped out. However, 1175 // renderer to suppress any further dialogs until it is swapped out. However,
1070 // crash reports indicate that it's still possible for modal dialogs to exist 1176 // crash reports indicate that it's still possible for modal dialogs to exist
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 if (cross_navigation_pending_) { 1365 if (cross_navigation_pending_) {
1260 if (pending_render_frame_host_) 1366 if (pending_render_frame_host_)
1261 CancelPending(); 1367 CancelPending();
1262 cross_navigation_pending_ = false; 1368 cross_navigation_pending_ = false;
1263 } 1369 }
1264 1370
1265 // render_frame_host_'s SiteInstance and new_instance will not be deleted 1371 // render_frame_host_'s SiteInstance and new_instance will not be deleted
1266 // before the end of this method, so we don't have to worry about their ref 1372 // before the end of this method, so we don't have to worry about their ref
1267 // counts dropping to zero. 1373 // counts dropping to zero.
1268 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); 1374 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
1269 SiteInstance* new_instance = current_instance; 1375 SiteInstance* new_instance = GetSiteInstanceForNavigation(entry);
1270
1271 // We do not currently swap processes for navigations in webview tag guests.
1272 bool is_guest_scheme = current_instance->GetSiteURL().SchemeIs(kGuestScheme);
1273
1274 // Determine if we need a new BrowsingInstance for this entry. If true, this
1275 // implies that it will get a new SiteInstance (and likely process), and that
1276 // other tabs in the current BrowsingInstance will be unable to script it.
1277 // This is used for cases that require a process swap even in the
1278 // process-per-tab model, such as WebUI pages.
1279 const NavigationEntry* current_entry = 1376 const NavigationEntry* current_entry =
1280 delegate_->GetLastCommittedNavigationEntryForRenderManager(); 1377 delegate_->GetLastCommittedNavigationEntryForRenderManager();
1281 bool force_swap = !is_guest_scheme &&
1282 ShouldSwapBrowsingInstancesForNavigation(current_entry, &entry);
1283 if (!is_guest_scheme && (ShouldTransitionCrossSite() || force_swap))
1284 new_instance = GetSiteInstanceForEntry(entry, current_instance, force_swap);
1285
1286 // If force_swap is true, we must use a different SiteInstance. If we didn't,
1287 // we would have two RenderFrameHosts in the same SiteInstance and the same
1288 // frame, resulting in page_id conflicts for their NavigationEntries.
1289 if (force_swap)
1290 CHECK_NE(new_instance, current_instance);
1291 1378
1292 if (new_instance != current_instance) { 1379 if (new_instance != current_instance) {
1293 // New SiteInstance: create a pending RFH to navigate. 1380 // New SiteInstance: create a pending RFH to navigate.
1294 DCHECK(!cross_navigation_pending_); 1381 DCHECK(!cross_navigation_pending_);
1295 1382
1296 // This will possibly create (set to NULL) a Web UI object for the pending 1383 // This will possibly create (set to NULL) a Web UI object for the pending
1297 // page. We'll use this later to give the page special access. This must 1384 // page. We'll use this later to give the page special access. This must
1298 // happen before the new renderer is created below so it will get bindings. 1385 // happen before the new renderer is created below so it will get bindings.
1299 // It must also happen after the above conditional call to CancelPending(), 1386 // It must also happen after the above conditional call to CancelPending(),
1300 // otherwise CancelPending may clear the pending_web_ui_ and the page will 1387 // otherwise CancelPending may clear the pending_web_ui_ and the page will
1301 // not have its bindings set appropriately. 1388 // not have its bindings set appropriately.
1302 SetPendingWebUI(entry); 1389 SetPendingWebUI(entry);
1303 1390
1304 // Ensure that we have created RFHs for the new RFH's opener chain if 1391 // Ensure that we have created RFHs for the new RFH's opener chain if
1305 // we are staying in the same BrowsingInstance. This allows the pending RFH 1392 // we are staying in the same BrowsingInstance. This allows the pending RFH
1306 // to send cross-process script calls to its opener(s). 1393 // to send cross-process script calls to its opener(s).
1307 int opener_route_id = MSG_ROUTING_NONE; 1394 int opener_route_id = MSG_ROUTING_NONE;
1308 if (new_instance->IsRelatedSiteInstance(current_instance)) { 1395 if (new_instance->IsRelatedSiteInstance(current_instance)) {
1309 opener_route_id = 1396 opener_route_id =
1310 delegate_->CreateOpenerRenderViewsForRenderManager(new_instance); 1397 delegate_->CreateOpenerRenderViewsForRenderManager(new_instance);
1311 } 1398 }
1312 1399
1313 // Create a non-swapped-out pending RFH with the given opener and navigate 1400 // Create a non-swapped-out pending RFH with the given opener and navigate
1314 // it. 1401 // it.
1315 int route_id = CreateRenderFrame(new_instance, opener_route_id, false, 1402 int route_id = CreateRenderFrame(new_instance, opener_route_id, false,
1316 delegate_->IsHidden()); 1403 delegate_->IsHidden(), false);
1317 if (route_id == MSG_ROUTING_NONE) 1404 if (route_id == MSG_ROUTING_NONE)
1318 return NULL; 1405 return NULL;
1319 1406
1320 // Check if our current RFH is live before we set up a transition. 1407 // Check if our current RFH is live before we set up a transition.
1321 if (!render_frame_host_->render_view_host()->IsRenderViewLive()) { 1408 if (!render_frame_host_->render_view_host()->IsRenderViewLive()) {
1322 if (!cross_navigation_pending_) { 1409 if (!cross_navigation_pending_) {
1323 // The current RFH is not live. There's no reason to sit around with a 1410 // The current RFH is not live. There's no reason to sit around with a
1324 // sad tab or a newly created RFH while we wait for the pending RFH to 1411 // sad tab or a newly created RFH while we wait for the pending RFH to
1325 // navigate. Just switch to the pending RFH now and go back to non 1412 // navigate. Just switch to the pending RFH now and go back to non
1326 // cross-navigating (Note that we don't care about on{before}unload 1413 // cross-navigating (Note that we don't care about on{before}unload
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 SiteInstance* instance) const { 1593 SiteInstance* instance) const {
1507 RenderFrameProxyHostMap::const_iterator iter = 1594 RenderFrameProxyHostMap::const_iterator iter =
1508 proxy_hosts_.find(instance->GetId()); 1595 proxy_hosts_.find(instance->GetId());
1509 if (iter != proxy_hosts_.end()) 1596 if (iter != proxy_hosts_.end())
1510 return iter->second; 1597 return iter->second;
1511 1598
1512 return NULL; 1599 return NULL;
1513 } 1600 }
1514 1601
1515 } // namespace content 1602 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698