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