Index: net/disk_cache/simple/simple_entry_impl.h |
diff --git a/net/disk_cache/simple/simple_entry_impl.h b/net/disk_cache/simple/simple_entry_impl.h |
index 2d78d8bfe0a04c984916d9b09e3ee7d208855cd0..41f4cc142983b1b138442a6c046861e12306b9ab 100644 |
--- a/net/disk_cache/simple/simple_entry_impl.h |
+++ b/net/disk_cache/simple/simple_entry_impl.h |
@@ -11,7 +11,6 @@ |
#include "base/files/file_path.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
-#include "base/memory/weak_ptr.h" |
#include "base/threading/thread_checker.h" |
#include "net/base/cache_type.h" |
#include "net/base/net_export.h" |
@@ -40,8 +39,7 @@ struct SimpleEntryCreationResults; |
// disk cache. It proxies for the SimpleSynchronousEntry, which performs IO |
// on the worker thread. |
class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
- public base::RefCounted<SimpleEntryImpl>, |
- public base::SupportsWeakPtr<SimpleEntryImpl> { |
+ public base::RefCounted<SimpleEntryImpl> { |
friend class base::RefCounted<SimpleEntryImpl>; |
public: |
enum OperationsMode { |
@@ -49,6 +47,14 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
OPTIMISTIC_OPERATIONS, |
}; |
+ // The Backend can provide an instance of BackendDisconnector to an entry, to |
+ // allow the entry to remove itself from the Backend for instance when doomed |
+ // or destructed. |
+ class BackendDisconnector { |
+ public: |
+ virtual ~BackendDisconnector() = 0; |
+ }; |
+ |
SimpleEntryImpl(net::CacheType cache_type, |
const base::FilePath& path, |
uint64 entry_hash, |
@@ -56,6 +62,11 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
SimpleBackendImpl* backend, |
net::NetLog* net_log); |
+ // The provided |backend_disconnector| will be destroyed when this object |
+ // no longer is to be managed by its backend. |
+ void SetBackendDisconnector( |
+ scoped_ptr<BackendDisconnector> backend_disconnector); |
+ |
// Adds another reader/writer to this entry, if possible, returning |this| to |
// |entry|. |
int OpenEntry(Entry** entry, const CompletionCallback& callback); |
@@ -297,6 +308,10 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
int length, |
int stream_index); |
+ // The |backend_disconnector_| is among our first methods to insure that the |
Deprecated (see juliatuttle)
2014/08/22 19:26:38
This is a field, not a method, and isn't destructi
gavinp
2014/08/25 13:18:27
Removed this comment. And I think its placement is
|
+ // entry removes itself from the backend early. |
+ scoped_ptr<BackendDisconnector> backend_disconnector_; |
+ |
// All nonstatic SimpleEntryImpl methods should always be called on the IO |
// thread, in all cases. |io_thread_checker_| documents and enforces this. |
base::ThreadChecker io_thread_checker_; |