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

Side by Side Diff: net/disk_cache/simple/simple_entry_impl.cc

Issue 23486006: Track entries pending Doom in SimpleCache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 Closure reply = base::Bind(&SimpleEntryImpl::WriteOperationComplete, 884 Closure reply = base::Bind(&SimpleEntryImpl::WriteOperationComplete,
885 this, 885 this,
886 stream_index, 886 stream_index,
887 callback, 887 callback,
888 base::Passed(&entry_stat), 888 base::Passed(&entry_stat),
889 base::Passed(&result)); 889 base::Passed(&result));
890 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply); 890 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply);
891 } 891 }
892 892
893 void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) { 893 void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) {
894 if (backend_)
895 backend_->OnDoomStart(entry_hash_);
894 PostTaskAndReplyWithResult( 896 PostTaskAndReplyWithResult(
895 worker_pool_, FROM_HERE, 897 worker_pool_, FROM_HERE,
896 base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_), 898 base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_),
897 base::Bind(&SimpleEntryImpl::DoomOperationComplete, this, callback, 899 base::Bind(&SimpleEntryImpl::DoomOperationComplete,
898 state_)); 900 this, backend_, callback, state_));
899 state_ = STATE_IO_PENDING; 901 state_ = STATE_IO_PENDING;
900 } 902 }
901 903
902 void SimpleEntryImpl::CreationOperationComplete( 904 void SimpleEntryImpl::CreationOperationComplete(
903 const CompletionCallback& completion_callback, 905 const CompletionCallback& completion_callback,
904 const base::TimeTicks& start_time, 906 const base::TimeTicks& start_time,
905 scoped_ptr<SimpleEntryCreationResults> in_results, 907 scoped_ptr<SimpleEntryCreationResults> in_results,
906 Entry** out_entry, 908 Entry** out_entry,
907 net::NetLog::EventType end_event_type) { 909 net::NetLog::EventType end_event_type) {
908 DCHECK(io_thread_checker_.CalledOnValidThread()); 910 DCHECK(io_thread_checker_.CalledOnValidThread());
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 RecordWriteResult(WRITE_RESULT_SYNC_WRITE_FAILURE); 1064 RecordWriteResult(WRITE_RESULT_SYNC_WRITE_FAILURE);
1063 if (net_log_.IsLoggingAllEvents()) { 1065 if (net_log_.IsLoggingAllEvents()) {
1064 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, 1066 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END,
1065 CreateNetLogReadWriteCompleteCallback(*result)); 1067 CreateNetLogReadWriteCompleteCallback(*result));
1066 } 1068 }
1067 1069
1068 EntryOperationComplete( 1070 EntryOperationComplete(
1069 stream_index, completion_callback, *entry_stat, result.Pass()); 1071 stream_index, completion_callback, *entry_stat, result.Pass());
1070 } 1072 }
1071 1073
1072 void SimpleEntryImpl::DoomOperationComplete(const CompletionCallback& callback, 1074 void SimpleEntryImpl::DoomOperationComplete(
1073 State state_to_restore, 1075 const base::WeakPtr<SimpleBackendImpl>& backend,
1074 int result) { 1076 const CompletionCallback& callback,
1077 State state_to_restore,
1078 int result) {
1075 state_ = state_to_restore; 1079 state_ = state_to_restore;
1080 if (backend)
1081 backend->OnDoomComplete(entry_hash_);
1076 if (!callback.is_null()) 1082 if (!callback.is_null())
1077 callback.Run(result); 1083 callback.Run(result);
1078 RunNextOperationIfNeeded(); 1084 RunNextOperationIfNeeded();
1079 } 1085 }
1080 1086
1081 void SimpleEntryImpl::ChecksumOperationComplete( 1087 void SimpleEntryImpl::ChecksumOperationComplete(
1082 int orig_result, 1088 int orig_result,
1083 int stream_index, 1089 int stream_index,
1084 const CompletionCallback& completion_callback, 1090 const CompletionCallback& completion_callback,
1085 scoped_ptr<int> result) { 1091 scoped_ptr<int> result) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 } else { 1219 } else {
1214 type = conflicting ? WRITE_FOLLOWS_CONFLICTING_WRITE 1220 type = conflicting ? WRITE_FOLLOWS_CONFLICTING_WRITE
1215 : WRITE_FOLLOWS_NON_CONFLICTING_WRITE; 1221 : WRITE_FOLLOWS_NON_CONFLICTING_WRITE;
1216 } 1222 }
1217 } 1223 }
1218 UMA_HISTOGRAM_ENUMERATION( 1224 UMA_HISTOGRAM_ENUMERATION(
1219 "SimpleCache.WriteDependencyType", type, WRITE_DEPENDENCY_TYPE_MAX); 1225 "SimpleCache.WriteDependencyType", type, WRITE_DEPENDENCY_TYPE_MAX);
1220 } 1226 }
1221 1227
1222 } // namespace disk_cache 1228 } // namespace disk_cache
OLDNEW
« net/disk_cache/simple/simple_backend_impl.cc ('K') | « net/disk_cache/simple/simple_entry_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698