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 16 matching lines...) Expand all Loading... | |
27 #include "content/child/service_worker/service_worker_network_provider.h" | 27 #include "content/child/service_worker/service_worker_network_provider.h" |
28 #include "content/child/service_worker/service_worker_provider_context.h" | 28 #include "content/child/service_worker/service_worker_provider_context.h" |
29 #include "content/child/service_worker/web_service_worker_provider_impl.h" | 29 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
30 #include "content/child/web_url_loader_impl.h" | 30 #include "content/child/web_url_loader_impl.h" |
31 #include "content/child/web_url_request_util.h" | 31 #include "content/child/web_url_request_util.h" |
32 #include "content/child/webmessageportchannel_impl.h" | 32 #include "content/child/webmessageportchannel_impl.h" |
33 #include "content/child/websocket_bridge.h" | 33 #include "content/child/websocket_bridge.h" |
34 #include "content/child/weburlresponse_extradata_impl.h" | 34 #include "content/child/weburlresponse_extradata_impl.h" |
35 #include "content/common/clipboard_messages.h" | 35 #include "content/common/clipboard_messages.h" |
36 #include "content/common/frame_messages.h" | 36 #include "content/common/frame_messages.h" |
37 #include "content/common/frame_replication_state.h" | |
37 #include "content/common/input_messages.h" | 38 #include "content/common/input_messages.h" |
38 #include "content/common/service_worker/service_worker_types.h" | 39 #include "content/common/service_worker/service_worker_types.h" |
39 #include "content/common/swapped_out_messages.h" | 40 #include "content/common/swapped_out_messages.h" |
40 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
41 #include "content/public/common/bindings_policy.h" | 42 #include "content/public/common/bindings_policy.h" |
42 #include "content/public/common/content_constants.h" | 43 #include "content/public/common/content_constants.h" |
43 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
44 #include "content/public/common/context_menu_params.h" | 45 #include "content/public/common/context_menu_params.h" |
45 #include "content/public/common/page_state.h" | 46 #include "content/public/common/page_state.h" |
46 #include "content/public/common/resource_response.h" | 47 #include "content/public/common/resource_response.h" |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1099 CHECK(!frame_->parent()); | 1100 CHECK(!frame_->parent()); |
1100 | 1101 |
1101 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); | 1102 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); |
1102 bool proceed = frame_->dispatchBeforeUnloadEvent(); | 1103 bool proceed = frame_->dispatchBeforeUnloadEvent(); |
1103 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); | 1104 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); |
1104 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, | 1105 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, |
1105 before_unload_start_time, | 1106 before_unload_start_time, |
1106 before_unload_end_time)); | 1107 before_unload_end_time)); |
1107 } | 1108 } |
1108 | 1109 |
1109 void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { | 1110 void RenderFrameImpl::OnSwapOut( |
1111 int proxy_routing_id, | |
1112 const FrameReplicationState& remote_frame_state) { | |
1110 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); | 1113 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); |
1111 RenderFrameProxy* proxy = NULL; | 1114 RenderFrameProxy* proxy = NULL; |
1112 bool is_site_per_process = | 1115 bool is_site_per_process = |
1113 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess); | 1116 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess); |
1114 bool is_main_frame = !frame_->parent(); | 1117 bool is_main_frame = !frame_->parent(); |
1115 | 1118 |
1116 // Only run unload if we're not swapped out yet, but send the ack either way. | 1119 // Only run unload if we're not swapped out yet, but send the ack either way. |
1117 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { | 1120 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { |
1118 // Swap this RenderFrame out so the frame can navigate to a page rendered by | 1121 // Swap this RenderFrame out so the frame can navigate to a page rendered by |
1119 // a different process. This involves running the unload handler and | 1122 // a different process. This involves running the unload handler and |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1185 frame_->swap(proxy->web_frame()); | 1188 frame_->swap(proxy->web_frame()); |
1186 if (is_site_per_process) { | 1189 if (is_site_per_process) { |
1187 // TODO(nasko): delete the frame here, since we've replaced it with a | 1190 // TODO(nasko): delete the frame here, since we've replaced it with a |
1188 // proxy. | 1191 // proxy. |
1189 } | 1192 } |
1190 } else { | 1193 } else { |
1191 set_render_frame_proxy(proxy); | 1194 set_render_frame_proxy(proxy); |
1192 } | 1195 } |
1193 } | 1196 } |
1194 | 1197 |
1198 // In --site-per-process, initialize the WebRemoteFrame with the replication | |
1199 // state passed by the process that is now rendering the frame. | |
1200 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because | |
1201 // in that case we leave the LocalFrame as the main frame visible to Blink | |
1202 // and don't call swap() above. Because swap() is what creates a RemoteFrame | |
1203 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. | |
1204 // When we do an unconditional swap for all frames, we can remove | |
1205 // !is_main_frame below. | |
1206 if (is_site_per_process && proxy && !is_main_frame) { | |
Charlie Reis
2014/11/19 19:31:46
nit: No braces needed anymore.
alexmos
2014/11/20 00:29:28
Done.
| |
1207 proxy->SetReplicatedState(remote_frame_state); | |
1208 } | |
1209 | |
1195 // Safe to exit if no one else is using the process. | 1210 // Safe to exit if no one else is using the process. |
1196 if (is_main_frame) | 1211 if (is_main_frame) |
1197 render_view_->WasSwappedOut(); | 1212 render_view_->WasSwappedOut(); |
1198 } | 1213 } |
1199 | 1214 |
1200 void RenderFrameImpl::OnContextMenuClosed( | 1215 void RenderFrameImpl::OnContextMenuClosed( |
1201 const CustomContextMenuContext& custom_context) { | 1216 const CustomContextMenuContext& custom_context) { |
1202 if (custom_context.request_id) { | 1217 if (custom_context.request_id) { |
1203 // External request, should be in our map. | 1218 // External request, should be in our map. |
1204 ContextMenuClient* client = | 1219 ContextMenuClient* client = |
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3451 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response); | 3466 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response); |
3452 if (extra_data) | 3467 if (extra_data) |
3453 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); | 3468 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); |
3454 params.was_within_same_page = navigation_state->was_within_same_page(); | 3469 params.was_within_same_page = navigation_state->was_within_same_page(); |
3455 params.security_info = response.securityInfo(); | 3470 params.security_info = response.securityInfo(); |
3456 | 3471 |
3457 // Set the URL to be displayed in the browser UI to the user. | 3472 // Set the URL to be displayed in the browser UI to the user. |
3458 params.url = GetLoadingUrl(); | 3473 params.url = GetLoadingUrl(); |
3459 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); | 3474 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); |
3460 | 3475 |
3476 // Set the origin of the frame. This will be replicated to the corresponding | |
3477 // RenderFrameProxies in other processes. | |
3478 if (!is_swapped_out_) { | |
3479 params.origin = | |
3480 url::Origin(frame->document().securityOrigin().toString().utf8()); | |
3481 } | |
3482 | |
3461 if (frame->document().baseURL() != params.url) | 3483 if (frame->document().baseURL() != params.url) |
3462 params.base_url = frame->document().baseURL(); | 3484 params.base_url = frame->document().baseURL(); |
3463 | 3485 |
3464 GetRedirectChain(ds, ¶ms.redirects); | 3486 GetRedirectChain(ds, ¶ms.redirects); |
3465 params.should_update_history = !ds->hasUnreachableURL() && | 3487 params.should_update_history = !ds->hasUnreachableURL() && |
3466 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | 3488 !response.isMultipartPayload() && (response.httpStatusCode() != 404); |
3467 | 3489 |
3468 params.searchable_form_url = internal_data->searchable_form_url(); | 3490 params.searchable_form_url = internal_data->searchable_form_url(); |
3469 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | 3491 params.searchable_form_encoding = internal_data->searchable_form_encoding(); |
3470 | 3492 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4198 | 4220 |
4199 #if defined(ENABLE_BROWSER_CDMS) | 4221 #if defined(ENABLE_BROWSER_CDMS) |
4200 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4222 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
4201 if (!cdm_manager_) | 4223 if (!cdm_manager_) |
4202 cdm_manager_ = new RendererCdmManager(this); | 4224 cdm_manager_ = new RendererCdmManager(this); |
4203 return cdm_manager_; | 4225 return cdm_manager_; |
4204 } | 4226 } |
4205 #endif // defined(ENABLE_BROWSER_CDMS) | 4227 #endif // defined(ENABLE_BROWSER_CDMS) |
4206 | 4228 |
4207 } // namespace content | 4229 } // namespace content |
OLD | NEW |