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

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

Issue 1271793003: Create alternative service field trial group. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it a QUIC parameter. Created 5 years, 3 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
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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 globals->next_protos.push_back(net::kProtoQUIC1SPDY3); 886 globals->next_protos.push_back(net::kProtoQUIC1SPDY3);
887 } 887 }
888 888
889 // No SPDY command-line flags have been specified. Examine trial groups. 889 // No SPDY command-line flags have been specified. Examine trial groups.
890 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { 890 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) {
891 net::HttpStreamFactory::set_spdy_enabled(false); 891 net::HttpStreamFactory::set_spdy_enabled(false);
892 return; 892 return;
893 } 893 }
894 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { 894 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) {
895 globals->next_protos.push_back(net::kProtoSPDY31); 895 globals->next_protos.push_back(net::kProtoSPDY31);
896 globals->use_alternative_services.set(true);
897 return; 896 return;
898 } 897 }
899 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { 898 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) {
900 globals->next_protos.push_back(net::kProtoSPDY31); 899 globals->next_protos.push_back(net::kProtoSPDY31);
901 globals->next_protos.push_back(net::kProtoHTTP2); 900 globals->next_protos.push_back(net::kProtoHTTP2);
902 globals->use_alternative_services.set(true);
903 return; 901 return;
904 } 902 }
905 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { 903 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) {
906 bool spdy_enabled = false; 904 bool spdy_enabled = false;
907 if (base::LowerCaseEqualsASCII( 905 if (base::LowerCaseEqualsASCII(
908 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { 906 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) {
909 globals->next_protos.push_back(net::kProtoSPDY31); 907 globals->next_protos.push_back(net::kProtoSPDY31);
910 spdy_enabled = true; 908 spdy_enabled = true;
911 } 909 }
912 if (base::LowerCaseEqualsASCII( 910 if (base::LowerCaseEqualsASCII(
913 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { 911 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) {
914 globals->next_protos.push_back(net::kProtoHTTP2); 912 globals->next_protos.push_back(net::kProtoHTTP2);
915 spdy_enabled = true; 913 spdy_enabled = true;
916 } 914 }
917 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with 915 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with
918 // globals->next_protos, can it be eliminated? 916 // globals->next_protos, can it be eliminated?
919 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); 917 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled);
920 globals->use_alternative_services.set(true);
921 return; 918 return;
922 } 919 }
923 920
924 // By default, enable HTTP/2. 921 // By default, enable HTTP/2.
925 globals->next_protos.push_back(net::kProtoSPDY31); 922 globals->next_protos.push_back(net::kProtoSPDY31);
926 globals->next_protos.push_back(net::kProtoHTTP2); 923 globals->next_protos.push_back(net::kProtoHTTP2);
927 globals->use_alternative_services.set(true);
928 } 924 }
929 925
930 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { 926 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {
931 registry->RegisterStringPref(prefs::kAuthSchemes, 927 registry->RegisterStringPref(prefs::kAuthSchemes,
932 "basic,digest,ntlm,negotiate"); 928 "basic,digest,ntlm,negotiate");
933 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); 929 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false);
934 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); 930 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
935 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); 931 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string());
936 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, 932 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist,
937 std::string()); 933 std::string());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 load_server_info_timeout_srtt_multiplier); 1152 load_server_info_timeout_srtt_multiplier);
1157 } 1153 }
1158 globals->quic_enable_connection_racing.set( 1154 globals->quic_enable_connection_racing.set(
1159 ShouldQuicEnableConnectionRacing(quic_trial_params)); 1155 ShouldQuicEnableConnectionRacing(quic_trial_params));
1160 globals->quic_enable_non_blocking_io.set( 1156 globals->quic_enable_non_blocking_io.set(
1161 ShouldQuicEnableNonBlockingIO(quic_trial_params)); 1157 ShouldQuicEnableNonBlockingIO(quic_trial_params));
1162 globals->quic_disable_disk_cache.set( 1158 globals->quic_disable_disk_cache.set(
1163 ShouldQuicDisableDiskCache(quic_trial_params)); 1159 ShouldQuicDisableDiskCache(quic_trial_params));
1164 globals->quic_prefer_aes.set( 1160 globals->quic_prefer_aes.set(
1165 ShouldQuicPreferAes(quic_trial_params)); 1161 ShouldQuicPreferAes(quic_trial_params));
1162 globals->use_alternative_services.set(
1163 ShouldQuicEnableAlternativeServices(quic_trial_params));
1166 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( 1164 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections(
1167 quic_trial_params); 1165 quic_trial_params);
1168 if (max_number_of_lossy_connections != 0) { 1166 if (max_number_of_lossy_connections != 0) {
1169 globals->quic_max_number_of_lossy_connections.set( 1167 globals->quic_max_number_of_lossy_connections.set(
1170 max_number_of_lossy_connections); 1168 max_number_of_lossy_connections);
1171 } 1169 }
1172 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); 1170 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params);
1173 if (packet_loss_threshold != 0) 1171 if (packet_loss_threshold != 0)
1174 globals->quic_packet_loss_threshold.set(packet_loss_threshold); 1172 globals->quic_packet_loss_threshold.set(packet_loss_threshold);
1175 globals->enable_quic_port_selection.set( 1173 globals->enable_quic_port_selection.set(
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 return base::LowerCaseEqualsASCII( 1364 return base::LowerCaseEqualsASCII(
1367 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); 1365 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true");
1368 } 1366 }
1369 1367
1370 bool IOThread::ShouldQuicPreferAes( 1368 bool IOThread::ShouldQuicPreferAes(
1371 const VariationParameters& quic_trial_params) { 1369 const VariationParameters& quic_trial_params) {
1372 return base::LowerCaseEqualsASCII( 1370 return base::LowerCaseEqualsASCII(
1373 GetVariationParam(quic_trial_params, "prefer_aes"), "true"); 1371 GetVariationParam(quic_trial_params, "prefer_aes"), "true");
1374 } 1372 }
1375 1373
1374 bool IOThread::ShouldQuicEnableAlternativeServices(
1375 const VariationParameters& quic_trial_params) {
1376 return base::LowerCaseEqualsASCII(
1377 GetVariationParam(quic_trial_params, "use_alternative_services"), "true");
1378 }
1379
1376 int IOThread::GetQuicMaxNumberOfLossyConnections( 1380 int IOThread::GetQuicMaxNumberOfLossyConnections(
1377 const VariationParameters& quic_trial_params) { 1381 const VariationParameters& quic_trial_params) {
1378 int value; 1382 int value;
1379 if (base::StringToInt(GetVariationParam(quic_trial_params, 1383 if (base::StringToInt(GetVariationParam(quic_trial_params,
1380 "max_number_of_lossy_connections"), 1384 "max_number_of_lossy_connections"),
1381 &value)) { 1385 &value)) {
1382 return value; 1386 return value;
1383 } 1387 }
1384 return 0; 1388 return 0;
1385 } 1389 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); 1578 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass();
1575 1579
1576 context->set_job_factory( 1580 context->set_job_factory(
1577 globals->proxy_script_fetcher_url_request_job_factory.get()); 1581 globals->proxy_script_fetcher_url_request_job_factory.get());
1578 1582
1579 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1583 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1580 // system URLRequestContext too. There's no reason this should be tied to a 1584 // system URLRequestContext too. There's no reason this should be tied to a
1581 // profile. 1585 // profile.
1582 return context; 1586 return context;
1583 } 1587 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698