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

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

Issue 2416473004: Add functionality for embedders to configure NQE (Closed)
Patch Set: rebased Created 3 years, 7 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const char kStaleDnsMaxStaleUses[] = "max_stale_uses"; 72 const char kStaleDnsMaxStaleUses[] = "max_stale_uses";
73 // Name of boolean to allow stale DNS results from other networks to be used on 73 // Name of boolean to allow stale DNS results from other networks to be used on
74 // the current network. 74 // the current network.
75 const char kStaleDnsAllowOtherNetwork[] = "allow_other_network"; 75 const char kStaleDnsAllowOtherNetwork[] = "allow_other_network";
76 76
77 // Rules to override DNS resolution. Intended for testing. 77 // Rules to override DNS resolution. Intended for testing.
78 // See explanation of format in net/dns/mapped_host_resolver.h. 78 // See explanation of format in net/dns/mapped_host_resolver.h.
79 const char kHostResolverRulesFieldTrialName[] = "HostResolverRules"; 79 const char kHostResolverRulesFieldTrialName[] = "HostResolverRules";
80 const char kHostResolverRules[] = "host_resolver_rules"; 80 const char kHostResolverRules[] = "host_resolver_rules";
81 81
82 // NetworkQualityEstimator experiment dictionary name.
83 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator";
84
82 // Disable IPv6 when on WiFi. This is a workaround for a known issue on certain 85 // Disable IPv6 when on WiFi. This is a workaround for a known issue on certain
83 // Android phones, and should not be necessary when not on one of those devices. 86 // Android phones, and should not be necessary when not on one of those devices.
84 // See https://crbug.com/696569 for details. 87 // See https://crbug.com/696569 for details.
85 const char kDisableIPv6OnWifi[] = "disable_ipv6_on_wifi"; 88 const char kDisableIPv6OnWifi[] = "disable_ipv6_on_wifi";
86 89
87 const char kSSLKeyLogFile[] = "ssl_key_log_file"; 90 const char kSSLKeyLogFile[] = "ssl_key_log_file";
88 91
89 // Returns the effective experimental options. 92 // Returns the effective experimental options.
90 std::unique_ptr<base::DictionaryValue> ParseAndSetExperimentalOptions( 93 std::unique_ptr<base::DictionaryValue> ParseAndSetExperimentalOptions(
91 const std::string& experimental_options, 94 const std::string& experimental_options,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (!ssl_key_log_file.empty() && file_task_runner) { 271 if (!ssl_key_log_file.empty() && file_task_runner) {
269 // SetSSLKeyLogFile is only safe to call before any SSLClientSockets 272 // SetSSLKeyLogFile is only safe to call before any SSLClientSockets
270 // are created. This should not be used if there are multiple 273 // are created. This should not be used if there are multiple
271 // CronetEngine. 274 // CronetEngine.
272 // TODO(xunjieli): Expose this as a stable API after crbug.com/458365 275 // TODO(xunjieli): Expose this as a stable API after crbug.com/458365
273 // is resolved. 276 // is resolved.
274 net::SSLClientSocket::SetSSLKeyLogFile(ssl_key_log_file, 277 net::SSLClientSocket::SetSSLKeyLogFile(ssl_key_log_file,
275 file_task_runner); 278 file_task_runner);
276 } 279 }
277 } 280 }
281 } else if (it.key() == kNetworkQualityEstimatorFieldTrialName) {
282 const base::DictionaryValue* nqe_args = nullptr;
283 if (!it.value().GetAsDictionary(&nqe_args)) {
284 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value()
285 << "\" is not a dictionary value";
286 effective_experimental_options->Remove(it.key(), nullptr);
287 }
278 } else { 288 } else {
279 LOG(WARNING) << "Unrecognized Cronet experimental option \"" << it.key() 289 LOG(WARNING) << "Unrecognized Cronet experimental option \"" << it.key()
280 << "\" with params \"" << it.value(); 290 << "\" with params \"" << it.value();
281 effective_experimental_options->Remove(it.key(), nullptr); 291 effective_experimental_options->Remove(it.key(), nullptr);
282 } 292 }
283 } 293 }
284 294
285 if (async_dns_enable || stale_dns_enable || host_resolver_rules_enable || 295 if (async_dns_enable || stale_dns_enable || host_resolver_rules_enable ||
286 disable_ipv6_on_wifi) { 296 disable_ipv6_on_wifi) {
287 CHECK(net_log) << "All DNS-related experiments require NetLog."; 297 CHECK(net_log) << "All DNS-related experiments require NetLog.";
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 : enable_quic(enable_quic), 356 : enable_quic(enable_quic),
347 quic_user_agent_id(quic_user_agent_id), 357 quic_user_agent_id(quic_user_agent_id),
348 enable_spdy(enable_spdy), 358 enable_spdy(enable_spdy),
349 enable_sdch(enable_sdch), 359 enable_sdch(enable_sdch),
350 enable_brotli(enable_brotli), 360 enable_brotli(enable_brotli),
351 http_cache(http_cache), 361 http_cache(http_cache),
352 http_cache_max_size(http_cache_max_size), 362 http_cache_max_size(http_cache_max_size),
353 load_disable_cache(load_disable_cache), 363 load_disable_cache(load_disable_cache),
354 storage_path(storage_path), 364 storage_path(storage_path),
355 user_agent(user_agent), 365 user_agent(user_agent),
356 experimental_options(experimental_options),
357 mock_cert_verifier(std::move(mock_cert_verifier)), 366 mock_cert_verifier(std::move(mock_cert_verifier)),
358 enable_network_quality_estimator(enable_network_quality_estimator), 367 enable_network_quality_estimator(enable_network_quality_estimator),
359 bypass_public_key_pinning_for_local_trust_anchors( 368 bypass_public_key_pinning_for_local_trust_anchors(
360 bypass_public_key_pinning_for_local_trust_anchors), 369 bypass_public_key_pinning_for_local_trust_anchors),
361 cert_verifier_data(cert_verifier_data) {} 370 cert_verifier_data(cert_verifier_data),
371 experimental_options(experimental_options) {}
362 372
363 URLRequestContextConfig::~URLRequestContextConfig() {} 373 URLRequestContextConfig::~URLRequestContextConfig() {}
364 374
365 void URLRequestContextConfig::ConfigureURLRequestContextBuilder( 375 void URLRequestContextConfig::ConfigureURLRequestContextBuilder(
366 net::URLRequestContextBuilder* context_builder, 376 net::URLRequestContextBuilder* context_builder,
367 net::NetLog* net_log, 377 net::NetLog* net_log,
368 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) { 378 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) {
369 DCHECK(net_log); 379 DCHECK(net_log);
370 380
371 std::string config_cache; 381 std::string config_cache;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 URLRequestContextConfigBuilder::Build() { 425 URLRequestContextConfigBuilder::Build() {
416 return base::MakeUnique<URLRequestContextConfig>( 426 return base::MakeUnique<URLRequestContextConfig>(
417 enable_quic, quic_user_agent_id, enable_spdy, enable_sdch, enable_brotli, 427 enable_quic, quic_user_agent_id, enable_spdy, enable_sdch, enable_brotli,
418 http_cache, http_cache_max_size, load_disable_cache, storage_path, 428 http_cache, http_cache_max_size, load_disable_cache, storage_path,
419 user_agent, experimental_options, std::move(mock_cert_verifier), 429 user_agent, experimental_options, std::move(mock_cert_verifier),
420 enable_network_quality_estimator, 430 enable_network_quality_estimator,
421 bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data); 431 bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data);
422 } 432 }
423 433
424 } // namespace cronet 434 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698