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_H_ | 7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ |
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ | 8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual ~BackendImpl(); | 60 virtual ~BackendImpl(); |
61 | 61 |
62 // Performs general initialization for this current instance of the cache. | 62 // Performs general initialization for this current instance of the cache. |
63 int Init(const CompletionCallback& callback); | 63 int Init(const CompletionCallback& callback); |
64 | 64 |
65 // Performs the actual initialization and final cleanup on destruction. | 65 // Performs the actual initialization and final cleanup on destruction. |
66 int SyncInit(); | 66 int SyncInit(); |
67 void CleanupCache(); | 67 void CleanupCache(); |
68 | 68 |
69 // Same behavior as OpenNextEntry but walks the list from back to front. | 69 // Same behavior as OpenNextEntry but walks the list from back to front. |
70 int OpenPrevEntry(void** iter, Entry** prev_entry, | 70 int OpenPrevEntry(Iterator* iter, Entry** prev_entry, |
71 const CompletionCallback& callback); | 71 const CompletionCallback& callback); |
72 | 72 |
73 // Synchronous implementation of the asynchronous interface. | 73 // Synchronous implementation of the asynchronous interface. |
74 int SyncOpenEntry(const std::string& key, Entry** entry); | 74 int SyncOpenEntry(const std::string& key, Entry** entry); |
75 int SyncCreateEntry(const std::string& key, Entry** entry); | 75 int SyncCreateEntry(const std::string& key, Entry** entry); |
76 int SyncDoomEntry(const std::string& key); | 76 int SyncDoomEntry(const std::string& key); |
77 int SyncDoomAllEntries(); | 77 int SyncDoomAllEntries(); |
78 int SyncDoomEntriesBetween(base::Time initial_time, | 78 int SyncDoomEntriesBetween(base::Time initial_time, |
79 base::Time end_time); | 79 base::Time end_time); |
80 int SyncDoomEntriesSince(base::Time initial_time); | 80 int SyncDoomEntriesSince(base::Time initial_time); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 virtual int CreateEntry(const std::string& key, Entry** entry, | 272 virtual int CreateEntry(const std::string& key, Entry** entry, |
273 const CompletionCallback& callback) OVERRIDE; | 273 const CompletionCallback& callback) OVERRIDE; |
274 virtual int DoomEntry(const std::string& key, | 274 virtual int DoomEntry(const std::string& key, |
275 const CompletionCallback& callback) OVERRIDE; | 275 const CompletionCallback& callback) OVERRIDE; |
276 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; | 276 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; |
277 virtual int DoomEntriesBetween(base::Time initial_time, | 277 virtual int DoomEntriesBetween(base::Time initial_time, |
278 base::Time end_time, | 278 base::Time end_time, |
279 const CompletionCallback& callback) OVERRIDE; | 279 const CompletionCallback& callback) OVERRIDE; |
280 virtual int DoomEntriesSince(base::Time initial_time, | 280 virtual int DoomEntriesSince(base::Time initial_time, |
281 const CompletionCallback& callback) OVERRIDE; | 281 const CompletionCallback& callback) OVERRIDE; |
282 virtual int OpenNextEntry(void** iter, Entry** next_entry, | 282 virtual int OpenNextEntry(Iterator* iter, Entry** next_entry, |
283 const CompletionCallback& callback) OVERRIDE; | 283 const CompletionCallback& callback) OVERRIDE; |
284 virtual void EndEnumeration(void** iter) OVERRIDE; | |
285 virtual void GetStats(StatsItems* stats) OVERRIDE; | 284 virtual void GetStats(StatsItems* stats) OVERRIDE; |
286 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 285 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
287 | 286 |
288 private: | 287 private: |
289 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; | 288 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; |
290 | 289 |
291 // Creates a new backing file for the cache index. | 290 // Creates a new backing file for the cache index. |
292 bool CreateBackingStore(disk_cache::File* file); | 291 bool CreateBackingStore(disk_cache::File* file); |
293 bool InitBackingStore(bool* file_created); | 292 bool InitBackingStore(bool* file_created); |
294 void AdjustMaxCacheSize(int table_len); | 293 void AdjustMaxCacheSize(int table_len); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 base::WaitableEvent done_; // Signals the end of background work. | 398 base::WaitableEvent done_; // Signals the end of background work. |
400 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 399 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
401 base::WeakPtrFactory<BackendImpl> ptr_factory_; | 400 base::WeakPtrFactory<BackendImpl> ptr_factory_; |
402 | 401 |
403 DISALLOW_COPY_AND_ASSIGN(BackendImpl); | 402 DISALLOW_COPY_AND_ASSIGN(BackendImpl); |
404 }; | 403 }; |
405 | 404 |
406 } // namespace disk_cache | 405 } // namespace disk_cache |
407 | 406 |
408 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ | 407 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ |
OLD | NEW |