| 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_MEMORY_MEM_BACKEND_IMPL_H_ | 7 #ifndef NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ |
| 8 #define NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ | 8 #define NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 int DoomEntriesSince(base::Time initial_time, | 91 int DoomEntriesSince(base::Time initial_time, |
| 92 const CompletionCallback& callback) override; | 92 const CompletionCallback& callback) override; |
| 93 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; | 93 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; |
| 94 int CalculateSizeOfEntriesBetween( | 94 int CalculateSizeOfEntriesBetween( |
| 95 base::Time initial_time, | 95 base::Time initial_time, |
| 96 base::Time end_time, | 96 base::Time end_time, |
| 97 const CompletionCallback& callback) override; | 97 const CompletionCallback& callback) override; |
| 98 std::unique_ptr<Iterator> CreateIterator() override; | 98 std::unique_ptr<Iterator> CreateIterator() override; |
| 99 void GetStats(base::StringPairs* stats) override {} | 99 void GetStats(base::StringPairs* stats) override {} |
| 100 void OnExternalCacheHit(const std::string& key) override; | 100 void OnExternalCacheHit(const std::string& key) override; |
| 101 size_t EstimateMemoryUsage() const override; | 101 size_t DumpMemoryStats( |
| 102 base::trace_event::ProcessMemoryDump* pmd, |
| 103 const std::string& parent_absolute_name) const override; |
| 102 | 104 |
| 103 private: | 105 private: |
| 104 class MemIterator; | 106 class MemIterator; |
| 105 friend class MemIterator; | 107 friend class MemIterator; |
| 106 | 108 |
| 107 using EntryMap = std::unordered_map<std::string, MemEntryImpl*>; | 109 using EntryMap = std::unordered_map<std::string, MemEntryImpl*>; |
| 108 | 110 |
| 109 // Deletes entries from the cache until the current size is below the limit. | 111 // Deletes entries from the cache until the current size is below the limit. |
| 110 void EvictIfNeeded(); | 112 void EvictIfNeeded(); |
| 111 | 113 |
| 112 EntryMap entries_; | 114 EntryMap entries_; |
| 113 | 115 |
| 114 // Stored in increasing order of last use time, from least recently used to | 116 // Stored in increasing order of last use time, from least recently used to |
| 115 // most recently used. | 117 // most recently used. |
| 116 base::LinkedList<MemEntryImpl> lru_list_; | 118 base::LinkedList<MemEntryImpl> lru_list_; |
| 117 | 119 |
| 118 int32_t max_size_; // Maximum data size for this instance. | 120 int32_t max_size_; // Maximum data size for this instance. |
| 119 int32_t current_size_; | 121 int32_t current_size_; |
| 120 | 122 |
| 121 net::NetLog* net_log_; | 123 net::NetLog* net_log_; |
| 122 | 124 |
| 123 base::WeakPtrFactory<MemBackendImpl> weak_factory_; | 125 base::WeakPtrFactory<MemBackendImpl> weak_factory_; |
| 124 | 126 |
| 125 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); | 127 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 } // namespace disk_cache | 130 } // namespace disk_cache |
| 129 | 131 |
| 130 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ | 132 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ |
| OLD | NEW |