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

Unified Diff: net/disk_cache/simple/simple_entry_impl.h

Issue 478573003: Connect SimpleCache Backend active_entries_ more closely to Entry lifetime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more comment Created 6 years, 4 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 | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2dfb757e19a5292ea8495ff4155850944ed9b5e5 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 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,
@@ -56,6 +62,9 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry,
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);
@@ -150,10 +159,6 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry,
// 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.
@@ -297,6 +302,8 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry,
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_;
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698