Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 8a5a5f8e95ac81e499194f4d38ad652f41a7aab0..1ec62e9beac0c657ea147cdebf5847712b8dd882 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -34,6 +34,7 @@ |
| #include "content/child/weburlresponse_extradata_impl.h" |
| #include "content/common/clipboard_messages.h" |
| #include "content/common/frame_messages.h" |
| +#include "content/common/frame_replication_state.h" |
| #include "content/common/input_messages.h" |
| #include "content/common/service_worker/service_worker_types.h" |
| #include "content/common/swapped_out_messages.h" |
| @@ -1122,7 +1123,9 @@ void RenderFrameImpl::OnBeforeUnload() { |
| before_unload_end_time)); |
| } |
| -void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { |
| +void RenderFrameImpl::OnSwapOut( |
| + int proxy_routing_id, |
| + const FrameReplicationState& remote_frame_state) { |
| TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); |
| RenderFrameProxy* proxy = NULL; |
| bool is_site_per_process = |
| @@ -1208,6 +1211,17 @@ void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { |
| } |
| } |
| + // In --site-per-process, initialize the WebRemoteFrame with the replication |
| + // state passed by the process that is now rendering the frame. |
| + // TODO(alexmos): We cannot yet do this for swapped-out main frames, because |
| + // in that case we leave the LocalFrame as the main frame visible to Blink |
| + // and don't call swap() above. Because swap() is what creates a RemoteFrame |
|
nasko
2014/11/20 17:22:54
nit: The comment is not quite correct, as the Remo
alexmos
2014/11/20 21:09:10
I thought the proxy creation only creates the WebR
nasko
2014/11/20 21:21:21
Yes, you are correct. I was thinking of frames at
|
| + // in proxy->web_frame(), the RemoteFrame will not exist for main frames. |
| + // When we do an unconditional swap for all frames, we can remove |
| + // !is_main_frame below. |
| + if (is_site_per_process && proxy && !is_main_frame) |
| + proxy->SetReplicatedState(remote_frame_state); |
| + |
| // Safe to exit if no one else is using the process. |
| if (is_main_frame) |
| render_view_->WasSwappedOut(); |
| @@ -3485,6 +3499,13 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(blink::WebFrame* frame) { |
| params.url = GetLoadingUrl(); |
| DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); |
| + // Set the origin of the frame. This will be replicated to the corresponding |
| + // RenderFrameProxies in other processes. |
| + if (!is_swapped_out_) { |
| + params.origin = |
| + url::Origin(frame->document().securityOrigin().toString().utf8()); |
| + } |
| + |
| if (frame->document().baseURL() != params.url) |
| params.base_url = frame->document().baseURL(); |