OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/common/chrome_content_client.h" | 43 #include "chrome/common/chrome_content_client.h" |
44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
47 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 47 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
48 #include "components/data_usage/core/data_use_aggregator.h" | 48 #include "components/data_usage/core/data_use_aggregator.h" |
49 #include "components/data_usage/core/data_use_amortizer.h" | 49 #include "components/data_usage/core/data_use_amortizer.h" |
50 #include "components/data_usage/core/data_use_annotator.h" | 50 #include "components/data_usage/core/data_use_annotator.h" |
51 #include "components/metrics/metrics_service.h" | 51 #include "components/metrics/metrics_service.h" |
52 #include "components/net_log/chrome_net_log.h" | 52 #include "components/net_log/chrome_net_log.h" |
| 53 #include "components/network_session_configurator/network_session_configurator.h
" |
53 #include "components/policy/core/common/policy_service.h" | 54 #include "components/policy/core/common/policy_service.h" |
54 #include "components/prefs/pref_registry_simple.h" | 55 #include "components/prefs/pref_registry_simple.h" |
55 #include "components/prefs/pref_service.h" | 56 #include "components/prefs/pref_service.h" |
56 #include "components/proxy_config/pref_proxy_config_tracker.h" | 57 #include "components/proxy_config/pref_proxy_config_tracker.h" |
57 #include "components/variations/variations_associated_data.h" | 58 #include "components/variations/variations_associated_data.h" |
58 #include "components/version_info/version_info.h" | 59 #include "components/version_info/version_info.h" |
59 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
60 #include "content/public/browser/cookie_store_factory.h" | 61 #include "content/public/browser/cookie_store_factory.h" |
61 #include "content/public/common/content_features.h" | 62 #include "content/public/common/content_features.h" |
62 #include "content/public/common/content_switches.h" | 63 #include "content/public/common/content_switches.h" |
(...skipping 16 matching lines...) Expand all Loading... |
79 #include "net/dns/mapped_host_resolver.h" | 80 #include "net/dns/mapped_host_resolver.h" |
80 #include "net/ftp/ftp_network_layer.h" | 81 #include "net/ftp/ftp_network_layer.h" |
81 #include "net/http/http_auth_filter.h" | 82 #include "net/http/http_auth_filter.h" |
82 #include "net/http/http_auth_handler_factory.h" | 83 #include "net/http/http_auth_handler_factory.h" |
83 #include "net/http/http_auth_preferences.h" | 84 #include "net/http/http_auth_preferences.h" |
84 #include "net/http/http_network_layer.h" | 85 #include "net/http/http_network_layer.h" |
85 #include "net/http/http_server_properties_impl.h" | 86 #include "net/http/http_server_properties_impl.h" |
86 #include "net/proxy/proxy_config_service.h" | 87 #include "net/proxy/proxy_config_service.h" |
87 #include "net/proxy/proxy_script_fetcher_impl.h" | 88 #include "net/proxy/proxy_script_fetcher_impl.h" |
88 #include "net/proxy/proxy_service.h" | 89 #include "net/proxy/proxy_service.h" |
89 #include "net/quic/crypto/crypto_protocol.h" | |
90 #include "net/quic/quic_protocol.h" | |
91 #include "net/quic/quic_utils.h" | |
92 #include "net/socket/ssl_client_socket.h" | 90 #include "net/socket/ssl_client_socket.h" |
93 #include "net/socket/tcp_client_socket.h" | 91 #include "net/socket/tcp_client_socket.h" |
94 #include "net/spdy/spdy_session.h" | |
95 #include "net/ssl/channel_id_service.h" | 92 #include "net/ssl/channel_id_service.h" |
96 #include "net/ssl/default_channel_id_store.h" | 93 #include "net/ssl/default_channel_id_store.h" |
97 #include "net/url_request/data_protocol_handler.h" | 94 #include "net/url_request/data_protocol_handler.h" |
98 #include "net/url_request/file_protocol_handler.h" | 95 #include "net/url_request/file_protocol_handler.h" |
99 #include "net/url_request/ftp_protocol_handler.h" | 96 #include "net/url_request/ftp_protocol_handler.h" |
100 #include "net/url_request/static_http_user_agent_settings.h" | 97 #include "net/url_request/static_http_user_agent_settings.h" |
101 #include "net/url_request/url_fetcher.h" | 98 #include "net/url_request/url_fetcher.h" |
102 #include "net/url_request/url_request_backoff_manager.h" | 99 #include "net/url_request/url_request_backoff_manager.h" |
103 #include "net/url_request/url_request_context.h" | 100 #include "net/url_request/url_request_context.h" |
104 #include "net/url_request/url_request_context_builder.h" | 101 #include "net/url_request/url_request_context_builder.h" |
(...skipping 24 matching lines...) Expand all Loading... |
129 | 126 |
130 using content::BrowserThread; | 127 using content::BrowserThread; |
131 | 128 |
132 class SafeBrowsingURLRequestContext; | 129 class SafeBrowsingURLRequestContext; |
133 | 130 |
134 // The IOThread object must outlive any tasks posted to the IO thread before the | 131 // The IOThread object must outlive any tasks posted to the IO thread before the |
135 // Quit task, so base::Bind() calls are not refcounted. | 132 // Quit task, so base::Bind() calls are not refcounted. |
136 | 133 |
137 namespace { | 134 namespace { |
138 | 135 |
139 const char kTCPFastOpenFieldTrialName[] = "TCPFastOpen"; | |
140 const char kTCPFastOpenHttpsEnabledGroupName[] = "HttpsEnabled"; | |
141 | |
142 const char kQuicFieldTrialName[] = "QUIC"; | |
143 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; | |
144 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; | |
145 | |
146 // The SPDY trial composes two different trial plus control groups: | |
147 // * A "holdback" group with SPDY disabled, and corresponding control | |
148 // (SPDY/3.1). The primary purpose of the holdback group is to encourage site | |
149 // operators to do feature detection rather than UA-sniffing. As such, this | |
150 // trial runs continuously. | |
151 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and | |
152 // eventual SPDY/4 deployment. | |
153 const char kSpdyFieldTrialName[] = "SPDY"; | |
154 const char kSpdyFieldTrialHoldbackGroupNamePrefix[] = "SpdyDisabled"; | |
155 const char kSpdyFieldTrialSpdy31GroupNamePrefix[] = "Spdy31Enabled"; | |
156 const char kSpdyFieldTrialSpdy4GroupNamePrefix[] = "Spdy4Enabled"; | |
157 const char kSpdyFieldTrialParametrizedPrefix[] = "Parametrized"; | |
158 | |
159 // The AltSvc trial controls whether Alt-Svc headers are parsed. | |
160 // Disabled: | |
161 // Alt-Svc headers are not parsed. | |
162 // Alternate-Protocol headers are parsed. | |
163 // Enabled: | |
164 // Alt-Svc headers are parsed, but only same-host entries are used by | |
165 // default. (Use "enable_alternative_service_with_different_host" QUIC | |
166 // parameter to enable entries with different hosts.) | |
167 // Alternate-Protocol headers are ignored for responses that have an Alt-Svc | |
168 // header. | |
169 const char kAltSvcFieldTrialName[] = "ParseAltSvc"; | |
170 const char kAltSvcFieldTrialDisabledPrefix[] = "AltSvcDisabled"; | |
171 const char kAltSvcFieldTrialEnabledPrefix[] = "AltSvcEnabled"; | |
172 | |
173 // Field trial for network quality estimator. Seeds RTT and downstream | 136 // Field trial for network quality estimator. Seeds RTT and downstream |
174 // throughput observations with values that correspond to the connection type | 137 // throughput observations with values that correspond to the connection type |
175 // determined by the operating system. | 138 // determined by the operating system. |
176 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator"; | 139 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator"; |
177 | 140 |
178 // Field trial for NPN. | |
179 const char kNpnTrialName[] = "NPN"; | |
180 const char kNpnTrialEnabledGroupNamePrefix[] = "Enable"; | |
181 const char kNpnTrialDisabledGroupNamePrefix[] = "Disable"; | |
182 | |
183 // Field trial for priority dependencies. | |
184 const char kSpdyDependenciesFieldTrial[] = "SpdyEnableDependencies"; | |
185 const char kSpdyDependenciesFieldTrialEnable[] = "Enable"; | |
186 const char kSpdyDepencenciesFieldTrialDisable[] = "Disable"; | |
187 | |
188 #if defined(OS_MACOSX) | 141 #if defined(OS_MACOSX) |
189 void ObserveKeychainEvents() { | 142 void ObserveKeychainEvents() { |
190 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
191 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); | 144 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); |
192 } | 145 } |
193 #endif | 146 #endif |
194 | 147 |
195 // Gets file path into ssl_keylog_file from command line argument or | 148 // Gets file path into ssl_keylog_file from command line argument or |
196 // environment variable. Command line argument has priority when | 149 // environment variable. Command line argument has priority when |
197 // both specified. | 150 // both specified. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (!command_line.HasSwitch(switches::kHostResolverRules)) | 223 if (!command_line.HasSwitch(switches::kHostResolverRules)) |
271 return global_host_resolver; | 224 return global_host_resolver; |
272 | 225 |
273 std::unique_ptr<net::MappedHostResolver> remapped_resolver( | 226 std::unique_ptr<net::MappedHostResolver> remapped_resolver( |
274 new net::MappedHostResolver(std::move(global_host_resolver))); | 227 new net::MappedHostResolver(std::move(global_host_resolver))); |
275 remapped_resolver->SetRulesFromString( | 228 remapped_resolver->SetRulesFromString( |
276 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | 229 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
277 return std::move(remapped_resolver); | 230 return std::move(remapped_resolver); |
278 } | 231 } |
279 | 232 |
280 int GetSwitchValueAsInt(const base::CommandLine& command_line, | |
281 const std::string& switch_name) { | |
282 int value; | |
283 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), | |
284 &value)) { | |
285 return 0; | |
286 } | |
287 return value; | |
288 } | |
289 | |
290 // Returns the value associated with |key| in |params| or "" if the | |
291 // key is not present in the map. | |
292 const std::string& GetVariationParam( | |
293 const std::map<std::string, std::string>& params, | |
294 const std::string& key) { | |
295 std::map<std::string, std::string>::const_iterator it = params.find(key); | |
296 if (it == params.end()) | |
297 return base::EmptyString(); | |
298 | |
299 return it->second; | |
300 } | |
301 | |
302 } // namespace | 233 } // namespace |
303 | 234 |
304 class IOThread::LoggingNetworkChangeObserver | 235 class IOThread::LoggingNetworkChangeObserver |
305 : public net::NetworkChangeNotifier::IPAddressObserver, | 236 : public net::NetworkChangeNotifier::IPAddressObserver, |
306 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 237 public net::NetworkChangeNotifier::ConnectionTypeObserver, |
307 public net::NetworkChangeNotifier::NetworkChangeObserver { | 238 public net::NetworkChangeNotifier::NetworkChangeObserver { |
308 public: | 239 public: |
309 // |net_log| must remain valid throughout our lifetime. | 240 // |net_log| must remain valid throughout our lifetime. |
310 explicit LoggingNetworkChangeObserver(net::NetLog* net_log) | 241 explicit LoggingNetworkChangeObserver(net::NetLog* net_log) |
311 : net_log_(net_log) { | 242 : net_log_(net_log) { |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 params_.enable_token_binding = | 738 params_.enable_token_binding = |
808 base::FeatureList::IsEnabled(features::kTokenBinding); | 739 base::FeatureList::IsEnabled(features::kTokenBinding); |
809 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 740 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
810 // is fixed. | 741 // is fixed. |
811 tracked_objects::ScopedTracker tracking_profile13( | 742 tracked_objects::ScopedTracker tracking_profile13( |
812 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 743 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
813 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 744 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
814 // TODO(rch): Make the client socket factory a per-network session instance, | 745 // TODO(rch): Make the client socket factory a per-network session instance, |
815 // constructed from a NetworkSession::Params, to allow us to move this option | 746 // constructed from a NetworkSession::Params, to allow us to move this option |
816 // to IOThread::Globals & HttpNetworkSession::Params. | 747 // to IOThread::Globals & HttpNetworkSession::Params. |
817 network_session_configurator_.ParseFieldTrialsAndCommandLine( | 748 std::string quic_user_agent_id = chrome::GetChannelString(); |
818 is_spdy_allowed_by_policy_, is_quic_allowed_by_policy_, ¶ms_); | 749 if (!quic_user_agent_id.empty()) |
| 750 quic_user_agent_id.push_back(' '); |
| 751 quic_user_agent_id.append( |
| 752 version_info::GetProductNameAndVersionForUserAgent()); |
| 753 quic_user_agent_id.push_back(' '); |
| 754 quic_user_agent_id.append(content::BuildOSCpuInfo()); |
| 755 network_session_configurator::ParseFieldTrialsAndCommandLine( |
| 756 is_spdy_allowed_by_policy_, is_quic_allowed_by_policy_, |
| 757 quic_user_agent_id, ¶ms_); |
| 758 |
819 bool always_enable_tfo_if_supported = | 759 bool always_enable_tfo_if_supported = |
820 command_line.HasSwitch(switches::kEnableTcpFastOpen); | 760 command_line.HasSwitch(switches::kEnableTcpFastOpen); |
821 // Check for OS support of TCP FastOpen, and turn it on for all connections if | 761 // Check for OS support of TCP FastOpen, and turn it on for all connections if |
822 // indicated by user. | 762 // indicated by user. |
823 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); | 763 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); |
824 | 764 |
825 TRACE_EVENT_BEGIN0("startup", | 765 TRACE_EVENT_BEGIN0("startup", |
826 "IOThread::Init:ProxyScriptFetcherRequestContext"); | 766 "IOThread::Init:ProxyScriptFetcherRequestContext"); |
827 globals_->proxy_script_fetcher_context.reset( | 767 globals_->proxy_script_fetcher_context.reset( |
828 ConstructProxyScriptFetcherContext(globals_, params_, net_log_)); | 768 ConstructProxyScriptFetcherContext(globals_, params_, net_log_)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 network_change_observer_.reset(); | 820 network_change_observer_.reset(); |
881 | 821 |
882 system_proxy_config_service_.reset(); | 822 system_proxy_config_service_.reset(); |
883 delete globals_; | 823 delete globals_; |
884 globals_ = NULL; | 824 globals_ = NULL; |
885 | 825 |
886 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); | 826 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); |
887 } | 827 } |
888 | 828 |
889 // static | 829 // static |
890 void IOThread::NetworkSessionConfigurator::ParseFieldTrials( | |
891 bool is_spdy_allowed_by_policy, | |
892 bool is_quic_allowed_by_policy, | |
893 net::HttpNetworkSession::Params* params) { | |
894 const base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | |
895 ParseFieldTrialsAndCommandLineInternal(command_line, | |
896 is_spdy_allowed_by_policy, | |
897 is_quic_allowed_by_policy, params); | |
898 } | |
899 | |
900 // static | |
901 void IOThread::NetworkSessionConfigurator::ParseFieldTrialsAndCommandLine( | |
902 bool is_spdy_allowed_by_policy, | |
903 bool is_quic_allowed_by_policy, | |
904 net::HttpNetworkSession::Params* params) { | |
905 const base::CommandLine& command_line = | |
906 *base::CommandLine::ForCurrentProcess(); | |
907 ParseFieldTrialsAndCommandLineInternal(command_line, | |
908 is_spdy_allowed_by_policy, | |
909 is_quic_allowed_by_policy, params); | |
910 } | |
911 | |
912 // static | |
913 void IOThread::NetworkSessionConfigurator:: | |
914 ParseFieldTrialsAndCommandLineInternal( | |
915 const base::CommandLine& command_line, | |
916 bool is_spdy_allowed_by_policy, | |
917 bool is_quic_allowed_by_policy, | |
918 net::HttpNetworkSession::Params* params) { | |
919 // Parameters only controlled by command line. | |
920 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) | |
921 params->ignore_certificate_errors = true; | |
922 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { | |
923 params->testing_fixed_http_port = | |
924 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort); | |
925 } | |
926 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | |
927 params->testing_fixed_https_port = | |
928 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); | |
929 } | |
930 | |
931 // Always fetch the field trial groups to ensure they are reported correctly. | |
932 // The command line flags will be associated with a group that is reported so | |
933 // long as trial is actually queried. | |
934 | |
935 std::string altsvc_trial_group = | |
936 base::FieldTrialList::FindFullName(kAltSvcFieldTrialName); | |
937 ConfigureAltSvcParams(command_line, altsvc_trial_group, params); | |
938 | |
939 std::string quic_trial_group = | |
940 base::FieldTrialList::FindFullName(kQuicFieldTrialName); | |
941 VariationParameters quic_trial_params; | |
942 if (!variations::GetVariationParams(kQuicFieldTrialName, &quic_trial_params)) | |
943 quic_trial_params.clear(); | |
944 ConfigureQuicParams(command_line, quic_trial_group, quic_trial_params, | |
945 is_quic_allowed_by_policy, params); | |
946 | |
947 if (!is_spdy_allowed_by_policy) { | |
948 base::FieldTrial* trial = base::FieldTrialList::Find(kSpdyFieldTrialName); | |
949 if (trial) | |
950 trial->Disable(); | |
951 } | |
952 std::string spdy_trial_group = | |
953 base::FieldTrialList::FindFullName(kSpdyFieldTrialName); | |
954 VariationParameters spdy_trial_params; | |
955 if (!variations::GetVariationParams(kSpdyFieldTrialName, &spdy_trial_params)) | |
956 spdy_trial_params.clear(); | |
957 ConfigureSpdyParams(command_line, spdy_trial_group, spdy_trial_params, | |
958 is_spdy_allowed_by_policy, params); | |
959 | |
960 const std::string tfo_trial_group = | |
961 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); | |
962 ConfigureTCPFastOpenParams(tfo_trial_group, params); | |
963 | |
964 std::string npn_trial_group = | |
965 base::FieldTrialList::FindFullName(kNpnTrialName); | |
966 ConfigureNPNParams(command_line, npn_trial_group, params); | |
967 | |
968 std::string priority_dependencies_trial_group = | |
969 base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial); | |
970 ConfigurePriorityDependencies(priority_dependencies_trial_group, params); | |
971 } | |
972 | |
973 // static | |
974 void IOThread::NetworkSessionConfigurator::ConfigureTCPFastOpenParams( | |
975 base::StringPiece tfo_trial_group, | |
976 net::HttpNetworkSession::Params* params) { | |
977 if (tfo_trial_group == kTCPFastOpenHttpsEnabledGroupName) | |
978 params->enable_tcp_fast_open_for_ssl = true; | |
979 } | |
980 | |
981 // static | |
982 void IOThread::NetworkSessionConfigurator::ConfigureSpdyParams( | |
983 const base::CommandLine& command_line, | |
984 base::StringPiece spdy_trial_group, | |
985 const VariationParameters& spdy_trial_params, | |
986 bool is_spdy_allowed_by_policy, | |
987 net::HttpNetworkSession::Params* params) { | |
988 // Only handle SPDY field trial parameters and command line flags if | |
989 // "spdy.disabled" preference is not forced via policy. | |
990 if (!is_spdy_allowed_by_policy) { | |
991 params->enable_spdy31 = false; | |
992 params->enable_http2 = false; | |
993 return; | |
994 } | |
995 | |
996 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | |
997 net::URLFetcher::SetIgnoreCertificateRequests(true); | |
998 | |
999 if (command_line.HasSwitch(switches::kDisableHttp2)) { | |
1000 params->enable_spdy31 = false; | |
1001 params->enable_http2 = false; | |
1002 return; | |
1003 } | |
1004 | |
1005 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { | |
1006 net::HttpStreamFactory::set_spdy_enabled(false); | |
1007 return; | |
1008 } | |
1009 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { | |
1010 params->enable_spdy31 = true; | |
1011 params->enable_http2 = false; | |
1012 return; | |
1013 } | |
1014 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { | |
1015 params->enable_spdy31 = true; | |
1016 params->enable_http2 = true; | |
1017 return; | |
1018 } | |
1019 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { | |
1020 bool spdy_enabled = false; | |
1021 params->enable_spdy31 = false; | |
1022 params->enable_http2 = false; | |
1023 if (base::LowerCaseEqualsASCII( | |
1024 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { | |
1025 spdy_enabled = true; | |
1026 params->enable_http2 = true; | |
1027 } | |
1028 if (base::LowerCaseEqualsASCII( | |
1029 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { | |
1030 spdy_enabled = true; | |
1031 params->enable_spdy31 = true; | |
1032 } | |
1033 // TODO(bnc): https://crbug.com/521597 | |
1034 // HttpStreamFactory::spdy_enabled_ is redundant with params->enable_http2 | |
1035 // and enable_spdy31, can it be eliminated? | |
1036 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); | |
1037 return; | |
1038 } | |
1039 } | |
1040 | |
1041 // static | |
1042 void IOThread::NetworkSessionConfigurator::ConfigureAltSvcParams( | |
1043 const base::CommandLine& command_line, | |
1044 base::StringPiece altsvc_trial_group, | |
1045 net::HttpNetworkSession::Params* params) { | |
1046 if (command_line.HasSwitch(switches::kEnableAlternativeServices) || | |
1047 altsvc_trial_group.starts_with(kAltSvcFieldTrialEnabledPrefix)) { | |
1048 params->parse_alternative_services = true; | |
1049 return; | |
1050 } | |
1051 if (altsvc_trial_group.starts_with(kAltSvcFieldTrialDisabledPrefix)) { | |
1052 params->parse_alternative_services = false; | |
1053 } | |
1054 } | |
1055 | |
1056 // static | |
1057 void IOThread::NetworkSessionConfigurator::ConfigureNPNParams( | |
1058 const base::CommandLine& command_line, | |
1059 base::StringPiece npn_trial_group, | |
1060 net::HttpNetworkSession::Params* params) { | |
1061 if (npn_trial_group.starts_with(kNpnTrialEnabledGroupNamePrefix)) { | |
1062 params->enable_npn = true; | |
1063 } else if (npn_trial_group.starts_with(kNpnTrialDisabledGroupNamePrefix)) { | |
1064 params->enable_npn = false; | |
1065 } | |
1066 } | |
1067 | |
1068 // static | |
1069 void IOThread::NetworkSessionConfigurator::ConfigurePriorityDependencies( | |
1070 base::StringPiece priority_dependencies_trial_group, | |
1071 net::HttpNetworkSession::Params* params) { | |
1072 if (priority_dependencies_trial_group.starts_with( | |
1073 kSpdyDependenciesFieldTrialEnable)) { | |
1074 params->enable_priority_dependencies = true; | |
1075 } else if (priority_dependencies_trial_group.starts_with( | |
1076 kSpdyDepencenciesFieldTrialDisable)) { | |
1077 params->enable_priority_dependencies = false; | |
1078 } | |
1079 } | |
1080 | |
1081 // static | |
1082 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { | 830 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { |
1083 registry->RegisterStringPref(prefs::kAuthSchemes, | 831 registry->RegisterStringPref(prefs::kAuthSchemes, |
1084 "basic,digest,ntlm,negotiate"); | 832 "basic,digest,ntlm,negotiate"); |
1085 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); | 833 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); |
1086 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 834 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
1087 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); | 835 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); |
1088 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, | 836 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, |
1089 std::string()); | 837 std::string()); |
1090 registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string()); | 838 registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string()); |
1091 registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, | 839 registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 } | 906 } |
1159 | 907 |
1160 base::TimeTicks IOThread::creation_time() const { | 908 base::TimeTicks IOThread::creation_time() const { |
1161 return creation_time_; | 909 return creation_time_; |
1162 } | 910 } |
1163 | 911 |
1164 // static | 912 // static |
1165 bool IOThread::ShouldEnableQuicForDataReductionProxy() { | 913 bool IOThread::ShouldEnableQuicForDataReductionProxy() { |
1166 const base::CommandLine& command_line = | 914 const base::CommandLine& command_line = |
1167 *base::CommandLine::ForCurrentProcess(); | 915 *base::CommandLine::ForCurrentProcess(); |
1168 return NetworkSessionConfigurator::ShouldEnableQuicForDataReductionProxy( | 916 return network_session_configurator::ShouldEnableQuicForDataReductionProxy( |
1169 command_line); | 917 command_line); |
1170 } | 918 } |
1171 | 919 |
1172 net::SSLConfigService* IOThread::GetSSLConfigService() { | 920 net::SSLConfigService* IOThread::GetSSLConfigService() { |
1173 return ssl_config_service_manager_->Get(); | 921 return ssl_config_service_manager_->Get(); |
1174 } | 922 } |
1175 | 923 |
1176 void IOThread::ChangedToOnTheRecordOnIOThread() { | 924 void IOThread::ChangedToOnTheRecordOnIOThread() { |
1177 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 925 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1178 | 926 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 | 963 |
1216 globals_->system_request_context.reset( | 964 globals_->system_request_context.reset( |
1217 ConstructSystemRequestContext(globals_, params_, net_log_)); | 965 ConstructSystemRequestContext(globals_, params_, net_log_)); |
1218 } | 966 } |
1219 | 967 |
1220 void IOThread::UpdateDnsClientEnabled() { | 968 void IOThread::UpdateDnsClientEnabled() { |
1221 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 969 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
1222 } | 970 } |
1223 | 971 |
1224 // static | 972 // static |
1225 void IOThread::NetworkSessionConfigurator::ConfigureQuicParams( | |
1226 const base::CommandLine& command_line, | |
1227 base::StringPiece quic_trial_group, | |
1228 const VariationParameters& quic_trial_params, | |
1229 bool is_quic_allowed_by_policy, | |
1230 net::HttpNetworkSession::Params* params) { | |
1231 params->enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | |
1232 is_quic_allowed_by_policy); | |
1233 params->disable_quic_on_timeout_with_open_streams = | |
1234 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams(quic_trial_params); | |
1235 params->enable_quic_for_proxies = ShouldEnableQuicForProxies( | |
1236 command_line, quic_trial_group, is_quic_allowed_by_policy); | |
1237 | |
1238 if (ShouldQuicEnableAlternativeServicesForDifferentHost(command_line, | |
1239 quic_trial_params)) { | |
1240 params->enable_alternative_service_with_different_host = true; | |
1241 params->parse_alternative_services = true; | |
1242 } else { | |
1243 params->enable_alternative_service_with_different_host = false; | |
1244 } | |
1245 | |
1246 if (params->enable_quic) { | |
1247 params->quic_always_require_handshake_confirmation = | |
1248 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params); | |
1249 params->quic_disable_connection_pooling = | |
1250 ShouldQuicDisableConnectionPooling(quic_trial_params); | |
1251 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); | |
1252 if (receive_buffer_size != 0) { | |
1253 params->quic_socket_receive_buffer_size = receive_buffer_size; | |
1254 } | |
1255 params->quic_delay_tcp_race = ShouldQuicDelayTcpRace(quic_trial_params); | |
1256 float load_server_info_timeout_srtt_multiplier = | |
1257 GetQuicLoadServerInfoTimeoutSrttMultiplier(quic_trial_params); | |
1258 if (load_server_info_timeout_srtt_multiplier != 0) { | |
1259 params->quic_load_server_info_timeout_srtt_multiplier = | |
1260 load_server_info_timeout_srtt_multiplier; | |
1261 } | |
1262 params->quic_enable_connection_racing = | |
1263 ShouldQuicEnableConnectionRacing(quic_trial_params); | |
1264 params->quic_enable_non_blocking_io = | |
1265 ShouldQuicEnableNonBlockingIO(quic_trial_params); | |
1266 params->quic_disable_disk_cache = | |
1267 ShouldQuicDisableDiskCache(quic_trial_params); | |
1268 params->quic_prefer_aes = ShouldQuicPreferAes(quic_trial_params); | |
1269 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( | |
1270 quic_trial_params); | |
1271 if (max_number_of_lossy_connections != 0) { | |
1272 params->quic_max_number_of_lossy_connections = | |
1273 max_number_of_lossy_connections; | |
1274 } | |
1275 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); | |
1276 if (packet_loss_threshold != 0) | |
1277 params->quic_packet_loss_threshold = packet_loss_threshold; | |
1278 params->enable_quic_port_selection = | |
1279 ShouldEnableQuicPortSelection(command_line); | |
1280 params->quic_connection_options = | |
1281 GetQuicConnectionOptions(command_line, quic_trial_params); | |
1282 params->quic_close_sessions_on_ip_change = | |
1283 ShouldQuicCloseSessionsOnIpChange(quic_trial_params); | |
1284 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( | |
1285 quic_trial_params); | |
1286 if (idle_connection_timeout_seconds != 0) { | |
1287 params->quic_idle_connection_timeout_seconds = | |
1288 idle_connection_timeout_seconds; | |
1289 } | |
1290 params->quic_disable_preconnect_if_0rtt = | |
1291 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params); | |
1292 params->quic_host_whitelist = | |
1293 GetQuicHostWhitelist(command_line, quic_trial_params); | |
1294 params->quic_migrate_sessions_on_network_change = | |
1295 ShouldQuicMigrateSessionsOnNetworkChange(quic_trial_params); | |
1296 params->quic_migrate_sessions_early = | |
1297 ShouldQuicMigrateSessionsEarly(quic_trial_params); | |
1298 } | |
1299 | |
1300 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | |
1301 quic_trial_params); | |
1302 if (max_packet_length != 0) { | |
1303 params->quic_max_packet_length = max_packet_length; | |
1304 } | |
1305 | |
1306 params->quic_user_agent_id = chrome::GetChannelString(); | |
1307 if (!params->quic_user_agent_id.empty()) | |
1308 params->quic_user_agent_id.push_back(' '); | |
1309 params->quic_user_agent_id.append( | |
1310 version_info::GetProductNameAndVersionForUserAgent()); | |
1311 params->quic_user_agent_id.push_back(' '); | |
1312 params->quic_user_agent_id.append(content::BuildOSCpuInfo()); | |
1313 | |
1314 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); | |
1315 if (version != net::QUIC_VERSION_UNSUPPORTED) { | |
1316 net::QuicVersionVector supported_versions; | |
1317 supported_versions.push_back(version); | |
1318 params->quic_supported_versions = supported_versions; | |
1319 } | |
1320 | |
1321 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | |
1322 std::string origins = | |
1323 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn); | |
1324 for (const std::string& host_port : base::SplitString( | |
1325 origins, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | |
1326 net::HostPortPair quic_origin = net::HostPortPair::FromString(host_port); | |
1327 if (!quic_origin.IsEmpty()) | |
1328 params->origins_to_force_quic_on.insert(quic_origin); | |
1329 } | |
1330 } | |
1331 } | |
1332 | |
1333 // static | |
1334 bool IOThread::NetworkSessionConfigurator:: | |
1335 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams( | |
1336 const VariationParameters& quic_trial_params) { | |
1337 return base::LowerCaseEqualsASCII( | |
1338 GetVariationParam(quic_trial_params, | |
1339 "disable_quic_on_timeout_with_open_streams"), | |
1340 "true"); | |
1341 } | |
1342 | |
1343 // static | |
1344 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuic( | |
1345 const base::CommandLine& command_line, | |
1346 base::StringPiece quic_trial_group, | |
1347 bool is_quic_allowed_by_policy) { | |
1348 if (command_line.HasSwitch(switches::kDisableQuic) || | |
1349 !is_quic_allowed_by_policy) | |
1350 return false; | |
1351 | |
1352 if (command_line.HasSwitch(switches::kEnableQuic)) | |
1353 return true; | |
1354 | |
1355 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | |
1356 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); | |
1357 } | |
1358 | |
1359 // static | |
1360 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuicForProxies( | |
1361 const base::CommandLine& command_line, | |
1362 base::StringPiece quic_trial_group, | |
1363 bool is_quic_allowed_by_policy) { | |
1364 return ShouldEnableQuic(command_line, quic_trial_group, | |
1365 is_quic_allowed_by_policy) || | |
1366 ShouldEnableQuicForDataReductionProxy(command_line); | |
1367 } | |
1368 | |
1369 // static | |
1370 bool IOThread::NetworkSessionConfigurator:: | |
1371 ShouldEnableQuicForDataReductionProxy( | |
1372 const base::CommandLine& command_line) { | |
1373 if (command_line.HasSwitch(switches::kDisableQuic)) | |
1374 return false; | |
1375 | |
1376 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); | |
1377 } | |
1378 | |
1379 // static | |
1380 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuicPortSelection( | |
1381 const base::CommandLine& command_line) { | |
1382 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | |
1383 return false; | |
1384 | |
1385 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | |
1386 return true; | |
1387 | |
1388 return false; // Default to disabling port selection on all channels. | |
1389 } | |
1390 | |
1391 // static | |
1392 net::QuicTagVector | |
1393 IOThread::NetworkSessionConfigurator::GetQuicConnectionOptions( | |
1394 const base::CommandLine& command_line, | |
1395 const VariationParameters& quic_trial_params) { | |
1396 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { | |
1397 return net::QuicUtils::ParseQuicConnectionOptions( | |
1398 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); | |
1399 } | |
1400 | |
1401 VariationParameters::const_iterator it = | |
1402 quic_trial_params.find("connection_options"); | |
1403 if (it == quic_trial_params.end()) { | |
1404 return net::QuicTagVector(); | |
1405 } | |
1406 | |
1407 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | |
1408 } | |
1409 | |
1410 // static | |
1411 bool IOThread::NetworkSessionConfigurator:: | |
1412 ShouldQuicAlwaysRequireHandshakeConfirmation( | |
1413 const VariationParameters& quic_trial_params) { | |
1414 return base::LowerCaseEqualsASCII( | |
1415 GetVariationParam(quic_trial_params, | |
1416 "always_require_handshake_confirmation"), | |
1417 "true"); | |
1418 } | |
1419 | |
1420 // static | |
1421 bool IOThread::NetworkSessionConfigurator::ShouldQuicDisableConnectionPooling( | |
1422 const VariationParameters& quic_trial_params) { | |
1423 return base::LowerCaseEqualsASCII( | |
1424 GetVariationParam(quic_trial_params, "disable_connection_pooling"), | |
1425 "true"); | |
1426 } | |
1427 | |
1428 // static | |
1429 float IOThread::NetworkSessionConfigurator:: | |
1430 GetQuicLoadServerInfoTimeoutSrttMultiplier( | |
1431 const VariationParameters& quic_trial_params) { | |
1432 double value; | |
1433 if (base::StringToDouble(GetVariationParam(quic_trial_params, | |
1434 "load_server_info_time_to_srtt"), | |
1435 &value)) { | |
1436 return static_cast<float>(value); | |
1437 } | |
1438 return 0.0f; | |
1439 } | |
1440 | |
1441 // static | |
1442 bool IOThread::NetworkSessionConfigurator::ShouldQuicEnableConnectionRacing( | |
1443 const VariationParameters& quic_trial_params) { | |
1444 return base::LowerCaseEqualsASCII( | |
1445 GetVariationParam(quic_trial_params, "enable_connection_racing"), | |
1446 "true"); | |
1447 } | |
1448 | |
1449 // static | |
1450 bool IOThread::NetworkSessionConfigurator::ShouldQuicEnableNonBlockingIO( | |
1451 const VariationParameters& quic_trial_params) { | |
1452 return base::LowerCaseEqualsASCII( | |
1453 GetVariationParam(quic_trial_params, "enable_non_blocking_io"), | |
1454 "true"); | |
1455 } | |
1456 | |
1457 // static | |
1458 bool IOThread::NetworkSessionConfigurator::ShouldQuicDisableDiskCache( | |
1459 const VariationParameters& quic_trial_params) { | |
1460 return base::LowerCaseEqualsASCII( | |
1461 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); | |
1462 } | |
1463 | |
1464 // static | |
1465 bool IOThread::NetworkSessionConfigurator::ShouldQuicPreferAes( | |
1466 const VariationParameters& quic_trial_params) { | |
1467 return base::LowerCaseEqualsASCII( | |
1468 GetVariationParam(quic_trial_params, "prefer_aes"), "true"); | |
1469 } | |
1470 | |
1471 // static | |
1472 bool IOThread::NetworkSessionConfigurator:: | |
1473 ShouldQuicEnableAlternativeServicesForDifferentHost( | |
1474 const base::CommandLine& command_line, | |
1475 const VariationParameters& quic_trial_params) { | |
1476 // TODO(bnc): Remove inaccurately named "use_alternative_services" parameter. | |
1477 return command_line.HasSwitch(switches::kEnableAlternativeServices) || | |
1478 base::LowerCaseEqualsASCII( | |
1479 GetVariationParam(quic_trial_params, "use_alternative_services"), | |
1480 "true") || | |
1481 base::LowerCaseEqualsASCII( | |
1482 GetVariationParam( | |
1483 quic_trial_params, | |
1484 "enable_alternative_service_with_different_host"), | |
1485 "true"); | |
1486 } | |
1487 | |
1488 // static | |
1489 int IOThread::NetworkSessionConfigurator::GetQuicMaxNumberOfLossyConnections( | |
1490 const VariationParameters& quic_trial_params) { | |
1491 int value; | |
1492 if (base::StringToInt(GetVariationParam(quic_trial_params, | |
1493 "max_number_of_lossy_connections"), | |
1494 &value)) { | |
1495 return value; | |
1496 } | |
1497 return 0; | |
1498 } | |
1499 | |
1500 // static | |
1501 float IOThread::NetworkSessionConfigurator::GetQuicPacketLossThreshold( | |
1502 const VariationParameters& quic_trial_params) { | |
1503 double value; | |
1504 if (base::StringToDouble(GetVariationParam(quic_trial_params, | |
1505 "packet_loss_threshold"), | |
1506 &value)) { | |
1507 return static_cast<float>(value); | |
1508 } | |
1509 return 0.0f; | |
1510 } | |
1511 | |
1512 // static | |
1513 int IOThread::NetworkSessionConfigurator::GetQuicSocketReceiveBufferSize( | |
1514 const VariationParameters& quic_trial_params) { | |
1515 int value; | |
1516 if (base::StringToInt(GetVariationParam(quic_trial_params, | |
1517 "receive_buffer_size"), | |
1518 &value)) { | |
1519 return value; | |
1520 } | |
1521 return 0; | |
1522 } | |
1523 | |
1524 // static | |
1525 bool IOThread::NetworkSessionConfigurator::ShouldQuicDelayTcpRace( | |
1526 const VariationParameters& quic_trial_params) { | |
1527 return base::LowerCaseEqualsASCII( | |
1528 GetVariationParam(quic_trial_params, "delay_tcp_race"), "true"); | |
1529 } | |
1530 | |
1531 // static | |
1532 bool IOThread::NetworkSessionConfigurator::ShouldQuicCloseSessionsOnIpChange( | |
1533 const VariationParameters& quic_trial_params) { | |
1534 return base::LowerCaseEqualsASCII( | |
1535 GetVariationParam(quic_trial_params, "close_sessions_on_ip_change"), | |
1536 "true"); | |
1537 } | |
1538 | |
1539 // static | |
1540 int IOThread::NetworkSessionConfigurator::GetQuicIdleConnectionTimeoutSeconds( | |
1541 const VariationParameters& quic_trial_params) { | |
1542 int value; | |
1543 if (base::StringToInt(GetVariationParam(quic_trial_params, | |
1544 "idle_connection_timeout_seconds"), | |
1545 &value)) { | |
1546 return value; | |
1547 } | |
1548 return 0; | |
1549 } | |
1550 | |
1551 // static | |
1552 bool IOThread::NetworkSessionConfigurator::ShouldQuicDisablePreConnectIfZeroRtt( | |
1553 const VariationParameters& quic_trial_params) { | |
1554 return base::LowerCaseEqualsASCII( | |
1555 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), | |
1556 "true"); | |
1557 } | |
1558 | |
1559 // static | |
1560 std::unordered_set<std::string> | |
1561 IOThread::NetworkSessionConfigurator::GetQuicHostWhitelist( | |
1562 const base::CommandLine& command_line, | |
1563 const VariationParameters& quic_trial_params) { | |
1564 std::string whitelist; | |
1565 if (command_line.HasSwitch(switches::kQuicHostWhitelist)) { | |
1566 whitelist = command_line.GetSwitchValueASCII(switches::kQuicHostWhitelist); | |
1567 } else { | |
1568 whitelist = GetVariationParam(quic_trial_params, "quic_host_whitelist"); | |
1569 } | |
1570 std::unordered_set<std::string> hosts; | |
1571 for (const std::string& host :base::SplitString(whitelist, ",", | |
1572 base::TRIM_WHITESPACE, | |
1573 base::SPLIT_WANT_ALL)) { | |
1574 hosts.insert(host); | |
1575 } | |
1576 return hosts; | |
1577 } | |
1578 | |
1579 // static | |
1580 bool IOThread::NetworkSessionConfigurator:: | |
1581 ShouldQuicMigrateSessionsOnNetworkChange( | |
1582 const VariationParameters& quic_trial_params) { | |
1583 return base::LowerCaseEqualsASCII( | |
1584 GetVariationParam(quic_trial_params, | |
1585 "migrate_sessions_on_network_change"), | |
1586 "true"); | |
1587 } | |
1588 | |
1589 // static | |
1590 bool IOThread::NetworkSessionConfigurator::ShouldQuicMigrateSessionsEarly( | |
1591 const VariationParameters& quic_trial_params) { | |
1592 return base::LowerCaseEqualsASCII( | |
1593 GetVariationParam(quic_trial_params, "migrate_sessions_early"), "true"); | |
1594 } | |
1595 | |
1596 // static | |
1597 size_t IOThread::NetworkSessionConfigurator::GetQuicMaxPacketLength( | |
1598 const base::CommandLine& command_line, | |
1599 const VariationParameters& quic_trial_params) { | |
1600 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | |
1601 unsigned value; | |
1602 if (!base::StringToUint( | |
1603 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | |
1604 &value)) { | |
1605 return 0; | |
1606 } | |
1607 return value; | |
1608 } | |
1609 | |
1610 unsigned value; | |
1611 if (base::StringToUint(GetVariationParam(quic_trial_params, | |
1612 "max_packet_length"), | |
1613 &value)) { | |
1614 return value; | |
1615 } | |
1616 return 0; | |
1617 } | |
1618 | |
1619 // static | |
1620 net::QuicVersion IOThread::NetworkSessionConfigurator::GetQuicVersion( | |
1621 const base::CommandLine& command_line, | |
1622 const VariationParameters& quic_trial_params) { | |
1623 if (command_line.HasSwitch(switches::kQuicVersion)) { | |
1624 return ParseQuicVersion( | |
1625 command_line.GetSwitchValueASCII(switches::kQuicVersion)); | |
1626 } | |
1627 | |
1628 return ParseQuicVersion(GetVariationParam(quic_trial_params, "quic_version")); | |
1629 } | |
1630 | |
1631 // static | |
1632 net::QuicVersion IOThread::NetworkSessionConfigurator::ParseQuicVersion( | |
1633 const std::string& quic_version) { | |
1634 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | |
1635 for (size_t i = 0; i < supported_versions.size(); ++i) { | |
1636 net::QuicVersion version = supported_versions[i]; | |
1637 if (net::QuicVersionToString(version) == quic_version) { | |
1638 return version; | |
1639 } | |
1640 } | |
1641 | |
1642 return net::QUIC_VERSION_UNSUPPORTED; | |
1643 } | |
1644 | |
1645 // static | |
1646 net::URLRequestContext* IOThread::ConstructSystemRequestContext( | 973 net::URLRequestContext* IOThread::ConstructSystemRequestContext( |
1647 IOThread::Globals* globals, | 974 IOThread::Globals* globals, |
1648 const net::HttpNetworkSession::Params& params, | 975 const net::HttpNetworkSession::Params& params, |
1649 net::NetLog* net_log) { | 976 net::NetLog* net_log) { |
1650 net::URLRequestContext* context = new SystemURLRequestContext; | 977 net::URLRequestContext* context = new SystemURLRequestContext; |
1651 context->set_net_log(net_log); | 978 context->set_net_log(net_log); |
1652 context->set_host_resolver(globals->host_resolver.get()); | 979 context->set_host_resolver(globals->host_resolver.get()); |
1653 context->set_cert_verifier(globals->cert_verifier.get()); | 980 context->set_cert_verifier(globals->cert_verifier.get()); |
1654 context->set_transport_security_state( | 981 context->set_transport_security_state( |
1655 globals->transport_security_state.get()); | 982 globals->transport_security_state.get()); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1103 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1777 // system URLRequestContext too. There's no reason this should be tied to a | 1104 // system URLRequestContext too. There's no reason this should be tied to a |
1778 // profile. | 1105 // profile. |
1779 return context; | 1106 return context; |
1780 } | 1107 } |
1781 | 1108 |
1782 const metrics::UpdateUsagePrefCallbackType& | 1109 const metrics::UpdateUsagePrefCallbackType& |
1783 IOThread::GetMetricsDataUseForwarder() { | 1110 IOThread::GetMetricsDataUseForwarder() { |
1784 return metrics_data_use_forwarder_; | 1111 return metrics_data_use_forwarder_; |
1785 } | 1112 } |
OLD | NEW |