#include "third_party/blink/renderer/core/dom/abort_signal.h"
#include <optional>
#include <utility>
#include "base/check_deref.h"
#include "base/functional/callback.h"
#include "base/functional/function_ref.h"
#include "base/time/time.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/core/dom/abort_signal_composition_manager.h"
#include "third_party/blink/renderer/core/dom/abort_signal_composition_type.h"
#include "third_party/blink/renderer/core/dom/abort_signal_registry.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/event_target_names.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_linked_hash_set.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.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/heap/visitor.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/text/atomic_string.h"
namespace blink {
namespace {
class OnceCallbackAlgorithm final : public AbortSignal::Algorithm { … };
}
AbortSignal::AbortSignal(ExecutionContext* execution_context)
: … { … }
AbortSignal::AbortSignal(ExecutionContext* execution_context,
SignalType signal_type)
: … { … }
AbortSignal::AbortSignal(ScriptState* script_state,
const HeapVector<Member<AbortSignal>>& source_signals)
: … { … }
void AbortSignal::InitializeCompositeSignal(
const HeapVector<Member<AbortSignal>>& source_signals) { … }
AbortSignal::~AbortSignal() = default;
AbortSignal* AbortSignal::abort(ScriptState* script_state) { … }
AbortSignal* AbortSignal::abort(ScriptState* script_state, ScriptValue reason) { … }
AbortSignal* AbortSignal::any(ScriptState* script_state,
HeapVector<Member<AbortSignal>> signals) { … }
AbortSignal* AbortSignal::timeout(ScriptState* script_state,
uint64_t milliseconds) { … }
void AbortSignal::AbortTimeoutFired(ScriptState* script_state) { … }
ScriptValue AbortSignal::reason(ScriptState* script_state) const { … }
void AbortSignal::throwIfAborted(ScriptState* script_state,
ExceptionState& exception_state) const { … }
const AtomicString& AbortSignal::InterfaceName() const { … }
ExecutionContext* AbortSignal::GetExecutionContext() const { … }
AbortSignal::AlgorithmHandle* AbortSignal::AddAlgorithm(Algorithm* algorithm) { … }
AbortSignal::AlgorithmHandle* AbortSignal::AddAlgorithm(
base::OnceClosure algorithm) { … }
void AbortSignal::RemoveAlgorithm(AlgorithmHandle* handle) { … }
void AbortSignal::SignalAbort(ScriptState* script_state,
ScriptValue reason,
SignalAbortPassKey) { … }
void AbortSignal::SetAbortReason(ScriptState* script_state,
ScriptValue reason) { … }
void AbortSignal::RunAbortSteps() { … }
void AbortSignal::Trace(Visitor* visitor) const { … }
AbortSignalCompositionManager* AbortSignal::GetCompositionManager(
AbortSignalCompositionType type) { … }
void AbortSignal::DetachFromController() { … }
void AbortSignal::OnSignalSettled(AbortSignalCompositionType type) { … }
bool AbortSignal::CanAbort() const { … }
void AbortSignal::AddedEventListener(
const AtomicString& event_type,
RegisteredEventListener& registered_listener) { … }
void AbortSignal::RemovedEventListener(
const AtomicString& event_type,
const RegisteredEventListener& registered_listener) { … }
void AbortSignal::InvokeRegistryCallback(
base::FunctionRef<void(AbortSignalRegistry&)> callback) { … }
void AbortSignal::OnEventListenerAddedOrRemoved(const AtomicString& event_type,
AddRemoveType add_or_remove) { … }
bool AbortSignal::IsSettledFor(
AbortSignalCompositionType composition_type) const { … }
AbortSignal::AlgorithmHandle::AlgorithmHandle(AbortSignal::Algorithm* algorithm,
AbortSignal* signal)
: … { … }
AbortSignal::AlgorithmHandle::~AlgorithmHandle() = default;
void AbortSignal::AlgorithmHandle::Trace(Visitor* visitor) const { … }
}