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

Unified Diff: net/base/host_cache.cc

Issue 2721005: Mark HostCache as NonThreadSafe. (Closed)
Patch Set: Created 10 years, 6 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
« net/base/host_cache.h ('K') | « net/base/host_cache.h ('k') | no next file » | 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 791ecca3e20af1fd6659fa7025ff637989c3d72e..8debede6ba167e44c6949af006fb7062b49f3237 100644
--- a/net/base/host_cache.cc
+++ b/net/base/host_cache.cc
@@ -35,6 +35,7 @@ HostCache::~HostCache() {
const HostCache::Entry* HostCache::Lookup(const Key& key,
base::TimeTicks now) const {
+ DCHECK(CalledOnValidThread());
if (caching_is_disabled())
return NULL;
@@ -53,6 +54,7 @@ HostCache::Entry* HostCache::Set(const Key& key,
int error,
const AddressList addrlist,
base::TimeTicks now) {
+ DCHECK(CalledOnValidThread());
if (caching_is_disabled())
return NULL;
@@ -79,6 +81,37 @@ HostCache::Entry* HostCache::Set(const Key& key,
}
}
+void HostCache::clear() {
+ DCHECK(CalledOnValidThread());
+ entries_.clear();
+}
+
+size_t HostCache::size() const {
+ DCHECK(CalledOnValidThread());
+ return entries_.size();
+}
+
+size_t HostCache::max_entries() const {
+ DCHECK(CalledOnValidThread());
+ return max_entries_;
+}
+
+base::TimeDelta HostCache::success_entry_ttl() const {
+ DCHECK(CalledOnValidThread());
+ return success_entry_ttl_;
+}
+
+base::TimeDelta HostCache::failure_entry_ttl() const {
+ DCHECK(CalledOnValidThread());
+ return failure_entry_ttl_;
+}
+
+// Note that this map may contain expired entries.
+const HostCache::EntryMap& HostCache::entries() const {
+ DCHECK(CalledOnValidThread());
+ return entries_;
+}
+
// static
bool HostCache::CanUseEntry(const Entry* entry, const base::TimeTicks now) {
return entry->expiration > now;
« net/base/host_cache.h ('K') | « net/base/host_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698