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

Unified Diff: net/base/host_cache.cc

Issue 11065052: [net] Add AsyncDNS.TTL histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add NET_EXPORT to HostCache::Entry Created 8 years, 2 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 | « net/base/host_cache.h ('k') | net/base/host_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « net/base/host_cache.h ('k') | net/base/host_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698