summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc2
-rw-r--r--net/disk_cache/eviction.cc9
-rw-r--r--net/disk_cache/eviction.h1
3 files changed, 9 insertions, 3 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 63db6b1..be7292d 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -713,7 +713,7 @@ int BackendImpl::MaxFileSize() const {
}
void BackendImpl::ModifyStorageSize(int32 old_size, int32 new_size) {
- if (disabled_)
+ if (disabled_ || old_size == new_size)
return;
if (old_size > new_size)
SubstractStorageSize(old_size - new_size);
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc
index cae5702..f4e74b2 100644
--- a/net/disk_cache/eviction.cc
+++ b/net/disk_cache/eviction.cc
@@ -65,6 +65,7 @@ void Eviction::Init(BackendImpl* backend) {
max_size_ = LowWaterAdjust(backend_->max_size_);
new_eviction_ = backend->new_eviction_;
first_trim_ = true;
+ trimming_ = false;
}
void Eviction::TrimCache(bool empty) {
@@ -72,9 +73,10 @@ void Eviction::TrimCache(bool empty) {
return TrimCacheV2(empty);
Trace("*** Trim Cache ***");
- if (backend_->disabled_)
+ if (backend_->disabled_ || trimming_)
return;
+ trimming_ = true;
Time start = Time::Now();
Rankings::ScopedRankingsBlock node(rankings_);
Rankings::ScopedRankingsBlock next(rankings_,
@@ -103,6 +105,7 @@ void Eviction::TrimCache(bool empty) {
}
CACHE_UMA(AGE_MS, "TotalTrimTime", 0, start);
+ trimming_ = false;
Trace("*** Trim Cache end ***");
return;
}
@@ -204,9 +207,10 @@ bool Eviction::EvictEntry(CacheRankingsBlock* node, bool empty) {
void Eviction::TrimCacheV2(bool empty) {
Trace("*** Trim Cache ***");
- if (backend_->disabled_)
+ if (backend_->disabled_ || trimming_)
return;
+ trimming_ = true;
Time start = Time::Now();
const int kListsToSearch = 3;
@@ -274,6 +278,7 @@ void Eviction::TrimCacheV2(bool empty) {
CACHE_UMA(AGE_MS, "TotalTrimTime", 0, start);
Trace("*** Trim Cache end ***");
+ trimming_ = false;
return;
}
diff --git a/net/disk_cache/eviction.h b/net/disk_cache/eviction.h
index 6526cff..3392680 100644
--- a/net/disk_cache/eviction.h
+++ b/net/disk_cache/eviction.h
@@ -67,6 +67,7 @@ class Eviction {
int max_size_;
bool new_eviction_;
bool first_trim_;
+ bool trimming_;
ScopedRunnableMethodFactory<Eviction> factory_;
DISALLOW_COPY_AND_ASSIGN(Eviction);