blob: ff0f695d7e7b8dad4cf5e0b02039b7339d7ef6eb [file] [log] [blame]
[email protected]5138d5f2011-05-07 00:49:341// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
[email protected]408d35f52008-08-13 18:30:224
5#ifndef NET_DISK_CACHE_CACHE_UTIL_H_
6#define NET_DISK_CACHE_CACHE_UTIL_H_
7
avid0181f32015-12-10 19:41:478#include <stdint.h>
9
Matt Menkeb0f4c7c2018-07-06 19:25:3010#include "base/feature_list.h"
[email protected]172da1b2011-08-12 15:52:2611#include "net/base/net_export.h"
[email protected]398ad132013-04-02 15:11:0112#include "net/disk_cache/disk_cache.h"
[email protected]408d35f52008-08-13 18:30:2213
[email protected]a3ef4832013-02-02 05:12:3314namespace base {
[email protected]cfaa1f22009-10-12 17:14:5915class FilePath;
[email protected]a3ef4832013-02-02 05:12:3316}
[email protected]cfaa1f22009-10-12 17:14:5917
[email protected]408d35f52008-08-13 18:30:2218namespace disk_cache {
19
Matt Menkeb0f4c7c2018-07-06 19:25:3020NET_EXPORT_PRIVATE extern const base::Feature kChangeDiskCacheSizeExperiment;
21
[email protected]408d35f52008-08-13 18:30:2222// Moves the cache files from the given path to another location.
[email protected]831a1a762010-10-12 05:57:0823// Fails if the destination exists already, or if it doesn't have
24// permission for the operation. This is basically a rename operation
25// for the cache directory. Returns true if successful. On ChromeOS,
26// this moves the cache contents, and leaves the empty cache
27// directory.
[email protected]a3ef4832013-02-02 05:12:3328NET_EXPORT_PRIVATE bool MoveCache(const base::FilePath& from_path,
29 const base::FilePath& to_path);
[email protected]408d35f52008-08-13 18:30:2230
31// Deletes the cache files stored on |path|, and optionally also attempts to
32// delete the folder itself.
[email protected]a3ef4832013-02-02 05:12:3333NET_EXPORT_PRIVATE void DeleteCache(const base::FilePath& path,
34 bool remove_folder);
[email protected]408d35f52008-08-13 18:30:2235
[email protected]a88d601f2008-08-15 20:36:2136// Deletes a cache file.
[email protected]a3ef4832013-02-02 05:12:3337NET_EXPORT_PRIVATE bool DeleteCacheFile(const base::FilePath& name);
[email protected]a88d601f2008-08-15 20:36:2138
[email protected]398ad132013-04-02 15:11:0139// Renames cache directory synchronously and fires off a background cleanup
40// task. Used by cache creator itself or by backends for self-restart on error.
41bool DelayedCacheCleanup(const base::FilePath& full_path);
42
Bill Budge1bb18a942019-12-02 22:19:5443// Returns the preferred max cache size given the available disk space and
44// cache type.
45NET_EXPORT_PRIVATE int PreferredCacheSize(
46 int64_t available,
47 net::CacheType type = net::DISK_CACHE);
[email protected]18b5b262013-11-19 18:41:3748
49// The default cache size should not ideally be exposed, but the blockfile
50// backend uses it for reasons that include testing.
51NET_EXPORT_PRIVATE extern const int kDefaultCacheSize;
52
[email protected]408d35f52008-08-13 18:30:2253} // namespace disk_cache
54
55#endif // NET_DISK_CACHE_CACHE_UTIL_H_