Chromium Code Reviews| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 int index; | 110 int index; |
| 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. |
|
xunjieli
2017/05/02 18:21:29
can you add a comment here on when |start_time| re
Maks Orlovich
2017/05/02 19:49:20
Done.
| |
| 121 static void OpenEntry(net::CacheType cache_type, | 121 static void OpenEntry(net::CacheType cache_type, |
| 122 const base::FilePath& path, | 122 const base::FilePath& path, |
| 123 const std::string& key, | 123 const std::string& key, |
| 124 uint64_t entry_hash, | 124 uint64_t entry_hash, |
| 125 bool had_index, | 125 bool had_index, |
| 126 const base::TimeTicks& start_time, | |
| 126 SimpleEntryCreationResults* out_results); | 127 SimpleEntryCreationResults* out_results); |
| 127 | 128 |
| 128 static void CreateEntry(net::CacheType cache_type, | 129 static void CreateEntry(net::CacheType cache_type, |
| 129 const base::FilePath& path, | 130 const base::FilePath& path, |
| 130 const std::string& key, | 131 const std::string& key, |
| 131 uint64_t entry_hash, | 132 uint64_t entry_hash, |
| 132 bool had_index, | 133 bool had_index, |
| 134 const base::TimeTicks& start_time, | |
| 133 SimpleEntryCreationResults* out_results); | 135 SimpleEntryCreationResults* out_results); |
| 134 | 136 |
| 135 // Deletes an entry from the file system without affecting the state of the | 137 // Deletes an entry from the file system without affecting the state of the |
| 136 // corresponding instance, if any (allowing operations to continue to be | 138 // corresponding instance, if any (allowing operations to continue to be |
| 137 // executed through that instance). Returns a net error code. | 139 // executed through that instance). Returns a net error code. |
| 138 static int DoomEntry(const base::FilePath& path, uint64_t entry_hash); | 140 static int DoomEntry(const base::FilePath& path, uint64_t entry_hash); |
| 139 | 141 |
| 140 // Like |DoomEntry()| above, except that it truncates the entry files rather | 142 // Like |DoomEntry()| above, except that it truncates the entry files rather |
| 141 // than deleting them. Used when dooming entries after the backend has | 143 // than deleting them. Used when dooming entries after the backend has |
| 142 // shutdown. See implementation of |SimpleEntryImpl::DoomEntryInternal()| for | 144 // 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_; | 364 int64_t sparse_tail_offset_; |
| 363 | 365 |
| 364 // True if the entry was created, or false if it was opened. Used to log | 366 // True if the entry was created, or false if it was opened. Used to log |
| 365 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. | 367 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. |
| 366 bool files_created_; | 368 bool files_created_; |
| 367 }; | 369 }; |
| 368 | 370 |
| 369 } // namespace disk_cache | 371 } // namespace disk_cache |
| 370 | 372 |
| 371 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 373 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| OLD | NEW |