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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int SyncInit(); | 66 int SyncInit(); |
67 void CleanupCache(); | 67 void CleanupCache(); |
68 | 68 |
69 // Synchronous implementation of the asynchronous interface. | 69 // Synchronous implementation of the asynchronous interface. |
70 int SyncOpenEntry(const std::string& key, Entry** entry); | 70 int SyncOpenEntry(const std::string& key, Entry** entry); |
71 int SyncCreateEntry(const std::string& key, Entry** entry); | 71 int SyncCreateEntry(const std::string& key, Entry** entry); |
72 int SyncDoomEntry(const std::string& key); | 72 int SyncDoomEntry(const std::string& key); |
73 int SyncDoomAllEntries(); | 73 int SyncDoomAllEntries(); |
74 int SyncDoomEntriesBetween(base::Time initial_time, | 74 int SyncDoomEntriesBetween(base::Time initial_time, |
75 base::Time end_time); | 75 base::Time end_time); |
| 76 int SyncCalculateSizeOfAllEntries(); |
76 int SyncDoomEntriesSince(base::Time initial_time); | 77 int SyncDoomEntriesSince(base::Time initial_time); |
77 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry); | 78 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry); |
78 void SyncEndEnumeration(scoped_ptr<Rankings::Iterator> iterator); | 79 void SyncEndEnumeration(scoped_ptr<Rankings::Iterator> iterator); |
79 void SyncOnExternalCacheHit(const std::string& key); | 80 void SyncOnExternalCacheHit(const std::string& key); |
80 | 81 |
81 // Open or create an entry for the given |key| or |iter|. | 82 // Open or create an entry for the given |key| or |iter|. |
82 EntryImpl* OpenEntryImpl(const std::string& key); | 83 EntryImpl* OpenEntryImpl(const std::string& key); |
83 EntryImpl* CreateEntryImpl(const std::string& key); | 84 EntryImpl* CreateEntryImpl(const std::string& key); |
84 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter); | 85 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter); |
85 | 86 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 Entry** entry, | 269 Entry** entry, |
269 const CompletionCallback& callback) override; | 270 const CompletionCallback& callback) override; |
270 int DoomEntry(const std::string& key, | 271 int DoomEntry(const std::string& key, |
271 const CompletionCallback& callback) override; | 272 const CompletionCallback& callback) override; |
272 int DoomAllEntries(const CompletionCallback& callback) override; | 273 int DoomAllEntries(const CompletionCallback& callback) override; |
273 int DoomEntriesBetween(base::Time initial_time, | 274 int DoomEntriesBetween(base::Time initial_time, |
274 base::Time end_time, | 275 base::Time end_time, |
275 const CompletionCallback& callback) override; | 276 const CompletionCallback& callback) override; |
276 int DoomEntriesSince(base::Time initial_time, | 277 int DoomEntriesSince(base::Time initial_time, |
277 const CompletionCallback& callback) override; | 278 const CompletionCallback& callback) override; |
| 279 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; |
278 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify | 280 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify |
279 // the last_used field of the entry, and therefore it does not impact the | 281 // the last_used field of the entry, and therefore it does not impact the |
280 // eviction ranking of the entry. However, an enumeration will go through all | 282 // eviction ranking of the entry. However, an enumeration will go through all |
281 // entries on the cache only if the cache is not modified while the | 283 // entries on the cache only if the cache is not modified while the |
282 // enumeration is taking place. Significantly altering the entry pointed by | 284 // enumeration is taking place. Significantly altering the entry pointed by |
283 // the iterator (for example, deleting the entry) will invalidate the | 285 // the iterator (for example, deleting the entry) will invalidate the |
284 // iterator. Performing operations on an entry that modify the entry may | 286 // iterator. Performing operations on an entry that modify the entry may |
285 // result in loops in the iteration, skipped entries or similar. | 287 // result in loops in the iteration, skipped entries or similar. |
286 scoped_ptr<Iterator> CreateIterator() override; | 288 scoped_ptr<Iterator> CreateIterator() override; |
287 void GetStats(StatsItems* stats) override; | 289 void GetStats(StatsItems* stats) override; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 base::WaitableEvent done_; // Signals the end of background work. | 401 base::WaitableEvent done_; // Signals the end of background work. |
400 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 402 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
401 base::WeakPtrFactory<BackendImpl> ptr_factory_; | 403 base::WeakPtrFactory<BackendImpl> ptr_factory_; |
402 | 404 |
403 DISALLOW_COPY_AND_ASSIGN(BackendImpl); | 405 DISALLOW_COPY_AND_ASSIGN(BackendImpl); |
404 }; | 406 }; |
405 | 407 |
406 } // namespace disk_cache | 408 } // namespace disk_cache |
407 | 409 |
408 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ | 410 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ |
OLD | NEW |