Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index 9dfdf6b0a1a9a383e1a3c5da5997b169842dba26..74d145340fab41a96509ba929db78097f2113707 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" |
@@ -556,6 +557,15 @@ void RenderFrameImpl::InstallCreateHook( |
g_create_render_frame_impl = create_render_frame_impl; |
} |
+ |
+// static |
+void RenderFrameImpl::SetReplicatedState(blink::WebRemoteFrame* frame, |
Charlie Reis
2014/11/19 00:46:18
On second thought, maybe this belongs as a non-sta
alexmos
2014/11/19 02:49:27
Done - indeed, that seems much better and the code
|
+ const FrameReplicationState& state) { |
+ CHECK(frame); |
Charlie Reis
2014/11/19 00:46:18
DCHECK is fine here. It clarifies the intent, and
alexmos
2014/11/19 02:49:27
Done.
|
+ frame->setReplicatedOrigin(blink::WebSecurityOrigin::createFromString( |
+ blink::WebString::fromUTF8(state.origin.string()))); |
+} |
+ |
// RenderFrameImpl ---------------------------------------------------------- |
RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) |
: frame_(NULL), |
@@ -1106,7 +1116,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 = |
@@ -1192,6 +1204,19 @@ 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 |
+ // 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) { |
+ RenderFrameImpl::SetReplicatedState(proxy->web_frame(), |
+ remote_frame_state); |
+ } |
+ |
// Safe to exit if no one else is using the process. |
if (is_main_frame) |
render_view_->WasSwappedOut(); |
@@ -3458,6 +3483,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 corresponding |
Charlie Reis
2014/11/19 00:46:18
nit: to the corresponding
alexmos
2014/11/19 02:49:27
Done.
|
+ // RenderFrameProxies in other processes. |
+ if (!is_swapped_out_) { |
+ params.origin = url::Origin( |
Charlie Reis
2014/11/19 00:46:18
nit: 2 space indent
alexmos
2014/11/19 02:49:27
Done.
|
+ frame->document().securityOrigin().toString().utf8()); |
Charlie Reis
2014/11/19 00:46:18
Just checking: is toString().utf8() the right way
alexmos
2014/11/19 02:49:27
I based this off of how WebSerializedOrigin is ini
Charlie Reis
2014/11/19 19:31:46
Acknowledged.
|
+ } |
+ |
if (frame->document().baseURL() != params.url) |
params.base_url = frame->document().baseURL(); |