summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 00:10:01 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 00:10:01 +0000
commit442b94e6ffc81a9f23865459693e3d7465d54d0c (patch)
treeaed90bd26d9dd030d3215f984ab4b52e40242ef4 /net/disk_cache
parent9897ae912552cfd9315c9e6a8b09ab0166ecb9a4 (diff)
downloadchromium_src-442b94e6ffc81a9f23865459693e3d7465d54d0c.zip
chromium_src-442b94e6ffc81a9f23865459693e3d7465d54d0c.tar.gz
chromium_src-442b94e6ffc81a9f23865459693e3d7465d54d0c.tar.bz2
Disk Cache: Cleaner way to stop evictions at destruction.
BUG=49547 TEST=none Review URL: http://codereview.chromium.org/3008014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_impl.cc15
-rw-r--r--net/disk_cache/backend_impl.h3
-rw-r--r--net/disk_cache/eviction.cc1
3 files changed, 5 insertions, 14 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 13b17f4..5ae789e 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -259,7 +259,7 @@ class FinalCleanup : public Task {
};
void FinalCleanup::Run() {
- backend_->StartCleanup();
+ backend_->CleanupCache();
}
} // namespace
@@ -525,22 +525,15 @@ int BackendImpl::SyncInit() {
return disabled_ ? net::ERR_FAILED : net::OK;
}
-void BackendImpl::StartCleanup() {
- Trace("Backend StartCleanup");
- eviction_.Stop();
-
- // Give a chance for any posted evictions to be discarded.
- MessageLoop::current()->PostTask(FROM_HERE,
- factory_.NewRunnableMethod(&BackendImpl::CleanupCache));
-}
-
void BackendImpl::CleanupCache() {
Trace("Backend Cleanup");
+ eviction_.Stop();
+ timer_.Stop();
+
if (init_) {
if (data_)
data_->header.crash = 0;
- timer_.Stop();
File::WaitForPendingIO(&num_pending_io_);
DCHECK(!num_refs_);
}
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 90283fb..98fc16d 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -83,10 +83,7 @@ class BackendImpl : public Backend {
virtual void GetStats(StatsItems* stats);
// Performs the actual initialization and final cleanup on destruction.
- // Cleanup is a two step process (with a trip to the message loop in between).
- // Note that these methods are not intended for external consumption.
int SyncInit();
- void StartCleanup();
void CleanupCache();
// Same bahavior as OpenNextEntry but walks the list from back to front.
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc
index 91ef9b7..8da01ae 100644
--- a/net/disk_cache/eviction.cc
+++ b/net/disk_cache/eviction.cc
@@ -83,6 +83,7 @@ void Eviction::Stop() {
// this point on.
DCHECK(!trimming_);
trimming_ = true;
+ factory_.RevokeAll();
}
void Eviction::TrimCache(bool empty) {