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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SyncDoomEntriesSince(base::Time initial_time); | 76 int SyncDoomEntriesSince(base::Time initial_time); |
| 77 int SyncCalculateSizeOfEntriesBetween(base::Time initial_time, |
| 78 base::Time end_time); |
77 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry); | 79 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry); |
78 void SyncEndEnumeration(scoped_ptr<Rankings::Iterator> iterator); | 80 void SyncEndEnumeration(scoped_ptr<Rankings::Iterator> iterator); |
79 void SyncOnExternalCacheHit(const std::string& key); | 81 void SyncOnExternalCacheHit(const std::string& key); |
80 | 82 |
81 // Open or create an entry for the given |key| or |iter|. | 83 // Open or create an entry for the given |key| or |iter|. |
82 EntryImpl* OpenEntryImpl(const std::string& key); | 84 EntryImpl* OpenEntryImpl(const std::string& key); |
83 EntryImpl* CreateEntryImpl(const std::string& key); | 85 EntryImpl* CreateEntryImpl(const std::string& key); |
84 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter); | 86 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter); |
85 | 87 |
86 // Sets the maximum size for the total amount of data stored by this instance. | 88 // Sets the maximum size for the total amount of data stored by this instance. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 Entry** entry, | 270 Entry** entry, |
269 const CompletionCallback& callback) override; | 271 const CompletionCallback& callback) override; |
270 int DoomEntry(const std::string& key, | 272 int DoomEntry(const std::string& key, |
271 const CompletionCallback& callback) override; | 273 const CompletionCallback& callback) override; |
272 int DoomAllEntries(const CompletionCallback& callback) override; | 274 int DoomAllEntries(const CompletionCallback& callback) override; |
273 int DoomEntriesBetween(base::Time initial_time, | 275 int DoomEntriesBetween(base::Time initial_time, |
274 base::Time end_time, | 276 base::Time end_time, |
275 const CompletionCallback& callback) override; | 277 const CompletionCallback& callback) override; |
276 int DoomEntriesSince(base::Time initial_time, | 278 int DoomEntriesSince(base::Time initial_time, |
277 const CompletionCallback& callback) override; | 279 const CompletionCallback& callback) override; |
| 280 int CalculateSizeOfEntriesBetween( |
| 281 base::Time initial_time, |
| 282 base::Time end_time, |
| 283 const CompletionCallback& callback) override; |
278 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify | 284 // 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 | 285 // 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 | 286 // 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 | 287 // entries on the cache only if the cache is not modified while the |
282 // enumeration is taking place. Significantly altering the entry pointed by | 288 // enumeration is taking place. Significantly altering the entry pointed by |
283 // the iterator (for example, deleting the entry) will invalidate the | 289 // the iterator (for example, deleting the entry) will invalidate the |
284 // iterator. Performing operations on an entry that modify the entry may | 290 // iterator. Performing operations on an entry that modify the entry may |
285 // result in loops in the iteration, skipped entries or similar. | 291 // result in loops in the iteration, skipped entries or similar. |
286 scoped_ptr<Iterator> CreateIterator() override; | 292 scoped_ptr<Iterator> CreateIterator() override; |
287 void GetStats(StatsItems* stats) override; | 293 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. | 405 base::WaitableEvent done_; // Signals the end of background work. |
400 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 406 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
401 base::WeakPtrFactory<BackendImpl> ptr_factory_; | 407 base::WeakPtrFactory<BackendImpl> ptr_factory_; |
402 | 408 |
403 DISALLOW_COPY_AND_ASSIGN(BackendImpl); | 409 DISALLOW_COPY_AND_ASSIGN(BackendImpl); |
404 }; | 410 }; |
405 | 411 |
406 } // namespace disk_cache | 412 } // namespace disk_cache |
407 | 413 |
408 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ | 414 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ |
OLD | NEW |