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

Side by Side Diff: net/disk_cache/simple/simple_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/memory/mem_entry_impl.h ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_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 <utility> 13 #include <utility>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
16 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
17 #include "base/containers/hash_tables.h"
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/strings/string_split.h" 21 #include "base/strings/string_split.h"
22 #include "base/task_runner.h" 22 #include "base/task_runner.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "net/base/cache_type.h" 24 #include "net/base/cache_type.h"
25 #include "net/disk_cache/disk_cache.h" 25 #include "net/disk_cache/disk_cache.h"
26 #include "net/disk_cache/simple/simple_entry_impl.h" 26 #include "net/disk_cache/simple/simple_entry_impl.h"
27 #include "net/disk_cache/simple/simple_index_delegate.h" 27 #include "net/disk_cache/simple/simple_index_delegate.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const CompletionCallback& callback) override; 109 const CompletionCallback& callback) override;
110 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; 110 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override;
111 std::unique_ptr<Iterator> CreateIterator() override; 111 std::unique_ptr<Iterator> CreateIterator() override;
112 void GetStats(base::StringPairs* stats) override; 112 void GetStats(base::StringPairs* stats) override;
113 void OnExternalCacheHit(const std::string& key) override; 113 void OnExternalCacheHit(const std::string& key) override;
114 114
115 private: 115 private:
116 class SimpleIterator; 116 class SimpleIterator;
117 friend class SimpleIterator; 117 friend class SimpleIterator;
118 118
119 typedef base::hash_map<uint64_t, SimpleEntryImpl*> EntryMap; 119 using EntryMap = std::unordered_map<uint64_t, SimpleEntryImpl*>;
120 120
121 typedef base::Callback<void(base::Time mtime, uint64_t max_size, int result)> 121 using InitializeIndexCallback =
122 InitializeIndexCallback; 122 base::Callback<void(base::Time mtime, uint64_t max_size, int result)>;
123 123
124 class ActiveEntryProxy; 124 class ActiveEntryProxy;
125 friend class ActiveEntryProxy; 125 friend class ActiveEntryProxy;
126 126
127 // Return value of InitCacheStructureOnDisk(). 127 // Return value of InitCacheStructureOnDisk().
128 struct DiskStatResult { 128 struct DiskStatResult {
129 base::Time cache_dir_mtime; 129 base::Time cache_dir_mtime;
130 uint64_t max_size; 130 uint64_t max_size;
131 bool detected_magic_number_mismatch; 131 bool detected_magic_number_mismatch;
132 int net_error; 132 int net_error;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 int orig_max_size_; 204 int orig_max_size_;
205 const SimpleEntryImpl::OperationsMode entry_operations_mode_; 205 const SimpleEntryImpl::OperationsMode entry_operations_mode_;
206 206
207 EntryMap active_entries_; 207 EntryMap active_entries_;
208 208
209 // The set of all entries which are currently being doomed. To avoid races, 209 // The set of all entries which are currently being doomed. To avoid races,
210 // these entries cannot have Doom/Create/Open operations run until the doom 210 // these entries cannot have Doom/Create/Open operations run until the doom
211 // is complete. The base::Closure map target is used to store deferred 211 // is complete. The base::Closure map target is used to store deferred
212 // operations to be run at the completion of the Doom. 212 // operations to be run at the completion of the Doom.
213 base::hash_map<uint64_t, std::vector<base::Closure>> entries_pending_doom_; 213 std::unordered_map<uint64_t, std::vector<base::Closure>>
214 entries_pending_doom_;
214 215
215 net::NetLog* const net_log_; 216 net::NetLog* const net_log_;
216 }; 217 };
217 218
218 } // namespace disk_cache 219 } // namespace disk_cache
219 220
220 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 221 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.h ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698