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

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: Fix test failures for content:// URLs on Android Created 6 years 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 9ec55c99f716f96e8d502098bd13954c6f78bf90..db0706e870f36b68532bd73dd6cc008c3afa27bb 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"
@@ -1109,7 +1110,9 @@ void RenderFrameImpl::OnBeforeUnload() {
before_unload_end_time));
}
-void RenderFrameImpl::OnSwapOut(int proxy_routing_id) {
+void RenderFrameImpl::OnSwapOut(
+ int proxy_routing_id,
+ const FrameReplicationState& replicated_frame_state) {
TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
RenderFrameProxy* proxy = NULL;
bool is_site_per_process =
@@ -1194,6 +1197,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
+ // 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(replicated_frame_state);
+
// Safe to exit if no one else is using the process.
if (is_main_frame)
render_view_->WasSwappedOut();
@@ -3480,6 +3494,16 @@ 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.
+ // TODO(alexmos): Origins for URLs with non-standard schemes are excluded due
+ // to https://crbug.com/439608 and will be replicated as unique origins.
+ if (!is_swapped_out_) {
+ WebString serialized_origin(frame->document().securityOrigin().toString());
+ if (GURL(serialized_origin).IsStandard())
+ params.origin = url::Origin(serialized_origin.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