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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 return group_name == "RequirementEnforced"; | 320 return group_name == "RequirementEnforced"; |
321 } | 321 } |
322 | 322 |
323 // Parse kUseSpdy command line flag options, which may contain the following: | 323 // Parse kUseSpdy command line flag options, which may contain the following: |
324 // | 324 // |
325 // "off" : Disables SPDY support entirely. | 325 // "off" : Disables SPDY support entirely. |
326 // "no-ping" : Disables SPDY ping connection testing. | 326 // "no-ping" : Disables SPDY ping connection testing. |
327 // "exclude=<host>" : Disables SPDY support for the host <host>. | 327 // "exclude=<host>" : Disables SPDY support for the host <host>. |
328 // "no-compress" : Disables SPDY header compression. | 328 // "no-compress" : Disables SPDY header compression. |
329 // "no-alt-protocols : Disables alternate protocol support. | 329 // "no-alt-protocols : Disables alternate protocol support. |
330 // "force-alt-protocols : Forces an alternate protocol of SPDY/3 | |
331 // on port 443. | |
332 // "init-max-streams=<limit>" : Specifies the maximum number of concurrent | 330 // "init-max-streams=<limit>" : Specifies the maximum number of concurrent |
333 // streams for a SPDY session, unless the | 331 // streams for a SPDY session, unless the |
334 // specifies a different value via SETTINGS. | 332 // specifies a different value via SETTINGS. |
335 void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode, | 333 void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode, |
336 IOThread::Globals* globals) { | 334 IOThread::Globals* globals) { |
337 static const char kOff[] = "off"; | 335 static const char kOff[] = "off"; |
338 static const char kDisablePing[] = "no-ping"; | 336 static const char kDisablePing[] = "no-ping"; |
339 static const char kExclude[] = "exclude"; // Hosts to exclude | 337 static const char kExclude[] = "exclude"; // Hosts to exclude |
340 static const char kDisableCompression[] = "no-compress"; | 338 static const char kDisableCompression[] = "no-compress"; |
341 static const char kDisableAltProtocols[] = "no-alt-protocols"; | 339 static const char kDisableAltProtocols[] = "no-alt-protocols"; |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 ¶ms->enable_spdy_compression); | 1150 ¶ms->enable_spdy_compression); |
1153 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( | 1151 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( |
1154 ¶ms->enable_spdy_ping_based_connection_checking); | 1152 ¶ms->enable_spdy_ping_based_connection_checking); |
1155 globals.spdy_default_protocol.CopyToIfSet( | 1153 globals.spdy_default_protocol.CopyToIfSet( |
1156 ¶ms->spdy_default_protocol); | 1154 ¶ms->spdy_default_protocol); |
1157 params->next_protos = globals.next_protos; | 1155 params->next_protos = globals.next_protos; |
1158 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1156 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
1159 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1157 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
1160 globals.use_alternate_protocols.CopyToIfSet( | 1158 globals.use_alternate_protocols.CopyToIfSet( |
1161 ¶ms->use_alternate_protocols); | 1159 ¶ms->use_alternate_protocols); |
1162 globals.alternate_protocol_probability_threshold.CopyToIfSet( | 1160 globals.alternative_service_probability_threshold.CopyToIfSet( |
1163 ¶ms->alternate_protocol_probability_threshold); | 1161 ¶ms->alternative_service_probability_threshold); |
1164 | 1162 |
1165 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1163 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1166 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1164 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
1167 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1165 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
1168 ¶ms->quic_always_require_handshake_confirmation); | 1166 ¶ms->quic_always_require_handshake_confirmation); |
1169 globals.quic_disable_connection_pooling.CopyToIfSet( | 1167 globals.quic_disable_connection_pooling.CopyToIfSet( |
1170 ¶ms->quic_disable_connection_pooling); | 1168 ¶ms->quic_disable_connection_pooling); |
1171 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1169 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
1172 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1170 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
1173 globals.quic_enable_connection_racing.CopyToIfSet( | 1171 globals.quic_enable_connection_racing.CopyToIfSet( |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 quic_user_agent_id.append(version_info.ProductNameAndVersionForUserAgent()); | 1346 quic_user_agent_id.append(version_info.ProductNameAndVersionForUserAgent()); |
1349 globals->quic_user_agent_id.set(quic_user_agent_id); | 1347 globals->quic_user_agent_id.set(quic_user_agent_id); |
1350 | 1348 |
1351 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); | 1349 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); |
1352 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 1350 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
1353 net::QuicVersionVector supported_versions; | 1351 net::QuicVersionVector supported_versions; |
1354 supported_versions.push_back(version); | 1352 supported_versions.push_back(version); |
1355 globals->quic_supported_versions.set(supported_versions); | 1353 globals->quic_supported_versions.set(supported_versions); |
1356 } | 1354 } |
1357 | 1355 |
1358 double threshold = | 1356 double threshold = GetAlternativeProtocolProbabilityThreshold( |
1359 GetAlternateProtocolProbabilityThreshold(command_line, quic_trial_params); | 1357 command_line, quic_trial_params); |
1360 if (threshold >=0 && threshold <= 1) { | 1358 if (threshold >=0 && threshold <= 1) { |
1361 globals->alternate_protocol_probability_threshold.set(threshold); | 1359 globals->alternative_service_probability_threshold.set(threshold); |
1362 globals->http_server_properties->SetAlternateProtocolProbabilityThreshold( | 1360 globals->http_server_properties->SetAlternativeServiceProbabilityThreshold( |
1363 threshold); | 1361 threshold); |
1364 } | 1362 } |
1365 | 1363 |
1366 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | 1364 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { |
1367 net::HostPortPair quic_origin = | 1365 net::HostPortPair quic_origin = |
1368 net::HostPortPair::FromString( | 1366 net::HostPortPair::FromString( |
1369 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); | 1367 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); |
1370 if (!quic_origin.IsEmpty()) { | 1368 if (!quic_origin.IsEmpty()) { |
1371 globals->origin_to_force_quic_on.set(quic_origin); | 1369 globals->origin_to_force_quic_on.set(quic_origin); |
1372 } | 1370 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 VariationParameters::const_iterator it = | 1438 VariationParameters::const_iterator it = |
1441 quic_trial_params.find("connection_options"); | 1439 quic_trial_params.find("connection_options"); |
1442 if (it == quic_trial_params.end()) { | 1440 if (it == quic_trial_params.end()) { |
1443 return net::QuicTagVector(); | 1441 return net::QuicTagVector(); |
1444 } | 1442 } |
1445 | 1443 |
1446 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | 1444 return net::QuicUtils::ParseQuicConnectionOptions(it->second); |
1447 } | 1445 } |
1448 | 1446 |
1449 // static | 1447 // static |
1450 double IOThread::GetAlternateProtocolProbabilityThreshold( | 1448 double IOThread::GetAlternativeProtocolProbabilityThreshold( |
1451 const base::CommandLine& command_line, | 1449 const base::CommandLine& command_line, |
1452 const VariationParameters& quic_trial_params) { | 1450 const VariationParameters& quic_trial_params) { |
1453 double value; | 1451 double value; |
1454 if (command_line.HasSwitch( | 1452 if (command_line.HasSwitch( |
1455 switches::kAlternateProtocolProbabilityThreshold)) { | 1453 switches::kAlternativeServiceProbabilityThreshold)) { |
1456 if (base::StringToDouble( | 1454 if (base::StringToDouble( |
1457 command_line.GetSwitchValueASCII( | 1455 command_line.GetSwitchValueASCII( |
1458 switches::kAlternateProtocolProbabilityThreshold), | 1456 switches::kAlternativeServiceProbabilityThreshold), |
1459 &value)) { | 1457 &value)) { |
1460 return value; | 1458 return value; |
1461 } | 1459 } |
1462 } | 1460 } |
1463 if (command_line.HasSwitch(switches::kEnableQuic)) { | 1461 if (command_line.HasSwitch(switches::kEnableQuic)) { |
1464 return 0; | 1462 return 0; |
1465 } | 1463 } |
1466 if (base::StringToDouble( | 1464 if (base::StringToDouble( |
1467 GetVariationParam(quic_trial_params, | 1465 GetVariationParam(quic_trial_params, |
1468 "alternate_protocol_probability_threshold"), | 1466 "alternative_service_probability_threshold"), |
1469 &value)) { | 1467 &value)) { |
1470 return value; | 1468 return value; |
1471 } | 1469 } |
1472 return -1; | 1470 return -1; |
1473 } | 1471 } |
1474 | 1472 |
1475 // static | 1473 // static |
1476 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( | 1474 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
1477 const VariationParameters& quic_trial_params) { | 1475 const VariationParameters& quic_trial_params) { |
1478 return LowerCaseEqualsASCII( | 1476 return LowerCaseEqualsASCII( |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1598 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1601 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1599 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1602 net::QuicVersion version = supported_versions[i]; | 1600 net::QuicVersion version = supported_versions[i]; |
1603 if (net::QuicVersionToString(version) == quic_version) { | 1601 if (net::QuicVersionToString(version) == quic_version) { |
1604 return version; | 1602 return version; |
1605 } | 1603 } |
1606 } | 1604 } |
1607 | 1605 |
1608 return net::QUIC_VERSION_UNSUPPORTED; | 1606 return net::QUIC_VERSION_UNSUPPORTED; |
1609 } | 1607 } |
OLD | NEW |