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

Unified Diff: content/renderer/render_view_impl.cc

Issue 18601004: Add the UMA PLT.BeginToFinish{,Doc}_AfterPreconnectRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert unwanted change Created 7 years, 5 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 | « content/renderer/render_view_impl.h ('k') | webkit/glue/weburlrequest_extradata_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 9cf33c0fae0ef84d7c4d81dea6cba0e09f9b2e1c..88f42fad272af1b3829248cc9901dee555edd61f 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -3987,6 +3987,29 @@ void RenderViewImpl::assignIdentifierToRequest(
// Ignore
}
+void RenderViewImpl::willRequestAfterPreconnect(WebFrame* frame,
+ WebURLRequest& request) {
+ WebKit::WebReferrerPolicy referrer_policy = WebKit::WebReferrerPolicyDefault;
+ WebString custom_user_agent;
+
+ if(request.extraData()) {
jam 2013/07/26 04:59:39 nit: "if ("
kouhei (in TOK) 2013/07/26 10:50:02 Done.
+ // This will only be called before willSendRequest, so only ExtraData
+ // members we have to copy here is on WebURLRequestExtraDataImpl.
+ webkit_glue::WebURLRequestExtraDataImpl* old_extra_data =
+ static_cast<webkit_glue::WebURLRequestExtraDataImpl*>(
+ request.extraData());
+
+ referrer_policy = old_extra_data->referrer_policy();
+ custom_user_agent = old_extra_data->custom_user_agent();
+ }
+
+ bool was_after_preconnect_request = true;
+ // The args after |was_after_preconnect_request| are not used, and set to
+ // correct values at |willSendRequest|.
+ request.setExtraData(new webkit_glue::WebURLRequestExtraDataImpl(
+ referrer_policy, custom_user_agent, was_after_preconnect_request));
+}
+
void RenderViewImpl::willSendRequest(WebFrame* frame,
unsigned identifier,
WebURLRequest& request,
@@ -4037,11 +4060,14 @@ void RenderViewImpl::willSendRequest(WebFrame* frame,
// agent. This needs to be done here, after WebKit is through with setting the
// user agent on its own.
WebString custom_user_agent;
+ bool was_after_preconnect_request = false;
if (request.extraData()) {
webkit_glue::WebURLRequestExtraDataImpl* old_extra_data =
static_cast<webkit_glue::WebURLRequestExtraDataImpl*>(
request.extraData());
custom_user_agent = old_extra_data->custom_user_agent();
+ was_after_preconnect_request =
+ old_extra_data->was_after_preconnect_request();
if (!custom_user_agent.isNull()) {
if (custom_user_agent.isEmpty())
@@ -4054,6 +4080,7 @@ void RenderViewImpl::willSendRequest(WebFrame* frame,
request.setExtraData(
new RequestExtraData(referrer_policy,
custom_user_agent,
+ was_after_preconnect_request,
(frame == top_frame),
frame->identifier(),
frame->parent() == top_frame,
@@ -4065,11 +4092,15 @@ void RenderViewImpl::willSendRequest(WebFrame* frame,
DocumentState* top_document_state =
DocumentState::FromDataSource(top_data_source);
- // TODO(gavinp): separate out prefetching and prerender field trials
- // if the rel=prerender rel type is sticking around.
- if (top_document_state &&
- request.targetType() == WebURLRequest::TargetIsPrefetch)
- top_document_state->set_was_prefetcher(true);
+ if (top_document_state) {
+ // TODO(gavinp): separate out prefetching and prerender field trials
+ // if the rel=prerender rel type is sticking around.
+ if(request.targetType() == WebURLRequest::TargetIsPrefetch)
jam 2013/07/26 04:59:39 ditto and also below
kouhei (in TOK) 2013/07/26 10:50:02 Done.
+ top_document_state->set_was_prefetcher(true);
+
+ if(was_after_preconnect_request)
+ top_document_state->set_was_after_preconnect_request(true);
+ }
request.setRequestorID(routing_id_);
request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture());
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | webkit/glue/weburlrequest_extradata_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698