Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: net/disk_cache/backend_impl.h

Issue 3054012: Disk Cache: Replace the backend pointer of the ChildrenDeleter... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.cc » ('j') | net/disk_cache/entry_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.h
===================================================================
--- net/disk_cache/backend_impl.h (revision 53428)
+++ net/disk_cache/backend_impl.h (working copy)
@@ -42,7 +42,8 @@
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), done_(true, false),
- ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
+ ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {}
// mask can be used to limit the usable size of the hash table, for testing.
BackendImpl(const FilePath& path, uint32 mask,
base::MessageLoopProxy* cache_thread)
@@ -51,7 +52,8 @@
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), done_(true, false),
- ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
+ ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {}
~BackendImpl();
// Returns a new backend with the desired flags. See the declaration of
@@ -184,6 +186,11 @@
return cache_type_;
}
+ // Returns a weak pointer to this object.
+ base::WeakPtr<BackendImpl> GetWeakPtr() {
+ return ptr_factory_.GetWeakPtr();
+ }
+
// Returns the group for this client, based on the current cache size.
int GetSizeGroup() const;
@@ -337,6 +344,7 @@
base::WaitableEvent done_; // Signals the end of background work.
scoped_refptr<TraceObject> trace_object_; // Inits internal tracing.
ScopedRunnableMethodFactory<BackendImpl> factory_;
+ base::WeakPtrFactory<BackendImpl> ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BackendImpl);
};
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.cc » ('j') | net/disk_cache/entry_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698