diff options
author | rch <rch@chromium.org> | 2015-06-10 14:27:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-10 21:28:48 +0000 |
commit | 9976b0c7309301acc2d115c3b3856613948488fb (patch) | |
tree | 3ad8462518bf4591578b609d768e87128b82d184 | |
parent | 4f1226d35342914dbbf3decb806d0592838b49c6 (diff) | |
download | chromium_src-9976b0c7309301acc2d115c3b3856613948488fb.zip chromium_src-9976b0c7309301acc2d115c3b3856613948488fb.tar.gz chromium_src-9976b0c7309301acc2d115c3b3856613948488fb.tar.bz2 |
Add a new prefer_aes finch options for QUIC.
Review URL: https://codereview.chromium.org/1165283004
Cr-Commit-Position: refs/heads/master@{#333805}
-rw-r--r-- | chrome/browser/io_thread.cc | 10 | ||||
-rw-r--r-- | chrome/browser/io_thread.h | 4 | ||||
-rw-r--r-- | chrome/browser/io_thread_unittest.cc | 10 | ||||
-rw-r--r-- | net/http/http_network_session.cc | 2 | ||||
-rw-r--r-- | net/http/http_network_session.h | 1 | ||||
-rw-r--r-- | net/quic/quic_stream_factory.cc | 4 | ||||
-rw-r--r-- | net/quic/quic_stream_factory.h | 4 | ||||
-rw-r--r-- | net/quic/quic_stream_factory_test.cc | 1 |
8 files changed, 35 insertions, 1 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 42bbf7c..67f2619 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -1174,6 +1174,7 @@ void IOThread::InitializeNetworkSessionParamsFromGlobals( ¶ms->quic_enable_connection_racing); globals.quic_enable_non_blocking_io.CopyToIfSet( ¶ms->quic_enable_non_blocking_io); + globals.quic_prefer_aes.CopyToIfSet(¶ms->quic_prefer_aes); globals.quic_disable_disk_cache.CopyToIfSet( ¶ms->quic_disable_disk_cache); globals.quic_max_number_of_lossy_connections.CopyToIfSet( @@ -1321,6 +1322,8 @@ void IOThread::ConfigureQuicGlobals( ShouldQuicEnableNonBlockingIO(quic_trial_params)); globals->quic_disable_disk_cache.set( ShouldQuicDisableDiskCache(quic_trial_params)); + globals->quic_prefer_aes.set( + ShouldQuicPreferAes(quic_trial_params)); int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( quic_trial_params); if (max_number_of_lossy_connections != 0) { @@ -1532,6 +1535,13 @@ bool IOThread::ShouldQuicDisableDiskCache( } // static +bool IOThread::ShouldQuicPreferAes( + const VariationParameters& quic_trial_params) { + return base::LowerCaseEqualsASCII( + GetVariationParam(quic_trial_params, "prefer_aes"), "true"); +} + +// static int IOThread::GetQuicMaxNumberOfLossyConnections( const VariationParameters& quic_trial_params) { int value; diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 7a02c5b..aefdc97 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -189,6 +189,7 @@ class IOThread : public content::BrowserThreadDelegate { Optional<bool> quic_enable_connection_racing; Optional<bool> quic_enable_non_blocking_io; Optional<bool> quic_disable_disk_cache; + Optional<bool> quic_prefer_aes; Optional<int> quic_max_number_of_lossy_connections; Optional<float> quic_packet_loss_threshold; Optional<int> quic_socket_receive_buffer_size; @@ -375,6 +376,9 @@ class IOThread : public content::BrowserThreadDelegate { static bool ShouldQuicDisableDiskCache( const VariationParameters& quic_trial_params); + // Returns true if QUIC should prefer AES-GCN even without hardware support. + static bool ShouldQuicPreferAes(const VariationParameters& quic_trial_params); + // Returns the maximum number of QUIC connections with high packet loss in a // row after which QUIC should be disabled. Returns 0 if the default value // should be used. diff --git a/chrome/browser/io_thread_unittest.cc b/chrome/browser/io_thread_unittest.cc index 03e3dc4..6f460bd 100644 --- a/chrome/browser/io_thread_unittest.cc +++ b/chrome/browser/io_thread_unittest.cc @@ -188,6 +188,7 @@ TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { EXPECT_FALSE(params.quic_enable_connection_racing); EXPECT_FALSE(params.quic_enable_non_blocking_io); EXPECT_FALSE(params.quic_disable_disk_cache); + EXPECT_FALSE(params.quic_prefer_aes); EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); @@ -363,6 +364,15 @@ TEST_F(IOThreadTest, QuicDisableDiskCache) { EXPECT_TRUE(params.quic_disable_disk_cache); } +TEST_F(IOThreadTest, QuicPreferAes) { + field_trial_group_ = "Enabled"; + field_trial_params_["prefer_aes"] = "true"; + ConfigureQuicGlobals(); + net::HttpNetworkSession::Params params; + InitializeNetworkSessionParams(¶ms); + EXPECT_TRUE(params.quic_prefer_aes); +} + TEST_F(IOThreadTest, QuicMaxNumberOfLossyConnectionsFieldTrialParams) { field_trial_group_ = "Enabled"; field_trial_params_["max_number_of_lossy_connections"] = "5"; diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index c3d1f51..4b7edeb 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -98,6 +98,7 @@ HttpNetworkSession::Params::Params() quic_enable_connection_racing(false), quic_enable_non_blocking_io(false), quic_disable_disk_cache(false), + quic_prefer_aes(false), quic_max_number_of_lossy_connections(0), quic_packet_loss_threshold(1.0f), quic_socket_receive_buffer_size(kQuicSocketReceiveBufferSize), @@ -147,6 +148,7 @@ HttpNetworkSession::HttpNetworkSession(const Params& params) params.quic_enable_connection_racing, params.quic_enable_non_blocking_io, params.quic_disable_disk_cache, + params.quic_prefer_aes, params.quic_max_number_of_lossy_connections, params.quic_packet_loss_threshold, params.quic_socket_receive_buffer_size, diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 5ee2752..3327195 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -115,6 +115,7 @@ class NET_EXPORT HttpNetworkSession bool quic_enable_connection_racing; bool quic_enable_non_blocking_io; bool quic_disable_disk_cache; + bool quic_prefer_aes; int quic_max_number_of_lossy_connections; float quic_packet_loss_threshold; int quic_socket_receive_buffer_size; diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 23d02cd..e1ca618 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -553,6 +553,7 @@ QuicStreamFactory::QuicStreamFactory( bool enable_connection_racing, bool enable_non_blocking_io, bool disable_disk_cache, + bool prefer_aes, int max_number_of_lossy_connections, float packet_loss_threshold, int socket_receive_buffer_size, @@ -578,6 +579,7 @@ QuicStreamFactory::QuicStreamFactory( enable_connection_racing_(enable_connection_racing), enable_non_blocking_io_(enable_non_blocking_io), disable_disk_cache_(disable_disk_cache), + prefer_aes_(prefer_aes), max_number_of_lossy_connections_(max_number_of_lossy_connections), packet_loss_threshold_(packet_loss_threshold), socket_receive_buffer_size_(socket_receive_buffer_size), @@ -602,7 +604,7 @@ QuicStreamFactory::QuicStreamFactory( bool has_aes_hardware_support = cpu.has_aesni() && cpu.has_avx(); UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", has_aes_hardware_support); - if (has_aes_hardware_support) + if (has_aes_hardware_support || prefer_aes_) crypto_config_.PreferAesGcm(); if (!IsEcdsaSupported()) crypto_config_.DisableEcdsa(); diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index 185da1f..25e03ea 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h @@ -115,6 +115,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory bool enable_connection_racing, bool enable_non_blocking_io, bool disable_disk_cache, + bool prefer_aes, int max_number_of_lossy_connections, float packet_loss_threshold, int socket_receive_buffer_size, @@ -345,6 +346,9 @@ class NET_EXPORT_PRIVATE QuicStreamFactory // Set if we do not want to load server config from the disk cache. bool disable_disk_cache_; + // Set if AES-GCM should be preferred, even if there is no hardware support. + bool prefer_aes_; + // Set if we want to disable QUIC when there is high packet loss rate. // Specifies the maximum number of connections with high packet loss in a row // after which QUIC will be disabled. diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc index bc85df2..7ccd018 100644 --- a/net/quic/quic_stream_factory_test.cc +++ b/net/quic/quic_stream_factory_test.cc @@ -218,6 +218,7 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<TestParams> { /*enable_connection_racing=*/false, /*enable_non_blocking_io=*/true, /*disable_disk_cache=*/false, + /*prefer_aes=*/false, /*max_number_of_lossy_connections=*/0, /*packet_loss_threshold=*/1.0f, /*receive_buffer_size=*/0, |