#include "components/services/storage/dom_storage/storage_area_impl.h"
#include <memory>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
#include "third_party/leveldatabase/env_chromium.h"
namespace storage {
BASE_FEATURE(…);
StorageAreaImpl::Delegate::~Delegate() = default;
void StorageAreaImpl::Delegate::PrepareToCommit(
std::vector<DomStorageDatabase::KeyValuePair>* extra_entries_to_add,
std::vector<DomStorageDatabase::Key>* extra_keys_to_delete) { … }
void StorageAreaImpl::Delegate::OnMapLoaded(leveldb::Status) { … }
bool StorageAreaImpl::s_aggressive_flushing_enabled_ = …;
StorageAreaImpl::RateLimiter::RateLimiter(size_t desired_rate,
base::TimeDelta time_quantum)
: … { … }
base::TimeDelta StorageAreaImpl::RateLimiter::ComputeTimeNeeded() const { … }
base::TimeDelta StorageAreaImpl::RateLimiter::ComputeDelayNeeded(
const base::TimeDelta elapsed_time) const { … }
StorageAreaImpl::CommitBatch::CommitBatch() = default;
StorageAreaImpl::CommitBatch::~CommitBatch() = default;
StorageAreaImpl::StorageAreaImpl(AsyncDomStorageDatabase* database,
const std::string& prefix,
Delegate* delegate,
const Options& options)
: … { … }
StorageAreaImpl::StorageAreaImpl(AsyncDomStorageDatabase* database,
std::vector<uint8_t> prefix,
Delegate* delegate,
const Options& options)
: … { … }
StorageAreaImpl::~StorageAreaImpl() { … }
void StorageAreaImpl::InitializeAsEmpty() { … }
void StorageAreaImpl::Bind(
mojo::PendingReceiver<blink::mojom::StorageArea> receiver) { … }
std::unique_ptr<StorageAreaImpl> StorageAreaImpl::ForkToNewPrefix(
const std::string& new_prefix,
Delegate* delegate,
const Options& options) { … }
std::unique_ptr<StorageAreaImpl> StorageAreaImpl::ForkToNewPrefix(
std::vector<uint8_t> new_prefix,
Delegate* delegate,
const Options& options) { … }
void StorageAreaImpl::CancelAllPendingRequests() { … }
void StorageAreaImpl::EnableAggressiveCommitDelay() { … }
void StorageAreaImpl::ScheduleImmediateCommit() { … }
void StorageAreaImpl::OnMemoryDump(const std::string& name,
base::trace_event::ProcessMemoryDump* pmd) { … }
void StorageAreaImpl::PurgeMemory() { … }
void StorageAreaImpl::SetCacheModeForTesting(CacheMode cache_mode) { … }
void StorageAreaImpl::AddObserver(
mojo::PendingRemote<blink::mojom::StorageAreaObserver> observer) { … }
void StorageAreaImpl::Put(
const std::vector<uint8_t>& key,
const std::vector<uint8_t>& value,
const std::optional<std::vector<uint8_t>>& client_old_value,
const std::string& source,
PutCallback callback) { … }
void StorageAreaImpl::Delete(
const std::vector<uint8_t>& key,
const std::optional<std::vector<uint8_t>>& client_old_value,
const std::string& source,
DeleteCallback callback) { … }
void StorageAreaImpl::DeleteAll(
const std::string& source,
mojo::PendingRemote<blink::mojom::StorageAreaObserver> new_observer,
DeleteAllCallback callback) { … }
void StorageAreaImpl::Get(const std::vector<uint8_t>& key,
GetCallback callback) { … }
void StorageAreaImpl::GetAll(
mojo::PendingRemote<blink::mojom::StorageAreaObserver> new_observer,
GetAllCallback callback) { … }
base::OnceCallback<void(leveldb::Status)>
StorageAreaImpl::GetCommitCompleteCallback() { … }
void StorageAreaImpl::SetCacheMode(CacheMode cache_mode) { … }
void StorageAreaImpl::Checkpoint() { … }
void StorageAreaImpl::OnConnectionError() { … }
void StorageAreaImpl::LoadMap(base::OnceClosure completion_callback) { … }
void StorageAreaImpl::OnMapLoaded(
leveldb::Status status,
std::vector<DomStorageDatabase::KeyValuePair> data) { … }
void StorageAreaImpl::CalculateStorageAndMemoryUsed() { … }
void StorageAreaImpl::OnLoadComplete() { … }
void StorageAreaImpl::CreateCommitBatchIfNeeded() { … }
void StorageAreaImpl::StartCommitTimer() { … }
base::TimeDelta StorageAreaImpl::ComputeCommitDelay() const { … }
void StorageAreaImpl::CommitChanges() { … }
std::optional<AsyncDomStorageDatabase::Commit>
StorageAreaImpl::CollectCommit() { … }
void StorageAreaImpl::OnCommitComplete(leveldb::Status status) { … }
void StorageAreaImpl::UnloadMapIfPossible() { … }
void StorageAreaImpl::DoForkOperation(
const base::WeakPtr<StorageAreaImpl>& forked_area) { … }
void StorageAreaImpl::OnForkStateLoaded(bool database_enabled,
const ValueMap& value_map,
const KeysOnlyMap& keys_only_map) { … }
}