summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 18:06:15 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 18:06:15 +0000
commitb87b23727abd34f94fc25377424e4605b249fbc2 (patch)
treedd659392849e0b0fbbb90e3ee610437dfcc6b134 /net/disk_cache/backend_impl.h
parent6833846f5fc1334e8ce152e00bb80e0bfffce0c5 (diff)
downloadchromium_src-b87b23727abd34f94fc25377424e4605b249fbc2.zip
chromium_src-b87b23727abd34f94fc25377424e4605b249fbc2.tar.gz
chromium_src-b87b23727abd34f94fc25377424e4605b249fbc2.tar.bz2
Disk cache: Avoid restarting the cache while it may be in use.
Now the code that releases resources runs from the message loop so that methods can cause the cache to disable itself while still being able to touch internal state. BUG=17604 TEST=unittests. Review URL: http://codereview.chromium.org/159327 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21550 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.h')
-rw-r--r--net/disk_cache/backend_impl.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index ef282779..2ab582d 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -35,13 +35,15 @@ class BackendImpl : public Backend {
: path_(path), block_files_(path), mask_(0), max_size_(0),
cache_type_(net::DISK_CACHE), uma_report_(0), user_flags_(0),
init_(false), restarted_(false), unit_test_(false), read_only_(false),
- new_eviction_(false), first_timer_(true) {}
+ new_eviction_(false), first_timer_(true),
+ ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
// mask can be used to limit the usable size of the hash table, for testing.
BackendImpl(const std::wstring& path, uint32 mask)
: path_(path), block_files_(path), mask_(mask), max_size_(0),
cache_type_(net::DISK_CACHE), uma_report_(0), user_flags_(kMask),
init_(false), restarted_(false), unit_test_(false), read_only_(false),
- new_eviction_(false), first_timer_(true) {}
+ new_eviction_(false), first_timer_(true),
+ ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
~BackendImpl();
// Performs general initialization for this current instance of the cache.
@@ -272,6 +274,7 @@ class BackendImpl : public Backend {
Stats stats_; // Usage statistcs.
base::RepeatingTimer<BackendImpl> timer_; // Usage timer.
scoped_refptr<TraceObject> trace_object_; // Inits internal tracing.
+ ScopedRunnableMethodFactory<BackendImpl> factory_;
DISALLOW_EVIL_CONSTRUCTORS(BackendImpl);
};