| 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_SYNCHRONOUS_ENTRY_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 int offset; | 111 int offset; |
| 112 int64_t sparse_offset; | 112 int64_t sparse_offset; |
| 113 int buf_len; | 113 int buf_len; |
| 114 bool truncate; | 114 bool truncate; |
| 115 bool doomed; | 115 bool doomed; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 // Opens a disk cache entry on disk. The |key| parameter is optional, if empty | 118 // Opens a disk cache entry on disk. The |key| parameter is optional, if empty |
| 119 // the operation may be slower. The |entry_hash| parameter is required. | 119 // the operation may be slower. The |entry_hash| parameter is required. |
| 120 // |had_index| is provided only for histograms. | 120 // |had_index| is provided only for histograms. |
| 121 // |time_enqueued| is when this operation was added to the I/O thread pool, |
| 122 // and is provided only for histograms. |
| 121 static void OpenEntry(net::CacheType cache_type, | 123 static void OpenEntry(net::CacheType cache_type, |
| 122 const base::FilePath& path, | 124 const base::FilePath& path, |
| 123 const std::string& key, | 125 const std::string& key, |
| 124 uint64_t entry_hash, | 126 uint64_t entry_hash, |
| 125 bool had_index, | 127 bool had_index, |
| 128 const base::TimeTicks& time_enqueued, |
| 126 SimpleEntryCreationResults* out_results); | 129 SimpleEntryCreationResults* out_results); |
| 127 | 130 |
| 128 static void CreateEntry(net::CacheType cache_type, | 131 static void CreateEntry(net::CacheType cache_type, |
| 129 const base::FilePath& path, | 132 const base::FilePath& path, |
| 130 const std::string& key, | 133 const std::string& key, |
| 131 uint64_t entry_hash, | 134 uint64_t entry_hash, |
| 132 bool had_index, | 135 bool had_index, |
| 136 const base::TimeTicks& time_enqueued, |
| 133 SimpleEntryCreationResults* out_results); | 137 SimpleEntryCreationResults* out_results); |
| 134 | 138 |
| 135 // Deletes an entry from the file system without affecting the state of the | 139 // Deletes an entry from the file system without affecting the state of the |
| 136 // corresponding instance, if any (allowing operations to continue to be | 140 // corresponding instance, if any (allowing operations to continue to be |
| 137 // executed through that instance). Returns a net error code. | 141 // executed through that instance). Returns a net error code. |
| 138 static int DoomEntry(const base::FilePath& path, uint64_t entry_hash); | 142 static int DoomEntry(const base::FilePath& path, uint64_t entry_hash); |
| 139 | 143 |
| 140 // Like |DoomEntry()| above, except that it truncates the entry files rather | 144 // Like |DoomEntry()| above, except that it truncates the entry files rather |
| 141 // than deleting them. Used when dooming entries after the backend has | 145 // than deleting them. Used when dooming entries after the backend has |
| 142 // shutdown. See implementation of |SimpleEntryImpl::DoomEntryInternal()| for | 146 // shutdown. See implementation of |SimpleEntryImpl::DoomEntryInternal()| for |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 int64_t sparse_tail_offset_; | 366 int64_t sparse_tail_offset_; |
| 363 | 367 |
| 364 // True if the entry was created, or false if it was opened. Used to log | 368 // True if the entry was created, or false if it was opened. Used to log |
| 365 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. | 369 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. |
| 366 bool files_created_; | 370 bool files_created_; |
| 367 }; | 371 }; |
| 368 | 372 |
| 369 } // namespace disk_cache | 373 } // namespace disk_cache |
| 370 | 374 |
| 371 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 375 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| OLD | NEW |