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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Attempt to fix compile. Created 5 years, 4 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 23 matching lines...) Expand all
34 #include "content/child/web_url_request_util.h" 34 #include "content/child/web_url_request_util.h"
35 #include "content/child/webmessageportchannel_impl.h" 35 #include "content/child/webmessageportchannel_impl.h"
36 #include "content/child/websocket_bridge.h" 36 #include "content/child/websocket_bridge.h"
37 #include "content/child/weburlresponse_extradata_impl.h" 37 #include "content/child/weburlresponse_extradata_impl.h"
38 #include "content/common/clipboard_messages.h" 38 #include "content/common/clipboard_messages.h"
39 #include "content/common/frame_messages.h" 39 #include "content/common/frame_messages.h"
40 #include "content/common/frame_replication_state.h" 40 #include "content/common/frame_replication_state.h"
41 #include "content/common/input_messages.h" 41 #include "content/common/input_messages.h"
42 #include "content/common/navigation_params.h" 42 #include "content/common/navigation_params.h"
43 #include "content/common/service_worker/service_worker_types.h" 43 #include "content/common/service_worker/service_worker_types.h"
44 #include "content/common/site_isolation_policy.h"
44 #include "content/common/swapped_out_messages.h" 45 #include "content/common/swapped_out_messages.h"
45 #include "content/common/view_messages.h" 46 #include "content/common/view_messages.h"
46 #include "content/public/common/bindings_policy.h" 47 #include "content/public/common/bindings_policy.h"
47 #include "content/public/common/content_constants.h" 48 #include "content/public/common/content_constants.h"
48 #include "content/public/common/content_switches.h" 49 #include "content/public/common/content_switches.h"
49 #include "content/public/common/context_menu_params.h" 50 #include "content/public/common/context_menu_params.h"
50 #include "content/public/common/isolated_world_ids.h" 51 #include "content/public/common/isolated_world_ids.h"
51 #include "content/public/common/page_state.h" 52 #include "content/public/common/page_state.h"
52 #include "content/public/common/resource_response.h" 53 #include "content/public/common/resource_response.h"
53 #include "content/public/common/url_constants.h" 54 #include "content/public/common/url_constants.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 return media::Context3D(provider->ContextGL(), provider->GrContext()); 509 return media::Context3D(provider->ContextGL(), provider->GrContext());
509 } 510 }
510 #endif 511 #endif
511 512
512 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) { 513 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) {
513 return navigation_type == FrameMsg_Navigate_Type::RELOAD || 514 return navigation_type == FrameMsg_Navigate_Type::RELOAD ||
514 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || 515 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE ||
515 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; 516 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL;
516 } 517 }
517 518
518 bool IsSwappedOutStateForbidden() {
519 return base::CommandLine::ForCurrentProcess()->HasSwitch(
520 switches::kSitePerProcess);
521 }
522
523 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = 519 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl =
524 nullptr; 520 nullptr;
525 521
526 } // namespace 522 } // namespace
527 523
528 // static 524 // static
529 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, 525 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view,
530 int32 routing_id) { 526 int32 routing_id) {
531 DCHECK(routing_id != MSG_ROUTING_NONE); 527 DCHECK(routing_id != MSG_ROUTING_NONE);
532 CreateParams params(render_view, routing_id); 528 CreateParams params(render_view, routing_id);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 blink::WebLocalFrame::create(replicated_state.scope, render_frame); 588 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
593 render_frame->proxy_routing_id_ = proxy_routing_id; 589 render_frame->proxy_routing_id_ = proxy_routing_id;
594 web_frame->initializeToReplaceRemoteFrame( 590 web_frame->initializeToReplaceRemoteFrame(
595 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 591 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
596 replicated_state.sandbox_flags); 592 replicated_state.sandbox_flags);
597 } 593 }
598 render_frame->SetWebFrame(web_frame); 594 render_frame->SetWebFrame(web_frame);
599 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); 595 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent());
600 596
601 if (widget_params.routing_id != MSG_ROUTING_NONE) { 597 if (widget_params.routing_id != MSG_ROUTING_NONE) {
602 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 598 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
603 switches::kSitePerProcess));
604 render_frame->render_widget_ = RenderWidget::CreateForFrame( 599 render_frame->render_widget_ = RenderWidget::CreateForFrame(
605 widget_params.routing_id, widget_params.surface_id, 600 widget_params.routing_id, widget_params.surface_id,
606 widget_params.hidden, render_frame->render_view_->screen_info(), 601 widget_params.hidden, render_frame->render_view_->screen_info(),
607 compositor_deps, web_frame); 602 compositor_deps, web_frame);
608 // TODO(kenrb): Observing shouldn't be necessary when we sort out 603 // TODO(kenrb): Observing shouldn't be necessary when we sort out
609 // WasShown and WasHidden, separating page-level visibility from 604 // WasShown and WasHidden, separating page-level visibility from
610 // frame-level visibility. 605 // frame-level visibility.
611 render_frame->render_widget_->RegisterRenderFrame(render_frame); 606 render_frame->render_widget_->RegisterRenderFrame(render_frame);
612 } 607 }
613 608
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); 695 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct());
701 696
702 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_); 697 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_);
703 698
704 #if defined(VIDEO_HOLE) 699 #if defined(VIDEO_HOLE)
705 if (contains_media_player_) 700 if (contains_media_player_)
706 render_view_->UnregisterVideoHoleFrame(this); 701 render_view_->UnregisterVideoHoleFrame(this);
707 #endif 702 #endif
708 703
709 if (!is_subframe_) { 704 if (!is_subframe_) {
710 if (!IsSwappedOutStateForbidden()) { 705 // When using swapped out frames, RenderFrameProxy is owned by
711 // When using swapped out frames, RenderFrameProxy is "owned" by 706 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted
712 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted 707 // along with this object.
713 // along with this object. 708 if (render_frame_proxy_ &&
714 if (render_frame_proxy_ && 709 !RenderFrameProxy::IsSwappedOutStateForbidden()) {
715 !base::CommandLine::ForCurrentProcess()->HasSwitch( 710 // The following method calls back into this object and clears
716 switches::kSitePerProcess)) { 711 // |render_frame_proxy_|.
717 // The following method calls back into this object and clears 712 render_frame_proxy_->frameDetached(
718 // |render_frame_proxy_|. 713 blink::WebRemoteFrameClient::DetachType::Remove);
719 render_frame_proxy_->frameDetached(
720 blink::WebRemoteFrameClient::DetachType::Remove);
721 }
722 } 714 }
723 715
724 // Ensure the RenderView doesn't point to this object, once it is destroyed. 716 // Ensure the RenderView doesn't point to this object, once it is destroyed.
725 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_| 717 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_|
726 // is |this|, once the object is no longer leaked. 718 // is |this|, once the object is no longer leaked.
727 // See https://crbug.com/464764. 719 // See https://crbug.com/464764.
728 render_view_->main_render_frame_ = nullptr; 720 render_view_->main_render_frame_ = nullptr;
729 } 721 }
730 722
731 render_view_->UnregisterRenderFrame(this); 723 render_view_->UnregisterRenderFrame(this);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 before_unload_start_time, 1118 before_unload_start_time,
1127 before_unload_end_time)); 1119 before_unload_end_time));
1128 } 1120 }
1129 1121
1130 void RenderFrameImpl::OnSwapOut( 1122 void RenderFrameImpl::OnSwapOut(
1131 int proxy_routing_id, 1123 int proxy_routing_id,
1132 bool is_loading, 1124 bool is_loading,
1133 const FrameReplicationState& replicated_frame_state) { 1125 const FrameReplicationState& replicated_frame_state) {
1134 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); 1126 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
1135 RenderFrameProxy* proxy = NULL; 1127 RenderFrameProxy* proxy = NULL;
1136 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( 1128 bool swapped_out_forbidden = RenderFrameProxy::IsSwappedOutStateForbidden();
1137 switches::kSitePerProcess);
1138 bool is_main_frame = !frame_->parent(); 1129 bool is_main_frame = !frame_->parent();
1139 1130
1140 // This codepath should only be hit for subframes when in --site-per-process. 1131 // This codepath should only be hit for subframes when in --site-per-process.
1141 CHECK_IMPLIES(!is_main_frame, is_site_per_process); 1132 CHECK_IMPLIES(!is_main_frame,
1133 SiteIsolationPolicy::AreCrossProcessFramesPossible());
1142 1134
1143 // Only run unload if we're not swapped out yet, but send the ack either way. 1135 // Only run unload if we're not swapped out yet, but send the ack either way.
1144 if (!is_swapped_out_) { 1136 if (!is_swapped_out_) {
1145 // Swap this RenderFrame out so the frame can navigate to a page rendered by 1137 // Swap this RenderFrame out so the frame can navigate to a page rendered by
1146 // a different process. This involves running the unload handler and 1138 // a different process. This involves running the unload handler and
1147 // clearing the page. We also allow this process to exit if there are no 1139 // clearing the page. We also allow this process to exit if there are no
1148 // other active RenderFrames in it. 1140 // other active RenderFrames in it.
1149 1141
1150 // Send an UpdateState message before we get swapped out. 1142 // Send an UpdateState message before we get swapped out.
1151 render_view_->SendUpdateState(); 1143 render_view_->SendUpdateState();
(...skipping 21 matching lines...) Expand all
1173 // willCheckAndDispatchMessageEvent() that needs the proxy. 1165 // willCheckAndDispatchMessageEvent() that needs the proxy.
1174 if (proxy) 1166 if (proxy)
1175 set_render_frame_proxy(proxy); 1167 set_render_frame_proxy(proxy);
1176 1168
1177 // Now that we're swapped out and filtering IPC messages, stop loading to 1169 // Now that we're swapped out and filtering IPC messages, stop loading to
1178 // ensure that no other in-progress navigation continues. We do this here 1170 // ensure that no other in-progress navigation continues. We do this here
1179 // to avoid sending a DidStopLoading message to the browser process. 1171 // to avoid sending a DidStopLoading message to the browser process.
1180 // TODO(creis): Should we be stopping all frames here and using 1172 // TODO(creis): Should we be stopping all frames here and using
1181 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this 1173 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this
1182 // frame? 1174 // frame?
1183 if (!IsSwappedOutStateForbidden()) 1175 if (!swapped_out_forbidden)
1184 OnStop(); 1176 OnStop();
1185 1177
1186 // Transfer settings such as initial drawing parameters to the remote frame, 1178 // Transfer settings such as initial drawing parameters to the remote frame,
1187 // if one is created, that will replace this frame. 1179 // if one is created, that will replace this frame.
1188 if (!is_main_frame && proxy) 1180 if (!is_main_frame && proxy)
1189 proxy->web_frame()->initializeFromFrame(frame_); 1181 proxy->web_frame()->initializeFromFrame(frame_);
1190 1182
1191 // Replace the page with a blank dummy URL. The unload handler will not be 1183 // Replace the page with a blank dummy URL. The unload handler will not be
1192 // run a second time, thanks to a check in FrameLoader::stopLoading. 1184 // run a second time, thanks to a check in FrameLoader::stopLoading.
1193 // TODO(creis): Need to add a better way to do this that avoids running the 1185 // TODO(creis): Need to add a better way to do this that avoids running the
1194 // beforeunload handler. For now, we just run it a second time silently. 1186 // beforeunload handler. For now, we just run it a second time silently.
1195 if (!IsSwappedOutStateForbidden()) 1187 if (!swapped_out_forbidden)
1196 NavigateToSwappedOutURL(); 1188 NavigateToSwappedOutURL();
1197 1189
1198 // Let WebKit know that this view is hidden so it can drop resources and 1190 // Let WebKit know that this view is hidden so it can drop resources and
1199 // stop compositing. 1191 // stop compositing.
1200 // TODO(creis): Support this for subframes as well. 1192 // TODO(creis): Support this for subframes as well.
1201 if (is_main_frame) { 1193 if (is_main_frame) {
1202 render_view_->webview()->setVisibilityState( 1194 render_view_->webview()->setVisibilityState(
1203 blink::WebPageVisibilityStateHidden, false); 1195 blink::WebPageVisibilityStateHidden, false);
1204 } 1196 }
1205 } 1197 }
1206 1198
1207 // It is now safe to show modal dialogs again. 1199 // It is now safe to show modal dialogs again.
1208 // TODO(creis): Deal with modal dialogs from subframes. 1200 // TODO(creis): Deal with modal dialogs from subframes.
1209 if (is_main_frame) 1201 if (is_main_frame)
1210 render_view_->suppress_dialogs_until_swap_out_ = false; 1202 render_view_->suppress_dialogs_until_swap_out_ = false;
1211 1203
1212 Send(new FrameHostMsg_SwapOut_ACK(routing_id_)); 1204 Send(new FrameHostMsg_SwapOut_ACK(routing_id_));
1213 1205
1214 RenderViewImpl* render_view = render_view_.get(); 1206 RenderViewImpl* render_view = render_view_.get();
1215 1207
1216 // Now that all of the cleanup is complete and the browser side is notified, 1208 // Now that all of the cleanup is complete and the browser side is notified,
1217 // start using the RenderFrameProxy, if one is created. 1209 // start using the RenderFrameProxy, if one is created.
1218 if (proxy && IsSwappedOutStateForbidden()) { 1210 if (proxy && swapped_out_forbidden) {
1219 frame_->swap(proxy->web_frame()); 1211 frame_->swap(proxy->web_frame());
1220 1212
1221 if (is_loading) 1213 if (is_loading)
1222 proxy->OnDidStartLoading(); 1214 proxy->OnDidStartLoading();
1223 } 1215 }
1224 1216
1225 // In --site-per-process, initialize the WebRemoteFrame with the replication 1217 // In --site-per-process, initialize the WebRemoteFrame with the replication
1226 // state passed by the process that is now rendering the frame. 1218 // state passed by the process that is now rendering the frame.
1227 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because 1219 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because
1228 // in that case we leave the LocalFrame as the main frame visible to Blink 1220 // in that case we leave the LocalFrame as the main frame visible to Blink
1229 // and don't call swap() above. Because swap() is what creates a RemoteFrame 1221 // and don't call swap() above. Because swap() is what creates a RemoteFrame
1230 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. 1222 // in proxy->web_frame(), the RemoteFrame will not exist for main frames.
1231 // When we do an unconditional swap for all frames, we can remove 1223 // When we do an unconditional swap for all frames, we can remove
1232 // !is_main_frame below. 1224 // !is_main_frame below.
1233 if (proxy && IsSwappedOutStateForbidden()) 1225 if (proxy && swapped_out_forbidden)
1234 proxy->SetReplicatedState(replicated_frame_state); 1226 proxy->SetReplicatedState(replicated_frame_state);
1235 1227
1236 // Safe to exit if no one else is using the process. 1228 // Safe to exit if no one else is using the process.
1237 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count 1229 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count
1238 // the process based on the lifetime of this RenderFrameImpl object. 1230 // the process based on the lifetime of this RenderFrameImpl object.
1239 if (is_main_frame) { 1231 if (is_main_frame) {
1240 render_view->WasSwappedOut(); 1232 render_view->WasSwappedOut();
1241 } 1233 }
1242 } 1234 }
1243 1235
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 DCHECK(!frame_ || frame_ == frame); 2248 DCHECK(!frame_ || frame_ == frame);
2257 2249
2258 // TODO(alexmos): According to https://crbug.com/169110, sending window.name 2250 // TODO(alexmos): According to https://crbug.com/169110, sending window.name
2259 // updates may have performance implications for benchmarks like SunSpider. 2251 // updates may have performance implications for benchmarks like SunSpider.
2260 // For now, send these updates only for --site-per-process, which needs to 2252 // For now, send these updates only for --site-per-process, which needs to
2261 // replicate frame names to frame proxies, and when 2253 // replicate frame names to frame proxies, and when
2262 // |report_frame_name_changes| is set (used by <webview>). If needed, this 2254 // |report_frame_name_changes| is set (used by <webview>). If needed, this
2263 // can be optimized further by only sending the update if there are any 2255 // can be optimized further by only sending the update if there are any
2264 // remote frames in the frame tree, or delaying and batching up IPCs if 2256 // remote frames in the frame tree, or delaying and batching up IPCs if
2265 // updates are happening too frequently. 2257 // updates are happening too frequently.
2266 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( 2258 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() ||
2267 switches::kSitePerProcess);
2268 if (is_site_per_process ||
2269 render_view_->renderer_preferences_.report_frame_name_changes) { 2259 render_view_->renderer_preferences_.report_frame_name_changes) {
2270 Send(new FrameHostMsg_DidChangeName( 2260 Send(new FrameHostMsg_DidChangeName(
2271 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); 2261 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name))));
2272 } 2262 }
2273 } 2263 }
2274 2264
2275 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, 2265 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
2276 blink::WebSandboxFlags flags) { 2266 blink::WebSandboxFlags flags) {
2277 int frame_routing_id = MSG_ROUTING_NONE; 2267 int frame_routing_id = MSG_ROUTING_NONE;
2278 if (child_frame->isWebRemoteFrame()) { 2268 if (child_frame->isWebRemoteFrame()) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 // In fast/loader/stop-provisional-loads.html, we abort the load before this 2518 // In fast/loader/stop-provisional-loads.html, we abort the load before this
2529 // callback is invoked. 2519 // callback is invoked.
2530 if (!ds) 2520 if (!ds)
2531 return; 2521 return;
2532 2522
2533 TRACE_EVENT2("navigation", "RenderFrameImpl::didStartProvisionalLoad", 2523 TRACE_EVENT2("navigation", "RenderFrameImpl::didStartProvisionalLoad",
2534 "id", routing_id_, "url", ds->request().url().string().utf8()); 2524 "id", routing_id_, "url", ds->request().url().string().utf8());
2535 DocumentState* document_state = DocumentState::FromDataSource(ds); 2525 DocumentState* document_state = DocumentState::FromDataSource(ds);
2536 2526
2537 // We should only navigate to swappedout:// when is_swapped_out_ is true. 2527 // We should only navigate to swappedout:// when is_swapped_out_ is true.
2538 CHECK((ds->request().url() != GURL(kSwappedOutURL)) || 2528 CHECK_IMPLIES(ds->request().url() == GURL(kSwappedOutURL), is_swapped_out_)
2539 is_swapped_out_) << 2529 << "Heard swappedout:// when not swapped out.";
2540 "Heard swappedout:// when not swapped out.";
2541 2530
2542 // Update the request time if WebKit has better knowledge of it. 2531 // Update the request time if WebKit has better knowledge of it.
2543 if (document_state->request_time().is_null() && 2532 if (document_state->request_time().is_null() &&
2544 triggering_event_time != 0.0) { 2533 triggering_event_time != 0.0) {
2545 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); 2534 document_state->set_request_time(Time::FromDoubleT(triggering_event_time));
2546 } 2535 }
2547 2536
2548 // Start time is only set after request time. 2537 // Start time is only set after request time.
2549 document_state->set_start_load_time(Time::Now()); 2538 document_state->set_start_load_time(Time::Now());
2550 2539
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 3932
3944 params.searchable_form_url = internal_data->searchable_form_url(); 3933 params.searchable_form_url = internal_data->searchable_form_url();
3945 params.searchable_form_encoding = internal_data->searchable_form_encoding(); 3934 params.searchable_form_encoding = internal_data->searchable_form_encoding();
3946 3935
3947 params.gesture = render_view_->navigation_gesture_; 3936 params.gesture = render_view_->navigation_gesture_;
3948 render_view_->navigation_gesture_ = NavigationGestureUnknown; 3937 render_view_->navigation_gesture_ = NavigationGestureUnknown;
3949 3938
3950 // Make navigation state a part of the DidCommitProvisionalLoad message so 3939 // Make navigation state a part of the DidCommitProvisionalLoad message so
3951 // that committed entry has it at all times. 3940 // that committed entry has it at all times.
3952 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry(); 3941 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry();
3953 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 3942 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) {
3954 switches::kSitePerProcess)) {
3955 if (entry) 3943 if (entry)
3956 params.page_state = HistoryEntryToPageState(entry); 3944 params.page_state = HistoryEntryToPageState(entry);
3957 else 3945 else
3958 params.page_state = PageState::CreateFromURL(request.url()); 3946 params.page_state = PageState::CreateFromURL(request.url());
3959 } else { 3947 } else {
3960 // In --site-per-process, just send a single HistoryItem for this frame, 3948 // In --site-per-process, just send a single HistoryItem for this frame,
3961 // rather than the whole tree. It will be stored in the corresponding 3949 // rather than the whole tree. It will be stored in the corresponding
3962 // FrameNavigationEntry. 3950 // FrameNavigationEntry.
3963 params.page_state = SingleHistoryItemToPageState(item); 3951 params.page_state = SingleHistoryItemToPageState(item);
3964 } 3952 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 bool replace = is_reload || is_history_navigation || 4171 bool replace = is_reload || is_history_navigation ||
4184 common_params.url == GetLoadingUrl(); 4172 common_params.url == GetLoadingUrl();
4185 LoadNavigationErrorPage(failed_request, error, replace); 4173 LoadNavigationErrorPage(failed_request, error, replace);
4186 } 4174 }
4187 4175
4188 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( 4176 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
4189 RenderFrame* render_frame, 4177 RenderFrame* render_frame,
4190 const NavigationPolicyInfo& info) { 4178 const NavigationPolicyInfo& info) {
4191 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, 4179 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame,
4192 info.urlRequest)); 4180 info.urlRequest));
4193 const base::CommandLine& command_line =
4194 *base::CommandLine::ForCurrentProcess();
4195 4181
4196 if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe_) { 4182 // TODO(nick): Is consulting |is_subframe_| here correct?
4183 if (RenderFrameProxy::IsSwappedOutStateForbidden() && is_subframe_) {
4197 // There's no reason to ignore navigations on subframes, since the swap out 4184 // There's no reason to ignore navigations on subframes, since the swap out
4198 // logic no longer applies. 4185 // logic no longer applies.
4199 } else { 4186 } else {
4200 if (is_swapped_out_) { 4187 if (is_swapped_out_) {
4201 if (info.urlRequest.url() != GURL(kSwappedOutURL)) { 4188 if (info.urlRequest.url() != GURL(kSwappedOutURL)) {
4202 // Targeted links may try to navigate a swapped out frame. Allow the 4189 // Targeted links may try to navigate a swapped out frame. Allow the
4203 // browser process to navigate the tab instead. Note that it is also 4190 // browser process to navigate the tab instead. Note that it is also
4204 // possible for non-targeted navigations (from this view) to arrive 4191 // possible for non-targeted navigations (from this view) to arrive
4205 // here just after we are swapped out. It's ok to send them to the 4192 // here just after we are swapped out. It's ok to send them to the
4206 // browser, as long as they're for the top level frame. 4193 // browser, as long as they're for the top level frame.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
4493 scoped_ptr<HistoryEntry> entry = 4480 scoped_ptr<HistoryEntry> entry =
4494 PageStateToHistoryEntry(request_params.page_state); 4481 PageStateToHistoryEntry(request_params.page_state);
4495 if (entry) { 4482 if (entry) {
4496 // Ensure we didn't save the swapped out URL in UpdateState, since the 4483 // Ensure we didn't save the swapped out URL in UpdateState, since the
4497 // browser should never be telling us to navigate to swappedout://. 4484 // browser should never be telling us to navigate to swappedout://.
4498 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); 4485 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL));
4499 4486
4500 if (!browser_side_navigation) { 4487 if (!browser_side_navigation) {
4501 scoped_ptr<NavigationParams> navigation_params( 4488 scoped_ptr<NavigationParams> navigation_params(
4502 new NavigationParams(*pending_navigation_params_.get())); 4489 new NavigationParams(*pending_navigation_params_.get()));
4503 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 4490 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) {
4504 switches::kSitePerProcess)) {
4505 // By default, tell the HistoryController to go the deserialized 4491 // By default, tell the HistoryController to go the deserialized
4506 // HistoryEntry. This only works if all frames are in the same 4492 // HistoryEntry. This only works if all frames are in the same
4507 // process. 4493 // process.
4508 DCHECK(!frame_->parent()); 4494 DCHECK(!frame_->parent());
4509 render_view_->history_controller()->GoToEntry( 4495 render_view_->history_controller()->GoToEntry(
4510 frame_, entry.Pass(), navigation_params.Pass(), cache_policy); 4496 frame_, entry.Pass(), navigation_params.Pass(), cache_policy);
4511 } else { 4497 } else {
4512 // In --site-per-process, the browser process sends a single 4498 // In --site-per-process, the browser process sends a single
4513 // WebHistoryItem destined for this frame. 4499 // WebHistoryItem destined for this frame.
4514 // TODO(creis): Change PageState to FrameState. In the meantime, we 4500 // TODO(creis): Change PageState to FrameState. In the meantime, we
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
5065 void RenderFrameImpl::RegisterMojoServices() { 5051 void RenderFrameImpl::RegisterMojoServices() {
5066 // Only main frame have ImageDownloader service. 5052 // Only main frame have ImageDownloader service.
5067 if (!frame_->parent()) { 5053 if (!frame_->parent()) {
5068 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( 5054 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>(
5069 base::Bind(&ImageDownloaderImpl::CreateMojoService, 5055 base::Bind(&ImageDownloaderImpl::CreateMojoService,
5070 base::Unretained(this))); 5056 base::Unretained(this)));
5071 } 5057 }
5072 } 5058 }
5073 5059
5074 } // namespace content 5060 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698