| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 namespace { | 115 namespace { |
| 116 | 116 |
| 117 const char kTCPFastOpenFieldTrialName[] = "TCPFastOpen"; | 117 const char kTCPFastOpenFieldTrialName[] = "TCPFastOpen"; |
| 118 const char kTCPFastOpenHttpsEnabledGroupName[] = "HttpsEnabled"; | 118 const char kTCPFastOpenHttpsEnabledGroupName[] = "HttpsEnabled"; |
| 119 | 119 |
| 120 const char kQuicFieldTrialName[] = "QUIC"; | 120 const char kQuicFieldTrialName[] = "QUIC"; |
| 121 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; | 121 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; |
| 122 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; | 122 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; |
| 123 const char kQuicFieldTrialPacketLengthSuffix[] = "BytePackets"; | 123 const char kQuicFieldTrialPacketLengthSuffix[] = "BytePackets"; |
| 124 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; | 124 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; |
| 125 const char kQuicFieldTrialTimeBasedLossDetectionSuffix[] = | |
| 126 "WithTimeBasedLossDetection"; | |
| 127 | 125 |
| 128 // The SPDY trial composes two different trial plus control groups: | 126 // The SPDY trial composes two different trial plus control groups: |
| 129 // * A "holdback" group with SPDY disabled, and corresponding control | 127 // * A "holdback" group with SPDY disabled, and corresponding control |
| 130 // (SPDY/3.1). The primary purpose of the holdback group is to encourage site | 128 // (SPDY/3.1). The primary purpose of the holdback group is to encourage site |
| 131 // operators to do feature detection rather than UA-sniffing. As such, this | 129 // operators to do feature detection rather than UA-sniffing. As such, this |
| 132 // trial runs continuously. | 130 // trial runs continuously. |
| 133 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and | 131 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and |
| 134 // eventual SPDY/4 deployment. | 132 // eventual SPDY/4 deployment. |
| 135 const char kSpdyFieldTrialName[] = "SPDY"; | 133 const char kSpdyFieldTrialName[] = "SPDY"; |
| 136 const char kSpdyFieldTrialHoldbackGroupName[] = "SpdyDisabled"; | 134 const char kSpdyFieldTrialHoldbackGroupName[] = "SpdyDisabled"; |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 globals.force_spdy_always.CopyToIfSet(¶ms->force_spdy_always); | 1006 globals.force_spdy_always.CopyToIfSet(¶ms->force_spdy_always); |
| 1009 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1007 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
| 1010 globals.use_alternate_protocols.CopyToIfSet( | 1008 globals.use_alternate_protocols.CopyToIfSet( |
| 1011 ¶ms->use_alternate_protocols); | 1009 ¶ms->use_alternate_protocols); |
| 1012 globals.alternate_protocol_probability_threshold.CopyToIfSet( | 1010 globals.alternate_protocol_probability_threshold.CopyToIfSet( |
| 1013 ¶ms->alternate_protocol_probability_threshold); | 1011 ¶ms->alternate_protocol_probability_threshold); |
| 1014 globals.enable_websocket_over_spdy.CopyToIfSet( | 1012 globals.enable_websocket_over_spdy.CopyToIfSet( |
| 1015 ¶ms->enable_websocket_over_spdy); | 1013 ¶ms->enable_websocket_over_spdy); |
| 1016 | 1014 |
| 1017 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1015 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
| 1018 globals.enable_quic_time_based_loss_detection.CopyToIfSet( | |
| 1019 ¶ms->enable_quic_time_based_loss_detection); | |
| 1020 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1016 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
| 1021 ¶ms->quic_always_require_handshake_confirmation); | 1017 ¶ms->quic_always_require_handshake_confirmation); |
| 1022 globals.quic_disable_connection_pooling.CopyToIfSet( | 1018 globals.quic_disable_connection_pooling.CopyToIfSet( |
| 1023 ¶ms->quic_disable_connection_pooling); | 1019 ¶ms->quic_disable_connection_pooling); |
| 1024 globals.enable_quic_port_selection.CopyToIfSet( | 1020 globals.enable_quic_port_selection.CopyToIfSet( |
| 1025 ¶ms->enable_quic_port_selection); | 1021 ¶ms->enable_quic_port_selection); |
| 1026 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1022 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
| 1027 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1023 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
| 1028 globals.quic_supported_versions.CopyToIfSet( | 1024 globals.quic_supported_versions.CopyToIfSet( |
| 1029 ¶ms->quic_supported_versions); | 1025 ¶ms->quic_supported_versions); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 | 1158 |
| 1163 // static | 1159 // static |
| 1164 void IOThread::ConfigureQuicGlobals( | 1160 void IOThread::ConfigureQuicGlobals( |
| 1165 const base::CommandLine& command_line, | 1161 const base::CommandLine& command_line, |
| 1166 base::StringPiece quic_trial_group, | 1162 base::StringPiece quic_trial_group, |
| 1167 const VariationParameters& quic_trial_params, | 1163 const VariationParameters& quic_trial_params, |
| 1168 IOThread::Globals* globals) { | 1164 IOThread::Globals* globals) { |
| 1169 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); | 1165 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); |
| 1170 globals->enable_quic.set(enable_quic); | 1166 globals->enable_quic.set(enable_quic); |
| 1171 if (enable_quic) { | 1167 if (enable_quic) { |
| 1172 globals->enable_quic_time_based_loss_detection.set( | |
| 1173 ShouldEnableQuicTimeBasedLossDetection(command_line, quic_trial_group, | |
| 1174 quic_trial_params)); | |
| 1175 globals->quic_always_require_handshake_confirmation.set( | 1168 globals->quic_always_require_handshake_confirmation.set( |
| 1176 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); | 1169 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); |
| 1177 globals->quic_disable_connection_pooling.set( | 1170 globals->quic_disable_connection_pooling.set( |
| 1178 ShouldQuicDisableConnectionPooling(quic_trial_params)); | 1171 ShouldQuicDisableConnectionPooling(quic_trial_params)); |
| 1179 globals->enable_quic_port_selection.set( | 1172 globals->enable_quic_port_selection.set( |
| 1180 ShouldEnableQuicPortSelection(command_line)); | 1173 ShouldEnableQuicPortSelection(command_line)); |
| 1181 globals->quic_connection_options = | 1174 globals->quic_connection_options = |
| 1182 GetQuicConnectionOptions(command_line, quic_trial_params); | 1175 GetQuicConnectionOptions(command_line, quic_trial_params); |
| 1183 if (ShouldEnableQuicPacing(command_line, quic_trial_group, | 1176 if (ShouldEnableQuicPacing(command_line, quic_trial_group, |
| 1184 quic_trial_params)) { | 1177 quic_trial_params)) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 if (base::StringToDouble( | 1320 if (base::StringToDouble( |
| 1328 GetVariationParam(quic_trial_params, | 1321 GetVariationParam(quic_trial_params, |
| 1329 "alternate_protocol_probability_threshold"), | 1322 "alternate_protocol_probability_threshold"), |
| 1330 &value)) { | 1323 &value)) { |
| 1331 return value; | 1324 return value; |
| 1332 } | 1325 } |
| 1333 return -1; | 1326 return -1; |
| 1334 } | 1327 } |
| 1335 | 1328 |
| 1336 // static | 1329 // static |
| 1337 bool IOThread::ShouldEnableQuicTimeBasedLossDetection( | |
| 1338 const CommandLine& command_line, | |
| 1339 base::StringPiece quic_trial_group, | |
| 1340 const VariationParameters& quic_trial_params) { | |
| 1341 if (command_line.HasSwitch(switches::kEnableQuicTimeBasedLossDetection)) | |
| 1342 return true; | |
| 1343 | |
| 1344 if (command_line.HasSwitch(switches::kDisableQuicTimeBasedLossDetection)) | |
| 1345 return false; | |
| 1346 | |
| 1347 if (LowerCaseEqualsASCII( | |
| 1348 GetVariationParam(quic_trial_params, "enable_time_based_loss_detection"), | |
| 1349 "true")) | |
| 1350 return true; | |
| 1351 | |
| 1352 return quic_trial_group.ends_with( | |
| 1353 kQuicFieldTrialTimeBasedLossDetectionSuffix); | |
| 1354 } | |
| 1355 | |
| 1356 // static | |
| 1357 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( | 1330 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
| 1358 const VariationParameters& quic_trial_params) { | 1331 const VariationParameters& quic_trial_params) { |
| 1359 return LowerCaseEqualsASCII( | 1332 return LowerCaseEqualsASCII( |
| 1360 GetVariationParam(quic_trial_params, | 1333 GetVariationParam(quic_trial_params, |
| 1361 "always_require_handshake_confirmation"), | 1334 "always_require_handshake_confirmation"), |
| 1362 "true"); | 1335 "true"); |
| 1363 } | 1336 } |
| 1364 | 1337 |
| 1365 // static | 1338 // static |
| 1366 bool IOThread::ShouldQuicDisableConnectionPooling( | 1339 bool IOThread::ShouldQuicDisableConnectionPooling( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1402 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1430 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1403 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1431 net::QuicVersion version = supported_versions[i]; | 1404 net::QuicVersion version = supported_versions[i]; |
| 1432 if (net::QuicVersionToString(version) == quic_version) { | 1405 if (net::QuicVersionToString(version) == quic_version) { |
| 1433 return version; | 1406 return version; |
| 1434 } | 1407 } |
| 1435 } | 1408 } |
| 1436 | 1409 |
| 1437 return net::QUIC_VERSION_UNSUPPORTED; | 1410 return net::QUIC_VERSION_UNSUPPORTED; |
| 1438 } | 1411 } |
| OLD | NEW |