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 // initialize remote frame with the security origin that was passed to us | |
Charlie Reis
2014/11/13 18:00:58
nit: Initialize the RemoteFrame with the replicati
alexmos
2014/11/18 18:25:33
Done. Actually, rephrased a bit and used "WebRemo
| |
1199 // from the process that is now rendering the frame. | |
1200 // TODO(alexmos): we cannot yet do this for swapped-out main frames, | |
Charlie Reis
2014/11/13 18:00:58
nit: We
This TODO is what Nasko is currently work
alexmos
2014/11/18 18:25:33
Done.
| |
1201 // because in that case we leave the LocalFrame as the main frame visible to | |
1202 // Blink and don't call swap() above. Because swap() is what creates a | |
1203 // RemoteFrame in proxy->web_frame(), the RemoteFrame will not exist for main | |
1204 // frames. 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) { | |
1207 proxy->web_frame()->setReplicatedOrigin( | |
1208 blink::WebURL(GURL(remote_frame_state.origin.string())), | |
1209 remote_frame_state.is_unique_origin); | |
1210 } | |
1211 | |
1195 // Safe to exit if no one else is using the process. | 1212 // Safe to exit if no one else is using the process. |
1196 if (is_main_frame) | 1213 if (is_main_frame) |
1197 render_view_->WasSwappedOut(); | 1214 render_view_->WasSwappedOut(); |
1198 } | 1215 } |
1199 | 1216 |
1200 void RenderFrameImpl::OnContextMenuClosed( | 1217 void RenderFrameImpl::OnContextMenuClosed( |
1201 const CustomContextMenuContext& custom_context) { | 1218 const CustomContextMenuContext& custom_context) { |
1202 if (custom_context.request_id) { | 1219 if (custom_context.request_id) { |
1203 // External request, should be in our map. | 1220 // External request, should be in our map. |
1204 ContextMenuClient* client = | 1221 ContextMenuClient* client = |
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4198 | 4215 |
4199 #if defined(ENABLE_BROWSER_CDMS) | 4216 #if defined(ENABLE_BROWSER_CDMS) |
4200 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4217 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
4201 if (!cdm_manager_) | 4218 if (!cdm_manager_) |
4202 cdm_manager_ = new RendererCdmManager(this); | 4219 cdm_manager_ = new RendererCdmManager(this); |
4203 return cdm_manager_; | 4220 return cdm_manager_; |
4204 } | 4221 } |
4205 #endif // defined(ENABLE_BROWSER_CDMS) | 4222 #endif // defined(ENABLE_BROWSER_CDMS) |
4206 | 4223 |
4207 } // namespace content | 4224 } // namespace content |
OLD | NEW |