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

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

Issue 1091283007: Rename methods and members and const variables to alternative service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change command line flag. Created 5 years, 8 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 | « chrome/browser/io_thread.h ('k') | 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 <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return group_name == "RequirementEnforced"; 320 return group_name == "RequirementEnforced";
321 } 321 }
322 322
323 // Parse kUseSpdy command line flag options, which may contain the following: 323 // Parse kUseSpdy command line flag options, which may contain the following:
324 // 324 //
325 // "off" : Disables SPDY support entirely. 325 // "off" : Disables SPDY support entirely.
326 // "no-ping" : Disables SPDY ping connection testing. 326 // "no-ping" : Disables SPDY ping connection testing.
327 // "exclude=<host>" : Disables SPDY support for the host <host>. 327 // "exclude=<host>" : Disables SPDY support for the host <host>.
328 // "no-compress" : Disables SPDY header compression. 328 // "no-compress" : Disables SPDY header compression.
329 // "no-alt-protocols : Disables alternate protocol support. 329 // "no-alt-protocols : Disables alternate protocol support.
330 // "force-alt-protocols : Forces an alternate protocol of SPDY/3
331 // on port 443.
332 // "init-max-streams=<limit>" : Specifies the maximum number of concurrent 330 // "init-max-streams=<limit>" : Specifies the maximum number of concurrent
333 // streams for a SPDY session, unless the 331 // streams for a SPDY session, unless the
334 // specifies a different value via SETTINGS. 332 // specifies a different value via SETTINGS.
335 void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode, 333 void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode,
336 IOThread::Globals* globals) { 334 IOThread::Globals* globals) {
337 static const char kOff[] = "off"; 335 static const char kOff[] = "off";
338 static const char kDisablePing[] = "no-ping"; 336 static const char kDisablePing[] = "no-ping";
339 static const char kExclude[] = "exclude"; // Hosts to exclude 337 static const char kExclude[] = "exclude"; // Hosts to exclude
340 static const char kDisableCompression[] = "no-compress"; 338 static const char kDisableCompression[] = "no-compress";
341 static const char kDisableAltProtocols[] = "no-alt-protocols"; 339 static const char kDisableAltProtocols[] = "no-alt-protocols";
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 &params->enable_spdy_compression); 1150 &params->enable_spdy_compression);
1153 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( 1151 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet(
1154 &params->enable_spdy_ping_based_connection_checking); 1152 &params->enable_spdy_ping_based_connection_checking);
1155 globals.spdy_default_protocol.CopyToIfSet( 1153 globals.spdy_default_protocol.CopyToIfSet(
1156 &params->spdy_default_protocol); 1154 &params->spdy_default_protocol);
1157 params->next_protos = globals.next_protos; 1155 params->next_protos = globals.next_protos;
1158 globals.trusted_spdy_proxy.CopyToIfSet(&params->trusted_spdy_proxy); 1156 globals.trusted_spdy_proxy.CopyToIfSet(&params->trusted_spdy_proxy);
1159 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; 1157 params->forced_spdy_exclusions = globals.forced_spdy_exclusions;
1160 globals.use_alternate_protocols.CopyToIfSet( 1158 globals.use_alternate_protocols.CopyToIfSet(
1161 &params->use_alternate_protocols); 1159 &params->use_alternate_protocols);
1162 globals.alternate_protocol_probability_threshold.CopyToIfSet( 1160 globals.alternative_service_probability_threshold.CopyToIfSet(
1163 &params->alternate_protocol_probability_threshold); 1161 &params->alternative_service_probability_threshold);
1164 1162
1165 globals.enable_quic.CopyToIfSet(&params->enable_quic); 1163 globals.enable_quic.CopyToIfSet(&params->enable_quic);
1166 globals.enable_quic_for_proxies.CopyToIfSet(&params->enable_quic_for_proxies); 1164 globals.enable_quic_for_proxies.CopyToIfSet(&params->enable_quic_for_proxies);
1167 globals.quic_always_require_handshake_confirmation.CopyToIfSet( 1165 globals.quic_always_require_handshake_confirmation.CopyToIfSet(
1168 &params->quic_always_require_handshake_confirmation); 1166 &params->quic_always_require_handshake_confirmation);
1169 globals.quic_disable_connection_pooling.CopyToIfSet( 1167 globals.quic_disable_connection_pooling.CopyToIfSet(
1170 &params->quic_disable_connection_pooling); 1168 &params->quic_disable_connection_pooling);
1171 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( 1169 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet(
1172 &params->quic_load_server_info_timeout_srtt_multiplier); 1170 &params->quic_load_server_info_timeout_srtt_multiplier);
1173 globals.quic_enable_connection_racing.CopyToIfSet( 1171 globals.quic_enable_connection_racing.CopyToIfSet(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 quic_user_agent_id.append(version_info.ProductNameAndVersionForUserAgent()); 1346 quic_user_agent_id.append(version_info.ProductNameAndVersionForUserAgent());
1349 globals->quic_user_agent_id.set(quic_user_agent_id); 1347 globals->quic_user_agent_id.set(quic_user_agent_id);
1350 1348
1351 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); 1349 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params);
1352 if (version != net::QUIC_VERSION_UNSUPPORTED) { 1350 if (version != net::QUIC_VERSION_UNSUPPORTED) {
1353 net::QuicVersionVector supported_versions; 1351 net::QuicVersionVector supported_versions;
1354 supported_versions.push_back(version); 1352 supported_versions.push_back(version);
1355 globals->quic_supported_versions.set(supported_versions); 1353 globals->quic_supported_versions.set(supported_versions);
1356 } 1354 }
1357 1355
1358 double threshold = 1356 double threshold = GetAlternativeProtocolProbabilityThreshold(
1359 GetAlternateProtocolProbabilityThreshold(command_line, quic_trial_params); 1357 command_line, quic_trial_params);
1360 if (threshold >=0 && threshold <= 1) { 1358 if (threshold >=0 && threshold <= 1) {
1361 globals->alternate_protocol_probability_threshold.set(threshold); 1359 globals->alternative_service_probability_threshold.set(threshold);
1362 globals->http_server_properties->SetAlternateProtocolProbabilityThreshold( 1360 globals->http_server_properties->SetAlternativeServiceProbabilityThreshold(
1363 threshold); 1361 threshold);
1364 } 1362 }
1365 1363
1366 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { 1364 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) {
1367 net::HostPortPair quic_origin = 1365 net::HostPortPair quic_origin =
1368 net::HostPortPair::FromString( 1366 net::HostPortPair::FromString(
1369 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); 1367 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn));
1370 if (!quic_origin.IsEmpty()) { 1368 if (!quic_origin.IsEmpty()) {
1371 globals->origin_to_force_quic_on.set(quic_origin); 1369 globals->origin_to_force_quic_on.set(quic_origin);
1372 } 1370 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 VariationParameters::const_iterator it = 1438 VariationParameters::const_iterator it =
1441 quic_trial_params.find("connection_options"); 1439 quic_trial_params.find("connection_options");
1442 if (it == quic_trial_params.end()) { 1440 if (it == quic_trial_params.end()) {
1443 return net::QuicTagVector(); 1441 return net::QuicTagVector();
1444 } 1442 }
1445 1443
1446 return net::QuicUtils::ParseQuicConnectionOptions(it->second); 1444 return net::QuicUtils::ParseQuicConnectionOptions(it->second);
1447 } 1445 }
1448 1446
1449 // static 1447 // static
1450 double IOThread::GetAlternateProtocolProbabilityThreshold( 1448 double IOThread::GetAlternativeProtocolProbabilityThreshold(
1451 const base::CommandLine& command_line, 1449 const base::CommandLine& command_line,
1452 const VariationParameters& quic_trial_params) { 1450 const VariationParameters& quic_trial_params) {
1453 double value; 1451 double value;
1454 if (command_line.HasSwitch( 1452 if (command_line.HasSwitch(
1455 switches::kAlternateProtocolProbabilityThreshold)) { 1453 switches::kAlternativeServiceProbabilityThreshold)) {
1456 if (base::StringToDouble( 1454 if (base::StringToDouble(
1457 command_line.GetSwitchValueASCII( 1455 command_line.GetSwitchValueASCII(
1458 switches::kAlternateProtocolProbabilityThreshold), 1456 switches::kAlternativeServiceProbabilityThreshold),
1459 &value)) { 1457 &value)) {
1460 return value; 1458 return value;
1461 } 1459 }
1462 } 1460 }
1463 if (command_line.HasSwitch(switches::kEnableQuic)) { 1461 if (command_line.HasSwitch(switches::kEnableQuic)) {
1464 return 0; 1462 return 0;
1465 } 1463 }
1464 // TODO(bnc): Remove when new parameter name rolls out and server
1465 // configuration is changed.
1466 if (base::StringToDouble( 1466 if (base::StringToDouble(
1467 GetVariationParam(quic_trial_params, 1467 GetVariationParam(quic_trial_params,
1468 "alternate_protocol_probability_threshold"), 1468 "alternate_protocol_probability_threshold"),
1469 &value)) { 1469 &value)) {
1470 return value; 1470 return value;
1471 } 1471 }
1472 if (base::StringToDouble(
1473 GetVariationParam(quic_trial_params,
1474 "alternative_service_probability_threshold"),
1475 &value)) {
1476 return value;
1477 }
1472 return -1; 1478 return -1;
1473 } 1479 }
1474 1480
1475 // static 1481 // static
1476 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( 1482 bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation(
1477 const VariationParameters& quic_trial_params) { 1483 const VariationParameters& quic_trial_params) {
1478 return LowerCaseEqualsASCII( 1484 return LowerCaseEqualsASCII(
1479 GetVariationParam(quic_trial_params, 1485 GetVariationParam(quic_trial_params,
1480 "always_require_handshake_confirmation"), 1486 "always_require_handshake_confirmation"),
1481 "true"); 1487 "true");
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1606 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1601 for (size_t i = 0; i < supported_versions.size(); ++i) { 1607 for (size_t i = 0; i < supported_versions.size(); ++i) {
1602 net::QuicVersion version = supported_versions[i]; 1608 net::QuicVersion version = supported_versions[i];
1603 if (net::QuicVersionToString(version) == quic_version) { 1609 if (net::QuicVersionToString(version) == quic_version) {
1604 return version; 1610 return version;
1605 } 1611 }
1606 } 1612 }
1607 1613
1608 return net::QUIC_VERSION_UNSUPPORTED; 1614 return net::QUIC_VERSION_UNSUPPORTED;
1609 } 1615 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698