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

Unified Diff: net/base/host_cache.h

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 | « chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc ('k') | net/base/host_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_cache.h
diff --git a/net/base/host_cache.h b/net/base/host_cache.h
index 7aff49c1ba16dc85cd145c9298ed2314e3ad953e..2a3aedc69f60c2694da95ca353ccc23f44d39080 100644
--- a/net/base/host_cache.h
+++ b/net/base/host_cache.h
@@ -22,13 +22,19 @@ namespace net {
class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
// Stores the latest address list that was looked up for a hostname.
- struct Entry {
+ struct NET_EXPORT Entry {
+ Entry(int error, const AddressList& addrlist, base::TimeDelta ttl);
+ // Use when |ttl| is unknown.
Entry(int error, const AddressList& addrlist);
~Entry();
+ bool has_ttl() const { return ttl >= base::TimeDelta(); }
+
// The resolve results for this entry.
int error;
AddressList addrlist;
+ // TTL obtained from the nameserver. Negative if unknown.
+ base::TimeDelta ttl;
};
struct Key {
@@ -67,11 +73,10 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
const Entry* Lookup(const Key& key, base::TimeTicks now);
// Overwrites or creates an entry for |key|.
- // (|error|, |addrlist|) is the value to set, |now| is the current time
+ // |entry| is the value to set, |now| is the current time
// |ttl| is the "time to live".
void Set(const Key& key,
- int error,
- const AddressList& addrlist,
+ const Entry& entry,
base::TimeTicks now,
base::TimeDelta ttl);
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc ('k') | net/base/host_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698