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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2723083002: RenderFrameImpl: avoid creating many temporary WebDocuments. (Closed)
Patch Set: Created 3 years, 10 months 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 | « no previous file | no next file » | 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 4af9b671725620814b3f5d10384a881f4c68d83a..e96150cfd67cce99dfaea50ea8e7595d2babd6e4 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4195,9 +4195,10 @@ void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame,
// TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to
// initialize itself with a `nullptr` initiator so that this can be a simple
// `isNull()` check. https://crbug.com/625969
+ WebDocument frame_document = frame->document();
if (request.requestorOrigin().isUnique() &&
- !frame->document().getSecurityOrigin().isUnique()) {
- request.setRequestorOrigin(frame->document().getSecurityOrigin());
+ !frame_document.getSecurityOrigin().isUnique()) {
+ request.setRequestorOrigin(frame_document.getSecurityOrigin());
}
WebDataSource* provisional_data_source = frame->provisionalDataSource();
@@ -4310,7 +4311,7 @@ void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame,
extra_data->set_render_frame_id(routing_id_);
extra_data->set_is_main_frame(!parent);
extra_data->set_frame_origin(
- url::Origin(frame->document().getSecurityOrigin()));
+ url::Origin(frame_document.getSecurityOrigin()));
extra_data->set_parent_is_main_frame(parent && !parent->parent());
extra_data->set_parent_render_frame_id(parent_routing_id);
extra_data->set_allow_download(
@@ -4326,7 +4327,7 @@ void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame,
is_prefetch &&
WebURLRequestToResourceType(request) != RESOURCE_TYPE_MAIN_FRAME);
extra_data->set_initiated_in_secure_context(
- frame->document().isSecureContext());
+ frame_document.isSecureContext());
// Renderer process transfers apply only to navigational requests.
bool is_navigational_request =
@@ -4848,20 +4849,21 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
params.socket_address.set_port(response.remotePort());
params.was_within_same_page = navigation_state->WasWithinSamePage();
+ WebDocument frame_document = frame->document();
// Set the origin of the frame. This will be replicated to the corresponding
// RenderFrameProxies in other processes.
- params.origin = frame->document().getSecurityOrigin();
+ WebSecurityOrigin frame_origin = frame_document.getSecurityOrigin();
+ params.origin = frame_origin;
params.insecure_request_policy = frame->getInsecureRequestPolicy();
params.has_potentially_trustworthy_unique_origin =
- frame->document().getSecurityOrigin().isUnique() &&
- frame->document().getSecurityOrigin().isPotentiallyTrustworthy();
+ frame_origin.isUnique() && frame_origin.isPotentiallyTrustworthy();
// Set the URL to be displayed in the browser UI to the user.
params.url = GetLoadingUrl();
- if (GURL(frame->document().baseURL()) != params.url)
- params.base_url = frame->document().baseURL();
+ if (GURL(frame_document.baseURL()) != params.url)
+ params.base_url = frame_document.baseURL();
GetRedirectChain(ds, &params.redirects);
params.should_update_history =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698