summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrtenneti <rtenneti@chromium.org>2014-12-18 16:35:58 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-19 00:36:56 +0000
commitb4af4ed1886d04cc42e6a7a6e6f9d51261caa7fc (patch)
treeb7f1a44ff9f503e62336424d89d44a8a7905c59e /net
parent9bfeeb7b53e27a9014b811172cdab83074266113 (diff)
downloadchromium_src-b4af4ed1886d04cc42e6a7a6e6f9d51261caa7fc.zip
chromium_src-b4af4ed1886d04cc42e6a7a6e6f9d51261caa7fc.tar.gz
chromium_src-b4af4ed1886d04cc42e6a7a6e6f9d51261caa7fc.tar.bz2
QUIC - don't load data from disk cache if alternate protocol map doesn't
have an entry. This change tests if we will speed up completion of crypto handshake. We wouldn't have persisted quic server information if we haven't spoken QUIC to the server. In such cases, loading data from disk cache is not on the critical path. This is controlled via a FieldTrial to see if this change would have positive impact or not. R=rch@chromium.org Review URL: https://codereview.chromium.org/811073004 Cr-Commit-Position: refs/heads/master@{#309116}
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_session.cc2
-rw-r--r--net/http/http_network_session.h1
-rw-r--r--net/quic/quic_stream_factory.cc27
-rw-r--r--net/quic/quic_stream_factory.h6
-rw-r--r--net/quic/quic_stream_factory_test.cc1
5 files changed, 32 insertions, 5 deletions
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 405c88c..7d7a718 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -89,6 +89,7 @@ HttpNetworkSession::Params::Params()
quic_always_require_handshake_confirmation(false),
quic_disable_connection_pooling(false),
quic_load_server_info_timeout_ms(0),
+ quic_disable_loading_server_info_for_new_servers(false),
quic_clock(NULL),
quic_random(NULL),
quic_max_packet_length(kDefaultMaxPacketSize),
@@ -132,6 +133,7 @@ HttpNetworkSession::HttpNetworkSession(const Params& params)
params.quic_always_require_handshake_confirmation,
params.quic_disable_connection_pooling,
params.quic_load_server_info_timeout_ms,
+ params.quic_disable_loading_server_info_for_new_servers,
params.quic_connection_options),
spdy_session_pool_(params.host_resolver,
params.ssl_config_service,
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index c9704a4..39605c6 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -117,6 +117,7 @@ class NET_EXPORT HttpNetworkSession
bool quic_always_require_handshake_confirmation;
bool quic_disable_connection_pooling;
int quic_load_server_info_timeout_ms;
+ bool quic_disable_loading_server_info_for_new_servers;
HostPortPair origin_to_force_quic_on;
QuicClock* quic_clock; // Will be owned by QuicStreamFactory.
QuicRandom* quic_random;
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 45c60c0..3253e90 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -545,6 +545,7 @@ QuicStreamFactory::QuicStreamFactory(
bool always_require_handshake_confirmation,
bool disable_connection_pooling,
int load_server_info_timeout,
+ bool disable_loading_server_info_for_new_servers,
const QuicTagVector& connection_options)
: require_confirmation_(true),
host_resolver_(host_resolver),
@@ -563,6 +564,8 @@ QuicStreamFactory::QuicStreamFactory(
always_require_handshake_confirmation),
disable_connection_pooling_(disable_connection_pooling),
load_server_info_timeout_ms_(load_server_info_timeout),
+ disable_loading_server_info_for_new_servers_(
+ disable_loading_server_info_for_new_servers),
port_seed_(random_generator_->RandUint64()),
check_persisted_supports_quic_(true),
task_runner_(nullptr),
@@ -623,11 +626,25 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
QuicServerInfo* quic_server_info = nullptr;
if (quic_server_info_factory_) {
- QuicCryptoClientConfig::CachedState* cached =
- crypto_config_.LookupOrCreate(server_id);
- DCHECK(cached);
- if (cached->IsEmpty()) {
- quic_server_info = quic_server_info_factory_->GetForServer(server_id);
+ bool load_from_disk_cache = true;
+ if (disable_loading_server_info_for_new_servers_) {
+ const AlternateProtocolMap& alternate_protocol_map =
+ http_server_properties_->alternate_protocol_map();
+ AlternateProtocolMap::const_iterator it =
+ alternate_protocol_map.Peek(server_id.host_port_pair());
+ if (it == alternate_protocol_map.end() || it->second.protocol != QUIC) {
+ // If there is no entry for QUIC, consider that as a new server and
+ // don't wait for Cache thread to load the data for that server.
+ load_from_disk_cache = false;
+ }
+ }
+ if (load_from_disk_cache) {
+ QuicCryptoClientConfig::CachedState* cached =
+ crypto_config_.LookupOrCreate(server_id);
+ DCHECK(cached);
+ if (cached->IsEmpty()) {
+ quic_server_info = quic_server_info_factory_->GetForServer(server_id);
+ }
}
}
// TODO(rtenneti): Initialize task_runner_ in the constructor after
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h
index 2fad1fc..5d24c9b 100644
--- a/net/quic/quic_stream_factory.h
+++ b/net/quic/quic_stream_factory.h
@@ -105,6 +105,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
bool always_require_handshake_confirmation,
bool disable_connection_pooling,
int load_server_info_timeout,
+ bool disable_loading_server_info_for_new_servers,
const QuicTagVector& connection_options);
~QuicStreamFactory() override;
@@ -288,6 +289,11 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
// |load_server_info_timeout_ms_| to 0.
int load_server_info_timeout_ms_;
+ // Set to disable loading of QUIC server information from disk cache for new
+ // servers. New servers are those servers for which there is no QUIC protocol
+ // entry in AlternateProtocolMap.
+ bool disable_loading_server_info_for_new_servers_;
+
// Each profile will (probably) have a unique port_seed_ value. This value is
// used to help seed a pseudo-random number generator (PortSuggester) so that
// we consistently (within this profile) suggest the same ephemeral port when
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index 05234c0..b386527 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -163,6 +163,7 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> {
/*always_require_handshake_confirmation=*/false,
/*disable_connection_pooling=*/false,
/*load_server_info_timeout=*/0u,
+ /*disable_loading_server_info_for_new_servers=*/false,
QuicTagVector()),
host_port_pair_(kDefaultServerHostName, kDefaultServerPort),
is_https_(false),