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

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

Issue 478573003: Connect SimpleCache Backend active_entries_ more closely to Entry lifetime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove inline destructor 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
Index: net/disk_cache/simple/simple_entry_impl.cc
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index dc395d67e84eac208ad8465809331bb07dc867ac..5dbc4dcc4ed4101a0df333ba7c8fbd572aac99eb 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -161,6 +161,8 @@ class SimpleEntryImpl::ScopedOperationRunner {
SimpleEntryImpl* const entry_;
};
+SimpleEntryImpl::BackendDisconnector::~BackendDisconnector() {}
+
SimpleEntryImpl::SimpleEntryImpl(net::CacheType cache_type,
const FilePath& path,
const uint64 entry_hash,
@@ -196,6 +198,12 @@ SimpleEntryImpl::SimpleEntryImpl(net::CacheType cache_type,
CreateNetLogSimpleEntryConstructionCallback(this));
}
+void SimpleEntryImpl::SetBackendDisconnector(
+ scoped_ptr<BackendDisconnector> backend_disconnector) {
+ DCHECK(!backend_disconnector_);
+ backend_disconnector_.reset(backend_disconnector.release());
+}
+
int SimpleEntryImpl::OpenEntry(Entry** out_entry,
const CompletionCallback& callback) {
DCHECK(backend_.get());
@@ -526,7 +534,6 @@ SimpleEntryImpl::~SimpleEntryImpl() {
DCHECK_EQ(0U, pending_operations_.size());
DCHECK(state_ == STATE_UNINITIALIZED || state_ == STATE_FAILURE);
DCHECK(!synchronous_entry_);
- RemoveSelfFromBackend();
net_log_.EndEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY);
}
@@ -568,18 +575,12 @@ void SimpleEntryImpl::ReturnEntryToCaller(Entry** out_entry) {
*out_entry = this;
}
-void SimpleEntryImpl::RemoveSelfFromBackend() {
- if (!backend_.get())
- return;
- backend_->OnDeactivated(this);
-}
-
void SimpleEntryImpl::MarkAsDoomed() {
doomed_ = true;
if (!backend_.get())
return;
backend_->index()->Remove(entry_hash_);
- RemoveSelfFromBackend();
+ backend_disconnector_.reset();
Deprecated (see juliatuttle) 2014/08/22 19:26:38 I'd like a comment here making it clear that reset
gavinp 2014/08/25 13:18:27 I like your suggestion we rename this; I have gone
}
void SimpleEntryImpl::RunNextOperationIfNeeded() {
« net/disk_cache/simple/simple_entry_impl.h ('K') | « net/disk_cache/simple/simple_entry_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698