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