#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"
// 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 {
OPTIMISTIC_OPERATIONS,
};
+ // The Backend provides an |ActiveEntryProxy| instance to this entry when it
+ // is active, meaning it's the canonical entry for this |entry_hash_|. The
+ // entry can make itself inactive by deleting its proxy.
+ class ActiveEntryProxy {
+ public:
+ virtual ~ActiveEntryProxy() = 0;
+ };
+
SimpleEntryImpl(net::CacheType cache_type,
const base::FilePath& path,
uint64 entry_hash,
SimpleBackendImpl* backend,
net::NetLog* net_log);
+ void SetActiveEntryProxy(
+ scoped_ptr<ActiveEntryProxy> active_entry_proxy);
+
// Adds another reader/writer to this entry, if possible, returning |this| to
// |entry|.
int OpenEntry(Entry** entry, const CompletionCallback& callback);
// count.
void ReturnEntryToCaller(Entry** out_entry);
- // Ensures that |this| is no longer referenced by our |backend_|, this
- // guarantees that this entry cannot have OpenEntry/CreateEntry called again.
- void RemoveSelfFromBackend();
-
// An error occured, and the SimpleSynchronousEntry should have Doomed
// us at this point. We need to remove |this| from the Backend and the
// index.
int length,
int stream_index);
+ scoped_ptr<ActiveEntryProxy> active_entry_proxy_;
+
// 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_;