#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h"
#include <optional>
#include "base/time/time.h"
#include "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_function.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_animate_callback.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_animator_constructor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_state_callback.h"
#include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"
#include "third_party/blink/renderer/core/workers/worker_thread.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/modules/animationworklet/worklet_animation_effect_timings.h"
#include "third_party/blink/renderer/modules/animationworklet/worklet_animation_options.h"
#include "third_party/blink/renderer/platform/bindings/callback_method_retriever.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/v8_binding_macros.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
void UpdateAnimation(v8::Isolate* isolate,
Animator* animator,
WorkletAnimationId id,
double current_time,
AnimationWorkletDispatcherOutput* result) { … }
}
AnimationWorkletGlobalScope::AnimationWorkletGlobalScope(
std::unique_ptr<GlobalScopeCreationParams> creation_params,
WorkerThread* thread)
: … { … }
AnimationWorkletGlobalScope::~AnimationWorkletGlobalScope() = default;
void AnimationWorkletGlobalScope::Trace(Visitor* visitor) const { … }
void AnimationWorkletGlobalScope::Dispose() { … }
Animator* AnimationWorkletGlobalScope::CreateAnimatorFor(
int animation_id,
const String& name,
WorkletAnimationOptions options,
scoped_refptr<SerializedScriptValue> serialized_state,
const Vector<std::optional<base::TimeDelta>>& local_times,
const Vector<Timing>& timings,
const Vector<Timing::NormalizedTiming>& normalized_timings) { … }
void AnimationWorkletGlobalScope::UpdateAnimatorsList(
const AnimationWorkletInput& input) { … }
void AnimationWorkletGlobalScope::UpdateAnimators(
const AnimationWorkletInput& input,
AnimationWorkletOutput* output,
bool (*predicate)(Animator*)) { … }
void AnimationWorkletGlobalScope::RegisterWithProxyClientIfNeeded() { … }
void AnimationWorkletGlobalScope::registerAnimator(
const String& name,
V8AnimatorConstructor* animator_ctor,
ExceptionState& exception_state) { … }
Animator* AnimationWorkletGlobalScope::CreateInstance(
const String& name,
WorkletAnimationOptions options,
scoped_refptr<SerializedScriptValue> serialized_state,
const Vector<std::optional<base::TimeDelta>>& local_times,
const Vector<Timing>& timings,
const Vector<Timing::NormalizedTiming>& normalized_timings) { … }
bool AnimationWorkletGlobalScope::IsAnimatorStateful(int animation_id) { … }
void AnimationWorkletGlobalScope::MigrateAnimatorsTo(
AnimationWorkletGlobalScope* target_global_scope) { … }
AnimatorDefinition* AnimationWorkletGlobalScope::FindDefinitionForTest(
const String& name) { … }
}