OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/disk_cache/simple/simple_entry_impl.h" | 5 #include "net/disk_cache/simple/simple_entry_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 return ret_value; | 261 return ret_value; |
262 } | 262 } |
263 | 263 |
264 int SimpleEntryImpl::DoomEntry(const CompletionCallback& callback) { | 264 int SimpleEntryImpl::DoomEntry(const CompletionCallback& callback) { |
265 if (doomed_) | 265 if (doomed_) |
266 return net::OK; | 266 return net::OK; |
267 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_DOOM_CALL); | 267 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_DOOM_CALL); |
268 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_DOOM_BEGIN); | 268 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_DOOM_BEGIN); |
269 | 269 |
270 MarkAsDoomed(); | 270 MarkAsDoomed(); |
| 271 if (backend_.get()) |
| 272 backend_->OnDoomStart(entry_hash_); |
271 pending_operations_.push(SimpleEntryOperation::DoomOperation(this, callback)); | 273 pending_operations_.push(SimpleEntryOperation::DoomOperation(this, callback)); |
272 RunNextOperationIfNeeded(); | 274 RunNextOperationIfNeeded(); |
273 return net::ERR_IO_PENDING; | 275 return net::ERR_IO_PENDING; |
274 } | 276 } |
275 | 277 |
276 void SimpleEntryImpl::SetKey(const std::string& key) { | 278 void SimpleEntryImpl::SetKey(const std::string& key) { |
277 key_ = key; | 279 key_ = key; |
278 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_SET_KEY, | 280 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_SET_KEY, |
279 net::NetLog::StringCallback("key", &key)); | 281 net::NetLog::StringCallback("key", &key)); |
280 } | 282 } |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 Closure reply = base::Bind(&SimpleEntryImpl::WriteOperationComplete, | 912 Closure reply = base::Bind(&SimpleEntryImpl::WriteOperationComplete, |
911 this, | 913 this, |
912 stream_index, | 914 stream_index, |
913 callback, | 915 callback, |
914 base::Passed(&entry_stat), | 916 base::Passed(&entry_stat), |
915 base::Passed(&result)); | 917 base::Passed(&result)); |
916 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply); | 918 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply); |
917 } | 919 } |
918 | 920 |
919 void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) { | 921 void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) { |
920 if (backend_) | |
921 backend_->OnDoomStart(entry_hash_); | |
922 PostTaskAndReplyWithResult( | 922 PostTaskAndReplyWithResult( |
923 worker_pool_, FROM_HERE, | 923 worker_pool_, FROM_HERE, |
924 base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_), | 924 base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_), |
925 base::Bind(&SimpleEntryImpl::DoomOperationComplete, this, callback, | 925 base::Bind(&SimpleEntryImpl::DoomOperationComplete, this, callback, |
926 state_)); | 926 state_)); |
927 state_ = STATE_IO_PENDING; | 927 state_ = STATE_IO_PENDING; |
928 } | 928 } |
929 | 929 |
930 void SimpleEntryImpl::CreationOperationComplete( | 930 void SimpleEntryImpl::CreationOperationComplete( |
931 const CompletionCallback& completion_callback, | 931 const CompletionCallback& completion_callback, |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 type = conflicting ? WRITE_FOLLOWS_CONFLICTING_WRITE | 1241 type = conflicting ? WRITE_FOLLOWS_CONFLICTING_WRITE |
1242 : WRITE_FOLLOWS_NON_CONFLICTING_WRITE; | 1242 : WRITE_FOLLOWS_NON_CONFLICTING_WRITE; |
1243 } | 1243 } |
1244 } | 1244 } |
1245 SIMPLE_CACHE_UMA(ENUMERATION, | 1245 SIMPLE_CACHE_UMA(ENUMERATION, |
1246 "WriteDependencyType", cache_type_, | 1246 "WriteDependencyType", cache_type_, |
1247 type, WRITE_DEPENDENCY_TYPE_MAX); | 1247 type, WRITE_DEPENDENCY_TYPE_MAX); |
1248 } | 1248 } |
1249 | 1249 |
1250 } // namespace disk_cache | 1250 } // namespace disk_cache |
OLD | NEW |