Chromium Code Reviews| Index: third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h |
| diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7c9c70ef656900e3594097f5d901bccb8da8591d |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h |
| @@ -0,0 +1,50 @@ |
| +// 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. |
| + |
| +#ifndef AnimatorDefinition_h |
| +#define AnimatorDefinition_h |
| + |
| +#include "bindings/core/v8/ScopedPersistent.h" |
| +#include "platform/heap/Handle.h" |
| +#include "v8/include/v8.h" |
| + |
| +namespace blink { |
| + |
| +class ScriptState; |
| +class Animator; |
| + |
| +// This class represents a valid registered Javascript animator. Note that it |
| +// assumed the argument passed to its constructor have been validated to have |
| +// proper type. |
| +// It can be used to instantiate new animators and also to call the Javascript |
| +// 'animate' callback one a given instance. |
|
haraken
2017/03/14 20:33:02
on a given
majidvp
2017/05/18 21:05:03
Done.
|
| +class AnimatorDefinition final |
| + : public GarbageCollectedFinalized<AnimatorDefinition> { |
| + public: |
| + static AnimatorDefinition* create(ScriptState*, |
| + v8::Local<v8::Function> constructor, |
| + v8::Local<v8::Function> animate); |
| + |
| + ~AnimatorDefinition(); |
| + DEFINE_INLINE_TRACE() {} |
| + |
| + Animator* createInstance(); |
|
haraken
2017/03/14 20:33:02
For consistency with https://codereview.chromium.o
majidvp
2017/05/18 21:05:03
Done.
|
| + |
| + private: |
| + AnimatorDefinition(ScriptState*, |
| + v8::Local<v8::Function> constructor, |
| + v8::Local<v8::Function> animate); |
| + |
| + RefPtr<ScriptState> m_scriptState; |
| + |
| + // This object keeps the constructor function, and animate function alive. |
| + // It needs to be destroyed to break a reference cycle between it and the |
| + // AnimationWorkletGlobalScope. |
|
haraken
2017/03/14 20:33:02
Mention that it is broken at AnimationWorkletGloba
majidvp
2017/05/18 21:05:03
Done.
|
| + ScopedPersistent<v8::Function> m_constructor; |
| + ScopedPersistent<v8::Function> m_animate; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AnimatorDefinition_h |