| 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 04d2ce99ab7f5d11ed40e2e1fcf0a3dbc2196667..379b5877f4942c89e99abc81cbb3bc295b9c063e 100644
|
| --- a/net/disk_cache/simple/simple_entry_impl.cc
|
| +++ b/net/disk_cache/simple/simple_entry_impl.cc
|
| @@ -164,6 +164,7 @@ SimpleEntryImpl::SimpleEntryImpl(const FilePath& path,
|
| last_used_(Time::Now()),
|
| last_modified_(last_used_),
|
| open_count_(0),
|
| + doomed_(false),
|
| state_(STATE_UNINITIALIZED),
|
| synchronous_entry_(NULL),
|
| net_log_(net::BoundNetLog::Make(
|
| @@ -527,12 +528,12 @@ void SimpleEntryImpl::RemoveSelfFromBackend() {
|
| if (!backend_.get())
|
| return;
|
| backend_->OnDeactivated(this);
|
| - backend_.reset();
|
| }
|
|
|
| void SimpleEntryImpl::MarkAsDoomed() {
|
| if (!backend_.get())
|
| return;
|
| + doomed_ = true;
|
| backend_->index()->Remove(entry_hash_);
|
| RemoveSelfFromBackend();
|
| }
|
| @@ -779,7 +780,7 @@ void SimpleEntryImpl::ReadDataInternal(int stream_index,
|
| buf_len = std::min(buf_len, GetDataSize(stream_index) - offset);
|
|
|
| state_ = STATE_IO_PENDING;
|
| - if (backend_.get())
|
| + if (!doomed_ && backend_.get())
|
| backend_->index()->UseIfExists(entry_hash_);
|
|
|
| scoped_ptr<uint32> read_crc32(new uint32());
|
| @@ -839,7 +840,7 @@ void SimpleEntryImpl::WriteDataInternal(int stream_index,
|
|
|
| DCHECK_EQ(STATE_READY, state_);
|
| state_ = STATE_IO_PENDING;
|
| - if (backend_.get())
|
| + if (!doomed_ && backend_.get())
|
| backend_->index()->UseIfExists(entry_hash_);
|
| // It is easy to incrementally compute the CRC from [0 .. |offset + buf_len|)
|
| // if |offset == 0| or we have already computed the CRC for [0 .. offset).
|
| @@ -891,6 +892,8 @@ void SimpleEntryImpl::WriteDataInternal(int stream_index,
|
| }
|
|
|
| void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) {
|
| + if (backend_)
|
| + backend_->OnDoomStart(entry_hash_);
|
| PostTaskAndReplyWithResult(
|
| worker_pool_, FROM_HERE,
|
| base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_),
|
| @@ -1069,13 +1072,16 @@ void SimpleEntryImpl::WriteOperationComplete(
|
| stream_index, completion_callback, *entry_stat, result.Pass());
|
| }
|
|
|
| -void SimpleEntryImpl::DoomOperationComplete(const CompletionCallback& callback,
|
| - State state_to_restore,
|
| - int result) {
|
| +void SimpleEntryImpl::DoomOperationComplete(
|
| + const CompletionCallback& callback,
|
| + State state_to_restore,
|
| + int result) {
|
| state_ = state_to_restore;
|
| if (!callback.is_null())
|
| callback.Run(result);
|
| RunNextOperationIfNeeded();
|
| + if (backend_)
|
| + backend_->OnDoomComplete(entry_hash_);
|
| }
|
|
|
| void SimpleEntryImpl::ChecksumOperationComplete(
|
| @@ -1137,7 +1143,7 @@ void SimpleEntryImpl::UpdateDataFromEntryStat(
|
| for (int i = 0; i < kSimpleEntryFileCount; ++i) {
|
| data_size_[i] = entry_stat.data_size[i];
|
| }
|
| - if (backend_.get())
|
| + if (!doomed_ && backend_.get())
|
| backend_->index()->UpdateEntrySize(entry_hash_, GetDiskUsage());
|
| }
|
|
|
|
|