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

Unified Diff: chrome/browser/io_thread.cc

Issue 339663010: Add a probability to Alternate-Protocol support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: eliminate static initializer Created 6 years, 5 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 | « chrome/browser/io_thread.h ('k') | chrome/browser/net/http_server_properties_manager.h » ('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 7c918c7d73ffab946e74f87e714365b06f58ad25..c494ee4580fcdae2c46a1650f2216773985f0121 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -871,9 +871,7 @@ void IOThread::EnableSpdy(const std::string& mode) {
} else if (option == kDisableAltProtocols) {
globals_->use_alternate_protocols.set(false);
} else if (option == kForceAltProtocols) {
- net::PortAlternateProtocolPair pair;
- pair.port = 443;
- pair.protocol = net::NPN_SPDY_3;
+ net::AlternateProtocolInfo pair(443, net::NPN_SPDY_3, 1);
net::HttpServerPropertiesImpl::ForceAlternateProtocol(pair);
} else if (option == kSingleDomain) {
DVLOG(1) << "FORCING SINGLE DOMAIN";
@@ -984,6 +982,8 @@ void IOThread::InitializeNetworkSessionParamsFromGlobals(
params->forced_spdy_exclusions = globals.forced_spdy_exclusions;
globals.use_alternate_protocols.CopyToIfSet(
&params->use_alternate_protocols);
+ globals.alternate_protocol_probability_threshold.CopyToIfSet(
+ &params->alternate_protocol_probability_threshold);
globals.enable_websocket_over_spdy.CopyToIfSet(
&params->enable_websocket_over_spdy);
@@ -1135,6 +1135,14 @@ void IOThread::ConfigureQuicGlobals(
globals->quic_supported_versions.set(supported_versions);
}
+ double threshold =
+ GetAlternateProtocolProbabilityThreshold(command_line, quic_trial_params);
+ if (threshold >=0 && threshold <= 1) {
+ globals->alternate_protocol_probability_threshold.set(threshold);
+ globals->http_server_properties->SetAlternateProtocolProbabilityThreshold(
+ threshold);
+ }
+
if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) {
net::HostPortPair quic_origin =
net::HostPortPair::FromString(
@@ -1202,6 +1210,7 @@ net::QuicTagVector IOThread::GetQuicConnectionOptions(
return ParseQuicConnectionOptions(it->second);
}
+// static
net::QuicTagVector IOThread::ParseQuicConnectionOptions(
const std::string& connection_options) {
net::QuicTagVector options;
@@ -1221,6 +1230,30 @@ net::QuicTagVector IOThread::ParseQuicConnectionOptions(
return options;
}
+// static
+double IOThread::GetAlternateProtocolProbabilityThreshold(
+ const base::CommandLine& command_line,
+ const VariationParameters& quic_trial_params) {
+ double value;
+ if (command_line.HasSwitch(
+ switches::kAlternateProtocolProbabilityThreshold)) {
+ if (base::StringToDouble(
+ command_line.GetSwitchValueASCII(
+ switches::kAlternateProtocolProbabilityThreshold),
+ &value)) {
+ return value;
+ }
+ }
+ if (base::StringToDouble(
+ GetVariationParam(quic_trial_params,
+ "alternate_protocol_probability_threshold"),
+ &value)) {
+ return value;
+ }
+ return -1;
+}
+
+// static
bool IOThread::ShouldEnableQuicTimeBasedLossDetection(
const CommandLine& command_line,
base::StringPiece quic_trial_group,
@@ -1240,6 +1273,7 @@ bool IOThread::ShouldEnableQuicTimeBasedLossDetection(
kQuicFieldTrialTimeBasedLossDetectionSuffix);
}
+// static
size_t IOThread::GetQuicMaxPacketLength(
const CommandLine& command_line,
base::StringPiece quic_trial_group,
@@ -1281,6 +1315,7 @@ size_t IOThread::GetQuicMaxPacketLength(
return value;
}
+// static
net::QuicVersion IOThread::GetQuicVersion(
const CommandLine& command_line,
const VariationParameters& quic_trial_params) {
@@ -1292,6 +1327,7 @@ net::QuicVersion IOThread::GetQuicVersion(
return ParseQuicVersion(GetVariationParam(quic_trial_params, "quic_version"));
}
+// static
net::QuicVersion IOThread::ParseQuicVersion(const std::string& quic_version) {
net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
for (size_t i = 0; i < supported_versions.size(); ++i) {
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/http_server_properties_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698