diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 18:07:27 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 18:07:27 +0000 |
commit | 9e7bb508cad27e505644d856c132f742d5742cdc (patch) | |
tree | 3aae06610cc9babf29540a078d698dad217bf708 /net/base/host_cache.h | |
parent | 5af2c5d8f4dac890633084af4dd545fc488906ce (diff) | |
download | chromium_src-9e7bb508cad27e505644d856c132f742d5742cdc.zip chromium_src-9e7bb508cad27e505644d856c132f742d5742cdc.tar.gz chromium_src-9e7bb508cad27e505644d856c132f742d5742cdc.tar.bz2 |
Mark HostCache as NonThreadSafe.
BUG=None
TEST=net_unittests, and ran chrome with net_internals DNS.
Review URL: http://codereview.chromium.org/2721005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49285 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_cache.h')
-rw-r--r-- | net/base/host_cache.h | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/net/base/host_cache.h b/net/base/host_cache.h index 94022e4..59e4315 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,37 +93,21 @@ 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); @@ -135,6 +120,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_; |