OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // See net/disk_cache/disk_cache.h for the public interface of the cache. | 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ | 7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ | 8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 BackendImplV3(const base::FilePath& path, | 50 BackendImplV3(const base::FilePath& path, |
51 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, | 51 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, |
52 net::NetLog* net_log); | 52 net::NetLog* net_log); |
53 virtual ~BackendImplV3(); | 53 virtual ~BackendImplV3(); |
54 | 54 |
55 // Performs general initialization for this current instance of the cache. | 55 // Performs general initialization for this current instance of the cache. |
56 int Init(const CompletionCallback& callback); | 56 int Init(const CompletionCallback& callback); |
57 | 57 |
58 // Same behavior as OpenNextEntry but walks the list from back to front. | |
59 int OpenPrevEntry(void** iter, Entry** prev_entry, | |
60 const CompletionCallback& callback); | |
61 | |
62 // Sets the maximum size for the total amount of data stored by this instance. | 58 // Sets the maximum size for the total amount of data stored by this instance. |
63 bool SetMaxSize(int max_bytes); | 59 bool SetMaxSize(int max_bytes); |
64 | 60 |
65 // Sets the cache type for this backend. | 61 // Sets the cache type for this backend. |
66 void SetType(net::CacheType type); | 62 void SetType(net::CacheType type); |
67 | 63 |
68 // Creates a new storage block of size block_count. | 64 // Creates a new storage block of size block_count. |
69 bool CreateBlock(FileType block_type, int block_count, | 65 bool CreateBlock(FileType block_type, int block_count, |
70 Addr* block_address); | 66 Addr* block_address); |
71 | 67 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void RestartCache(bool failure); | 205 void RestartCache(bool failure); |
210 void PrepareForRestart(); | 206 void PrepareForRestart(); |
211 | 207 |
212 // Performs final cleanup. | 208 // Performs final cleanup. |
213 void CleanupCache(); | 209 void CleanupCache(); |
214 | 210 |
215 // Creates a new entry object. Returns zero on success, or a disk_cache error | 211 // Creates a new entry object. Returns zero on success, or a disk_cache error |
216 // on failure. | 212 // on failure. |
217 int NewEntry(Addr address, EntryImplV3** entry); | 213 int NewEntry(Addr address, EntryImplV3** entry); |
218 | 214 |
219 // Opens the next or previous entry on a cache iteration. | |
220 int OpenFollowingEntry(bool forward, void** iter, Entry** next_entry, | |
221 const CompletionCallback& callback); | |
222 | |
223 // Handles the used storage count. | 215 // Handles the used storage count. |
224 void AddStorageSize(int32 bytes); | 216 void AddStorageSize(int32 bytes); |
225 void SubstractStorageSize(int32 bytes); | 217 void SubstractStorageSize(int32 bytes); |
226 | 218 |
227 // Update the number of referenced cache entries. | 219 // Update the number of referenced cache entries. |
228 void IncreaseNumRefs(); | 220 void IncreaseNumRefs(); |
229 void DecreaseNumRefs(); | 221 void DecreaseNumRefs(); |
230 void IncreaseNumEntries(); | 222 void IncreaseNumEntries(); |
231 void DecreaseNumEntries(); | 223 void DecreaseNumEntries(); |
232 | 224 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 scoped_ptr<base::RepeatingTimer<BackendImplV3> > timer_; // Usage timer. | 272 scoped_ptr<base::RepeatingTimer<BackendImplV3> > timer_; // Usage timer. |
281 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 273 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
282 base::WeakPtrFactory<BackendImplV3> ptr_factory_; | 274 base::WeakPtrFactory<BackendImplV3> ptr_factory_; |
283 | 275 |
284 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); | 276 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); |
285 }; | 277 }; |
286 | 278 |
287 } // namespace disk_cache | 279 } // namespace disk_cache |
288 | 280 |
289 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ | 281 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
OLD | NEW |