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 // 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_BLOCKFILE_BACKEND_IMPL_V3_H_ | 7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ | 8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 | 11 |
12 #include <unordered_map> | 12 #include "base/containers/hash_tables.h" |
13 | |
14 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 14 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
17 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
18 #include "net/disk_cache/blockfile/block_bitmaps_v3.h" | 17 #include "net/disk_cache/blockfile/block_bitmaps_v3.h" |
19 #include "net/disk_cache/blockfile/block_files.h" | 18 #include "net/disk_cache/blockfile/block_files.h" |
20 #include "net/disk_cache/blockfile/eviction_v3.h" | 19 #include "net/disk_cache/blockfile/eviction_v3.h" |
21 #include "net/disk_cache/blockfile/index_table_v3.h" | 20 #include "net/disk_cache/blockfile/index_table_v3.h" |
22 #include "net/disk_cache/blockfile/stats.h" | 21 #include "net/disk_cache/blockfile/stats.h" |
23 #include "net/disk_cache/blockfile/stress_support.h" | 22 #include "net/disk_cache/blockfile/stress_support.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const CompletionCallback& callback) override; | 191 const CompletionCallback& callback) override; |
193 int DoomEntriesSince(base::Time initial_time, | 192 int DoomEntriesSince(base::Time initial_time, |
194 const CompletionCallback& callback) override; | 193 const CompletionCallback& callback) override; |
195 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; | 194 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; |
196 scoped_ptr<Iterator> CreateIterator() override; | 195 scoped_ptr<Iterator> CreateIterator() override; |
197 void GetStats(StatsItems* stats) override; | 196 void GetStats(StatsItems* stats) override; |
198 void OnExternalCacheHit(const std::string& key) override; | 197 void OnExternalCacheHit(const std::string& key) override; |
199 | 198 |
200 private: | 199 private: |
201 friend class EvictionV3; | 200 friend class EvictionV3; |
202 using EntriesMap = std::unordered_map<CacheAddr, EntryImplV3*>; | 201 typedef base::hash_map<CacheAddr, EntryImplV3*> EntriesMap; |
203 class IteratorImpl; | 202 class IteratorImpl; |
204 class NotImplementedIterator; | 203 class NotImplementedIterator; |
205 class Worker; | 204 class Worker; |
206 | 205 |
207 void AdjustMaxCacheSize(); | 206 void AdjustMaxCacheSize(); |
208 bool InitStats(void* stats_data); | 207 bool InitStats(void* stats_data); |
209 void StoreStats(); | 208 void StoreStats(); |
210 | 209 |
211 // Deletes the cache and starts again. | 210 // Deletes the cache and starts again. |
212 void RestartCache(bool failure); | 211 void RestartCache(bool failure); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 scoped_ptr<base::RepeatingTimer> timer_; // Usage timer. | 278 scoped_ptr<base::RepeatingTimer> timer_; // Usage timer. |
280 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 279 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
281 base::WeakPtrFactory<BackendImplV3> ptr_factory_; | 280 base::WeakPtrFactory<BackendImplV3> ptr_factory_; |
282 | 281 |
283 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); | 282 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); |
284 }; | 283 }; |
285 | 284 |
286 } // namespace disk_cache | 285 } // namespace disk_cache |
287 | 286 |
288 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ | 287 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
OLD | NEW |