| 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/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 Loading... |
| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 return media::Context3D(provider->ContextGL(), provider->GrContext()); | 505 return media::Context3D(provider->ContextGL(), provider->GrContext()); |
| 505 } | 506 } |
| 506 #endif | 507 #endif |
| 507 | 508 |
| 508 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) { | 509 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) { |
| 509 return navigation_type == FrameMsg_Navigate_Type::RELOAD || | 510 return navigation_type == FrameMsg_Navigate_Type::RELOAD || |
| 510 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || | 511 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
| 511 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; | 512 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 512 } | 513 } |
| 513 | 514 |
| 514 bool IsSwappedOutStateForbidden() { | |
| 515 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 516 switches::kSitePerProcess); | |
| 517 } | |
| 518 | |
| 519 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = | 515 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = |
| 520 nullptr; | 516 nullptr; |
| 521 | 517 |
| 522 } // namespace | 518 } // namespace |
| 523 | 519 |
| 524 // static | 520 // static |
| 525 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, | 521 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, |
| 526 int32 routing_id) { | 522 int32 routing_id) { |
| 527 DCHECK(routing_id != MSG_ROUTING_NONE); | 523 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 528 CreateParams params(render_view, routing_id); | 524 CreateParams params(render_view, routing_id); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 blink::WebLocalFrame::create(replicated_state.scope, render_frame); | 584 blink::WebLocalFrame::create(replicated_state.scope, render_frame); |
| 589 render_frame->proxy_routing_id_ = proxy_routing_id; | 585 render_frame->proxy_routing_id_ = proxy_routing_id; |
| 590 web_frame->initializeToReplaceRemoteFrame( | 586 web_frame->initializeToReplaceRemoteFrame( |
| 591 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), | 587 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), |
| 592 replicated_state.sandbox_flags); | 588 replicated_state.sandbox_flags); |
| 593 } | 589 } |
| 594 render_frame->SetWebFrame(web_frame); | 590 render_frame->SetWebFrame(web_frame); |
| 595 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); | 591 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); |
| 596 | 592 |
| 597 if (widget_params.routing_id != MSG_ROUTING_NONE) { | 593 if (widget_params.routing_id != MSG_ROUTING_NONE) { |
| 598 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 594 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
| 599 switches::kSitePerProcess)); | |
| 600 render_frame->render_widget_ = RenderWidget::CreateForFrame( | 595 render_frame->render_widget_ = RenderWidget::CreateForFrame( |
| 601 widget_params.routing_id, widget_params.surface_id, | 596 widget_params.routing_id, widget_params.surface_id, |
| 602 widget_params.hidden, render_frame->render_view_->screen_info(), | 597 widget_params.hidden, render_frame->render_view_->screen_info(), |
| 603 compositor_deps, web_frame); | 598 compositor_deps, web_frame); |
| 604 // TODO(kenrb): Observing shouldn't be necessary when we sort out | 599 // TODO(kenrb): Observing shouldn't be necessary when we sort out |
| 605 // WasShown and WasHidden, separating page-level visibility from | 600 // WasShown and WasHidden, separating page-level visibility from |
| 606 // frame-level visibility. | 601 // frame-level visibility. |
| 607 render_frame->render_widget_->RegisterRenderFrame(render_frame); | 602 render_frame->render_widget_->RegisterRenderFrame(render_frame); |
| 608 } | 603 } |
| 609 | 604 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); | 691 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); |
| 697 | 692 |
| 698 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_); | 693 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_); |
| 699 | 694 |
| 700 #if defined(VIDEO_HOLE) | 695 #if defined(VIDEO_HOLE) |
| 701 if (contains_media_player_) | 696 if (contains_media_player_) |
| 702 render_view_->UnregisterVideoHoleFrame(this); | 697 render_view_->UnregisterVideoHoleFrame(this); |
| 703 #endif | 698 #endif |
| 704 | 699 |
| 705 if (!is_subframe_) { | 700 if (!is_subframe_) { |
| 706 if (!IsSwappedOutStateForbidden()) { | 701 // When using swapped out frames, RenderFrameProxy is owned by |
| 707 // When using swapped out frames, RenderFrameProxy is "owned" by | 702 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted |
| 708 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted | 703 // along with this object. |
| 709 // along with this object. | 704 if (render_frame_proxy_ && |
| 710 if (render_frame_proxy_ && | 705 !RenderFrameProxy::IsSwappedOutStateForbidden()) { |
| 711 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 706 // The following method calls back into this object and clears |
| 712 switches::kSitePerProcess)) { | 707 // |render_frame_proxy_|. |
| 713 // The following method calls back into this object and clears | 708 render_frame_proxy_->frameDetached( |
| 714 // |render_frame_proxy_|. | 709 blink::WebRemoteFrameClient::DetachType::Remove); |
| 715 render_frame_proxy_->frameDetached( | |
| 716 blink::WebRemoteFrameClient::DetachType::Remove); | |
| 717 } | |
| 718 } | 710 } |
| 719 | 711 |
| 720 // Ensure the RenderView doesn't point to this object, once it is destroyed. | 712 // Ensure the RenderView doesn't point to this object, once it is destroyed. |
| 721 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_| | 713 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_| |
| 722 // is |this|, once the object is no longer leaked. | 714 // is |this|, once the object is no longer leaked. |
| 723 // See https://crbug.com/464764. | 715 // See https://crbug.com/464764. |
| 724 render_view_->main_render_frame_ = nullptr; | 716 render_view_->main_render_frame_ = nullptr; |
| 725 } | 717 } |
| 726 | 718 |
| 727 render_view_->UnregisterRenderFrame(this); | 719 render_view_->UnregisterRenderFrame(this); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 before_unload_start_time, | 1114 before_unload_start_time, |
| 1123 before_unload_end_time)); | 1115 before_unload_end_time)); |
| 1124 } | 1116 } |
| 1125 | 1117 |
| 1126 void RenderFrameImpl::OnSwapOut( | 1118 void RenderFrameImpl::OnSwapOut( |
| 1127 int proxy_routing_id, | 1119 int proxy_routing_id, |
| 1128 bool is_loading, | 1120 bool is_loading, |
| 1129 const FrameReplicationState& replicated_frame_state) { | 1121 const FrameReplicationState& replicated_frame_state) { |
| 1130 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); | 1122 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); |
| 1131 RenderFrameProxy* proxy = NULL; | 1123 RenderFrameProxy* proxy = NULL; |
| 1132 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | 1124 bool swapped_out_forbidden = RenderFrameProxy::IsSwappedOutStateForbidden(); |
| 1133 switches::kSitePerProcess); | |
| 1134 bool is_main_frame = !frame_->parent(); | 1125 bool is_main_frame = !frame_->parent(); |
| 1135 | 1126 |
| 1136 // This codepath should only be hit for subframes when in --site-per-process. | 1127 // This codepath should only be hit for subframes when in --site-per-process. |
| 1137 CHECK_IMPLIES(!is_main_frame, is_site_per_process); | 1128 CHECK_IMPLIES(!is_main_frame, |
| 1129 SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
| 1138 | 1130 |
| 1139 // Only run unload if we're not swapped out yet, but send the ack either way. | 1131 // Only run unload if we're not swapped out yet, but send the ack either way. |
| 1140 if (!is_swapped_out_) { | 1132 if (!is_swapped_out_) { |
| 1141 // Swap this RenderFrame out so the frame can navigate to a page rendered by | 1133 // Swap this RenderFrame out so the frame can navigate to a page rendered by |
| 1142 // a different process. This involves running the unload handler and | 1134 // a different process. This involves running the unload handler and |
| 1143 // clearing the page. We also allow this process to exit if there are no | 1135 // clearing the page. We also allow this process to exit if there are no |
| 1144 // other active RenderFrames in it. | 1136 // other active RenderFrames in it. |
| 1145 | 1137 |
| 1146 // Send an UpdateState message before we get swapped out. | 1138 // Send an UpdateState message before we get swapped out. |
| 1147 render_view_->SyncNavigationState(); | 1139 render_view_->SyncNavigationState(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1169 // willCheckAndDispatchMessageEvent() that needs the proxy. | 1161 // willCheckAndDispatchMessageEvent() that needs the proxy. |
| 1170 if (proxy) | 1162 if (proxy) |
| 1171 set_render_frame_proxy(proxy); | 1163 set_render_frame_proxy(proxy); |
| 1172 | 1164 |
| 1173 // Now that we're swapped out and filtering IPC messages, stop loading to | 1165 // Now that we're swapped out and filtering IPC messages, stop loading to |
| 1174 // ensure that no other in-progress navigation continues. We do this here | 1166 // ensure that no other in-progress navigation continues. We do this here |
| 1175 // to avoid sending a DidStopLoading message to the browser process. | 1167 // to avoid sending a DidStopLoading message to the browser process. |
| 1176 // TODO(creis): Should we be stopping all frames here and using | 1168 // TODO(creis): Should we be stopping all frames here and using |
| 1177 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this | 1169 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this |
| 1178 // frame? | 1170 // frame? |
| 1179 if (!IsSwappedOutStateForbidden()) | 1171 if (!swapped_out_forbidden) |
| 1180 OnStop(); | 1172 OnStop(); |
| 1181 | 1173 |
| 1182 // Transfer settings such as initial drawing parameters to the remote frame, | 1174 // Transfer settings such as initial drawing parameters to the remote frame, |
| 1183 // if one is created, that will replace this frame. | 1175 // if one is created, that will replace this frame. |
| 1184 if (!is_main_frame && proxy) | 1176 if (!is_main_frame && proxy) |
| 1185 proxy->web_frame()->initializeFromFrame(frame_); | 1177 proxy->web_frame()->initializeFromFrame(frame_); |
| 1186 | 1178 |
| 1187 // Replace the page with a blank dummy URL. The unload handler will not be | 1179 // Replace the page with a blank dummy URL. The unload handler will not be |
| 1188 // run a second time, thanks to a check in FrameLoader::stopLoading. | 1180 // run a second time, thanks to a check in FrameLoader::stopLoading. |
| 1189 // TODO(creis): Need to add a better way to do this that avoids running the | 1181 // TODO(creis): Need to add a better way to do this that avoids running the |
| 1190 // beforeunload handler. For now, we just run it a second time silently. | 1182 // beforeunload handler. For now, we just run it a second time silently. |
| 1191 if (!IsSwappedOutStateForbidden()) | 1183 if (!swapped_out_forbidden) |
| 1192 NavigateToSwappedOutURL(); | 1184 NavigateToSwappedOutURL(); |
| 1193 | 1185 |
| 1194 // Let WebKit know that this view is hidden so it can drop resources and | 1186 // Let WebKit know that this view is hidden so it can drop resources and |
| 1195 // stop compositing. | 1187 // stop compositing. |
| 1196 // TODO(creis): Support this for subframes as well. | 1188 // TODO(creis): Support this for subframes as well. |
| 1197 if (is_main_frame) { | 1189 if (is_main_frame) { |
| 1198 render_view_->webview()->setVisibilityState( | 1190 render_view_->webview()->setVisibilityState( |
| 1199 blink::WebPageVisibilityStateHidden, false); | 1191 blink::WebPageVisibilityStateHidden, false); |
| 1200 } | 1192 } |
| 1201 } | 1193 } |
| 1202 | 1194 |
| 1203 // It is now safe to show modal dialogs again. | 1195 // It is now safe to show modal dialogs again. |
| 1204 // TODO(creis): Deal with modal dialogs from subframes. | 1196 // TODO(creis): Deal with modal dialogs from subframes. |
| 1205 if (is_main_frame) | 1197 if (is_main_frame) |
| 1206 render_view_->suppress_dialogs_until_swap_out_ = false; | 1198 render_view_->suppress_dialogs_until_swap_out_ = false; |
| 1207 | 1199 |
| 1208 Send(new FrameHostMsg_SwapOut_ACK(routing_id_)); | 1200 Send(new FrameHostMsg_SwapOut_ACK(routing_id_)); |
| 1209 | 1201 |
| 1210 RenderViewImpl* render_view = render_view_.get(); | 1202 RenderViewImpl* render_view = render_view_.get(); |
| 1211 | 1203 |
| 1212 // Now that all of the cleanup is complete and the browser side is notified, | 1204 // Now that all of the cleanup is complete and the browser side is notified, |
| 1213 // start using the RenderFrameProxy, if one is created. | 1205 // start using the RenderFrameProxy, if one is created. |
| 1214 if (proxy && IsSwappedOutStateForbidden()) { | 1206 if (proxy && swapped_out_forbidden) { |
| 1215 frame_->swap(proxy->web_frame()); | 1207 frame_->swap(proxy->web_frame()); |
| 1216 | 1208 |
| 1217 if (is_loading) | 1209 if (is_loading) |
| 1218 proxy->OnDidStartLoading(); | 1210 proxy->OnDidStartLoading(); |
| 1219 } | 1211 } |
| 1220 | 1212 |
| 1221 // In --site-per-process, initialize the WebRemoteFrame with the replication | 1213 // In --site-per-process, initialize the WebRemoteFrame with the replication |
| 1222 // state passed by the process that is now rendering the frame. | 1214 // state passed by the process that is now rendering the frame. |
| 1223 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because | 1215 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because |
| 1224 // in that case we leave the LocalFrame as the main frame visible to Blink | 1216 // in that case we leave the LocalFrame as the main frame visible to Blink |
| 1225 // and don't call swap() above. Because swap() is what creates a RemoteFrame | 1217 // and don't call swap() above. Because swap() is what creates a RemoteFrame |
| 1226 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. | 1218 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. |
| 1227 // When we do an unconditional swap for all frames, we can remove | 1219 // When we do an unconditional swap for all frames, we can remove |
| 1228 // !is_main_frame below. | 1220 // !is_main_frame below. |
| 1229 if (proxy && IsSwappedOutStateForbidden()) | 1221 if (proxy && swapped_out_forbidden) |
| 1230 proxy->SetReplicatedState(replicated_frame_state); | 1222 proxy->SetReplicatedState(replicated_frame_state); |
| 1231 | 1223 |
| 1232 // Safe to exit if no one else is using the process. | 1224 // Safe to exit if no one else is using the process. |
| 1233 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count | 1225 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count |
| 1234 // the process based on the lifetime of this RenderFrameImpl object. | 1226 // the process based on the lifetime of this RenderFrameImpl object. |
| 1235 if (is_main_frame) { | 1227 if (is_main_frame) { |
| 1236 render_view->WasSwappedOut(); | 1228 render_view->WasSwappedOut(); |
| 1237 } | 1229 } |
| 1238 } | 1230 } |
| 1239 | 1231 |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 DCHECK(!frame_ || frame_ == frame); | 2242 DCHECK(!frame_ || frame_ == frame); |
| 2251 | 2243 |
| 2252 // TODO(alexmos): According to https://crbug.com/169110, sending window.name | 2244 // TODO(alexmos): According to https://crbug.com/169110, sending window.name |
| 2253 // updates may have performance implications for benchmarks like SunSpider. | 2245 // updates may have performance implications for benchmarks like SunSpider. |
| 2254 // For now, send these updates only for --site-per-process, which needs to | 2246 // For now, send these updates only for --site-per-process, which needs to |
| 2255 // replicate frame names to frame proxies, and when | 2247 // replicate frame names to frame proxies, and when |
| 2256 // |report_frame_name_changes| is set (used by <webview>). If needed, this | 2248 // |report_frame_name_changes| is set (used by <webview>). If needed, this |
| 2257 // can be optimized further by only sending the update if there are any | 2249 // can be optimized further by only sending the update if there are any |
| 2258 // remote frames in the frame tree, or delaying and batching up IPCs if | 2250 // remote frames in the frame tree, or delaying and batching up IPCs if |
| 2259 // updates are happening too frequently. | 2251 // updates are happening too frequently. |
| 2260 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | 2252 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() || |
| 2261 switches::kSitePerProcess); | |
| 2262 if (is_site_per_process || | |
| 2263 render_view_->renderer_preferences_.report_frame_name_changes) { | 2253 render_view_->renderer_preferences_.report_frame_name_changes) { |
| 2264 Send(new FrameHostMsg_DidChangeName(routing_id_, base::UTF16ToUTF8(name))); | 2254 Send(new FrameHostMsg_DidChangeName(routing_id_, base::UTF16ToUTF8(name))); |
| 2265 } | 2255 } |
| 2266 } | 2256 } |
| 2267 | 2257 |
| 2268 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, | 2258 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, |
| 2269 blink::WebSandboxFlags flags) { | 2259 blink::WebSandboxFlags flags) { |
| 2270 int frame_routing_id = MSG_ROUTING_NONE; | 2260 int frame_routing_id = MSG_ROUTING_NONE; |
| 2271 if (child_frame->isWebRemoteFrame()) { | 2261 if (child_frame->isWebRemoteFrame()) { |
| 2272 frame_routing_id = | 2262 frame_routing_id = |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 // In fast/loader/stop-provisional-loads.html, we abort the load before this | 2511 // In fast/loader/stop-provisional-loads.html, we abort the load before this |
| 2522 // callback is invoked. | 2512 // callback is invoked. |
| 2523 if (!ds) | 2513 if (!ds) |
| 2524 return; | 2514 return; |
| 2525 | 2515 |
| 2526 TRACE_EVENT2("navigation", "RenderFrameImpl::didStartProvisionalLoad", | 2516 TRACE_EVENT2("navigation", "RenderFrameImpl::didStartProvisionalLoad", |
| 2527 "id", routing_id_, "url", ds->request().url().string().utf8()); | 2517 "id", routing_id_, "url", ds->request().url().string().utf8()); |
| 2528 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2518 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2529 | 2519 |
| 2530 // We should only navigate to swappedout:// when is_swapped_out_ is true. | 2520 // We should only navigate to swappedout:// when is_swapped_out_ is true. |
| 2531 CHECK((ds->request().url() != GURL(kSwappedOutURL)) || | 2521 CHECK_IMPLIES(ds->request().url() == GURL(kSwappedOutURL), is_swapped_out_) |
| 2532 is_swapped_out_) << | 2522 << "Heard swappedout:// when not swapped out."; |
| 2533 "Heard swappedout:// when not swapped out."; | |
| 2534 | 2523 |
| 2535 // Update the request time if WebKit has better knowledge of it. | 2524 // Update the request time if WebKit has better knowledge of it. |
| 2536 if (document_state->request_time().is_null() && | 2525 if (document_state->request_time().is_null() && |
| 2537 triggering_event_time != 0.0) { | 2526 triggering_event_time != 0.0) { |
| 2538 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 2527 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); |
| 2539 } | 2528 } |
| 2540 | 2529 |
| 2541 // Start time is only set after request time. | 2530 // Start time is only set after request time. |
| 2542 document_state->set_start_load_time(Time::Now()); | 2531 document_state->set_start_load_time(Time::Now()); |
| 2543 | 2532 |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3935 | 3924 |
| 3936 params.searchable_form_url = internal_data->searchable_form_url(); | 3925 params.searchable_form_url = internal_data->searchable_form_url(); |
| 3937 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | 3926 params.searchable_form_encoding = internal_data->searchable_form_encoding(); |
| 3938 | 3927 |
| 3939 params.gesture = render_view_->navigation_gesture_; | 3928 params.gesture = render_view_->navigation_gesture_; |
| 3940 render_view_->navigation_gesture_ = NavigationGestureUnknown; | 3929 render_view_->navigation_gesture_ = NavigationGestureUnknown; |
| 3941 | 3930 |
| 3942 // Make navigation state a part of the DidCommitProvisionalLoad message so | 3931 // Make navigation state a part of the DidCommitProvisionalLoad message so |
| 3943 // that committed entry has it at all times. | 3932 // that committed entry has it at all times. |
| 3944 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry(); | 3933 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry(); |
| 3945 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 3934 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 3946 switches::kSitePerProcess)) { | |
| 3947 if (entry) | 3935 if (entry) |
| 3948 params.page_state = HistoryEntryToPageState(entry); | 3936 params.page_state = HistoryEntryToPageState(entry); |
| 3949 else | 3937 else |
| 3950 params.page_state = PageState::CreateFromURL(request.url()); | 3938 params.page_state = PageState::CreateFromURL(request.url()); |
| 3951 } else { | 3939 } else { |
| 3952 // In --site-per-process, just send a single HistoryItem for this frame, | 3940 // In --site-per-process, just send a single HistoryItem for this frame, |
| 3953 // rather than the whole tree. It will be stored in the corresponding | 3941 // rather than the whole tree. It will be stored in the corresponding |
| 3954 // FrameNavigationEntry. | 3942 // FrameNavigationEntry. |
| 3955 params.page_state = SingleHistoryItemToPageState(item); | 3943 params.page_state = SingleHistoryItemToPageState(item); |
| 3956 } | 3944 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4175 bool replace = is_reload || is_history_navigation || | 4163 bool replace = is_reload || is_history_navigation || |
| 4176 common_params.url == GetLoadingUrl(); | 4164 common_params.url == GetLoadingUrl(); |
| 4177 LoadNavigationErrorPage(failed_request, error, replace); | 4165 LoadNavigationErrorPage(failed_request, error, replace); |
| 4178 } | 4166 } |
| 4179 | 4167 |
| 4180 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 4168 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
| 4181 RenderFrame* render_frame, | 4169 RenderFrame* render_frame, |
| 4182 const NavigationPolicyInfo& info) { | 4170 const NavigationPolicyInfo& info) { |
| 4183 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, | 4171 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, |
| 4184 info.urlRequest)); | 4172 info.urlRequest)); |
| 4185 const base::CommandLine& command_line = | |
| 4186 *base::CommandLine::ForCurrentProcess(); | |
| 4187 | 4173 |
| 4188 if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe_) { | 4174 // TODO(nick): Is consulting |is_subframe_| here correct? |
| 4175 if (RenderFrameProxy::IsSwappedOutStateForbidden() && is_subframe_) { |
| 4189 // There's no reason to ignore navigations on subframes, since the swap out | 4176 // There's no reason to ignore navigations on subframes, since the swap out |
| 4190 // logic no longer applies. | 4177 // logic no longer applies. |
| 4191 } else { | 4178 } else { |
| 4192 if (is_swapped_out_) { | 4179 if (is_swapped_out_) { |
| 4193 if (info.urlRequest.url() != GURL(kSwappedOutURL)) { | 4180 if (info.urlRequest.url() != GURL(kSwappedOutURL)) { |
| 4194 // Targeted links may try to navigate a swapped out frame. Allow the | 4181 // Targeted links may try to navigate a swapped out frame. Allow the |
| 4195 // browser process to navigate the tab instead. Note that it is also | 4182 // browser process to navigate the tab instead. Note that it is also |
| 4196 // possible for non-targeted navigations (from this view) to arrive | 4183 // possible for non-targeted navigations (from this view) to arrive |
| 4197 // here just after we are swapped out. It's ok to send them to the | 4184 // here just after we are swapped out. It's ok to send them to the |
| 4198 // browser, as long as they're for the top level frame. | 4185 // browser, as long as they're for the top level frame. |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4484 scoped_ptr<HistoryEntry> entry = | 4471 scoped_ptr<HistoryEntry> entry = |
| 4485 PageStateToHistoryEntry(request_params.page_state); | 4472 PageStateToHistoryEntry(request_params.page_state); |
| 4486 if (entry) { | 4473 if (entry) { |
| 4487 // Ensure we didn't save the swapped out URL in UpdateState, since the | 4474 // Ensure we didn't save the swapped out URL in UpdateState, since the |
| 4488 // browser should never be telling us to navigate to swappedout://. | 4475 // browser should never be telling us to navigate to swappedout://. |
| 4489 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); | 4476 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
| 4490 | 4477 |
| 4491 if (!browser_side_navigation) { | 4478 if (!browser_side_navigation) { |
| 4492 scoped_ptr<NavigationParams> navigation_params( | 4479 scoped_ptr<NavigationParams> navigation_params( |
| 4493 new NavigationParams(*pending_navigation_params_.get())); | 4480 new NavigationParams(*pending_navigation_params_.get())); |
| 4494 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 4481 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 4495 switches::kSitePerProcess)) { | |
| 4496 // By default, tell the HistoryController to go the deserialized | 4482 // By default, tell the HistoryController to go the deserialized |
| 4497 // HistoryEntry. This only works if all frames are in the same | 4483 // HistoryEntry. This only works if all frames are in the same |
| 4498 // process. | 4484 // process. |
| 4499 DCHECK(!frame_->parent()); | 4485 DCHECK(!frame_->parent()); |
| 4500 render_view_->history_controller()->GoToEntry( | 4486 render_view_->history_controller()->GoToEntry( |
| 4501 frame_, entry.Pass(), navigation_params.Pass(), cache_policy); | 4487 frame_, entry.Pass(), navigation_params.Pass(), cache_policy); |
| 4502 } else { | 4488 } else { |
| 4503 // In --site-per-process, the browser process sends a single | 4489 // In --site-per-process, the browser process sends a single |
| 4504 // WebHistoryItem destined for this frame. | 4490 // WebHistoryItem destined for this frame. |
| 4505 // TODO(creis): Change PageState to FrameState. In the meantime, we | 4491 // TODO(creis): Change PageState to FrameState. In the meantime, we |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5034 void RenderFrameImpl::RegisterMojoServices() { | 5020 void RenderFrameImpl::RegisterMojoServices() { |
| 5035 // Only main frame have ImageDownloader service. | 5021 // Only main frame have ImageDownloader service. |
| 5036 if (!frame_->parent()) { | 5022 if (!frame_->parent()) { |
| 5037 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( | 5023 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( |
| 5038 base::Bind(&ImageDownloaderImpl::CreateMojoService, | 5024 base::Bind(&ImageDownloaderImpl::CreateMojoService, |
| 5039 base::Unretained(this))); | 5025 base::Unretained(this))); |
| 5040 } | 5026 } |
| 5041 } | 5027 } |
| 5042 | 5028 |
| 5043 } // namespace content | 5029 } // namespace content |
| OLD | NEW |