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

Unified Diff: components/cronet/url_request_context_config.cc

Issue 2954753002: Add Cronet experimental option for host cache persistence (Closed)
Patch Set: address comments Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/url_request_context_config.cc
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc
index e4b4a77376f2a3eb9641456d0839af42befffda9..432fb1eb64696798cbed62509c14f32e103b6be8 100644
--- a/components/cronet/url_request_context_config.cc
+++ b/components/cronet/url_request_context_config.cc
@@ -73,6 +73,12 @@ const char kStaleDnsMaxStaleUses[] = "max_stale_uses";
// Name of boolean to allow stale DNS results from other networks to be used on
// the current network.
const char kStaleDnsAllowOtherNetwork[] = "allow_other_network";
+// Name of boolean to enable persisting the DNS cache to disk.
+const char kStaleDnsPersist[] = "persist_to_disk";
+// Name of integer minimum time in milliseconds between writes to disk for DNS
+// cache persistence. Default value is one minute. Only relevant if
+// "persist_to_disk" is true.
+const char kStaleDnsPersistTimer[] = "persist_delay_ms";
// Rules to override DNS resolution. Intended for testing.
// See explanation of format in net/dns/mapped_host_resolver.h.
@@ -292,6 +298,12 @@ void URLRequestContextConfig::ParseAndSetExperimentalOptions(
&allow_other_network)) {
stale_dns_options.allow_other_network = allow_other_network;
}
+ bool persist;
+ if (stale_dns_args->GetBoolean(kStaleDnsPersist, &persist))
+ enable_host_cache_persistence = persist;
+ int persist_timer;
+ if (stale_dns_args->GetInteger(kStaleDnsPersistTimer, &persist_timer))
+ host_cache_persistence_delay_ms = persist_timer;
}
} else if (it.key() == kHostResolverRulesFieldTrialName) {
const base::DictionaryValue* host_resolver_rules_args = nullptr;

Powered by Google App Engine
This is Rietveld 408576698