Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: net/disk_cache/memory/mem_backend_impl.h

Issue 2661333002: Track SimpleCache memory usage in net/ MemoryDumpProvider (Closed)
Patch Set: Address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 102
102 private: 103 private:
103 class MemIterator; 104 class MemIterator;
104 friend class MemIterator; 105 friend class MemIterator;
105 106
106 using EntryMap = std::unordered_map<std::string, MemEntryImpl*>; 107 using EntryMap = std::unordered_map<std::string, MemEntryImpl*>;
107 108
108 // Deletes entries from the cache until the current size is below the limit. 109 // Deletes entries from the cache until the current size is below the limit.
109 void EvictIfNeeded(); 110 void EvictIfNeeded();
110 111
111 EntryMap entries_; 112 EntryMap entries_;
112 113
113 // Stored in increasing order of last use time, from least recently used to 114 // Stored in increasing order of last use time, from least recently used to
114 // most recently used. 115 // most recently used.
115 base::LinkedList<MemEntryImpl> lru_list_; 116 base::LinkedList<MemEntryImpl> lru_list_;
116 117
117 int32_t max_size_; // Maximum data size for this instance. 118 int32_t max_size_; // Maximum data size for this instance.
118 int32_t current_size_; 119 int32_t current_size_;
119 120
120 net::NetLog* net_log_; 121 net::NetLog* net_log_;
121 122
122 base::WeakPtrFactory<MemBackendImpl> weak_factory_; 123 base::WeakPtrFactory<MemBackendImpl> weak_factory_;
123 124
124 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 125 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
125 }; 126 };
126 127
127 } // namespace disk_cache 128 } // namespace disk_cache
128 129
129 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 130 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698