| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/compositorworker/AnimatorDefinition.h" |
| 6 |
| 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 10 #include "core/dom/ExecutionContext.h" |
| 11 #include "modules/compositorworker/Animator.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 AnimatorDefinition* AnimatorDefinition::create( |
| 16 ScriptState* scriptState, |
| 17 v8::Local<v8::Function> constructor, |
| 18 v8::Local<v8::Function> animate) { |
| 19 return new AnimatorDefinition(scriptState, constructor, animate); |
| 20 } |
| 21 |
| 22 AnimatorDefinition::AnimatorDefinition(ScriptState* scriptState, |
| 23 v8::Local<v8::Function> constructor, |
| 24 v8::Local<v8::Function> animate) |
| 25 : m_scriptState(scriptState), |
| 26 m_constructor(scriptState->isolate(), constructor), |
| 27 m_animate(scriptState->isolate(), animate) {} |
| 28 |
| 29 AnimatorDefinition::~AnimatorDefinition() {} |
| 30 |
| 31 Animator* AnimatorDefinition::createInstance() { |
| 32 v8::Isolate* isolate = m_scriptState->isolate(); |
| 33 v8::Local<v8::Function> constructor = m_constructor.newLocal(isolate); |
| 34 DCHECK(!isUndefinedOrNull(constructor)); |
| 35 |
| 36 v8::Local<v8::Object> instance; |
| 37 if (!V8ObjectConstructor::newInstance(isolate, constructor) |
| 38 .ToLocal(&instance)) { |
| 39 instance = v8::Local<v8::Object>(); |
| 40 } |
| 41 |
| 42 return Animator::create(m_scriptState.get(), this, instance); |
| 43 } |
| 44 |
| 45 } // namespace blink |
| OLD | NEW |