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

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

Issue 1897033002: Reland 'Convert //net and //chromecast to std::unordered_*' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix TestDownloadRequestHandler Created 4 years, 8 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
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.h ('k') | net/disk_cache/memory/mem_entry_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include <string> 12 #include <string>
13 #include <unordered_map>
13 14
14 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
15 #include "base/containers/hash_tables.h"
16 #include "base/containers/linked_list.h" 16 #include "base/containers/linked_list.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "net/disk_cache/disk_cache.h" 21 #include "net/disk_cache/disk_cache.h"
22 #include "net/disk_cache/memory/mem_entry_impl.h" 22 #include "net/disk_cache/memory/mem_entry_impl.h"
23 23
24 namespace net { 24 namespace net {
25 class NetLog; 25 class NetLog;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const CompletionCallback& callback) override; 91 const CompletionCallback& callback) override;
92 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; 92 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override;
93 std::unique_ptr<Iterator> CreateIterator() override; 93 std::unique_ptr<Iterator> CreateIterator() override;
94 void GetStats(base::StringPairs* stats) override {} 94 void GetStats(base::StringPairs* stats) override {}
95 void OnExternalCacheHit(const std::string& key) override; 95 void OnExternalCacheHit(const std::string& key) override;
96 96
97 private: 97 private:
98 class MemIterator; 98 class MemIterator;
99 friend class MemIterator; 99 friend class MemIterator;
100 100
101 typedef base::hash_map<std::string, MemEntryImpl*> EntryMap; 101 using EntryMap = std::unordered_map<std::string, MemEntryImpl*>;
102 102
103 // Deletes entries from the cache until the current size is below the limit. 103 // Deletes entries from the cache until the current size is below the limit.
104 void EvictIfNeeded(); 104 void EvictIfNeeded();
105 105
106 EntryMap entries_; 106 EntryMap entries_;
107 107
108 // Stored in increasing order of last use time, from least recently used to 108 // Stored in increasing order of last use time, from least recently used to
109 // most recently used. 109 // most recently used.
110 base::LinkedList<MemEntryImpl> lru_list_; 110 base::LinkedList<MemEntryImpl> lru_list_;
111 111
112 int32_t max_size_; // Maximum data size for this instance. 112 int32_t max_size_; // Maximum data size for this instance.
113 int32_t current_size_; 113 int32_t current_size_;
114 114
115 net::NetLog* net_log_; 115 net::NetLog* net_log_;
116 116
117 base::WeakPtrFactory<MemBackendImpl> weak_factory_; 117 base::WeakPtrFactory<MemBackendImpl> weak_factory_;
118 118
119 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 119 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
120 }; 120 };
121 121
122 } // namespace disk_cache 122 } // namespace disk_cache
123 123
124 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 124 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.h ('k') | net/disk_cache/memory/mem_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698