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

Unified Diff: net/disk_cache/memory/mem_backend_impl.cc

Issue 2784803004: [HTTP Cache] Prevent memory backend from exceeding its max size (Closed)
Patch Set: Nits Created 3 years, 9 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
Index: net/disk_cache/memory/mem_backend_impl.cc
diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc
index a7ad28b8d8d1e163aae095faa569e119e91bb864..e6de26f05de0a818c429ec1c68bc41115a8e8667 100644
--- a/net/disk_cache/memory/mem_backend_impl.cc
+++ b/net/disk_cache/memory/mem_backend_impl.cc
@@ -48,7 +48,7 @@ MemBackendImpl::~MemBackendImpl() {
DCHECK(CheckLRUListOrder(lru_list_));
while (!entries_.empty())
entries_.begin()->second->Doom();
- DCHECK(!current_size_);
+ DCHECK_EQ(0, current_size_);
jkarlin 2017/03/30 15:04:42 Hmm. I'm skeptical that this DCHECK even makes sen
Randy Smith (Not in Mondays) 2017/03/30 16:38:11 Plausible skepticism. I'd say not your problem, t
jkarlin 2017/03/30 17:18:27 Acknowledged.
}
// static
@@ -128,6 +128,10 @@ void MemBackendImpl::ModifyStorageSize(int32_t delta) {
EvictIfNeeded();
}
+bool MemBackendImpl::HasExceededStorageSize() const {
+ return current_size_ > max_size_;
+}
+
net::CacheType MemBackendImpl::GetCacheType() const {
return net::MEMORY_CACHE;
}

Powered by Google App Engine
This is Rietveld 408576698