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

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

Issue 22859060: Fix race condition for non-open/create operations happening after a doom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix parameters alignment 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int buf_len, 170 int buf_len,
171 const CompletionCallback& callback); 171 const CompletionCallback& callback);
172 172
173 void WriteDataInternal(int index, 173 void WriteDataInternal(int index,
174 int offset, 174 int offset,
175 net::IOBuffer* buf, 175 net::IOBuffer* buf,
176 int buf_len, 176 int buf_len,
177 const CompletionCallback& callback, 177 const CompletionCallback& callback,
178 bool truncate); 178 bool truncate);
179 179
180 void DoomEntryInternal(const CompletionCallback& callback);
181
180 // Called after a SimpleSynchronousEntry has completed CreateEntry() or 182 // Called after a SimpleSynchronousEntry has completed CreateEntry() or
181 // OpenEntry(). If |in_sync_entry| is non-NULL, creation is successful and we 183 // OpenEntry(). If |in_sync_entry| is non-NULL, creation is successful and we
182 // can return |this| SimpleEntryImpl to |*out_entry|. Runs 184 // can return |this| SimpleEntryImpl to |*out_entry|. Runs
183 // |completion_callback|. 185 // |completion_callback|.
184 void CreationOperationComplete( 186 void CreationOperationComplete(
185 const CompletionCallback& completion_callback, 187 const CompletionCallback& completion_callback,
186 const base::TimeTicks& start_time, 188 const base::TimeTicks& start_time,
187 scoped_ptr<SimpleEntryCreationResults> in_results, 189 scoped_ptr<SimpleEntryCreationResults> in_results,
188 Entry** out_entry, 190 Entry** out_entry,
189 net::NetLog::EventType end_event_type); 191 net::NetLog::EventType end_event_type);
(...skipping 17 matching lines...) Expand all
207 scoped_ptr<uint32> read_crc32, 209 scoped_ptr<uint32> read_crc32,
208 scoped_ptr<base::Time> last_used, 210 scoped_ptr<base::Time> last_used,
209 scoped_ptr<int> result); 211 scoped_ptr<int> result);
210 212
211 // Called after an asynchronous write completes. 213 // Called after an asynchronous write completes.
212 void WriteOperationComplete(int stream_index, 214 void WriteOperationComplete(int stream_index,
213 const CompletionCallback& completion_callback, 215 const CompletionCallback& completion_callback,
214 scoped_ptr<SimpleEntryStat> entry_stat, 216 scoped_ptr<SimpleEntryStat> entry_stat,
215 scoped_ptr<int> result); 217 scoped_ptr<int> result);
216 218
219 // Called after an asynchronous doom completes. |state_to_restore| was the
220 // state of the entry instance before it transitioned to IO_PENDING.
221 void DoomOperationComplete(State state_to_restore,
222 const CompletionCallback& callback,
223 int result);
224
217 // Called after validating the checksums on an entry. Passes through the 225 // Called after validating the checksums on an entry. Passes through the
218 // original result if successful, propogates the error if the checksum does 226 // original result if successful, propogates the error if the checksum does
219 // not validate. 227 // not validate.
220 void ChecksumOperationComplete( 228 void ChecksumOperationComplete(
221 int stream_index, 229 int stream_index,
222 int orig_result, 230 int orig_result,
223 const CompletionCallback& completion_callback, 231 const CompletionCallback& completion_callback,
224 scoped_ptr<int> result); 232 scoped_ptr<int> result);
225 233
226 // Called after completion of asynchronous IO and receiving file metadata for 234 // Called after completion of asynchronous IO and receiving file metadata for
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 uint32 crc32s_[kSimpleEntryFileCount]; 275 uint32 crc32s_[kSimpleEntryFileCount];
268 276
269 // If |have_written_[index]| is true, we have written to the stream |index|. 277 // If |have_written_[index]| is true, we have written to the stream |index|.
270 bool have_written_[kSimpleEntryFileCount]; 278 bool have_written_[kSimpleEntryFileCount];
271 279
272 // Reflects how much CRC checking has been done with the entry. This state is 280 // Reflects how much CRC checking has been done with the entry. This state is
273 // reported on closing each entry stream. 281 // reported on closing each entry stream.
274 CheckCrcResult crc_check_state_[kSimpleEntryFileCount]; 282 CheckCrcResult crc_check_state_[kSimpleEntryFileCount];
275 283
276 // The |synchronous_entry_| is the worker thread object that performs IO on 284 // The |synchronous_entry_| is the worker thread object that performs IO on
277 // entries. It's owned by this SimpleEntryImpl whenever |operation_running_| 285 // entries.
278 // is false (i.e. when an operation is not pending on the worker pool).
Randy Smith (Not in Mondays) 2013/08/27 19:16:39 I'd really like to keep a comment here describing
279 SimpleSynchronousEntry* synchronous_entry_; 286 SimpleSynchronousEntry* synchronous_entry_;
280 287
281 std::queue<SimpleEntryOperation> pending_operations_; 288 std::queue<SimpleEntryOperation> pending_operations_;
282 289
283 net::BoundNetLog net_log_; 290 net::BoundNetLog net_log_;
284 291
285 scoped_ptr<SimpleEntryOperation> executing_operation_; 292 scoped_ptr<SimpleEntryOperation> executing_operation_;
286 }; 293 };
287 294
288 } // namespace disk_cache 295 } // namespace disk_cache
289 296
290 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 297 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698