OLD | NEW |
---|---|
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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/hash_tables.h" | |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
19 #include "net/base/cache_type.h" | 20 #include "net/base/cache_type.h" |
20 #include "net/disk_cache/disk_cache.h" | 21 #include "net/disk_cache/disk_cache.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
24 } | 25 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 virtual int DoomEntriesSince(base::Time initial_time, | 78 virtual int DoomEntriesSince(base::Time initial_time, |
78 const CompletionCallback& callback) OVERRIDE; | 79 const CompletionCallback& callback) OVERRIDE; |
79 virtual int OpenNextEntry(void** iter, Entry** next_entry, | 80 virtual int OpenNextEntry(void** iter, Entry** next_entry, |
80 const CompletionCallback& callback) OVERRIDE; | 81 const CompletionCallback& callback) OVERRIDE; |
81 virtual void EndEnumeration(void** iter) OVERRIDE; | 82 virtual void EndEnumeration(void** iter) OVERRIDE; |
82 virtual void GetStats( | 83 virtual void GetStats( |
83 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; | 84 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; |
84 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 85 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
85 | 86 |
86 private: | 87 private: |
87 typedef std::map<uint64, base::WeakPtr<SimpleEntryImpl> > EntryMap; | 88 typedef base::hash_map<uint64, base::WeakPtr<SimpleEntryImpl> > EntryMap; |
pasko
2013/05/17 10:31:33
This change cannot make any significant improvemen
digit1
2013/05/17 14:36:18
I feel that these statements are contradicting eac
pasko
2013/05/17 16:57:19
You are right, there is practically no difference.
| |
88 | 89 |
89 typedef base::Callback<void(uint64 max_size, int result)> | 90 typedef base::Callback<void(uint64 max_size, int result)> |
90 InitializeIndexCallback; | 91 InitializeIndexCallback; |
91 | 92 |
92 // Must run on IO Thread. | 93 // Must run on IO Thread. |
93 void InitializeIndex(const CompletionCallback& callback, | 94 void InitializeIndex(const CompletionCallback& callback, |
94 uint64 suggested_max_size, | 95 uint64 suggested_max_size, |
95 int result); | 96 int result); |
96 | 97 |
97 // Dooms all entries previously accessed between |initial_time| and | 98 // Dooms all entries previously accessed between |initial_time| and |
(...skipping 23 matching lines...) Expand all Loading... | |
121 int orig_max_size_; | 122 int orig_max_size_; |
122 | 123 |
123 // TODO(gavinp): Store the entry_hash in SimpleEntryImpl, and index this map | 124 // TODO(gavinp): Store the entry_hash in SimpleEntryImpl, and index this map |
124 // by hash. This will save memory, and make IndexReadyForDoom easier. | 125 // by hash. This will save memory, and make IndexReadyForDoom easier. |
125 EntryMap active_entries_; | 126 EntryMap active_entries_; |
126 }; | 127 }; |
127 | 128 |
128 } // namespace disk_cache | 129 } // namespace disk_cache |
129 | 130 |
130 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 131 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ |
OLD | NEW |