Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 1773853003: Revert of Remove support for Alt-Svc/Alternate Protocol Probability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
1095 &params->enable_tcp_fast_open_for_ssl); 1095 &params->enable_tcp_fast_open_for_ssl);
1096 1096
1097 globals.spdy_default_protocol.CopyToIfSet( 1097 globals.spdy_default_protocol.CopyToIfSet(
1098 &params->spdy_default_protocol); 1098 &params->spdy_default_protocol);
1099 globals.enable_spdy31.CopyToIfSet(&params->enable_spdy31); 1099 globals.enable_spdy31.CopyToIfSet(&params->enable_spdy31);
1100 globals.enable_http2.CopyToIfSet(&params->enable_http2); 1100 globals.enable_http2.CopyToIfSet(&params->enable_http2);
1101 globals.parse_alternative_services.CopyToIfSet( 1101 globals.parse_alternative_services.CopyToIfSet(
1102 &params->parse_alternative_services); 1102 &params->parse_alternative_services);
1103 globals.enable_alternative_service_with_different_host.CopyToIfSet( 1103 globals.enable_alternative_service_with_different_host.CopyToIfSet(
1104 &params->enable_alternative_service_with_different_host); 1104 &params->enable_alternative_service_with_different_host);
1105 globals.alternative_service_probability_threshold.CopyToIfSet(
1106 &params->alternative_service_probability_threshold);
1105 1107
1106 globals.enable_npn.CopyToIfSet(&params->enable_npn); 1108 globals.enable_npn.CopyToIfSet(&params->enable_npn);
1107 1109
1108 globals.enable_brotli.CopyToIfSet(&params->enable_brotli); 1110 globals.enable_brotli.CopyToIfSet(&params->enable_brotli);
1109 1111
1110 globals.enable_quic.CopyToIfSet(&params->enable_quic); 1112 globals.enable_quic.CopyToIfSet(&params->enable_quic);
1111 globals.disable_quic_on_timeout_with_open_streams.CopyToIfSet( 1113 globals.disable_quic_on_timeout_with_open_streams.CopyToIfSet(
1112 &params->disable_quic_on_timeout_with_open_streams); 1114 &params->disable_quic_on_timeout_with_open_streams);
1113 globals.enable_quic_for_proxies.CopyToIfSet(&params->enable_quic_for_proxies); 1115 globals.enable_quic_for_proxies.CopyToIfSet(&params->enable_quic_for_proxies);
1114 globals.quic_always_require_handshake_confirmation.CopyToIfSet( 1116 globals.quic_always_require_handshake_confirmation.CopyToIfSet(
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 quic_user_agent_id.append(content::BuildOSCpuInfo()); 1323 quic_user_agent_id.append(content::BuildOSCpuInfo());
1322 globals->quic_user_agent_id.set(quic_user_agent_id); 1324 globals->quic_user_agent_id.set(quic_user_agent_id);
1323 1325
1324 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); 1326 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params);
1325 if (version != net::QUIC_VERSION_UNSUPPORTED) { 1327 if (version != net::QUIC_VERSION_UNSUPPORTED) {
1326 net::QuicVersionVector supported_versions; 1328 net::QuicVersionVector supported_versions;
1327 supported_versions.push_back(version); 1329 supported_versions.push_back(version);
1328 globals->quic_supported_versions.set(supported_versions); 1330 globals->quic_supported_versions.set(supported_versions);
1329 } 1331 }
1330 1332
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
1331 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { 1341 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) {
1332 net::HostPortPair quic_origin = 1342 net::HostPortPair quic_origin =
1333 net::HostPortPair::FromString( 1343 net::HostPortPair::FromString(
1334 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); 1344 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn));
1335 if (!quic_origin.IsEmpty()) { 1345 if (!quic_origin.IsEmpty()) {
1336 globals->origin_to_force_quic_on.set(quic_origin); 1346 globals->origin_to_force_quic_on.set(quic_origin);
1337 } 1347 }
1338 } 1348 }
1339 } 1349 }
1340 1350
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 1408
1399 VariationParameters::const_iterator it = 1409 VariationParameters::const_iterator it =
1400 quic_trial_params.find("connection_options"); 1410 quic_trial_params.find("connection_options");
1401 if (it == quic_trial_params.end()) { 1411 if (it == quic_trial_params.end()) {
1402 return net::QuicTagVector(); 1412 return net::QuicTagVector();
1403 } 1413 }
1404 1414
1405 return net::QuicUtils::ParseQuicConnectionOptions(it->second); 1415 return net::QuicUtils::ParseQuicConnectionOptions(it->second);
1406 } 1416 }
1407 1417
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
1408 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( 1451 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation(
1409 const VariationParameters& quic_trial_params) { 1452 const VariationParameters& quic_trial_params) {
1410 return base::LowerCaseEqualsASCII( 1453 return base::LowerCaseEqualsASCII(
1411 GetVariationParam(quic_trial_params, 1454 GetVariationParam(quic_trial_params,
1412 "always_require_handshake_confirmation"), 1455 "always_require_handshake_confirmation"),
1413 "true"); 1456 "true");
1414 } 1457 }
1415 1458
1416 bool IOThread::ShouldQuicDisableConnectionPooling( 1459 bool IOThread::ShouldQuicDisableConnectionPooling(
1417 const VariationParameters& quic_trial_params) { 1460 const VariationParameters& quic_trial_params) {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 std::move(job_factory); 1783 std::move(job_factory);
1741 1784
1742 context->set_job_factory( 1785 context->set_job_factory(
1743 globals->proxy_script_fetcher_url_request_job_factory.get()); 1786 globals->proxy_script_fetcher_url_request_job_factory.get());
1744 1787
1745 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1788 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1746 // system URLRequestContext too. There's no reason this should be tied to a 1789 // system URLRequestContext too. There's no reason this should be tied to a
1747 // profile. 1790 // profile.
1748 return context; 1791 return context;
1749 } 1792 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698