blob: 18f49e65811489adbd57aecec59a4afa08e9a0f7 [file] [log] [blame]
Tsuyoshi Horo447af66f2023-05-26 13:18:021// Copyright 2023 The Chromium Authors
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 CONTENT_BROWSER_NETWORK_SHARED_DICTIONARY_UTIL_H_
6#define CONTENT_BROWSER_NETWORK_SHARED_DICTIONARY_UTIL_H_
7
8#include "base/memory/weak_ptr.h"
9
10namespace base {
11class FilePath;
12} // namespace base
13
14namespace content {
15
16class StoragePartition;
17
18// Caliculates the cache max size for Shared Dictionary Cache on a different
19// thread, and sends the caliculated value to NetworkContext of
20// `storage_partition`.
21// When `path` is empty, caliculates the max size for in memory cache using
22// base::SysInfo::AmountOfPhysicalMemory. Otherwise, caliculates the max size
23// for on disk cache using base::SysInfo::AmountOfFreeDiskSpace with the `path`.
24void CalculateAndSetSharedDictionaryCacheMaxSize(
25 base::WeakPtr<StoragePartition> storage_partition,
26 const base::FilePath& path);
27
28} // namespace content
29
30#endif // CONTENT_BROWSER_NETWORK_SHARED_DICTIONARY_UTIL_H_