OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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/disk-cache | 6 // http://dev.chromium.org/developers/design-documents/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 14 matching lines...) Expand all Loading... |
25 namespace net { | 25 namespace net { |
26 class IOBuffer; | 26 class IOBuffer; |
27 } | 27 } |
28 | 28 |
29 namespace disk_cache { | 29 namespace disk_cache { |
30 | 30 |
31 class Entry; | 31 class Entry; |
32 class Backend; | 32 class Backend; |
33 typedef net::CompletionCallback CompletionCallback; | 33 typedef net::CompletionCallback CompletionCallback; |
34 | 34 |
35 // Returns an instance of the Backend. path points to a folder where | |
36 // the cached data will be stored. This cache instance must be the only object | |
37 // that will be reading or writing files to that folder. The returned object | |
38 // should be deleted when not needed anymore. If force is true, and there is | |
39 // a problem with the cache initialization, the files will be deleted and a | |
40 // new set will be created. max_bytes is the maximum size the cache can grow to. | |
41 // If zero is passed in as max_bytes, the cache will determine the value to use | |
42 // based on the available disk space. The returned pointer can be NULL if a | |
43 // fatal error is found. | |
44 // Note: This function is deprecated. | |
45 Backend* CreateCacheBackend(const FilePath& path, bool force, | |
46 int max_bytes, net::CacheType type); | |
47 | |
48 // Returns an instance of a Backend implemented only in memory. The returned | |
49 // object should be deleted when not needed anymore. max_bytes is the maximum | |
50 // size the cache can grow to. If zero is passed in as max_bytes, the cache will | |
51 // determine the value to use based on the available memory. The returned | |
52 // pointer can be NULL if a fatal error is found. | |
53 // Note: This function is deprecated. | |
54 Backend* CreateInMemoryCacheBackend(int max_bytes); | |
55 | |
56 // Returns an instance of a Backend of the given |type|. |path| points to a | 35 // Returns an instance of a Backend of the given |type|. |path| points to a |
57 // folder where the cached data will be stored (if appropriate). This cache | 36 // folder where the cached data will be stored (if appropriate). This cache |
58 // instance must be the only object that will be reading or writing files to | 37 // instance must be the only object that will be reading or writing files to |
59 // that folder. The returned object should be deleted when not needed anymore. | 38 // that folder. The returned object should be deleted when not needed anymore. |
60 // If |force| is true, and there is a problem with the cache initialization, the | 39 // If |force| is true, and there is a problem with the cache initialization, the |
61 // files will be deleted and a new set will be created. |max_bytes| is the | 40 // files will be deleted and a new set will be created. |max_bytes| is the |
62 // maximum size the cache can grow to. If zero is passed in as |max_bytes|, the | 41 // maximum size the cache can grow to. If zero is passed in as |max_bytes|, the |
63 // cache will determine the value to use. |thread| can be used to perform IO | 42 // cache will determine the value to use. |thread| can be used to perform IO |
64 // 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 |
65 // 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 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // Note: This method is deprecated. | 340 // Note: This method is deprecated. |
362 virtual int ReadyForSparseIO(CompletionCallback* completion_callback) = 0; | 341 virtual int ReadyForSparseIO(CompletionCallback* completion_callback) = 0; |
363 | 342 |
364 protected: | 343 protected: |
365 virtual ~Entry() {} | 344 virtual ~Entry() {} |
366 }; | 345 }; |
367 | 346 |
368 } // namespace disk_cache | 347 } // namespace disk_cache |
369 | 348 |
370 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 349 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |