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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index a8be562eed41749215eea52175cdf0b7f97c4b17..b8dda317216bb3cb71926fac76f54c22622c89bc 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -1102,6 +1102,8 @@
&params->parse_alternative_services);
globals.enable_alternative_service_with_different_host.CopyToIfSet(
&params->enable_alternative_service_with_different_host);
+ globals.alternative_service_probability_threshold.CopyToIfSet(
+ &params->alternative_service_probability_threshold);
globals.enable_npn.CopyToIfSet(&params->enable_npn);
@@ -1328,6 +1330,14 @@
globals->quic_supported_versions.set(supported_versions);
}
+ double threshold = GetAlternativeProtocolProbabilityThreshold(
+ command_line, quic_trial_params);
+ if (threshold >=0 && threshold <= 1) {
+ globals->alternative_service_probability_threshold.set(threshold);
+ globals->http_server_properties->SetAlternativeServiceProbabilityThreshold(
+ threshold);
+ }
+
if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) {
net::HostPortPair quic_origin =
net::HostPortPair::FromString(
@@ -1403,6 +1413,39 @@
}
return net::QuicUtils::ParseQuicConnectionOptions(it->second);
+}
+
+double IOThread::GetAlternativeProtocolProbabilityThreshold(
+ const base::CommandLine& command_line,
+ const VariationParameters& quic_trial_params) {
+ double value;
+ if (command_line.HasSwitch(
+ switches::kAlternativeServiceProbabilityThreshold)) {
+ if (base::StringToDouble(
+ command_line.GetSwitchValueASCII(
+ switches::kAlternativeServiceProbabilityThreshold),
+ &value)) {
+ return value;
+ }
+ }
+ if (command_line.HasSwitch(switches::kEnableQuic)) {
+ return 0;
+ }
+ // TODO(bnc): Remove when new parameter name rolls out and server
+ // configuration is changed.
+ if (base::StringToDouble(
+ GetVariationParam(quic_trial_params,
+ "alternate_protocol_probability_threshold"),
+ &value)) {
+ return value;
+ }
+ if (base::StringToDouble(
+ GetVariationParam(quic_trial_params,
+ "alternative_service_probability_threshold"),
+ &value)) {
+ return value;
+ }
+ return -1;
}
bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation(
« 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