#include "third_party/blink/renderer/modules/locks/lock_manager.h"
#include <algorithm>
#include <utility>
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_content_settings_client.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_lock_granted_callback.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_lock_info.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_lock_manager_snapshot.h"
#include "third_party/blink/renderer/core/dom/abort_signal.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/modules/locks/lock.h"
#include "third_party/blink/renderer/platform/bindings/name_client.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_receiver.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
namespace {
constexpr char kSecurityErrorMessage[] = …;
constexpr char kInvalidStateErrorMessage[] = …;
LockInfo* ToLockInfo(const mojom::blink::LockInfoPtr& record) { … }
HeapVector<Member<LockInfo>> ToLockInfos(
const Vector<mojom::blink::LockInfoPtr>& records) { … }
}
class LockManager::LockRequestImpl final
: public GarbageCollected<LockRequestImpl>,
public NameClient,
public mojom::blink::LockRequest { … };
const char LockManager::kSupplementName[] = …;
LockManager* LockManager::locks(NavigatorBase& navigator) { … }
LockManager::LockManager(NavigatorBase& navigator)
: … { … }
void LockManager::SetManager(
mojo::PendingRemote<mojom::blink::LockManager> manager,
ExecutionContext* execution_context) { … }
ScriptPromise<IDLAny> LockManager::request(ScriptState* script_state,
const String& name,
V8LockGrantedCallback* callback,
ExceptionState& exception_state) { … }
ScriptPromise<IDLAny> LockManager::request(ScriptState* script_state,
const String& name,
const LockOptions* options,
V8LockGrantedCallback* callback,
ExceptionState& exception_state) { … }
void LockManager::RequestImpl(const LockOptions* options,
const String& name,
V8LockGrantedCallback* callback,
mojom::blink::LockMode mode,
ScriptPromiseResolver<IDLAny>* resolver) { … }
ScriptPromise<LockManagerSnapshot> LockManager::query(
ScriptState* script_state,
ExceptionState& exception_state) { … }
void LockManager::QueryImpl(
ScriptPromiseResolver<LockManagerSnapshot>* resolver) { … }
void LockManager::AddPendingRequest(LockRequestImpl* request) { … }
void LockManager::RemovePendingRequest(LockRequestImpl* request) { … }
bool LockManager::IsPendingRequest(LockRequestImpl* request) { … }
void LockManager::Trace(Visitor* visitor) const { … }
void LockManager::ContextDestroyed() { … }
void LockManager::OnLockReleased(Lock* lock) { … }
void LockManager::CheckStorageAccessAllowed(
ExecutionContext* context,
ScriptPromiseResolverBase* resolver,
base::OnceCallback<void()> callback) { … }
void LockManager::DidCheckStorageAccessAllowed(
ScriptPromiseResolverBase* resolver,
base::OnceCallback<void()> callback,
bool allow_access) { … }
}