#include "third_party/blink/renderer/core/dom/observable.h"
#include "base/types/pass_key.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_catch_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_mapper.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_observable_inspector.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_observable_inspector_abort_handler.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_observer.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_observer_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_observer_complete_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_predicate.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_reducer.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_subscribe_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_subscribe_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_observableinspector_observercallback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_observer_observercallback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_visitor.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_void_function.h"
#include "third_party/blink/renderer/core/dom/abort_controller.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/observable_internal_observer.h"
#include "third_party/blink/renderer/core/dom/subscriber.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.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/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
namespace {
class ScriptValueHolder final : public GarbageCollected<ScriptValueHolder> { … };
class RejectPromiseAbortAlgorithm final : public AbortSignal::Algorithm { … };
class ScriptCallbackInternalObserver final : public ObservableInternalObserver { … };
class ToArrayInternalObserver final : public ObservableInternalObserver { … };
class OperatorReduceInternalObserver final : public ObservableInternalObserver { … };
class OperatorFindInternalObserver final : public ObservableInternalObserver { … };
class OperatorEveryInternalObserver final : public ObservableInternalObserver { … };
class OperatorSomeInternalObserver final : public ObservableInternalObserver { … };
class OperatorLastInternalObserver final : public ObservableInternalObserver { … };
class OperatorFirstInternalObserver final : public ObservableInternalObserver { … };
class OperatorForEachInternalObserver final
: public ObservableInternalObserver { … };
class OperatorFromPromiseSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorCatchSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorInspectSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorSwitchMapSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorFlatMapSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorFromIterableSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorDropSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorTakeSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorFilterSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorMapSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
class OperatorTakeUntilSubscribeDelegate final
: public Observable::SubscribeDelegate { … };
}
PassKey;
Observable* Observable::Create(ScriptState* script_state,
V8SubscribeCallback* subscribe_callback) { … }
Observable::Observable(ExecutionContext* execution_context,
V8SubscribeCallback* subscribe_callback)
: … { … }
Observable::Observable(ExecutionContext* execution_context,
SubscribeDelegate* subscribe_delegate)
: … { … }
void Observable::subscribe(ScriptState* script_state,
V8UnionObserverOrObserverCallback* observer_union,
SubscribeOptions* options) { … }
void Observable::SubscribeWithNativeObserver(
ScriptState* script_state,
ObservableInternalObserver* internal_observer,
SubscribeOptions* options) { … }
void Observable::SubscribeInternal(
ScriptState* script_state,
V8UnionObserverOrObserverCallback* observer_union,
ObservableInternalObserver* internal_observer,
SubscribeOptions* options) { … }
Observable* Observable::from(ScriptState* script_state,
ScriptValue value,
ExceptionState& exception_state) { … }
Observable* Observable::takeUntil(ScriptState*, Observable* notifier) { … }
Observable* Observable::map(ScriptState*, V8Mapper* mapper) { … }
Observable* Observable::filter(ScriptState*, V8Predicate* predicate) { … }
Observable* Observable::take(ScriptState*, uint64_t number_to_take) { … }
Observable* Observable::drop(ScriptState*, uint64_t number_to_drop) { … }
Observable* Observable::flatMap(ScriptState*,
V8Mapper* mapper,
ExceptionState& exception_state) { … }
Observable* Observable::switchMap(ScriptState*,
V8Mapper* mapper,
ExceptionState& exception_state) { … }
Observable* Observable::inspect(
ScriptState* script_state,
V8UnionObservableInspectorOrObserverCallback* inspector_union) { … }
Observable* Observable::catchImpl(ScriptState*,
V8CatchCallback* callback,
ExceptionState& exception_state) { … }
ScriptPromise<IDLSequence<IDLAny>> Observable::toArray(
ScriptState* script_state,
SubscribeOptions* options) { … }
ScriptPromise<IDLUndefined> Observable::forEach(ScriptState* script_state,
V8Visitor* callback,
SubscribeOptions* options) { … }
ScriptPromise<IDLAny> Observable::first(ScriptState* script_state,
SubscribeOptions* options) { … }
ScriptPromise<IDLAny> Observable::last(ScriptState* script_state,
SubscribeOptions* options) { … }
ScriptPromise<IDLBoolean> Observable::some(ScriptState* script_state,
V8Predicate* predicate,
SubscribeOptions* options) { … }
ScriptPromise<IDLBoolean> Observable::every(ScriptState* script_state,
V8Predicate* predicate,
SubscribeOptions* options) { … }
ScriptPromise<IDLAny> Observable::find(ScriptState* script_state,
V8Predicate* predicate,
SubscribeOptions* options) { … }
ScriptPromise<IDLAny> Observable::reduce(ScriptState* script_state,
V8Reducer* reducer) { … }
ScriptPromise<IDLAny> Observable::reduce(ScriptState* script_state,
V8Reducer* reducer,
v8::Local<v8::Value> initialValue,
SubscribeOptions* options) { … }
ScriptPromise<IDLAny> Observable::ReduceInternal(
ScriptState* script_state,
V8Reducer* reducer,
std::optional<ScriptValue> initial_value,
SubscribeOptions* options) { … }
void Observable::Trace(Visitor* visitor) const { … }
}