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

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

Issue 23486006: Track entries pending Doom in SimpleCache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 int64 GetDiskUsage() const; 238 int64 GetDiskUsage() const;
239 239
240 // Used to report histograms. 240 // Used to report histograms.
241 void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const; 241 void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const;
242 void RecordWriteDependencyType(const SimpleEntryOperation& operation) const; 242 void RecordWriteDependencyType(const SimpleEntryOperation& operation) const;
243 243
244 // All nonstatic SimpleEntryImpl methods should always be called on the IO 244 // All nonstatic SimpleEntryImpl methods should always be called on the IO
245 // thread, in all cases. |io_thread_checker_| documents and enforces this. 245 // thread, in all cases. |io_thread_checker_| documents and enforces this.
246 base::ThreadChecker io_thread_checker_; 246 base::ThreadChecker io_thread_checker_;
247 247
248 base::WeakPtr<SimpleBackendImpl> backend_; 248 const base::WeakPtr<SimpleBackendImpl> backend_;
249 const scoped_refptr<base::TaskRunner> worker_pool_; 249 const scoped_refptr<base::TaskRunner> worker_pool_;
250 const base::FilePath path_; 250 const base::FilePath path_;
251 const uint64 entry_hash_; 251 const uint64 entry_hash_;
252 const bool use_optimistic_operations_; 252 const bool use_optimistic_operations_;
253 std::string key_; 253 std::string key_;
254 254
255 // |last_used_|, |last_modified_| and |data_size_| are copied from the 255 // |last_used_|, |last_modified_| and |data_size_| are copied from the
256 // synchronous entry at the completion of each item of asynchronous IO. 256 // synchronous entry at the completion of each item of asynchronous IO.
257 // TODO(clamy): Unify last_used_ with data in the index. 257 // TODO(clamy): Unify last_used_ with data in the index.
258 base::Time last_used_; 258 base::Time last_used_;
259 base::Time last_modified_; 259 base::Time last_modified_;
260 int32 data_size_[kSimpleEntryFileCount]; 260 int32 data_size_[kSimpleEntryFileCount];
261 261
262 // Number of times this object has been returned from Backend::OpenEntry() and 262 // Number of times this object has been returned from Backend::OpenEntry() and
263 // Backend::CreateEntry() without subsequent Entry::Close() calls. Used to 263 // Backend::CreateEntry() without subsequent Entry::Close() calls. Used to
264 // notify the backend when this entry not used by any callers. 264 // notify the backend when this entry not used by any callers.
265 int open_count_; 265 int open_count_;
266 266
267 bool doomed_;
Philippe 2013/08/30 13:33:14 Good change :) I like the fact that the validity o
268
267 State state_; 269 State state_;
268 270
269 // When possible, we compute a crc32, for the data in each entry as we read or 271 // When possible, we compute a crc32, for the data in each entry as we read or
270 // write. For each stream, |crc32s_[index]| is the crc32 of that stream from 272 // write. For each stream, |crc32s_[index]| is the crc32 of that stream from
271 // [0 .. |crc32s_end_offset_|). If |crc32s_end_offset_[index] == 0| then the 273 // [0 .. |crc32s_end_offset_|). If |crc32s_end_offset_[index] == 0| then the
272 // value of |crc32s_[index]| is undefined. 274 // value of |crc32s_[index]| is undefined.
273 int32 crc32s_end_offset_[kSimpleEntryFileCount]; 275 int32 crc32s_end_offset_[kSimpleEntryFileCount];
274 uint32 crc32s_[kSimpleEntryFileCount]; 276 uint32 crc32s_[kSimpleEntryFileCount];
275 277
276 // If |have_written_[index]| is true, we have written to the stream |index|. 278 // If |have_written_[index]| is true, we have written to the stream |index|.
(...skipping 11 matching lines...) Expand all
288 std::queue<SimpleEntryOperation> pending_operations_; 290 std::queue<SimpleEntryOperation> pending_operations_;
289 291
290 net::BoundNetLog net_log_; 292 net::BoundNetLog net_log_;
291 293
292 scoped_ptr<SimpleEntryOperation> executing_operation_; 294 scoped_ptr<SimpleEntryOperation> executing_operation_;
293 }; 295 };
294 296
295 } // namespace disk_cache 297 } // namespace disk_cache
296 298
297 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 299 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698