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

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

Issue 1884453002: Revert of Convert //net and //chromecast to std::unordered_* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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>
14 13
15 #include "base/compiler_specific.h" 14 #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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const CompletionCallback& callback) override; 90 const CompletionCallback& callback) override;
91 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; 91 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override;
92 scoped_ptr<Iterator> CreateIterator() override; 92 scoped_ptr<Iterator> CreateIterator() override;
93 void GetStats(base::StringPairs* stats) override {} 93 void GetStats(base::StringPairs* stats) override {}
94 void OnExternalCacheHit(const std::string& key) override; 94 void OnExternalCacheHit(const std::string& key) override;
95 95
96 private: 96 private:
97 class MemIterator; 97 class MemIterator;
98 friend class MemIterator; 98 friend class MemIterator;
99 99
100 using EntryMap = std::unordered_map<std::string, MemEntryImpl*>; 100 typedef base::hash_map<std::string, MemEntryImpl*> EntryMap;
101 101
102 // Deletes entries from the cache until the current size is below the limit. 102 // Deletes entries from the cache until the current size is below the limit.
103 void EvictIfNeeded(); 103 void EvictIfNeeded();
104 104
105 EntryMap entries_; 105 EntryMap entries_;
106 106
107 // Stored in increasing order of last use time, from least recently used to 107 // Stored in increasing order of last use time, from least recently used to
108 // most recently used. 108 // most recently used.
109 base::LinkedList<MemEntryImpl> lru_list_; 109 base::LinkedList<MemEntryImpl> lru_list_;
110 110
111 int32_t max_size_; // Maximum data size for this instance. 111 int32_t max_size_; // Maximum data size for this instance.
112 int32_t current_size_; 112 int32_t current_size_;
113 113
114 net::NetLog* net_log_; 114 net::NetLog* net_log_;
115 115
116 base::WeakPtrFactory<MemBackendImpl> weak_factory_; 116 base::WeakPtrFactory<MemBackendImpl> weak_factory_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 118 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
119 }; 119 };
120 120
121 } // namespace disk_cache 121 } // namespace disk_cache
122 122
123 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 123 #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