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 <stdint.h> | 10 #include <stdint.h> |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // the last_used field of the entry, and therefore it does not impact the | 286 // the last_used field of the entry, and therefore it does not impact the |
287 // eviction ranking of the entry. However, an enumeration will go through all | 287 // eviction ranking of the entry. However, an enumeration will go through all |
288 // entries on the cache only if the cache is not modified while the | 288 // entries on the cache only if the cache is not modified while the |
289 // enumeration is taking place. Significantly altering the entry pointed by | 289 // enumeration is taking place. Significantly altering the entry pointed by |
290 // the iterator (for example, deleting the entry) will invalidate the | 290 // the iterator (for example, deleting the entry) will invalidate the |
291 // iterator. Performing operations on an entry that modify the entry may | 291 // iterator. Performing operations on an entry that modify the entry may |
292 // result in loops in the iteration, skipped entries or similar. | 292 // result in loops in the iteration, skipped entries or similar. |
293 std::unique_ptr<Iterator> CreateIterator() override; | 293 std::unique_ptr<Iterator> CreateIterator() override; |
294 void GetStats(StatsItems* stats) override; | 294 void GetStats(StatsItems* stats) override; |
295 void OnExternalCacheHit(const std::string& key) override; | 295 void OnExternalCacheHit(const std::string& key) override; |
| 296 size_t EstimateMemoryUsage() const override; |
296 | 297 |
297 private: | 298 private: |
298 using EntriesMap = std::unordered_map<CacheAddr, EntryImpl*>; | 299 using EntriesMap = std::unordered_map<CacheAddr, EntryImpl*>; |
299 class IteratorImpl; | 300 class IteratorImpl; |
300 | 301 |
301 // Creates a new backing file for the cache index. | 302 // Creates a new backing file for the cache index. |
302 bool CreateBackingStore(disk_cache::File* file); | 303 bool CreateBackingStore(disk_cache::File* file); |
303 bool InitBackingStore(bool* file_created); | 304 bool InitBackingStore(bool* file_created); |
304 void AdjustMaxCacheSize(int table_len); | 305 void AdjustMaxCacheSize(int table_len); |
305 | 306 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 base::WaitableEvent done_; // Signals the end of background work. | 410 base::WaitableEvent done_; // Signals the end of background work. |
410 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 411 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
411 base::WeakPtrFactory<BackendImpl> ptr_factory_; | 412 base::WeakPtrFactory<BackendImpl> ptr_factory_; |
412 | 413 |
413 DISALLOW_COPY_AND_ASSIGN(BackendImpl); | 414 DISALLOW_COPY_AND_ASSIGN(BackendImpl); |
414 }; | 415 }; |
415 | 416 |
416 } // namespace disk_cache | 417 } // namespace disk_cache |
417 | 418 |
418 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ | 419 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ |
OLD | NEW |