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 // Defines the public interface of the disk cache. For more details see | 5 // Defines the public interface of the disk cache. For more details see |
6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache | 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache |
7 | 7 |
8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ | 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ |
9 #define NET_DISK_CACHE_DISK_CACHE_H_ | 9 #define NET_DISK_CACHE_DISK_CACHE_H_ |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 base::Time end_time, | 138 base::Time end_time, |
139 const CompletionCallback& callback) = 0; | 139 const CompletionCallback& callback) = 0; |
140 | 140 |
141 // Marks all entries accessed since |initial_time| for deletion. The return | 141 // Marks all entries accessed since |initial_time| for deletion. The return |
142 // value is a net error code. If this method returns ERR_IO_PENDING, the | 142 // value is a net error code. If this method returns ERR_IO_PENDING, the |
143 // |callback| will be invoked when the operation completes. | 143 // |callback| will be invoked when the operation completes. |
144 // Entries with |initial_time| <= access time are deleted. | 144 // Entries with |initial_time| <= access time are deleted. |
145 virtual int DoomEntriesSince(base::Time initial_time, | 145 virtual int DoomEntriesSince(base::Time initial_time, |
146 const CompletionCallback& callback) = 0; | 146 const CompletionCallback& callback) = 0; |
147 | 147 |
| 148 // Calculate the total size of the cache. The return value is the size in |
| 149 // bytes or a net error code. If this method returns ERR_IO_PENDING, |
| 150 // the |callback| will be invoked when the operation completes. |
| 151 virtual int CalculateSizeOfAllEntries( |
| 152 const CompletionCallback& callback) = 0; |
| 153 |
148 // Returns an iterator which will enumerate all entries of the cache in an | 154 // Returns an iterator which will enumerate all entries of the cache in an |
149 // undefined order. | 155 // undefined order. |
150 virtual scoped_ptr<Iterator> CreateIterator() = 0; | 156 virtual scoped_ptr<Iterator> CreateIterator() = 0; |
151 | 157 |
152 // Return a list of cache statistics. | 158 // Return a list of cache statistics. |
153 virtual void GetStats(base::StringPairs* stats) = 0; | 159 virtual void GetStats(base::StringPairs* stats) = 0; |
154 | 160 |
155 // Called whenever an external cache in the system reuses the resource | 161 // Called whenever an external cache in the system reuses the resource |
156 // referred to by |key|. | 162 // referred to by |key|. |
157 virtual void OnExternalCacheHit(const std::string& key) = 0; | 163 virtual void OnExternalCacheHit(const std::string& key) = 0; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 entry->Close(); | 324 entry->Close(); |
319 } | 325 } |
320 }; | 326 }; |
321 | 327 |
322 // Automatically closes an entry when it goes out of scope. | 328 // Automatically closes an entry when it goes out of scope. |
323 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 329 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
324 | 330 |
325 } // namespace disk_cache | 331 } // namespace disk_cache |
326 | 332 |
327 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 333 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |