Tsuyoshi Horo | 447af66f | 2023-05-26 13:18:02 | [diff] [blame] | 1 | // 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 | |
| 10 | namespace base { |
| 11 | class FilePath; |
| 12 | } // namespace base |
| 13 | |
| 14 | namespace content { |
| 15 | |
| 16 | class 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`. |
| 24 | void 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_ |