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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 } | 1029 } |
1030 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { | 1030 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { |
1031 globals->next_protos.push_back(net::kProtoSPDY31); | 1031 globals->next_protos.push_back(net::kProtoSPDY31); |
1032 globals->next_protos.push_back(net::kProtoSPDY4_14); | 1032 globals->next_protos.push_back(net::kProtoSPDY4_14); |
1033 globals->next_protos.push_back(net::kProtoSPDY4); | 1033 globals->next_protos.push_back(net::kProtoSPDY4); |
1034 globals->use_alternate_protocols.set(true); | 1034 globals->use_alternate_protocols.set(true); |
1035 return; | 1035 return; |
1036 } | 1036 } |
1037 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { | 1037 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { |
1038 bool spdy_enabled = false; | 1038 bool spdy_enabled = false; |
1039 if (LowerCaseEqualsASCII( | 1039 if (base::LowerCaseEqualsASCII( |
1040 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { | 1040 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { |
1041 globals->next_protos.push_back(net::kProtoSPDY31); | 1041 globals->next_protos.push_back(net::kProtoSPDY31); |
1042 spdy_enabled = true; | 1042 spdy_enabled = true; |
1043 } | 1043 } |
1044 if (LowerCaseEqualsASCII( | 1044 if (base::LowerCaseEqualsASCII( |
1045 GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { | 1045 GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { |
1046 globals->next_protos.push_back(net::kProtoSPDY4_14); | 1046 globals->next_protos.push_back(net::kProtoSPDY4_14); |
1047 spdy_enabled = true; | 1047 spdy_enabled = true; |
1048 } | 1048 } |
1049 if (LowerCaseEqualsASCII( | 1049 if (base::LowerCaseEqualsASCII( |
1050 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { | 1050 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { |
1051 globals->next_protos.push_back(net::kProtoSPDY4); | 1051 globals->next_protos.push_back(net::kProtoSPDY4); |
1052 spdy_enabled = true; | 1052 spdy_enabled = true; |
1053 } | 1053 } |
1054 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with | 1054 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with |
1055 // globals->next_protos, can it be eliminated? | 1055 // globals->next_protos, can it be eliminated? |
1056 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); | 1056 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); |
1057 globals->use_alternate_protocols.set(true); | 1057 globals->use_alternate_protocols.set(true); |
1058 return; | 1058 return; |
1059 } | 1059 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 if (command_line.HasSwitch(switches::kDisableQuic)) | 1405 if (command_line.HasSwitch(switches::kDisableQuic)) |
1406 return false; | 1406 return false; |
1407 | 1407 |
1408 return data_reduction_proxy::DataReductionProxyParams:: | 1408 return data_reduction_proxy::DataReductionProxyParams:: |
1409 IsIncludedInQuicFieldTrial(); | 1409 IsIncludedInQuicFieldTrial(); |
1410 } | 1410 } |
1411 | 1411 |
1412 // static | 1412 // static |
1413 bool IOThread::ShouldDisableInsecureQuic( | 1413 bool IOThread::ShouldDisableInsecureQuic( |
1414 const VariationParameters& quic_trial_params) { | 1414 const VariationParameters& quic_trial_params) { |
1415 return LowerCaseEqualsASCII( | 1415 return base::LowerCaseEqualsASCII( |
1416 GetVariationParam(quic_trial_params, "disable_insecure_quic"), | 1416 GetVariationParam(quic_trial_params, "disable_insecure_quic"), |
1417 "true"); | 1417 "true"); |
1418 } | 1418 } |
1419 | 1419 |
1420 bool IOThread::ShouldEnableQuicPortSelection( | 1420 bool IOThread::ShouldEnableQuicPortSelection( |
1421 const base::CommandLine& command_line) { | 1421 const base::CommandLine& command_line) { |
1422 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1422 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
1423 return false; | 1423 return false; |
1424 | 1424 |
1425 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1425 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 "alternative_service_probability_threshold"), | 1475 "alternative_service_probability_threshold"), |
1476 &value)) { | 1476 &value)) { |
1477 return value; | 1477 return value; |
1478 } | 1478 } |
1479 return -1; | 1479 return -1; |
1480 } | 1480 } |
1481 | 1481 |
1482 // static | 1482 // static |
1483 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( | 1483 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
1484 const VariationParameters& quic_trial_params) { | 1484 const VariationParameters& quic_trial_params) { |
1485 return LowerCaseEqualsASCII( | 1485 return base::LowerCaseEqualsASCII( |
1486 GetVariationParam(quic_trial_params, | 1486 GetVariationParam(quic_trial_params, |
1487 "always_require_handshake_confirmation"), | 1487 "always_require_handshake_confirmation"), |
1488 "true"); | 1488 "true"); |
1489 } | 1489 } |
1490 | 1490 |
1491 // static | 1491 // static |
1492 bool IOThread::ShouldQuicDisableConnectionPooling( | 1492 bool IOThread::ShouldQuicDisableConnectionPooling( |
1493 const VariationParameters& quic_trial_params) { | 1493 const VariationParameters& quic_trial_params) { |
1494 return LowerCaseEqualsASCII( | 1494 return base::LowerCaseEqualsASCII( |
1495 GetVariationParam(quic_trial_params, "disable_connection_pooling"), | 1495 GetVariationParam(quic_trial_params, "disable_connection_pooling"), |
1496 "true"); | 1496 "true"); |
1497 } | 1497 } |
1498 | 1498 |
1499 // static | 1499 // static |
1500 float IOThread::GetQuicLoadServerInfoTimeoutSrttMultiplier( | 1500 float IOThread::GetQuicLoadServerInfoTimeoutSrttMultiplier( |
1501 const VariationParameters& quic_trial_params) { | 1501 const VariationParameters& quic_trial_params) { |
1502 double value; | 1502 double value; |
1503 if (base::StringToDouble(GetVariationParam(quic_trial_params, | 1503 if (base::StringToDouble(GetVariationParam(quic_trial_params, |
1504 "load_server_info_time_to_srtt"), | 1504 "load_server_info_time_to_srtt"), |
1505 &value)) { | 1505 &value)) { |
1506 return (float)value; | 1506 return (float)value; |
1507 } | 1507 } |
1508 return 0.0f; | 1508 return 0.0f; |
1509 } | 1509 } |
1510 | 1510 |
1511 // static | 1511 // static |
1512 bool IOThread::ShouldQuicEnableConnectionRacing( | 1512 bool IOThread::ShouldQuicEnableConnectionRacing( |
1513 const VariationParameters& quic_trial_params) { | 1513 const VariationParameters& quic_trial_params) { |
1514 return LowerCaseEqualsASCII( | 1514 return base::LowerCaseEqualsASCII( |
1515 GetVariationParam(quic_trial_params, "enable_connection_racing"), | 1515 GetVariationParam(quic_trial_params, "enable_connection_racing"), |
1516 "true"); | 1516 "true"); |
1517 } | 1517 } |
1518 | 1518 |
1519 // static | 1519 // static |
1520 bool IOThread::ShouldQuicEnableNonBlockingIO( | 1520 bool IOThread::ShouldQuicEnableNonBlockingIO( |
1521 const VariationParameters& quic_trial_params) { | 1521 const VariationParameters& quic_trial_params) { |
1522 return LowerCaseEqualsASCII( | 1522 return base::LowerCaseEqualsASCII( |
1523 GetVariationParam(quic_trial_params, "enable_non_blocking_io"), | 1523 GetVariationParam(quic_trial_params, "enable_non_blocking_io"), |
1524 "true"); | 1524 "true"); |
1525 } | 1525 } |
1526 | 1526 |
1527 // static | 1527 // static |
1528 bool IOThread::ShouldQuicDisableDiskCache( | 1528 bool IOThread::ShouldQuicDisableDiskCache( |
1529 const VariationParameters& quic_trial_params) { | 1529 const VariationParameters& quic_trial_params) { |
1530 return LowerCaseEqualsASCII( | 1530 return base::LowerCaseEqualsASCII( |
1531 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); | 1531 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); |
1532 } | 1532 } |
1533 | 1533 |
1534 // static | 1534 // static |
1535 int IOThread::GetQuicMaxNumberOfLossyConnections( | 1535 int IOThread::GetQuicMaxNumberOfLossyConnections( |
1536 const VariationParameters& quic_trial_params) { | 1536 const VariationParameters& quic_trial_params) { |
1537 int value; | 1537 int value; |
1538 if (base::StringToInt(GetVariationParam(quic_trial_params, | 1538 if (base::StringToInt(GetVariationParam(quic_trial_params, |
1539 "max_number_of_lossy_connections"), | 1539 "max_number_of_lossy_connections"), |
1540 &value)) { | 1540 &value)) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1607 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1608 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1608 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1609 net::QuicVersion version = supported_versions[i]; | 1609 net::QuicVersion version = supported_versions[i]; |
1610 if (net::QuicVersionToString(version) == quic_version) { | 1610 if (net::QuicVersionToString(version) == quic_version) { |
1611 return version; | 1611 return version; |
1612 } | 1612 } |
1613 } | 1613 } |
1614 | 1614 |
1615 return net::QUIC_VERSION_UNSUPPORTED; | 1615 return net::QUIC_VERSION_UNSUPPORTED; |
1616 } | 1616 } |
OLD | NEW |