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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Returns an iterator which will enumerate all entries of the cache in an | 167 // Returns an iterator which will enumerate all entries of the cache in an |
168 // undefined order. | 168 // undefined order. |
169 virtual std::unique_ptr<Iterator> CreateIterator() = 0; | 169 virtual std::unique_ptr<Iterator> CreateIterator() = 0; |
170 | 170 |
171 // Return a list of cache statistics. | 171 // Return a list of cache statistics. |
172 virtual void GetStats(base::StringPairs* stats) = 0; | 172 virtual void GetStats(base::StringPairs* stats) = 0; |
173 | 173 |
174 // Called whenever an external cache in the system reuses the resource | 174 // Called whenever an external cache in the system reuses the resource |
175 // referred to by |key|. | 175 // referred to by |key|. |
176 virtual void OnExternalCacheHit(const std::string& key) = 0; | 176 virtual void OnExternalCacheHit(const std::string& key) = 0; |
| 177 |
| 178 // Returns the estimate of dynamically allocated memory in bytes. |
| 179 virtual size_t EstimateMemoryUsage() const = 0; |
177 }; | 180 }; |
178 | 181 |
179 // This interface represents an entry in the disk cache. | 182 // This interface represents an entry in the disk cache. |
180 class NET_EXPORT Entry { | 183 class NET_EXPORT Entry { |
181 public: | 184 public: |
182 typedef net::CompletionCallback CompletionCallback; | 185 typedef net::CompletionCallback CompletionCallback; |
183 typedef net::IOBuffer IOBuffer; | 186 typedef net::IOBuffer IOBuffer; |
184 | 187 |
185 // Marks this cache entry for deletion. | 188 // Marks this cache entry for deletion. |
186 virtual void Doom() = 0; | 189 virtual void Doom() = 0; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 entry->Close(); | 346 entry->Close(); |
344 } | 347 } |
345 }; | 348 }; |
346 | 349 |
347 // Automatically closes an entry when it goes out of scope. | 350 // Automatically closes an entry when it goes out of scope. |
348 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 351 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
349 | 352 |
350 } // namespace disk_cache | 353 } // namespace disk_cache |
351 | 354 |
352 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 355 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |