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 #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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 int64 GetDiskUsage() const; | 240 int64 GetDiskUsage() const; |
241 | 241 |
242 // Used to report histograms. | 242 // Used to report histograms. |
243 void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const; | 243 void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const; |
244 void RecordWriteDependencyType(const SimpleEntryOperation& operation) const; | 244 void RecordWriteDependencyType(const SimpleEntryOperation& operation) const; |
245 | 245 |
246 // All nonstatic SimpleEntryImpl methods should always be called on the IO | 246 // All nonstatic SimpleEntryImpl methods should always be called on the IO |
247 // thread, in all cases. |io_thread_checker_| documents and enforces this. | 247 // thread, in all cases. |io_thread_checker_| documents and enforces this. |
248 base::ThreadChecker io_thread_checker_; | 248 base::ThreadChecker io_thread_checker_; |
249 | 249 |
250 base::WeakPtr<SimpleBackendImpl> backend_; | 250 const base::WeakPtr<SimpleBackendImpl> backend_; |
251 const net::CacheType cache_type_; | 251 const net::CacheType cache_type_; |
252 const scoped_refptr<base::TaskRunner> worker_pool_; | 252 const scoped_refptr<base::TaskRunner> worker_pool_; |
253 const base::FilePath path_; | 253 const base::FilePath path_; |
254 const uint64 entry_hash_; | 254 const uint64 entry_hash_; |
255 const bool use_optimistic_operations_; | 255 const bool use_optimistic_operations_; |
256 std::string key_; | 256 std::string key_; |
257 | 257 |
258 // |last_used_|, |last_modified_| and |data_size_| are copied from the | 258 // |last_used_|, |last_modified_| and |data_size_| are copied from the |
259 // synchronous entry at the completion of each item of asynchronous IO. | 259 // synchronous entry at the completion of each item of asynchronous IO. |
260 // TODO(clamy): Unify last_used_ with data in the index. | 260 // TODO(clamy): Unify last_used_ with data in the index. |
261 base::Time last_used_; | 261 base::Time last_used_; |
262 base::Time last_modified_; | 262 base::Time last_modified_; |
263 int32 data_size_[kSimpleEntryFileCount]; | 263 int32 data_size_[kSimpleEntryFileCount]; |
264 | 264 |
265 // Number of times this object has been returned from Backend::OpenEntry() and | 265 // Number of times this object has been returned from Backend::OpenEntry() and |
266 // Backend::CreateEntry() without subsequent Entry::Close() calls. Used to | 266 // Backend::CreateEntry() without subsequent Entry::Close() calls. Used to |
267 // notify the backend when this entry not used by any callers. | 267 // notify the backend when this entry not used by any callers. |
268 int open_count_; | 268 int open_count_; |
269 | 269 |
| 270 bool doomed_; |
| 271 |
270 State state_; | 272 State state_; |
271 | 273 |
272 // When possible, we compute a crc32, for the data in each entry as we read or | 274 // When possible, we compute a crc32, for the data in each entry as we read or |
273 // write. For each stream, |crc32s_[index]| is the crc32 of that stream from | 275 // write. For each stream, |crc32s_[index]| is the crc32 of that stream from |
274 // [0 .. |crc32s_end_offset_|). If |crc32s_end_offset_[index] == 0| then the | 276 // [0 .. |crc32s_end_offset_|). If |crc32s_end_offset_[index] == 0| then the |
275 // value of |crc32s_[index]| is undefined. | 277 // value of |crc32s_[index]| is undefined. |
276 int32 crc32s_end_offset_[kSimpleEntryFileCount]; | 278 int32 crc32s_end_offset_[kSimpleEntryFileCount]; |
277 uint32 crc32s_[kSimpleEntryFileCount]; | 279 uint32 crc32s_[kSimpleEntryFileCount]; |
278 | 280 |
279 // If |have_written_[index]| is true, we have written to the stream |index|. | 281 // If |have_written_[index]| is true, we have written to the stream |index|. |
(...skipping 14 matching lines...) Expand all Loading... |
294 std::queue<SimpleEntryOperation> pending_operations_; | 296 std::queue<SimpleEntryOperation> pending_operations_; |
295 | 297 |
296 net::BoundNetLog net_log_; | 298 net::BoundNetLog net_log_; |
297 | 299 |
298 scoped_ptr<SimpleEntryOperation> executing_operation_; | 300 scoped_ptr<SimpleEntryOperation> executing_operation_; |
299 }; | 301 }; |
300 | 302 |
301 } // namespace disk_cache | 303 } // namespace disk_cache |
302 | 304 |
303 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 305 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
OLD | NEW |