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 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "net/base/cache_type.h" | 16 #include "net/base/cache_type.h" |
17 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
19 #include "net/disk_cache/disk_cache.h" | |
rvargas (doing something else)
2013/03/13 19:36:01
ah?
pasko-google - do not use
2013/03/18 15:47:07
Done.
| |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class FilePath; | 22 class FilePath; |
22 class MessageLoopProxy; | 23 class MessageLoopProxy; |
23 } | 24 } |
24 | 25 |
25 namespace net { | 26 namespace net { |
26 class IOBuffer; | 27 class IOBuffer; |
27 class NetLog; | 28 class NetLog; |
28 } | 29 } |
(...skipping 11 matching lines...) Expand all Loading... | |
40 // files will be deleted and a new set will be created. |max_bytes| is the | 41 // files will be deleted and a new set will be created. |max_bytes| is the |
41 // maximum size the cache can grow to. If zero is passed in as |max_bytes|, the | 42 // maximum size the cache can grow to. If zero is passed in as |max_bytes|, the |
42 // cache will determine the value to use. |thread| can be used to perform IO | 43 // cache will determine the value to use. |thread| can be used to perform IO |
43 // operations if a dedicated thread is required; a valid value is expected for | 44 // 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 | 45 // 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 | 46 // 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 | 47 // 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. | 48 // 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 | 49 // The pointer to receive the |backend| must remain valid until the operation |
49 // completes (the callback is notified). | 50 // completes (the callback is notified). |
51 NET_EXPORT int CreateCacheBackendWithFlags( | |
52 net::CacheType type, | |
53 const base::FilePath& path, | |
54 int max_bytes, | |
55 bool force, | |
56 uint32 flags, | |
57 base::MessageLoopProxy* thread, | |
58 net::NetLog* net_log, | |
59 Backend** backend, | |
60 const net::CompletionCallback& callback); | |
61 | |
62 // A slightly shorter version than the above. It is invoked from WebKit and | |
rvargas (doing something else)
2013/03/13 19:36:01
what is webkit?
pasko-google - do not use
2013/03/18 15:47:07
oh, I incorrectly interpreted the linker error mes
| |
63 // requires a cleanup step there to eliminate. | |
64 // TODO(pasko): eliminate this call. | |
gavinp
2013/03/13 18:36:12
I think it's best if the stuff after the : is a fu
pasko-google - do not use
2013/03/18 15:47:07
Agreed. Good general note. This time it does not r
| |
50 NET_EXPORT int CreateCacheBackend(net::CacheType type, | 65 NET_EXPORT int CreateCacheBackend(net::CacheType type, |
51 const base::FilePath& path, | 66 const base::FilePath& path, |
52 int max_bytes, bool force, | 67 int max_bytes, bool force, |
53 base::MessageLoopProxy* thread, | 68 base::MessageLoopProxy* thread, |
54 net::NetLog* net_log, Backend** backend, | 69 net::NetLog* net_log, Backend** backend, |
55 const net::CompletionCallback& callback); | 70 const net::CompletionCallback& callback); |
56 | 71 |
72 // Renames cache directory synchronously and fires off a background cleanup | |
73 // task. Used by cache creator itself or by backends for self-restart on error. | |
74 bool DelayedCacheCleanup(const base::FilePath& full_path); | |
rvargas (doing something else)
2013/03/13 19:36:01
Why is this part of the interface?
pasko-google - do not use
2013/03/18 15:47:07
It should not necessary be a part of a generic cac
rvargas (doing something else)
2013/03/18 22:25:25
How about cache_creator.h? There's already cache_u
rvargas (doing something else)
2013/03/18 22:27:16
In case it is not clear, this comment is basically
| |
75 | |
57 // The root interface for a disk cache instance. | 76 // The root interface for a disk cache instance. |
58 class NET_EXPORT Backend { | 77 class NET_EXPORT Backend { |
59 public: | 78 public: |
60 typedef net::CompletionCallback CompletionCallback; | 79 typedef net::CompletionCallback CompletionCallback; |
61 | 80 |
62 // If the backend is destroyed when there are operations in progress (any | 81 // If the backend is destroyed when there are operations in progress (any |
63 // callback that has not been invoked yet), this method cancels said | 82 // callback that has not been invoked yet), this method cancels said |
64 // operations so the callbacks are not invoked, possibly leaving the work | 83 // 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 | 84 // 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 | 85 // 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. | 321 // Note: This method is deprecated. |
303 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; | 322 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; |
304 | 323 |
305 protected: | 324 protected: |
306 virtual ~Entry() {} | 325 virtual ~Entry() {} |
307 }; | 326 }; |
308 | 327 |
309 } // namespace disk_cache | 328 } // namespace disk_cache |
310 | 329 |
311 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 330 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |