#include "services/network/shared_dictionary/shared_dictionary_manager.h"
#include <algorithm>
#include <memory>
#include <ranges>
#include "base/feature_list.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/load_flags.h"
#include "net/shared_dictionary/shared_dictionary.h"
#include "services/network/public/cpp/features.h"
#include "services/network/shared_dictionary/shared_dictionary_manager_in_memory.h"
#include "services/network/shared_dictionary/shared_dictionary_manager_on_disk.h"
#include "services/network/shared_dictionary/shared_dictionary_storage.h"
namespace network {
namespace {
constexpr size_t kCachedStorageMaxSize = …;
}
std::unique_ptr<SharedDictionaryManager>
SharedDictionaryManager::CreateInMemory(uint64_t cache_max_size,
uint64_t cache_max_count) { … }
class SharedDictionaryManager::PreloadedDictionaries
: public mojom::PreloadedSharedDictionaryInfoHandle { … };
std::unique_ptr<SharedDictionaryManager> SharedDictionaryManager::CreateOnDisk(
const base::FilePath& database_path,
const base::FilePath& cache_directory_path,
uint64_t cache_max_size,
uint64_t cache_max_count,
#if BUILDFLAG(IS_ANDROID)
disk_cache::ApplicationStatusListenerGetter app_status_listener_getter,
#endif
scoped_refptr<disk_cache::BackendFileOperationsFactory>
file_operations_factory) { … }
SharedDictionaryManager::SharedDictionaryManager()
: … { … }
SharedDictionaryManager::~SharedDictionaryManager() = default;
scoped_refptr<SharedDictionaryStorage> SharedDictionaryManager::GetStorage(
const net::SharedDictionaryIsolationKey& isolation_key) { … }
void SharedDictionaryManager::OnStorageDeleted(
const net::SharedDictionaryIsolationKey& isolation_key) { … }
base::WeakPtr<SharedDictionaryManager> SharedDictionaryManager::GetWeakPtr() { … }
void SharedDictionaryManager::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel level) { … }
size_t SharedDictionaryManager::GetStorageCountForTesting() { … }
net::SharedDictionaryGetter
SharedDictionaryManager::MaybeCreateSharedDictionaryGetter(
int request_load_flags,
mojom::RequestDestination request_destination) { … }
scoped_refptr<net::SharedDictionary> SharedDictionaryManager::GetDictionaryImpl(
mojom::RequestDestination request_destination,
const std::optional<net::SharedDictionaryIsolationKey>& isolation_key,
const GURL& request_url) { … }
void SharedDictionaryManager::PreloadSharedDictionaryInfoForDocument(
const std::vector<GURL>& urls,
mojo::PendingReceiver<mojom::PreloadedSharedDictionaryInfoHandle>
preload_handle) { … }
void SharedDictionaryManager::DeletePreloadedDictionaries(
PreloadedDictionaries* preloaded_dictionaries) { … }
bool SharedDictionaryManager::HasPreloadedSharedDictionaryInfo() const { … }
}