Chromium Code Reviews| 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(); |
| } |