#include "content/browser/storage_partition_impl_map.h"
#include <unordered_set>
#include <utility>
#include "base/barrier_closure.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/map_util.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "content/browser/background_fetch/background_fetch_context.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/code_cache/generated_code_cache_context.h"
#include "content/browser/cookie_store/cookie_store_manager.h"
#include "content/browser/file_system/browser_file_system_helper.h"
#include "content/browser/loader/subresource_proxying_url_loader_service.h"
#include "content/browser/resource_context_impl.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "crypto/sha2.h"
#include "services/network/public/cpp/features.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/database/database_tracker.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
namespace content {
namespace {
const base::FilePath::CharType kStoragePartitionDirname[] = …);
const base::FilePath::CharType kExtensionsDirname[] = …);
const base::FilePath::CharType kDefaultPartitionDirname[] = …);
const base::FilePath::CharType kTrashDirname[] = …);
const int kPartitionNameHashBytes = …;
#if BUILDFLAG(IS_POSIX)
const int kAllFileTypes = …;
#else
const int kAllFileTypes = base::FileEnumerator::FILES |
base::FileEnumerator::DIRECTORIES;
#endif
base::FilePath GetStoragePartitionDomainPath(
const std::string& partition_domain) { … }
void ObliterateOneDirectory(const base::FilePath& current_dir,
const std::vector<base::FilePath>& paths_to_keep,
std::vector<base::FilePath>* paths_to_consider) { … }
void BlockingObliteratePath(
const base::FilePath& unnormalized_browser_context_root,
const base::FilePath& unnormalized_root,
const std::vector<base::FilePath>& paths_to_keep,
const scoped_refptr<base::TaskRunner>& closure_runner,
base::OnceClosure on_gc_required) { … }
void NormalizeActivePaths(const base::FilePath& storage_root,
std::unordered_set<base::FilePath>* active_paths) { … }
void BlockingGarbageCollect(
const base::FilePath& storage_root,
const scoped_refptr<base::TaskRunner>& file_access_runner,
std::unordered_set<base::FilePath> active_paths) { … }
}
base::FilePath StoragePartitionImplMap::GetStoragePartitionPath(
const std::string& partition_domain,
const std::string& partition_name) { … }
StoragePartitionImplMap::StoragePartitionImplMap(
BrowserContext* browser_context)
: … { … }
StoragePartitionImplMap::~StoragePartitionImplMap() { … }
StoragePartitionImpl* StoragePartitionImplMap::Get(
const StoragePartitionConfig& partition_config,
bool can_create) { … }
void StoragePartitionImplMap::AsyncObliterate(
const std::string& partition_domain,
base::OnceClosure on_gc_required,
base::OnceClosure done_callback) { … }
void StoragePartitionImplMap::GarbageCollect(
std::unordered_set<base::FilePath> active_paths,
base::OnceClosure done) { … }
void StoragePartitionImplMap::ForEach(
base::FunctionRef<void(StoragePartition*)> fn) { … }
void StoragePartitionImplMap::PostCreateInitialization(
StoragePartitionImpl* partition,
bool in_memory) { … }
}