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

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: fix merge 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 d0e9dadf9fb87ff6adaf2d8edf9093b1048c142d..b75f710bdd4bd08275e636c1607e8e7944009f91 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() {
DCHECK(thread_checker_.CalledOnValidThread());
- if (synchronous_entry_in_use_by_worker_) {
- NOTIMPLEMENTED() << ": Overlapping an asynchronous operation.";
- 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
rvargas (doing something else) 2013/02/13 03:23:46 I think this is wrong, but it is also wrong on the
felipeg 2013/02/13 13:47:36 Hi Ricardo, Sorry, why ReaData(old_content) will
+ // 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() {
@@ -93,14 +92,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;
@@ -231,8 +228,7 @@ SimpleEntryImpl::SimpleEntryImpl(
path_(synchronous_entry->path()),
key_(synchronous_entry->key()),
synchronous_entry_(NULL),
- synchronous_entry_in_use_by_worker_(false),
- has_been_doomed_(false) {
+ synchronous_entry_in_use_by_worker_(false) {
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