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

Unified Diff: net/dns/host_cache.h

Issue 2083643003: DNS: Let requests specify a callback for future cache hits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify a couple comments. Created 4 years, 4 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
« no previous file with comments | « no previous file | net/dns/host_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_cache.h
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h
index 700d5c2e8014322bc7e9c9bbb82977de5160dc6d..7b3d350a8f8c624509f0906980a55756f7d1ef40 100644
--- a/net/dns/host_cache.h
+++ b/net/dns/host_cache.h
@@ -113,6 +113,7 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
};
using EntryMap = std::map<Key, Entry>;
+ using EvictionCallback = base::Callback<void(const Key&, const Entry&)>;
// Constructs a HostCache that stores up to |max_entries|.
explicit HostCache(size_t max_entries);
@@ -141,6 +142,10 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Marks all entries as stale on account of a network change.
void OnNetworkChange();
+ void set_eviction_callback(const EvictionCallback& callback) {
+ eviction_callback_ = callback;
+ }
+
// Empties the cache
void clear();
@@ -186,6 +191,7 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
EntryMap entries_;
size_t max_entries_;
int network_changes_;
+ EvictionCallback eviction_callback_;
DISALLOW_COPY_AND_ASSIGN(HostCache);
};
« no previous file with comments | « no previous file | net/dns/host_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698