| Index: third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.cpp
|
| diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.cpp b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8cadceb2cfdef8a1e956bc56db46d04ef0c54b69
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.cpp
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "modules/compositorworker/AnimatorDefinition.h"
|
| +
|
| +#include "bindings/core/v8/ScriptState.h"
|
| +#include "bindings/core/v8/V8Binding.h"
|
| +#include "bindings/core/v8/V8ObjectConstructor.h"
|
| +#include "core/dom/ExecutionContext.h"
|
| +#include "modules/compositorworker/Animator.h"
|
| +
|
| +namespace blink {
|
| +
|
| +AnimatorDefinition* AnimatorDefinition::create(
|
| + ScriptState* scriptState,
|
| + v8::Local<v8::Function> constructor,
|
| + v8::Local<v8::Function> animate) {
|
| + return new AnimatorDefinition(scriptState, constructor, animate);
|
| +}
|
| +
|
| +AnimatorDefinition::AnimatorDefinition(ScriptState* scriptState,
|
| + v8::Local<v8::Function> constructor,
|
| + v8::Local<v8::Function> animate)
|
| + : m_scriptState(scriptState),
|
| + m_constructor(scriptState->isolate(), constructor),
|
| + m_animate(scriptState->isolate(), animate) {}
|
| +
|
| +AnimatorDefinition::~AnimatorDefinition() {}
|
| +
|
| +Animator* AnimatorDefinition::createInstance() {
|
| + v8::Isolate* isolate = m_scriptState->isolate();
|
| + v8::Local<v8::Function> constructor = m_constructor.newLocal(isolate);
|
| + DCHECK(!isUndefinedOrNull(constructor));
|
| +
|
| + v8::Local<v8::Object> instance;
|
| + if (!V8ObjectConstructor::newInstance(isolate, constructor)
|
| + .ToLocal(&instance)) {
|
| + instance = v8::Local<v8::Object>();
|
| + }
|
| +
|
| + return Animator::create(m_scriptState.get(), this, instance);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|