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

Unified Diff: net/http/http_stream_factory_impl_job.cc

Issue 14749006: [WIP] Pretend-to-preconnect for {mouse,touch}-event triggers. Base URL: https://chromium.googlesource.com/chromium/src.git@preconnect-pretend
Patch Set: Created 7 years, 8 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
Index: net/http/http_stream_factory_impl_job.cc
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index 680cd321227ff79cc89690419f7fa497ec4bc601..d72272786b2d22a53a2f886e48683d963951bd6f 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -766,19 +766,43 @@ int HttpStreamFactoryImpl::Job::DoInitConnection() {
}
if (IsPreconnecting()) {
- return PreconnectSocketsForHttpRequest(
- origin_url_,
- request_info_.extra_headers,
- request_info_.load_flags,
- priority_,
- session_,
- proxy_info_,
- ShouldForceSpdySSL(),
- want_spdy_over_npn,
- server_ssl_config_,
- proxy_ssl_config_,
- net_log_,
- num_streams_);
+ HttpRequestInfo::RequestMotivation motivation = request_info_.motivation;
+ if(motivation == HttpRequestInfo::MOUSE_OVER_MOTIVATED ||
+ motivation == HttpRequestInfo::MOUSE_DOWN_MOTIVATED ||
+ motivation == HttpRequestInfo::TAP_UNCONFIRMED_MOTIVATED ||
+ motivation == HttpRequestInfo::TAP_DOWN_MOTIVATED) {
mmenke 2013/05/01 16:55:08 Different behaviors based on motivation really doe
+ int would_have_been_connected =
+ PretendToPreconnectSocketsForHttpRequest(
+ origin_url_,
+ request_info_.extra_headers,
+ request_info_.load_flags,
+ priority_,
+ session_,
+ proxy_info_,
+ ShouldForceSpdySSL(),
+ want_spdy_over_npn,
+ server_ssl_config_,
+ proxy_ssl_config_,
+ net_log_,
+ num_streams_);
+ int key = motivation * 2 + (would_have_been_connected > 0 ? 1 : 0);
+ UMA_HISTOGRAM_ENUMERATION("Net.PretendToPreconnect",
+ key, HttpRequestInfo::MAX_MOTIVATED * 2);
+ return OK;
+ } else
+ return PreconnectSocketsForHttpRequest(
+ origin_url_,
+ request_info_.extra_headers,
+ request_info_.load_flags,
+ priority_,
+ session_,
+ proxy_info_,
+ ShouldForceSpdySSL(),
+ want_spdy_over_npn,
+ server_ssl_config_,
+ proxy_ssl_config_,
+ net_log_,
+ num_streams_);
} else {
// If we can't use a SPDY session, don't both checking for one after
// the hostname is resolved.

Powered by Google App Engine
This is Rietveld 408576698