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 #ifndef NET_DISK_CACHE_MEMORY_MEM_ENTRY_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_MEMORY_MEM_ENTRY_IMPL_H_ |
6 #define NET_DISK_CACHE_MEMORY_MEM_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_MEMORY_MEM_ENTRY_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
| 12 #include <unordered_map> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/containers/hash_tables.h" | |
15 #include "base/containers/linked_list.h" | 15 #include "base/containers/linked_list.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "net/disk_cache/disk_cache.h" | 19 #include "net/disk_cache/disk_cache.h" |
20 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
21 | 21 |
22 namespace disk_cache { | 22 namespace disk_cache { |
23 | 23 |
24 class MemBackendImpl; | 24 class MemBackendImpl; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void CancelSparseIO() override {} | 126 void CancelSparseIO() override {} |
127 int ReadyForSparseIO(const CompletionCallback& callback) override; | 127 int ReadyForSparseIO(const CompletionCallback& callback) override; |
128 | 128 |
129 private: | 129 private: |
130 MemEntryImpl(MemBackendImpl* backend, | 130 MemEntryImpl(MemBackendImpl* backend, |
131 const std::string& key, | 131 const std::string& key, |
132 int child_id, | 132 int child_id, |
133 MemEntryImpl* parent, | 133 MemEntryImpl* parent, |
134 net::NetLog* net_log); | 134 net::NetLog* net_log); |
135 | 135 |
136 typedef base::hash_map<int, MemEntryImpl*> EntryMap; | 136 using EntryMap = std::unordered_map<int, MemEntryImpl*>; |
137 | 137 |
138 static const int kNumStreams = 3; | 138 static const int kNumStreams = 3; |
139 | 139 |
140 ~MemEntryImpl() override; | 140 ~MemEntryImpl() override; |
141 | 141 |
142 // Do all the work for corresponding public functions. Implemented as | 142 // Do all the work for corresponding public functions. Implemented as |
143 // separate functions to make logging of results simpler. | 143 // separate functions to make logging of results simpler. |
144 int InternalReadData(int index, int offset, IOBuffer* buf, int buf_len); | 144 int InternalReadData(int index, int offset, IOBuffer* buf, int buf_len); |
145 int InternalWriteData(int index, int offset, IOBuffer* buf, int buf_len, | 145 int InternalWriteData(int index, int offset, IOBuffer* buf, int buf_len, |
146 bool truncate); | 146 bool truncate); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 bool doomed_; // True if this entry was removed from the cache. | 180 bool doomed_; // True if this entry was removed from the cache. |
181 | 181 |
182 net::BoundNetLog net_log_; | 182 net::BoundNetLog net_log_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(MemEntryImpl); | 184 DISALLOW_COPY_AND_ASSIGN(MemEntryImpl); |
185 }; | 185 }; |
186 | 186 |
187 } // namespace disk_cache | 187 } // namespace disk_cache |
188 | 188 |
189 #endif // NET_DISK_CACHE_MEMORY_MEM_ENTRY_IMPL_H_ | 189 #endif // NET_DISK_CACHE_MEMORY_MEM_ENTRY_IMPL_H_ |
OLD | NEW |