Index: net/base/host_cache.cc |
diff --git a/net/base/host_cache.cc b/net/base/host_cache.cc |
index f94b6869d76bf4e0b1f76f6117ded61774c93c9f..9d746463f3dc7f1b826a6aae060595fe55973af8 100644 |
--- a/net/base/host_cache.cc |
+++ b/net/base/host_cache.cc |
@@ -11,9 +11,18 @@ namespace net { |
//----------------------------------------------------------------------------- |
+HostCache::Entry::Entry(int error, const AddressList& addrlist, |
+ base::TimeDelta ttl) |
+ : error(error), |
+ addrlist(addrlist), |
+ ttl(ttl) { |
+ DCHECK(ttl >= base::TimeDelta()); |
+} |
+ |
HostCache::Entry::Entry(int error, const AddressList& addrlist) |
: error(error), |
- addrlist(addrlist) { |
+ addrlist(addrlist), |
+ ttl(base::TimeDelta::FromSeconds(-1)) { |
} |
HostCache::Entry::~Entry() { |
@@ -38,15 +47,14 @@ const HostCache::Entry* HostCache::Lookup(const Key& key, |
} |
void HostCache::Set(const Key& key, |
- int error, |
- const AddressList& addrlist, |
+ const Entry& entry, |
base::TimeTicks now, |
base::TimeDelta ttl) { |
DCHECK(CalledOnValidThread()); |
if (caching_is_disabled()) |
return; |
- entries_.Put(key, Entry(error, addrlist), now, now + ttl); |
+ entries_.Put(key, entry, now, now + ttl); |
} |
void HostCache::clear() { |