Index: net/base/host_cache.h |
diff --git a/net/base/host_cache.h b/net/base/host_cache.h |
index 94022e4ac57eb6e83543c92786aad9c9fb29ce8e..c5cdae95c46b9b7c668c152cf5731b600241f64e 100644 |
--- a/net/base/host_cache.h |
+++ b/net/base/host_cache.h |
@@ -8,6 +8,7 @@ |
#include <map> |
#include <string> |
+#include "base/non_thread_safe.h" |
#include "base/ref_counted.h" |
#include "base/time.h" |
#include "net/base/address_family.h" |
@@ -17,7 +18,7 @@ |
namespace net { |
// Cache used by HostResolver to map hostnames to their resolved result. |
-class HostCache { |
+class HostCache : public NonThreadSafe { |
public: |
// Stores the latest address list that was looked up for a hostname. |
struct Entry : public base::RefCounted<Entry> { |
@@ -92,42 +93,25 @@ class HostCache { |
const AddressList addrlist, |
base::TimeTicks now); |
- // Empties the cache. |
- void clear() { |
- entries_.clear(); |
- } |
- |
- // Returns true if this HostCache can contain no entries. |
- bool caching_is_disabled() const { |
- return max_entries_ == 0; |
- } |
+ // Empties the cache |
+ void clear(); |
// Returns the number of entries in the cache. |
- size_t size() const { |
- return entries_.size(); |
- } |
+ size_t size() const; |
- size_t max_entries() const { |
- return max_entries_; |
- } |
+ // Following are used by net_internals UI. |
+ size_t max_entries() const; |
- base::TimeDelta success_entry_ttl() const { |
- return success_entry_ttl_; |
- } |
+ base::TimeDelta success_entry_ttl() const; |
- base::TimeDelta failure_entry_ttl() const { |
- return failure_entry_ttl_; |
- } |
+ base::TimeDelta failure_entry_ttl() const; |
// Note that this map may contain expired entries. |
- const EntryMap& entries() const { |
- return entries_; |
- } |
+ const EntryMap& entries() const; |
private: |
FRIEND_TEST(HostCacheTest, Compact); |
FRIEND_TEST(HostCacheTest, NoCache); |
willchan no longer on Chromium
2010/06/08 20:24:22
Was this \n deletion intentional? Up to you, but
cbentzel
2010/06/09 18:01:29
Unintentional, thanks for the catch.
|
- |
// Returns true if this cache entry's result is valid at time |now|. |
static bool CanUseEntry(const Entry* entry, const base::TimeTicks now); |
@@ -135,6 +119,11 @@ class HostCache { |
// matching |pinned_entry| will NOT be pruned. |
void Compact(base::TimeTicks now, const Entry* pinned_entry); |
+ // Returns true if this HostCache can contain no entries. |
+ bool caching_is_disabled() const { |
+ return max_entries_ == 0; |
+ } |
+ |
// Bound on total size of the cache. |
size_t max_entries_; |