OLD | NEW |
---|---|
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 const char kStaleDnsDelayMs[] = "delay_ms"; | 66 const char kStaleDnsDelayMs[] = "delay_ms"; |
67 // Name of integer maximum age (past expiration) in milliseconds of a stale DNS | 67 // Name of integer maximum age (past expiration) in milliseconds of a stale DNS |
68 // result that will be used, or 0 for no limit. | 68 // result that will be used, or 0 for no limit. |
69 const char kStaleDnsMaxExpiredTimeMs[] = "max_expired_time_ms"; | 69 const char kStaleDnsMaxExpiredTimeMs[] = "max_expired_time_ms"; |
70 // Name of integer maximum times each stale DNS result can be used, or 0 for no | 70 // Name of integer maximum times each stale DNS result can be used, or 0 for no |
71 // limit. | 71 // limit. |
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 // Name of boolean to enable persisting the DNS cache to disk. | |
77 const char kStaleDnsPersist[] = "persist_to_disk"; | |
78 // Name of integer minimum time in milliseconds between writes to disk for DNS | |
79 // cache persistence. | |
pauljensen
2017/06/26 16:37:17
Can we mention that it defaults to one minute?
pauljensen
2017/06/26 16:37:17
Can we mention that it only has an effect if kStal
mgersh
2017/06/26 23:21:45
Done.
mgersh
2017/06/26 23:21:45
Done.
| |
80 const char kStaleDnsPersistTimer[] = "persist_timer_ms"; | |
pauljensen
2017/06/26 16:37:17
similar to url_request_context_config.h:175, can w
mgersh
2017/06/26 23:21:45
Done.
| |
76 | 81 |
77 // Rules to override DNS resolution. Intended for testing. | 82 // Rules to override DNS resolution. Intended for testing. |
78 // See explanation of format in net/dns/mapped_host_resolver.h. | 83 // See explanation of format in net/dns/mapped_host_resolver.h. |
79 const char kHostResolverRulesFieldTrialName[] = "HostResolverRules"; | 84 const char kHostResolverRulesFieldTrialName[] = "HostResolverRules"; |
80 const char kHostResolverRules[] = "host_resolver_rules"; | 85 const char kHostResolverRules[] = "host_resolver_rules"; |
81 | 86 |
82 // Disable IPv6 when on WiFi. This is a workaround for a known issue on certain | 87 // 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. | 88 // Android phones, and should not be necessary when not on one of those devices. |
84 // See https://crbug.com/696569 for details. | 89 // See https://crbug.com/696569 for details. |
85 const char kDisableIPv6OnWifi[] = "disable_ipv6_on_wifi"; | 90 const char kDisableIPv6OnWifi[] = "disable_ipv6_on_wifi"; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 base::TimeDelta::FromMilliseconds(max_expired_time_ms); | 290 base::TimeDelta::FromMilliseconds(max_expired_time_ms); |
286 } | 291 } |
287 int max_stale_uses; | 292 int max_stale_uses; |
288 if (stale_dns_args->GetInteger(kStaleDnsMaxStaleUses, &max_stale_uses)) | 293 if (stale_dns_args->GetInteger(kStaleDnsMaxStaleUses, &max_stale_uses)) |
289 stale_dns_options.max_stale_uses = max_stale_uses; | 294 stale_dns_options.max_stale_uses = max_stale_uses; |
290 bool allow_other_network; | 295 bool allow_other_network; |
291 if (stale_dns_args->GetBoolean(kStaleDnsAllowOtherNetwork, | 296 if (stale_dns_args->GetBoolean(kStaleDnsAllowOtherNetwork, |
292 &allow_other_network)) { | 297 &allow_other_network)) { |
293 stale_dns_options.allow_other_network = allow_other_network; | 298 stale_dns_options.allow_other_network = allow_other_network; |
294 } | 299 } |
300 bool persist; | |
301 if (stale_dns_args->GetBoolean(kStaleDnsPersist, &persist)) | |
302 enable_host_cache_persistence = persist; | |
303 int persist_timer; | |
304 if (stale_dns_args->GetInteger(kStaleDnsPersistTimer, &persist_timer)) | |
305 host_cache_persistence_timer = persist_timer; | |
295 } | 306 } |
296 } else if (it.key() == kHostResolverRulesFieldTrialName) { | 307 } else if (it.key() == kHostResolverRulesFieldTrialName) { |
297 const base::DictionaryValue* host_resolver_rules_args = nullptr; | 308 const base::DictionaryValue* host_resolver_rules_args = nullptr; |
298 if (!it.value().GetAsDictionary(&host_resolver_rules_args)) { | 309 if (!it.value().GetAsDictionary(&host_resolver_rules_args)) { |
299 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() | 310 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() |
300 << "\" is not a dictionary value"; | 311 << "\" is not a dictionary value"; |
301 effective_experimental_options->Remove(it.key(), nullptr); | 312 effective_experimental_options->Remove(it.key(), nullptr); |
302 continue; | 313 continue; |
303 } | 314 } |
304 host_resolver_rules_enable = host_resolver_rules_args->GetString( | 315 host_resolver_rules_enable = host_resolver_rules_args->GetString( |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 URLRequestContextConfigBuilder::Build() { | 421 URLRequestContextConfigBuilder::Build() { |
411 return base::MakeUnique<URLRequestContextConfig>( | 422 return base::MakeUnique<URLRequestContextConfig>( |
412 enable_quic, quic_user_agent_id, enable_spdy, enable_sdch, enable_brotli, | 423 enable_quic, quic_user_agent_id, enable_spdy, enable_sdch, enable_brotli, |
413 http_cache, http_cache_max_size, load_disable_cache, storage_path, | 424 http_cache, http_cache_max_size, load_disable_cache, storage_path, |
414 user_agent, experimental_options, std::move(mock_cert_verifier), | 425 user_agent, experimental_options, std::move(mock_cert_verifier), |
415 enable_network_quality_estimator, | 426 enable_network_quality_estimator, |
416 bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data); | 427 bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data); |
417 } | 428 } |
418 | 429 |
419 } // namespace cronet | 430 } // namespace cronet |
OLD | NEW |