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 "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 EVICTION_V2 = 1 << 4, // Use of new eviction was specified. | 43 EVICTION_V2 = 1 << 4, // Use of new eviction was specified. |
44 BASIC_UNIT_TEST = 1 << 5, // Identifies almost all unit tests. | 44 BASIC_UNIT_TEST = 1 << 5, // Identifies almost all unit tests. |
45 NO_LOAD_PROTECTION = 1 << 6, // Don't act conservatively under load. | 45 NO_LOAD_PROTECTION = 1 << 6, // Don't act conservatively under load. |
46 NO_BUFFERING = 1 << 7, // Disable extended IO buffering. | 46 NO_BUFFERING = 1 << 7, // Disable extended IO buffering. |
47 NO_CLEAN_ON_EXIT = 1 << 8 // Avoid saving data at exit time. | 47 NO_CLEAN_ON_EXIT = 1 << 8 // Avoid saving data at exit time. |
48 }; | 48 }; |
49 | 49 |
50 BackendImplV3(const base::FilePath& path, | 50 BackendImplV3(const base::FilePath& path, |
51 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, | 51 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, |
52 net::NetLog* net_log); | 52 net::NetLog* net_log); |
53 virtual ~BackendImplV3(); | 53 ~BackendImplV3() override; |
54 | 54 |
55 // Performs general initialization for this current instance of the cache. | 55 // Performs general initialization for this current instance of the cache. |
56 int Init(const CompletionCallback& callback); | 56 int Init(const CompletionCallback& callback); |
57 | 57 |
58 // Sets the maximum size for the total amount of data stored by this instance. | 58 // Sets the maximum size for the total amount of data stored by this instance. |
59 bool SetMaxSize(int max_bytes); | 59 bool SetMaxSize(int max_bytes); |
60 | 60 |
61 // Sets the cache type for this backend. | 61 // Sets the cache type for this backend. |
62 void SetType(net::CacheType type); | 62 void SetType(net::CacheType type); |
63 | 63 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Trims an entry (all if |empty| is true) from the list of deleted | 166 // Trims an entry (all if |empty| is true) from the list of deleted |
167 // entries. This method should be called directly on the cache thread. | 167 // entries. This method should be called directly on the cache thread. |
168 void TrimDeletedListForTest(bool empty); | 168 void TrimDeletedListForTest(bool empty); |
169 | 169 |
170 // Performs a simple self-check, and returns the number of dirty items | 170 // Performs a simple self-check, and returns the number of dirty items |
171 // or an error code (negative value). | 171 // or an error code (negative value). |
172 int SelfCheck(); | 172 int SelfCheck(); |
173 | 173 |
174 // Backend implementation. | 174 // Backend implementation. |
175 virtual net::CacheType GetCacheType() const override; | 175 net::CacheType GetCacheType() const override; |
176 virtual int32 GetEntryCount() const override; | 176 int32 GetEntryCount() const override; |
177 virtual int OpenEntry(const std::string& key, Entry** entry, | 177 int OpenEntry(const std::string& key, |
178 const CompletionCallback& callback) override; | 178 Entry** entry, |
179 virtual int CreateEntry(const std::string& key, Entry** entry, | 179 const CompletionCallback& callback) override; |
180 const CompletionCallback& callback) override; | 180 int CreateEntry(const std::string& key, |
181 virtual int DoomEntry(const std::string& key, | 181 Entry** entry, |
182 const CompletionCallback& callback) override; | 182 const CompletionCallback& callback) override; |
183 virtual int DoomAllEntries(const CompletionCallback& callback) override; | 183 int DoomEntry(const std::string& key, |
184 virtual int DoomEntriesBetween(base::Time initial_time, | 184 const CompletionCallback& callback) override; |
185 base::Time end_time, | 185 int DoomAllEntries(const CompletionCallback& callback) override; |
186 const CompletionCallback& callback) override; | 186 int DoomEntriesBetween(base::Time initial_time, |
187 virtual int DoomEntriesSince(base::Time initial_time, | 187 base::Time end_time, |
188 const CompletionCallback& callback) override; | 188 const CompletionCallback& callback) override; |
189 virtual scoped_ptr<Iterator> CreateIterator() override; | 189 int DoomEntriesSince(base::Time initial_time, |
190 virtual void GetStats(StatsItems* stats) override; | 190 const CompletionCallback& callback) override; |
191 virtual void OnExternalCacheHit(const std::string& key) override; | 191 scoped_ptr<Iterator> CreateIterator() override; |
| 192 void GetStats(StatsItems* stats) override; |
| 193 void OnExternalCacheHit(const std::string& key) override; |
192 | 194 |
193 private: | 195 private: |
194 friend class EvictionV3; | 196 friend class EvictionV3; |
195 typedef base::hash_map<CacheAddr, EntryImplV3*> EntriesMap; | 197 typedef base::hash_map<CacheAddr, EntryImplV3*> EntriesMap; |
196 class IteratorImpl; | 198 class IteratorImpl; |
197 class NotImplementedIterator; | 199 class NotImplementedIterator; |
198 class Worker; | 200 class Worker; |
199 | 201 |
200 void AdjustMaxCacheSize(); | 202 void AdjustMaxCacheSize(); |
201 bool InitStats(void* stats_data); | 203 bool InitStats(void* stats_data); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 scoped_ptr<base::RepeatingTimer<BackendImplV3> > timer_; // Usage timer. | 274 scoped_ptr<base::RepeatingTimer<BackendImplV3> > timer_; // Usage timer. |
273 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. | 275 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. |
274 base::WeakPtrFactory<BackendImplV3> ptr_factory_; | 276 base::WeakPtrFactory<BackendImplV3> ptr_factory_; |
275 | 277 |
276 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); | 278 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); |
277 }; | 279 }; |
278 | 280 |
279 } // namespace disk_cache | 281 } // namespace disk_cache |
280 | 282 |
281 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ | 283 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ |
OLD | NEW |