| 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 globals->quic_max_number_of_lossy_connections.set( | 1335 globals->quic_max_number_of_lossy_connections.set( |
| 1336 max_number_of_lossy_connections); | 1336 max_number_of_lossy_connections); |
| 1337 } | 1337 } |
| 1338 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); | 1338 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); |
| 1339 if (packet_loss_threshold != 0) | 1339 if (packet_loss_threshold != 0) |
| 1340 globals->quic_packet_loss_threshold.set(packet_loss_threshold); | 1340 globals->quic_packet_loss_threshold.set(packet_loss_threshold); |
| 1341 globals->enable_quic_port_selection.set( | 1341 globals->enable_quic_port_selection.set( |
| 1342 ShouldEnableQuicPortSelection(command_line)); | 1342 ShouldEnableQuicPortSelection(command_line)); |
| 1343 globals->quic_connection_options = | 1343 globals->quic_connection_options = |
| 1344 GetQuicConnectionOptions(command_line, quic_trial_params); | 1344 GetQuicConnectionOptions(command_line, quic_trial_params); |
| 1345 if (ShouldEnableQuicPacing(command_line, quic_trial_params)) { | |
| 1346 globals->quic_connection_options.push_back(net::kPACE); | |
| 1347 } | |
| 1348 } | 1345 } |
| 1349 | 1346 |
| 1350 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1347 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
| 1351 quic_trial_params); | 1348 quic_trial_params); |
| 1352 if (max_packet_length != 0) { | 1349 if (max_packet_length != 0) { |
| 1353 globals->quic_max_packet_length.set(max_packet_length); | 1350 globals->quic_max_packet_length.set(max_packet_length); |
| 1354 } | 1351 } |
| 1355 | 1352 |
| 1356 std::string quic_user_agent_id = | 1353 std::string quic_user_agent_id = |
| 1357 chrome::VersionInfo::GetVersionStringModifier(); | 1354 chrome::VersionInfo::GetVersionStringModifier(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 const base::CommandLine& command_line) { | 1429 const base::CommandLine& command_line) { |
| 1433 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1430 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
| 1434 return false; | 1431 return false; |
| 1435 | 1432 |
| 1436 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1433 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1437 return true; | 1434 return true; |
| 1438 | 1435 |
| 1439 return false; // Default to disabling port selection on all channels. | 1436 return false; // Default to disabling port selection on all channels. |
| 1440 } | 1437 } |
| 1441 | 1438 |
| 1442 bool IOThread::ShouldEnableQuicPacing( | |
| 1443 const base::CommandLine& command_line, | |
| 1444 const VariationParameters& quic_trial_params) { | |
| 1445 if (command_line.HasSwitch(switches::kEnableQuicPacing)) | |
| 1446 return true; | |
| 1447 | |
| 1448 if (command_line.HasSwitch(switches::kDisableQuicPacing)) | |
| 1449 return false; | |
| 1450 | |
| 1451 return LowerCaseEqualsASCII( | |
| 1452 GetVariationParam(quic_trial_params, "enable_pacing"), | |
| 1453 "true"); | |
| 1454 } | |
| 1455 | |
| 1456 net::QuicTagVector IOThread::GetQuicConnectionOptions( | 1439 net::QuicTagVector IOThread::GetQuicConnectionOptions( |
| 1457 const base::CommandLine& command_line, | 1440 const base::CommandLine& command_line, |
| 1458 const VariationParameters& quic_trial_params) { | 1441 const VariationParameters& quic_trial_params) { |
| 1459 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { | 1442 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { |
| 1460 return net::QuicUtils::ParseQuicConnectionOptions( | 1443 return net::QuicUtils::ParseQuicConnectionOptions( |
| 1461 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); | 1444 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); |
| 1462 } | 1445 } |
| 1463 | 1446 |
| 1464 VariationParameters::const_iterator it = | 1447 VariationParameters::const_iterator it = |
| 1465 quic_trial_params.find("connection_options"); | 1448 quic_trial_params.find("connection_options"); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1615 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1633 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1616 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1634 net::QuicVersion version = supported_versions[i]; | 1617 net::QuicVersion version = supported_versions[i]; |
| 1635 if (net::QuicVersionToString(version) == quic_version) { | 1618 if (net::QuicVersionToString(version) == quic_version) { |
| 1636 return version; | 1619 return version; |
| 1637 } | 1620 } |
| 1638 } | 1621 } |
| 1639 | 1622 |
| 1640 return net::QUIC_VERSION_UNSUPPORTED; | 1623 return net::QUIC_VERSION_UNSUPPORTED; |
| 1641 } | 1624 } |
| OLD | NEW |