Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2705)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 692973005: Pass origin information for remote frame creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Second round of feedback Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d1a8dfaa83974207441b11384a75eee849855b6c 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"
@@ -1106,7 +1107,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 +1195,18 @@ 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) {
Charlie Reis 2014/11/19 19:31:46 nit: No braces needed anymore.
alexmos 2014/11/20 00:29:28 Done.
+ proxy->SetReplicatedState(remote_frame_state);
+ }
+
// Safe to exit if no one else is using the process.
if (is_main_frame)
render_view_->WasSwappedOut();
@@ -3458,6 +3473,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();
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698