OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_DISK_CACHE_CACHE_UTIL_H_ | |
6 #define NET_DISK_CACHE_CACHE_UTIL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "net/base/net_export.h" | |
10 #include "net/disk_cache/disk_cache.h" | |
11 | |
12 namespace base { | |
13 class FilePath; | |
14 } | |
15 | |
16 namespace disk_cache { | |
17 | |
18 // Moves the cache files from the given path to another location. | |
19 // Fails if the destination exists already, or if it doesn't have | |
20 // permission for the operation. This is basically a rename operation | |
21 // for the cache directory. Returns true if successful. On ChromeOS, | |
22 // this moves the cache contents, and leaves the empty cache | |
23 // directory. | |
24 NET_EXPORT_PRIVATE bool MoveCache(const base::FilePath& from_path, | |
25 const base::FilePath& to_path); | |
26 | |
27 // Deletes the cache files stored on |path|, and optionally also attempts to | |
28 // delete the folder itself. | |
29 NET_EXPORT_PRIVATE void DeleteCache(const base::FilePath& path, | |
30 bool remove_folder); | |
31 | |
32 // Deletes a cache file. | |
33 NET_EXPORT_PRIVATE bool DeleteCacheFile(const base::FilePath& name); | |
34 | |
35 // Renames cache directory synchronously and fires off a background cleanup | |
36 // task. Used by cache creator itself or by backends for self-restart on error. | |
37 bool DelayedCacheCleanup(const base::FilePath& full_path); | |
38 | |
39 // Returns the preferred max cache size given the available disk space. | |
40 NET_EXPORT_PRIVATE int PreferredCacheSize(int64 available); | |
41 | |
42 // The default cache size should not ideally be exposed, but the blockfile | |
43 // backend uses it for reasons that include testing. | |
44 NET_EXPORT_PRIVATE extern const int kDefaultCacheSize; | |
45 | |
46 } // namespace disk_cache | |
47 | |
48 #endif // NET_DISK_CACHE_CACHE_UTIL_H_ | |
OLD | NEW |