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 // Defines the public interface of the disk cache. For more details see | 5 // Defines the public interface of the disk cache. For more details see |
6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache | 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache |
7 | 7 |
8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ | 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ |
9 #define NET_DISK_CACHE_DISK_CACHE_H_ | 9 #define NET_DISK_CACHE_DISK_CACHE_H_ |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // be invoked when a backend is available or a fatal error condition is reached. | 47 // be invoked when a backend is available or a fatal error condition is reached. |
48 // The pointer to receive the |backend| must remain valid until the operation | 48 // The pointer to receive the |backend| must remain valid until the operation |
49 // completes (the callback is notified). | 49 // completes (the callback is notified). |
50 NET_EXPORT int CreateCacheBackend(net::CacheType type, | 50 NET_EXPORT int CreateCacheBackend(net::CacheType type, |
51 const base::FilePath& path, | 51 const base::FilePath& path, |
52 int max_bytes, bool force, | 52 int max_bytes, bool force, |
53 base::MessageLoopProxy* thread, | 53 base::MessageLoopProxy* thread, |
54 net::NetLog* net_log, Backend** backend, | 54 net::NetLog* net_log, Backend** backend, |
55 const net::CompletionCallback& callback); | 55 const net::CompletionCallback& callback); |
56 | 56 |
| 57 // A version of the above with additional |flags| allowing more fine-tuned |
| 58 // testing. |
| 59 int CreateCacheBackendWithFlags(net::CacheType type, |
| 60 const base::FilePath& path, |
| 61 int max_bytes, |
| 62 bool force, |
| 63 uint32 flags, |
| 64 base::MessageLoopProxy* thread, |
| 65 net::NetLog* net_log, |
| 66 Backend** backend, |
| 67 const net::CompletionCallback& callback); |
| 68 |
| 69 // Renames cache directory synchronously and fires off a background cleanup |
| 70 // task. Used by cache creator itself or by backends for self-restart on error. |
| 71 bool DelayedCacheCleanup(const base::FilePath& full_path); |
| 72 |
57 // The root interface for a disk cache instance. | 73 // The root interface for a disk cache instance. |
58 class NET_EXPORT Backend { | 74 class NET_EXPORT Backend { |
59 public: | 75 public: |
60 typedef net::CompletionCallback CompletionCallback; | 76 typedef net::CompletionCallback CompletionCallback; |
61 | 77 |
62 // If the backend is destroyed when there are operations in progress (any | 78 // If the backend is destroyed when there are operations in progress (any |
63 // callback that has not been invoked yet), this method cancels said | 79 // callback that has not been invoked yet), this method cancels said |
64 // operations so the callbacks are not invoked, possibly leaving the work | 80 // operations so the callbacks are not invoked, possibly leaving the work |
65 // half way (for instance, dooming just a few entries). Note that pending IO | 81 // half way (for instance, dooming just a few entries). Note that pending IO |
66 // for a given Entry (as opposed to the Backend) will still generate a | 82 // for a given Entry (as opposed to the Backend) will still generate a |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // Note: This method is deprecated. | 318 // Note: This method is deprecated. |
303 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; | 319 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; |
304 | 320 |
305 protected: | 321 protected: |
306 virtual ~Entry() {} | 322 virtual ~Entry() {} |
307 }; | 323 }; |
308 | 324 |
309 } // namespace disk_cache | 325 } // namespace disk_cache |
310 | 326 |
311 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 327 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |