summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 01:04:03 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 01:04:03 +0000
commit05b4878b77f5f93b375a021f677e62351ab78894 (patch)
tree7e8cd39a76d12cc571a9d8c80c91a301a5b44059 /net/disk_cache/backend_impl.cc
parent781f2253d08b20835efb11cfbffb2e305f9575bc (diff)
downloadchromium_src-05b4878b77f5f93b375a021f677e62351ab78894.zip
chromium_src-05b4878b77f5f93b375a021f677e62351ab78894.tar.gz
chromium_src-05b4878b77f5f93b375a021f677e62351ab78894.tar.bz2
Revert "Revert the disk_cache change part of http://codereview.chromium.org/9035012"
The hanging test is unrelated to this change (it's merely tickled by a potential timing change). BUG=50346 TEST=none TBR=awong Review URL: http://codereview.chromium.org/9088002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r--net/disk_cache/backend_impl.cc22
1 files changed, 5 insertions, 17 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index c86d9a8..a014c5a 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -87,23 +87,10 @@ FilePath GetPrefixedName(const FilePath& path, const std::string& name,
return path.AppendASCII(tmp);
}
-// This is a simple Task to cleanup old caches.
-class CleanupTask : public Task {
- public:
- CleanupTask(const FilePath& path, const std::string& name)
- : path_(path), name_(name) {}
-
- virtual void Run();
-
- private:
- FilePath path_;
- std::string name_;
- DISALLOW_COPY_AND_ASSIGN(CleanupTask);
-};
-
-void CleanupTask::Run() {
+// This is a simple callback to cleanup old caches.
+void CleanupCallback(const FilePath& path, const std::string& name) {
for (int i = 0; i < kMaxOldFolders; i++) {
- FilePath to_delete = GetPrefixedName(path_, name_, i);
+ FilePath to_delete = GetPrefixedName(path, name, i);
disk_cache::DeleteCache(to_delete, true);
}
}
@@ -148,7 +135,8 @@ bool DelayedCacheCleanup(const FilePath& full_path) {
return false;
}
- base::WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
+ base::WorkerPool::PostTask(
+ FROM_HERE, base::Bind(&CleanupCallback, path, name_str), true);
return true;
}