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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // operations if a dedicated thread is required; a valid value is expected for | 43 // operations if a dedicated thread is required; a valid value is expected for |
44 // any backend that performs operations on a disk. The returned pointer can be | 44 // any backend that performs operations on a disk. The returned pointer can be |
45 // NULL if a fatal error is found. The actual return value of the function is a | 45 // NULL if a fatal error is found. The actual return value of the function is a |
46 // net error code. If this function returns ERR_IO_PENDING, the |callback| will | 46 // net error code. If this function returns ERR_IO_PENDING, the |callback| will |
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 net::BackendType backend_type, | 51 net::BackendType backend_type, |
52 const base::FilePath& path, | 52 const base::FilePath& path, |
53 int max_bytes, bool force, | 53 int max_bytes, |
| 54 bool force, |
54 base::MessageLoopProxy* thread, | 55 base::MessageLoopProxy* thread, |
55 net::NetLog* net_log, Backend** backend, | 56 net::NetLog* net_log, |
| 57 scoped_ptr<Backend>* backend, |
56 const net::CompletionCallback& callback); | 58 const net::CompletionCallback& callback); |
57 | 59 |
58 // The root interface for a disk cache instance. | 60 // The root interface for a disk cache instance. |
59 class NET_EXPORT Backend { | 61 class NET_EXPORT Backend { |
60 public: | 62 public: |
61 typedef net::CompletionCallback CompletionCallback; | 63 typedef net::CompletionCallback CompletionCallback; |
62 | 64 |
63 // If the backend is destroyed when there are operations in progress (any | 65 // If the backend is destroyed when there are operations in progress (any |
64 // callback that has not been invoked yet), this method cancels said | 66 // callback that has not been invoked yet), this method cancels said |
65 // operations so the callbacks are not invoked, possibly leaving the work | 67 // operations so the callbacks are not invoked, possibly leaving the work |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 entry->Close(); | 315 entry->Close(); |
314 } | 316 } |
315 }; | 317 }; |
316 | 318 |
317 // Automatically closes an entry when it goes out of scope. | 319 // Automatically closes an entry when it goes out of scope. |
318 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 320 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
319 | 321 |
320 } // namespace disk_cache | 322 } // namespace disk_cache |
321 | 323 |
322 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 324 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |