summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/eviction.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 00:00:21 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 00:00:21 +0000
commit93794a7e23b578fac1cd41b232f6018268cd21fa (patch)
treed75981f821084772ff488a60b1da0b86c6ed2a98 /net/disk_cache/eviction.cc
parent5471c7aacd182997567ee7ee5c78328b98b933ab (diff)
downloadchromium_src-93794a7e23b578fac1cd41b232f6018268cd21fa.zip
chromium_src-93794a7e23b578fac1cd41b232f6018268cd21fa.tar.gz
chromium_src-93794a7e23b578fac1cd41b232f6018268cd21fa.tar.bz2
Disk cache: Stop evictions while performing final cleanup.
The evictions code may post tasks for further processing and that is a problem at cache destruction, so add an explicit method to stop evictions. BUG=49547 TEST=none Review URL: http://codereview.chromium.org/2854053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/eviction.cc')
-rw-r--r--net/disk_cache/eviction.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc
index e2e810a..91ef9b7 100644
--- a/net/disk_cache/eviction.cc
+++ b/net/disk_cache/eviction.cc
@@ -70,6 +70,19 @@ void Eviction::Init(BackendImpl* backend) {
trimming_ = false;
delay_trim_ = false;
trim_delays_ = 0;
+ init_ = true;
+}
+
+void Eviction::Stop() {
+ // It is possible for the backend initialization to fail, in which case this
+ // object was never initialized... and there is nothing to do.
+ if (!init_)
+ return;
+
+ // We want to stop further evictions, so let's pretend that we are busy from
+ // this point on.
+ DCHECK(!trimming_);
+ trimming_ = true;
}
void Eviction::TrimCache(bool empty) {