| 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 globals->quic_enable_truncated_connection_ids.set( | 1236 globals->quic_enable_truncated_connection_ids.set( |
| 1237 ShouldQuicEnableTruncatedConnectionIds(quic_trial_params)); | 1237 ShouldQuicEnableTruncatedConnectionIds(quic_trial_params)); |
| 1238 if (load_server_info_timeout_srtt_multiplier != 0) { | 1238 if (load_server_info_timeout_srtt_multiplier != 0) { |
| 1239 globals->quic_load_server_info_timeout_srtt_multiplier.set( | 1239 globals->quic_load_server_info_timeout_srtt_multiplier.set( |
| 1240 load_server_info_timeout_srtt_multiplier); | 1240 load_server_info_timeout_srtt_multiplier); |
| 1241 } | 1241 } |
| 1242 globals->enable_quic_port_selection.set( | 1242 globals->enable_quic_port_selection.set( |
| 1243 ShouldEnableQuicPortSelection(command_line)); | 1243 ShouldEnableQuicPortSelection(command_line)); |
| 1244 globals->quic_connection_options = | 1244 globals->quic_connection_options = |
| 1245 GetQuicConnectionOptions(command_line, quic_trial_params); | 1245 GetQuicConnectionOptions(command_line, quic_trial_params); |
| 1246 if (ShouldEnableQuicPacing(command_line, quic_trial_group, | 1246 if (ShouldEnableQuicPacing(command_line, quic_trial_params)) { |
| 1247 quic_trial_params)) { | |
| 1248 globals->quic_connection_options.push_back(net::kPACE); | 1247 globals->quic_connection_options.push_back(net::kPACE); |
| 1249 } | 1248 } |
| 1250 } | 1249 } |
| 1251 | 1250 |
| 1252 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1251 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
| 1253 quic_trial_group, | |
| 1254 quic_trial_params); | 1252 quic_trial_params); |
| 1255 if (max_packet_length != 0) { | 1253 if (max_packet_length != 0) { |
| 1256 globals->quic_max_packet_length.set(max_packet_length); | 1254 globals->quic_max_packet_length.set(max_packet_length); |
| 1257 } | 1255 } |
| 1258 | 1256 |
| 1259 std::string quic_user_agent_id = | 1257 std::string quic_user_agent_id = |
| 1260 chrome::VersionInfo::GetVersionStringModifier(); | 1258 chrome::VersionInfo::GetVersionStringModifier(); |
| 1261 if (!quic_user_agent_id.empty()) | 1259 if (!quic_user_agent_id.empty()) |
| 1262 quic_user_agent_id.push_back(' '); | 1260 quic_user_agent_id.push_back(' '); |
| 1263 chrome::VersionInfo version_info; | 1261 chrome::VersionInfo version_info; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 return false; | 1305 return false; |
| 1308 | 1306 |
| 1309 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1307 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1310 return true; | 1308 return true; |
| 1311 | 1309 |
| 1312 return false; // Default to disabling port selection on all channels. | 1310 return false; // Default to disabling port selection on all channels. |
| 1313 } | 1311 } |
| 1314 | 1312 |
| 1315 bool IOThread::ShouldEnableQuicPacing( | 1313 bool IOThread::ShouldEnableQuicPacing( |
| 1316 const base::CommandLine& command_line, | 1314 const base::CommandLine& command_line, |
| 1317 base::StringPiece quic_trial_group, | |
| 1318 const VariationParameters& quic_trial_params) { | 1315 const VariationParameters& quic_trial_params) { |
| 1319 if (command_line.HasSwitch(switches::kEnableQuicPacing)) | 1316 if (command_line.HasSwitch(switches::kEnableQuicPacing)) |
| 1320 return true; | 1317 return true; |
| 1321 | 1318 |
| 1322 if (command_line.HasSwitch(switches::kDisableQuicPacing)) | 1319 if (command_line.HasSwitch(switches::kDisableQuicPacing)) |
| 1323 return false; | 1320 return false; |
| 1324 | 1321 |
| 1325 return LowerCaseEqualsASCII( | 1322 return LowerCaseEqualsASCII( |
| 1326 GetVariationParam(quic_trial_params, "enable_pacing"), | 1323 GetVariationParam(quic_trial_params, "enable_pacing"), |
| 1327 "true"); | 1324 "true"); |
| 1328 } | 1325 } |
| 1329 | 1326 |
| 1330 net::QuicTagVector IOThread::GetQuicConnectionOptions( | 1327 net::QuicTagVector IOThread::GetQuicConnectionOptions( |
| 1331 const base::CommandLine& command_line, | 1328 const base::CommandLine& command_line, |
| 1332 const VariationParameters& quic_trial_params) { | 1329 const VariationParameters& quic_trial_params) { |
| 1333 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { | 1330 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { |
| 1334 return net::QuicUtils::ParseQuicConnectionOptions( | 1331 return net::QuicUtils::ParseQuicConnectionOptions( |
| 1335 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); | 1332 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); |
| 1336 } | 1333 } |
| 1337 | 1334 |
| 1338 VariationParameters::const_iterator it = | 1335 VariationParameters::const_iterator it = |
| 1339 quic_trial_params.find("connection_options"); | 1336 quic_trial_params.find("connection_options"); |
| 1340 if (it == quic_trial_params.end()) { | 1337 if (it == quic_trial_params.end()) { |
| 1341 // TODO(rch): remove support for deprecated congestion_options. | 1338 return net::QuicTagVector(); |
| 1342 it = quic_trial_params.find("congestion_options"); | |
| 1343 if (it == quic_trial_params.end()) | |
| 1344 return net::QuicTagVector(); | |
| 1345 } | 1339 } |
| 1346 | 1340 |
| 1347 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | 1341 return net::QuicUtils::ParseQuicConnectionOptions(it->second); |
| 1348 } | 1342 } |
| 1349 | 1343 |
| 1350 // static | 1344 // static |
| 1351 double IOThread::GetAlternateProtocolProbabilityThreshold( | 1345 double IOThread::GetAlternateProtocolProbabilityThreshold( |
| 1352 const base::CommandLine& command_line, | 1346 const base::CommandLine& command_line, |
| 1353 const VariationParameters& quic_trial_params) { | 1347 const VariationParameters& quic_trial_params) { |
| 1354 double value; | 1348 double value; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 bool IOThread::ShouldQuicEnableTruncatedConnectionIds( | 1421 bool IOThread::ShouldQuicEnableTruncatedConnectionIds( |
| 1428 const VariationParameters& quic_trial_params) { | 1422 const VariationParameters& quic_trial_params) { |
| 1429 return LowerCaseEqualsASCII( | 1423 return LowerCaseEqualsASCII( |
| 1430 GetVariationParam(quic_trial_params, "enable_truncated_connection_ids"), | 1424 GetVariationParam(quic_trial_params, "enable_truncated_connection_ids"), |
| 1431 "true"); | 1425 "true"); |
| 1432 } | 1426 } |
| 1433 | 1427 |
| 1434 // static | 1428 // static |
| 1435 size_t IOThread::GetQuicMaxPacketLength( | 1429 size_t IOThread::GetQuicMaxPacketLength( |
| 1436 const base::CommandLine& command_line, | 1430 const base::CommandLine& command_line, |
| 1437 base::StringPiece quic_trial_group, | |
| 1438 const VariationParameters& quic_trial_params) { | 1431 const VariationParameters& quic_trial_params) { |
| 1439 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1432 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
| 1440 unsigned value; | 1433 unsigned value; |
| 1441 if (!base::StringToUint( | 1434 if (!base::StringToUint( |
| 1442 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1435 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
| 1443 &value)) { | 1436 &value)) { |
| 1444 return 0; | 1437 return 0; |
| 1445 } | 1438 } |
| 1446 return value; | 1439 return value; |
| 1447 } | 1440 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1472 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1465 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1473 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1466 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1474 net::QuicVersion version = supported_versions[i]; | 1467 net::QuicVersion version = supported_versions[i]; |
| 1475 if (net::QuicVersionToString(version) == quic_version) { | 1468 if (net::QuicVersionToString(version) == quic_version) { |
| 1476 return version; | 1469 return version; |
| 1477 } | 1470 } |
| 1478 } | 1471 } |
| 1479 | 1472 |
| 1480 return net::QUIC_VERSION_UNSUPPORTED; | 1473 return net::QUIC_VERSION_UNSUPPORTED; |
| 1481 } | 1474 } |
| OLD | NEW |