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

Side by Side Diff: components/cronet/url_request_context_config.cc

Issue 1665503002: [Cronet] Expose quic_user_agent_id and quic_prefer_aes config options. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document QUIC UAID string usage, don't pass it down unless QUIC is enabled. Created 4 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/cronet/url_request_context_config.h" 5 #include "components/cronet/url_request_context_config.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 const char kQuicDelayTcpRace[] = "delay_tcp_race"; 34 const char kQuicDelayTcpRace[] = "delay_tcp_race";
35 const char kQuicMaxNumberOfLossyConnections[] = 35 const char kQuicMaxNumberOfLossyConnections[] =
36 "max_number_of_lossy_connections"; 36 "max_number_of_lossy_connections";
37 const char kQuicPacketLossThreshold[] = "packet_loss_threshold"; 37 const char kQuicPacketLossThreshold[] = "packet_loss_threshold";
38 const char kQuicIdleConnectionTimeoutSeconds[] = 38 const char kQuicIdleConnectionTimeoutSeconds[] =
39 "idle_connection_timeout_seconds"; 39 "idle_connection_timeout_seconds";
40 const char kQuicHostWhitelist[] = "host_whitelist"; 40 const char kQuicHostWhitelist[] = "host_whitelist";
41 const char kQuicCloseSessionsOnIpChange[] = "close_sessions_on_ip_change"; 41 const char kQuicCloseSessionsOnIpChange[] = "close_sessions_on_ip_change";
42 const char kQuicMigrateSessionsOnNetworkChange[] = 42 const char kQuicMigrateSessionsOnNetworkChange[] =
43 "migrate_sessions_on_network_change"; 43 "migrate_sessions_on_network_change";
44 const char kQuicPreferAes[] = "prefer_aes";
45 const char kQuicUserAgentId[] = "user_agent_id";
44 46
45 // AsyncDNS experiment dictionary name. 47 // AsyncDNS experiment dictionary name.
46 const char kAsyncDnsFieldTrialName[] = "AsyncDNS"; 48 const char kAsyncDnsFieldTrialName[] = "AsyncDNS";
47 // Name of boolean to enable AsyncDNS experiment. 49 // Name of boolean to enable AsyncDNS experiment.
48 const char kAsyncDnsEnable[] = "enable"; 50 const char kAsyncDnsEnable[] = "enable";
49 51
50 void ParseAndSetExperimentalOptions( 52 void ParseAndSetExperimentalOptions(
51 const std::string& experimental_options, 53 const std::string& experimental_options,
52 net::URLRequestContextBuilder* context_builder, 54 net::URLRequestContextBuilder* context_builder,
53 net::NetLog* net_log) { 55 net::NetLog* net_log) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 context_builder->set_quic_close_sessions_on_ip_change( 143 context_builder->set_quic_close_sessions_on_ip_change(
142 quic_close_sessions_on_ip_change); 144 quic_close_sessions_on_ip_change);
143 } 145 }
144 146
145 bool quic_migrate_sessions_on_network_change = false; 147 bool quic_migrate_sessions_on_network_change = false;
146 if (quic_args->GetBoolean(kQuicMigrateSessionsOnNetworkChange, 148 if (quic_args->GetBoolean(kQuicMigrateSessionsOnNetworkChange,
147 &quic_migrate_sessions_on_network_change)) { 149 &quic_migrate_sessions_on_network_change)) {
148 context_builder->set_quic_migrate_sessions_on_network_change( 150 context_builder->set_quic_migrate_sessions_on_network_change(
149 quic_migrate_sessions_on_network_change); 151 quic_migrate_sessions_on_network_change);
150 } 152 }
153
154 bool quic_prefer_aes = false;
155 if (quic_args->GetBoolean(kQuicPreferAes, &quic_prefer_aes)) {
156 context_builder->set_quic_prefer_aes(quic_prefer_aes);
157 }
158
159 std::string quic_user_agent_id;
160 if (quic_args->GetString(kQuicUserAgentId, &quic_user_agent_id)) {
161 context_builder->set_quic_user_agent_id(quic_user_agent_id);
162 }
151 } 163 }
152 164
153 const base::DictionaryValue* async_dns_args = nullptr; 165 const base::DictionaryValue* async_dns_args = nullptr;
154 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) { 166 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) {
155 bool async_dns_enable = false; 167 bool async_dns_enable = false;
156 if (async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable) && 168 if (async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable) &&
157 async_dns_enable) { 169 async_dns_enable) {
158 if (net_log == nullptr) { 170 if (net_log == nullptr) {
159 DCHECK(false) << "AsyncDNS experiment requires NetLog."; 171 DCHECK(false) << "AsyncDNS experiment requires NetLog.";
160 } else { 172 } else {
(...skipping 19 matching lines...) Expand all
180 bool include_subdomains, 192 bool include_subdomains,
181 const base::Time& expiration_date) 193 const base::Time& expiration_date)
182 : host(host), 194 : host(host),
183 include_subdomains(include_subdomains), 195 include_subdomains(include_subdomains),
184 expiration_date(expiration_date) {} 196 expiration_date(expiration_date) {}
185 197
186 URLRequestContextConfig::Pkp::~Pkp() {} 198 URLRequestContextConfig::Pkp::~Pkp() {}
187 199
188 URLRequestContextConfig::URLRequestContextConfig( 200 URLRequestContextConfig::URLRequestContextConfig(
189 bool enable_quic, 201 bool enable_quic,
202 const std::string& quic_user_agent_id,
190 bool enable_spdy, 203 bool enable_spdy,
191 bool enable_sdch, 204 bool enable_sdch,
192 HttpCacheType http_cache, 205 HttpCacheType http_cache,
193 int http_cache_max_size, 206 int http_cache_max_size,
194 bool load_disable_cache, 207 bool load_disable_cache,
195 const std::string& storage_path, 208 const std::string& storage_path,
196 const std::string& user_agent, 209 const std::string& user_agent,
197 const std::string& experimental_options, 210 const std::string& experimental_options,
198 const std::string& data_reduction_proxy_key, 211 const std::string& data_reduction_proxy_key,
199 const std::string& data_reduction_primary_proxy, 212 const std::string& data_reduction_primary_proxy,
200 const std::string& data_reduction_fallback_proxy, 213 const std::string& data_reduction_fallback_proxy,
201 const std::string& data_reduction_secure_proxy_check_url, 214 const std::string& data_reduction_secure_proxy_check_url,
202 scoped_ptr<net::CertVerifier> mock_cert_verifier) 215 scoped_ptr<net::CertVerifier> mock_cert_verifier)
203 : enable_quic(enable_quic), 216 : enable_quic(enable_quic),
217 quic_user_agent_id(quic_user_agent_id),
204 enable_spdy(enable_spdy), 218 enable_spdy(enable_spdy),
205 enable_sdch(enable_sdch), 219 enable_sdch(enable_sdch),
206 http_cache(http_cache), 220 http_cache(http_cache),
207 http_cache_max_size(http_cache_max_size), 221 http_cache_max_size(http_cache_max_size),
208 load_disable_cache(load_disable_cache), 222 load_disable_cache(load_disable_cache),
209 storage_path(storage_path), 223 storage_path(storage_path),
210 user_agent(user_agent), 224 user_agent(user_agent),
211 experimental_options(experimental_options), 225 experimental_options(experimental_options),
212 data_reduction_proxy_key(data_reduction_proxy_key), 226 data_reduction_proxy_key(data_reduction_proxy_key),
213 data_reduction_primary_proxy(data_reduction_primary_proxy), 227 data_reduction_primary_proxy(data_reduction_primary_proxy),
(...skipping 18 matching lines...) Expand all
232 net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY; 246 net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY;
233 } 247 }
234 cache_params.max_size = http_cache_max_size; 248 cache_params.max_size = http_cache_max_size;
235 context_builder->EnableHttpCache(cache_params); 249 context_builder->EnableHttpCache(cache_params);
236 } else { 250 } else {
237 context_builder->DisableHttpCache(); 251 context_builder->DisableHttpCache();
238 } 252 }
239 context_builder->set_user_agent(user_agent); 253 context_builder->set_user_agent(user_agent);
240 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); 254 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic);
241 context_builder->set_sdch_enabled(enable_sdch); 255 context_builder->set_sdch_enabled(enable_sdch);
256 if (enable_quic)
257 context_builder->set_quic_user_agent_id(quic_user_agent_id);
242 258
243 ParseAndSetExperimentalOptions(experimental_options, context_builder, 259 ParseAndSetExperimentalOptions(experimental_options, context_builder,
244 net_log); 260 net_log);
245 261
246 if (mock_cert_verifier) 262 if (mock_cert_verifier)
247 context_builder->SetCertVerifier(std::move(mock_cert_verifier)); 263 context_builder->SetCertVerifier(std::move(mock_cert_verifier));
248 // TODO(mef): Use |config| to set cookies. 264 // TODO(mef): Use |config| to set cookies.
249 } 265 }
250 266
251 } // namespace cronet 267 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/url_request_context_config.h ('k') | components/cronet/url_request_context_config_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698