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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 globals.use_alternate_protocols.CopyToIfSet( | 1039 globals.use_alternate_protocols.CopyToIfSet( |
1040 ¶ms->use_alternate_protocols); | 1040 ¶ms->use_alternate_protocols); |
1041 globals.alternate_protocol_probability_threshold.CopyToIfSet( | 1041 globals.alternate_protocol_probability_threshold.CopyToIfSet( |
1042 ¶ms->alternate_protocol_probability_threshold); | 1042 ¶ms->alternate_protocol_probability_threshold); |
1043 globals.enable_websocket_over_spdy.CopyToIfSet( | 1043 globals.enable_websocket_over_spdy.CopyToIfSet( |
1044 ¶ms->enable_websocket_over_spdy); | 1044 ¶ms->enable_websocket_over_spdy); |
1045 | 1045 |
1046 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1046 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1047 globals.enable_quic_time_based_loss_detection.CopyToIfSet( | 1047 globals.enable_quic_time_based_loss_detection.CopyToIfSet( |
1048 ¶ms->enable_quic_time_based_loss_detection); | 1048 ¶ms->enable_quic_time_based_loss_detection); |
| 1049 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
| 1050 ¶ms->quic_always_require_handshake_confirmation); |
1049 globals.enable_quic_port_selection.CopyToIfSet( | 1051 globals.enable_quic_port_selection.CopyToIfSet( |
1050 ¶ms->enable_quic_port_selection); | 1052 ¶ms->enable_quic_port_selection); |
1051 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1053 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
1052 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1054 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
1053 globals.quic_supported_versions.CopyToIfSet( | 1055 globals.quic_supported_versions.CopyToIfSet( |
1054 ¶ms->quic_supported_versions); | 1056 ¶ms->quic_supported_versions); |
1055 params->quic_connection_options = globals.quic_connection_options; | 1057 params->quic_connection_options = globals.quic_connection_options; |
1056 | 1058 |
1057 globals.origin_to_force_quic_on.CopyToIfSet( | 1059 globals.origin_to_force_quic_on.CopyToIfSet( |
1058 ¶ms->origin_to_force_quic_on); | 1060 ¶ms->origin_to_force_quic_on); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 const base::CommandLine& command_line, | 1154 const base::CommandLine& command_line, |
1153 base::StringPiece quic_trial_group, | 1155 base::StringPiece quic_trial_group, |
1154 const VariationParameters& quic_trial_params, | 1156 const VariationParameters& quic_trial_params, |
1155 IOThread::Globals* globals) { | 1157 IOThread::Globals* globals) { |
1156 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); | 1158 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); |
1157 globals->enable_quic.set(enable_quic); | 1159 globals->enable_quic.set(enable_quic); |
1158 if (enable_quic) { | 1160 if (enable_quic) { |
1159 globals->enable_quic_time_based_loss_detection.set( | 1161 globals->enable_quic_time_based_loss_detection.set( |
1160 ShouldEnableQuicTimeBasedLossDetection(command_line, quic_trial_group, | 1162 ShouldEnableQuicTimeBasedLossDetection(command_line, quic_trial_group, |
1161 quic_trial_params)); | 1163 quic_trial_params)); |
| 1164 globals->quic_always_require_handshake_confirmation.set( |
| 1165 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); |
1162 globals->enable_quic_port_selection.set( | 1166 globals->enable_quic_port_selection.set( |
1163 ShouldEnableQuicPortSelection(command_line)); | 1167 ShouldEnableQuicPortSelection(command_line)); |
1164 globals->quic_connection_options = | 1168 globals->quic_connection_options = |
1165 GetQuicConnectionOptions(command_line, quic_trial_params); | 1169 GetQuicConnectionOptions(command_line, quic_trial_params); |
1166 if (ShouldEnableQuicPacing(command_line, quic_trial_group, | 1170 if (ShouldEnableQuicPacing(command_line, quic_trial_group, |
1167 quic_trial_params)) { | 1171 quic_trial_params)) { |
1168 globals->quic_connection_options.push_back(net::kPACE); | 1172 globals->quic_connection_options.push_back(net::kPACE); |
1169 } | 1173 } |
1170 } | 1174 } |
1171 | 1175 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 if (LowerCaseEqualsASCII( | 1331 if (LowerCaseEqualsASCII( |
1328 GetVariationParam(quic_trial_params, "enable_time_based_loss_detection"), | 1332 GetVariationParam(quic_trial_params, "enable_time_based_loss_detection"), |
1329 "true")) | 1333 "true")) |
1330 return true; | 1334 return true; |
1331 | 1335 |
1332 return quic_trial_group.ends_with( | 1336 return quic_trial_group.ends_with( |
1333 kQuicFieldTrialTimeBasedLossDetectionSuffix); | 1337 kQuicFieldTrialTimeBasedLossDetectionSuffix); |
1334 } | 1338 } |
1335 | 1339 |
1336 // static | 1340 // static |
| 1341 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
| 1342 const VariationParameters& quic_trial_params) { |
| 1343 return LowerCaseEqualsASCII( |
| 1344 GetVariationParam(quic_trial_params, |
| 1345 "always_require_handshake_confirmation"), |
| 1346 "true"); |
| 1347 } |
| 1348 |
| 1349 // static |
1337 size_t IOThread::GetQuicMaxPacketLength( | 1350 size_t IOThread::GetQuicMaxPacketLength( |
1338 const CommandLine& command_line, | 1351 const CommandLine& command_line, |
1339 base::StringPiece quic_trial_group, | 1352 base::StringPiece quic_trial_group, |
1340 const VariationParameters& quic_trial_params) { | 1353 const VariationParameters& quic_trial_params) { |
1341 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1354 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1342 unsigned value; | 1355 unsigned value; |
1343 if (!base::StringToUint( | 1356 if (!base::StringToUint( |
1344 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1357 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1345 &value)) { | 1358 &value)) { |
1346 return 0; | 1359 return 0; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1405 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1393 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1406 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1394 net::QuicVersion version = supported_versions[i]; | 1407 net::QuicVersion version = supported_versions[i]; |
1395 if (net::QuicVersionToString(version) == quic_version) { | 1408 if (net::QuicVersionToString(version) == quic_version) { |
1396 return version; | 1409 return version; |
1397 } | 1410 } |
1398 } | 1411 } |
1399 | 1412 |
1400 return net::QUIC_VERSION_UNSUPPORTED; | 1413 return net::QUIC_VERSION_UNSUPPORTED; |
1401 } | 1414 } |
OLD | NEW |