#include "components/services/storage/indexed_db/locks/partitioned_lock_manager.h"
#include <cstddef>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include "base/check.h"
#include "base/containers/flat_set.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/task/sequenced_task_runner.h"
#include "components/services/storage/indexed_db/locks/partitioned_lock.h"
#include "components/services/storage/indexed_db/locks/partitioned_lock_id.h"
namespace content {
PartitionedLockHolder::PartitionedLockHolder() = default;
PartitionedLockHolder::~PartitionedLockHolder() { … }
void PartitionedLockHolder::CancelLockRequest() { … }
PartitionedLockManager::PartitionedLockRequest::PartitionedLockRequest(
PartitionedLockId lock_id,
LockType type)
: … { … }
PartitionedLockManager::AcquisitionRequest::AcquisitionRequest() = default;
PartitionedLockManager::AcquisitionRequest::~AcquisitionRequest() = default;
PartitionedLockManager::AcquisitionRequest::AcquisitionRequest(
AcquisitionRequest&&) = default;
PartitionedLockManager::LockState::LockState() = default;
PartitionedLockManager::LockState::LockState(LockState&&) noexcept = default;
PartitionedLockManager::LockState::~LockState() = default;
PartitionedLockManager::LockState& PartitionedLockManager::LockState::operator=(
PartitionedLockManager::LockState&&) noexcept = default;
PartitionedLockManager::PartitionedLockManager() = default;
PartitionedLockManager::~PartitionedLockManager() = default;
int64_t PartitionedLockManager::LocksHeldForTesting() const { … }
int64_t PartitionedLockManager::RequestsWaitingForTesting() const { … }
void PartitionedLockManager::AcquireLocks(
base::flat_set<PartitionedLockRequest> lock_requests,
PartitionedLockHolder& locks_holder,
base::OnceClosure acquired_callback,
base::RepeatingCallback<bool(const PartitionedLockHolder&)>
compare_priority) { … }
bool PartitionedLockManager::RequestsAreOverlapping(
const base::flat_set<PartitionedLockRequest>& requests_a,
const base::flat_set<PartitionedLockRequest>& requests_b) { … }
std::list<PartitionedLockManager::AcquisitionRequest>::iterator
PartitionedLockManager::MaybeGrantLocksAndIterate(
std::list<AcquisitionRequest>::iterator requests_iter,
bool notify_synchronously) { … }
bool PartitionedLockManager::CanAcquireLock(PartitionedLockId lock_id,
LockType type) { … }
PartitionedLockManager::TestLockResult PartitionedLockManager::TestLock(
PartitionedLockRequest request) { … }
std::vector<PartitionedLockId> PartitionedLockManager::GetUnacquirableLocks(
std::vector<PartitionedLockRequest>& lock_requests) { … }
void PartitionedLockManager::AcquireLock(PartitionedLockRequest request,
PartitionedLockHolder& locks_holder) { … }
void PartitionedLockManager::LockReleased(PartitionedLockId released_lock_id) { … }
void PartitionedLockManager::LockRequestCancelled() { … }
std::set<PartitionedLockHolder*> PartitionedLockManager::GetBlockedRequests(
const base::flat_set<PartitionedLockId>& held_locks) const { … }
bool operator<(const PartitionedLockManager::PartitionedLockRequest& x,
const PartitionedLockManager::PartitionedLockRequest& y) { … }
bool operator==(const PartitionedLockManager::PartitionedLockRequest& x,
const PartitionedLockManager::PartitionedLockRequest& y) { … }
bool operator!=(const PartitionedLockManager::PartitionedLockRequest& x,
const PartitionedLockManager::PartitionedLockRequest& y) { … }
}