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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 ¶ms->enable_tcp_fast_open_for_ssl); | 1095 ¶ms->enable_tcp_fast_open_for_ssl); |
1096 | 1096 |
1097 globals.spdy_default_protocol.CopyToIfSet( | 1097 globals.spdy_default_protocol.CopyToIfSet( |
1098 ¶ms->spdy_default_protocol); | 1098 ¶ms->spdy_default_protocol); |
1099 globals.enable_spdy31.CopyToIfSet(¶ms->enable_spdy31); | 1099 globals.enable_spdy31.CopyToIfSet(¶ms->enable_spdy31); |
1100 globals.enable_http2.CopyToIfSet(¶ms->enable_http2); | 1100 globals.enable_http2.CopyToIfSet(¶ms->enable_http2); |
1101 globals.parse_alternative_services.CopyToIfSet( | 1101 globals.parse_alternative_services.CopyToIfSet( |
1102 ¶ms->parse_alternative_services); | 1102 ¶ms->parse_alternative_services); |
1103 globals.enable_alternative_service_with_different_host.CopyToIfSet( | 1103 globals.enable_alternative_service_with_different_host.CopyToIfSet( |
1104 ¶ms->enable_alternative_service_with_different_host); | 1104 ¶ms->enable_alternative_service_with_different_host); |
1105 globals.alternative_service_probability_threshold.CopyToIfSet( | |
1106 ¶ms->alternative_service_probability_threshold); | |
1107 | 1105 |
1108 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 1106 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
1109 | 1107 |
1110 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); | 1108 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); |
1111 | 1109 |
1112 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1110 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1113 globals.disable_quic_on_timeout_with_open_streams.CopyToIfSet( | 1111 globals.disable_quic_on_timeout_with_open_streams.CopyToIfSet( |
1114 ¶ms->disable_quic_on_timeout_with_open_streams); | 1112 ¶ms->disable_quic_on_timeout_with_open_streams); |
1115 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1113 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
1116 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1114 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 quic_user_agent_id.append(content::BuildOSCpuInfo()); | 1321 quic_user_agent_id.append(content::BuildOSCpuInfo()); |
1324 globals->quic_user_agent_id.set(quic_user_agent_id); | 1322 globals->quic_user_agent_id.set(quic_user_agent_id); |
1325 | 1323 |
1326 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); | 1324 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); |
1327 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 1325 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
1328 net::QuicVersionVector supported_versions; | 1326 net::QuicVersionVector supported_versions; |
1329 supported_versions.push_back(version); | 1327 supported_versions.push_back(version); |
1330 globals->quic_supported_versions.set(supported_versions); | 1328 globals->quic_supported_versions.set(supported_versions); |
1331 } | 1329 } |
1332 | 1330 |
1333 double threshold = GetAlternativeProtocolProbabilityThreshold( | |
1334 command_line, quic_trial_params); | |
1335 if (threshold >=0 && threshold <= 1) { | |
1336 globals->alternative_service_probability_threshold.set(threshold); | |
1337 globals->http_server_properties->SetAlternativeServiceProbabilityThreshold( | |
1338 threshold); | |
1339 } | |
1340 | |
1341 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | 1331 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { |
1342 net::HostPortPair quic_origin = | 1332 net::HostPortPair quic_origin = |
1343 net::HostPortPair::FromString( | 1333 net::HostPortPair::FromString( |
1344 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); | 1334 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); |
1345 if (!quic_origin.IsEmpty()) { | 1335 if (!quic_origin.IsEmpty()) { |
1346 globals->origin_to_force_quic_on.set(quic_origin); | 1336 globals->origin_to_force_quic_on.set(quic_origin); |
1347 } | 1337 } |
1348 } | 1338 } |
1349 } | 1339 } |
1350 | 1340 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 | 1398 |
1409 VariationParameters::const_iterator it = | 1399 VariationParameters::const_iterator it = |
1410 quic_trial_params.find("connection_options"); | 1400 quic_trial_params.find("connection_options"); |
1411 if (it == quic_trial_params.end()) { | 1401 if (it == quic_trial_params.end()) { |
1412 return net::QuicTagVector(); | 1402 return net::QuicTagVector(); |
1413 } | 1403 } |
1414 | 1404 |
1415 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | 1405 return net::QuicUtils::ParseQuicConnectionOptions(it->second); |
1416 } | 1406 } |
1417 | 1407 |
1418 double IOThread::GetAlternativeProtocolProbabilityThreshold( | |
1419 const base::CommandLine& command_line, | |
1420 const VariationParameters& quic_trial_params) { | |
1421 double value; | |
1422 if (command_line.HasSwitch( | |
1423 switches::kAlternativeServiceProbabilityThreshold)) { | |
1424 if (base::StringToDouble( | |
1425 command_line.GetSwitchValueASCII( | |
1426 switches::kAlternativeServiceProbabilityThreshold), | |
1427 &value)) { | |
1428 return value; | |
1429 } | |
1430 } | |
1431 if (command_line.HasSwitch(switches::kEnableQuic)) { | |
1432 return 0; | |
1433 } | |
1434 // TODO(bnc): Remove when new parameter name rolls out and server | |
1435 // configuration is changed. | |
1436 if (base::StringToDouble( | |
1437 GetVariationParam(quic_trial_params, | |
1438 "alternate_protocol_probability_threshold"), | |
1439 &value)) { | |
1440 return value; | |
1441 } | |
1442 if (base::StringToDouble( | |
1443 GetVariationParam(quic_trial_params, | |
1444 "alternative_service_probability_threshold"), | |
1445 &value)) { | |
1446 return value; | |
1447 } | |
1448 return -1; | |
1449 } | |
1450 | |
1451 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( | 1408 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
1452 const VariationParameters& quic_trial_params) { | 1409 const VariationParameters& quic_trial_params) { |
1453 return base::LowerCaseEqualsASCII( | 1410 return base::LowerCaseEqualsASCII( |
1454 GetVariationParam(quic_trial_params, | 1411 GetVariationParam(quic_trial_params, |
1455 "always_require_handshake_confirmation"), | 1412 "always_require_handshake_confirmation"), |
1456 "true"); | 1413 "true"); |
1457 } | 1414 } |
1458 | 1415 |
1459 bool IOThread::ShouldQuicDisableConnectionPooling( | 1416 bool IOThread::ShouldQuicDisableConnectionPooling( |
1460 const VariationParameters& quic_trial_params) { | 1417 const VariationParameters& quic_trial_params) { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 std::move(job_factory); | 1740 std::move(job_factory); |
1784 | 1741 |
1785 context->set_job_factory( | 1742 context->set_job_factory( |
1786 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1743 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1787 | 1744 |
1788 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1745 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1789 // system URLRequestContext too. There's no reason this should be tied to a | 1746 // system URLRequestContext too. There's no reason this should be tied to a |
1790 // profile. | 1747 // profile. |
1791 return context; | 1748 return context; |
1792 } | 1749 } |
OLD | NEW |