OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BACKEND_IMPL_H_ | 7 #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ |
8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ | 8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 net::NetLog* net_log, Backend** backend, | 58 net::NetLog* net_log, Backend** backend, |
59 OldCompletionCallback* callback); | 59 OldCompletionCallback* callback); |
60 | 60 |
61 // Performs general initialization for this current instance of the cache. | 61 // Performs general initialization for this current instance of the cache. |
62 int Init(OldCompletionCallback* callback); | 62 int Init(OldCompletionCallback* callback); |
63 | 63 |
64 // Performs the actual initialization and final cleanup on destruction. | 64 // Performs the actual initialization and final cleanup on destruction. |
65 int SyncInit(); | 65 int SyncInit(); |
66 void CleanupCache(); | 66 void CleanupCache(); |
67 | 67 |
68 // Same behavior as OpenNextEntry but walks the list from back to front. | 68 // Same bahavior as OpenNextEntry but walks the list from back to front. |
69 int OpenPrevEntry(void** iter, Entry** prev_entry, | 69 int OpenPrevEntry(void** iter, Entry** prev_entry, |
70 OldCompletionCallback* callback); | 70 OldCompletionCallback* callback); |
71 | 71 |
72 // Synchronous implementation of the asynchronous interface. | 72 // Synchronous implementation of the asynchronous interface. |
73 int SyncOpenEntry(const std::string& key, Entry** entry); | 73 int SyncOpenEntry(const std::string& key, Entry** entry); |
74 int SyncCreateEntry(const std::string& key, Entry** entry); | 74 int SyncCreateEntry(const std::string& key, Entry** entry); |
75 int SyncDoomEntry(const std::string& key); | 75 int SyncDoomEntry(const std::string& key); |
76 int SyncDoomAllEntries(); | 76 int SyncDoomAllEntries(); |
77 int SyncDoomEntriesBetween(const base::Time initial_time, | 77 int SyncDoomEntriesBetween(const base::Time initial_time, |
78 const base::Time end_time); | 78 const base::Time end_time); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void TrimDeletedListForTest(bool empty); | 253 void TrimDeletedListForTest(bool empty); |
254 | 254 |
255 // Peforms a simple self-check, and returns the number of dirty items | 255 // Peforms a simple self-check, and returns the number of dirty items |
256 // or an error code (negative value). | 256 // or an error code (negative value). |
257 int SelfCheck(); | 257 int SelfCheck(); |
258 | 258 |
259 // Backend interface. | 259 // Backend interface. |
260 virtual int32 GetEntryCount() const OVERRIDE; | 260 virtual int32 GetEntryCount() const OVERRIDE; |
261 virtual int OpenEntry(const std::string& key, Entry** entry, | 261 virtual int OpenEntry(const std::string& key, Entry** entry, |
262 OldCompletionCallback* callback) OVERRIDE; | 262 OldCompletionCallback* callback) OVERRIDE; |
263 virtual int OpenEntry(const std::string& key, Entry** entry, | |
264 const net::CompletionCallback& callback) OVERRIDE; | |
265 virtual int CreateEntry(const std::string& key, Entry** entry, | 263 virtual int CreateEntry(const std::string& key, Entry** entry, |
266 OldCompletionCallback* callback) OVERRIDE; | 264 OldCompletionCallback* callback) OVERRIDE; |
267 virtual int CreateEntry(const std::string& key, Entry** entry, | |
268 const net::CompletionCallback& callback) OVERRIDE; | |
269 virtual int DoomEntry(const std::string& key, | 265 virtual int DoomEntry(const std::string& key, |
270 OldCompletionCallback* callback) OVERRIDE; | 266 OldCompletionCallback* callback) OVERRIDE; |
271 virtual int DoomAllEntries(OldCompletionCallback* callback) OVERRIDE; | 267 virtual int DoomAllEntries(OldCompletionCallback* callback) OVERRIDE; |
272 virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; | |
273 virtual int DoomEntriesBetween(const base::Time initial_time, | 268 virtual int DoomEntriesBetween(const base::Time initial_time, |
274 const base::Time end_time, | 269 const base::Time end_time, |
275 OldCompletionCallback* callback) OVERRIDE; | 270 OldCompletionCallback* callback) OVERRIDE; |
276 virtual int DoomEntriesBetween( | |
277 const base::Time initial_time, | |
278 const base::Time end_time, | |
279 const net::CompletionCallback& callback) OVERRIDE; | |
280 virtual int DoomEntriesSince(const base::Time initial_time, | 271 virtual int DoomEntriesSince(const base::Time initial_time, |
281 OldCompletionCallback* callback) OVERRIDE; | 272 OldCompletionCallback* callback) OVERRIDE; |
282 virtual int OpenNextEntry(void** iter, Entry** next_entry, | 273 virtual int OpenNextEntry(void** iter, Entry** next_entry, |
283 OldCompletionCallback* callback) OVERRIDE; | 274 OldCompletionCallback* callback) OVERRIDE; |
284 virtual int OpenNextEntry(void** iter, Entry** next_entry, | |
285 const net::CompletionCallback& callback) OVERRIDE; | |
286 virtual void EndEnumeration(void** iter) OVERRIDE; | 275 virtual void EndEnumeration(void** iter) OVERRIDE; |
287 virtual void GetStats(StatsItems* stats) OVERRIDE; | 276 virtual void GetStats(StatsItems* stats) OVERRIDE; |
288 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 277 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
289 | 278 |
290 private: | 279 private: |
291 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; | 280 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; |
292 | 281 |
293 // Creates a new backing file for the cache index. | 282 // Creates a new backing file for the cache index. |
294 bool CreateBackingStore(disk_cache::File* file); | 283 bool CreateBackingStore(disk_cache::File* file); |
295 bool InitBackingStore(bool* file_created); | 284 bool InitBackingStore(bool* file_created); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 390 |
402 DISALLOW_COPY_AND_ASSIGN(BackendImpl); | 391 DISALLOW_COPY_AND_ASSIGN(BackendImpl); |
403 }; | 392 }; |
404 | 393 |
405 // Returns the prefered max cache size given the available disk space. | 394 // Returns the prefered max cache size given the available disk space. |
406 NET_EXPORT_PRIVATE int PreferedCacheSize(int64 available); | 395 NET_EXPORT_PRIVATE int PreferedCacheSize(int64 available); |
407 | 396 |
408 } // namespace disk_cache | 397 } // namespace disk_cache |
409 | 398 |
410 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ | 399 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ |
OLD | NEW |