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

Unified Diff: net/base/host_cache.h

Issue 9197009: Adds custom ttl argument to HostCache::Set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed default TTL from net-internals Created 8 years, 11 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: net/base/host_cache.h
diff --git a/net/base/host_cache.h b/net/base/host_cache.h
index 62c07ab978f51ee76132809e70b16eacea79aa8b..32e063096e92bdc3052d44f987851b604a47e0d0 100644
--- a/net/base/host_cache.h
+++ b/net/base/host_cache.h
@@ -73,12 +73,8 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
typedef std::map<Key, scoped_refptr<Entry> > EntryMap;
- // Constructs a HostCache that caches successful host resolves for
- // |success_entry_ttl| time, and failed host resolves for
- // |failure_entry_ttl|. The cache will store up to |max_entries|.
- HostCache(size_t max_entries,
- base::TimeDelta success_entry_ttl,
- base::TimeDelta failure_entry_ttl);
+ // Constructs a HostCache that stores up to |max_entries|.
+ HostCache(size_t max_entries);
~HostCache();
@@ -88,11 +84,12 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Overwrites or creates an entry for |key|. Returns the pointer to the
// entry, or NULL on failure (fails if caching is disabled).
- // (|error|, |addrlist|) is the value to set, and |now| is the current
- // timestamp.
+ // (|error|, |addrlist|) is the value to set, |ttl| is the "time to live",
+ // and |now| is the current timestamp.
Entry* Set(const Key& key,
int error,
const AddressList& addrlist,
+ base::TimeDelta ttl,
base::TimeTicks now);
mmenke 2012/01/19 22:12:43 nit: Cognitively, I think putting |now| before |t
// Empties the cache
@@ -104,10 +101,6 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Following are used by net_internals UI.
size_t max_entries() const;
- base::TimeDelta success_entry_ttl() const;
-
- base::TimeDelta failure_entry_ttl() const;
-
// Note that this map may contain expired entries.
const EntryMap& entries() const;
@@ -133,10 +126,6 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Bound on total size of the cache.
size_t max_entries_;
- // Time to live for cache entries.
- base::TimeDelta success_entry_ttl_;
- base::TimeDelta failure_entry_ttl_;
-
// Map from hostname (presumably in lowercase canonicalized format) to
// a resolved result entry.
EntryMap entries_;

Powered by Google App Engine
This is Rietveld 408576698