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

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

Issue 12223075: Make SimpleEntryImpl::Doom() completely asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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_entry_impl.h ('k') | net/disk_cache/simple/simple_synchronous_entry.h » ('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.cc
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index 6d1b7b134e4f97d084271c992c1d34cbd3ad9129..68f65dc12f8e1c5e4bf4bac22270844bc943dbb6 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -74,16 +74,15 @@ int SimpleEntryImpl::DoomEntry(const FilePath& path,
}
void SimpleEntryImpl::Doom() {
- if (synchronous_entry_in_use_by_worker_) {
- NOTIMPLEMENTED();
- return;
- }
- WorkerPool::PostTask(FROM_HERE,
- base::Bind(&SimpleSynchronousEntry::DoomAndClose,
- base::Unretained(synchronous_entry_)),
- true);
- synchronous_entry_ = NULL;
- has_been_doomed_ = true;
+#if defined(OS_POSIX)
+ // This call to static SimpleEntryImpl::DoomEntry() will just erase the
+ // underlying files. On POSIX, this is fine; the files are still open on the
+ // SimpleSynchronousEntry, and operations can even happen on them. The files
+ // will be removed from the filesystem when they are closed.
+ DoomEntry(path_, key_, CompletionCallback());
+#else
+ NOTIMPLEMENTED();
+#endif
}
void SimpleEntryImpl::Close() {
@@ -92,14 +91,12 @@ void SimpleEntryImpl::Close() {
delete this;
return;
}
- DCHECK(synchronous_entry_ || has_been_doomed_);
- if (!has_been_doomed_) {
- WorkerPool::PostTask(FROM_HERE,
- base::Bind(&SimpleSynchronousEntry::Close,
- base::Unretained(synchronous_entry_)),
- true);
- synchronous_entry_ = NULL;
- }
+ DCHECK(synchronous_entry_);
+ WorkerPool::PostTask(FROM_HERE,
+ base::Bind(&SimpleSynchronousEntry::Close,
+ base::Unretained(synchronous_entry_)),
+ true);
+ synchronous_entry_ = NULL;
// Entry::Close() is expected to release this entry. See disk_cache.h for
// details.
delete this;
@@ -218,8 +215,7 @@ SimpleEntryImpl::SimpleEntryImpl(
path_(synchronous_entry->path()),
key_(synchronous_entry->key()),
synchronous_entry_(synchronous_entry),
- synchronous_entry_in_use_by_worker_(false),
- has_been_doomed_(false) {
+ synchronous_entry_in_use_by_worker_(false) {
DCHECK(synchronous_entry);
SetSynchronousData();
}
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.h ('k') | net/disk_cache/simple/simple_synchronous_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698