Chromium Code Reviews| 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 #ifndef AnimatorDefinition_h | |
| 6 #define AnimatorDefinition_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | |
| 9 #include "platform/heap/Handle.h" | |
| 10 #include "v8/include/v8.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class ScriptState; | |
| 15 class Animator; | |
| 16 | |
| 17 // This class represents a valid registered Javascript animator. Note that it | |
| 18 // assumed the argument passed to its constructor have been validated to have | |
| 19 // proper type. | |
| 20 // It can be used to instantiate new animators and also to call the Javascript | |
| 21 // 'animate' callback one a given instance. | |
|
haraken
2017/03/14 20:33:02
on a given
majidvp
2017/05/18 21:05:03
Done.
| |
| 22 class AnimatorDefinition final | |
| 23 : public GarbageCollectedFinalized<AnimatorDefinition> { | |
| 24 public: | |
| 25 static AnimatorDefinition* create(ScriptState*, | |
| 26 v8::Local<v8::Function> constructor, | |
| 27 v8::Local<v8::Function> animate); | |
| 28 | |
| 29 ~AnimatorDefinition(); | |
| 30 DEFINE_INLINE_TRACE() {} | |
| 31 | |
| 32 Animator* createInstance(); | |
|
haraken
2017/03/14 20:33:02
For consistency with https://codereview.chromium.o
majidvp
2017/05/18 21:05:03
Done.
| |
| 33 | |
| 34 private: | |
| 35 AnimatorDefinition(ScriptState*, | |
| 36 v8::Local<v8::Function> constructor, | |
| 37 v8::Local<v8::Function> animate); | |
| 38 | |
| 39 RefPtr<ScriptState> m_scriptState; | |
| 40 | |
| 41 // This object keeps the constructor function, and animate function alive. | |
| 42 // It needs to be destroyed to break a reference cycle between it and the | |
| 43 // AnimationWorkletGlobalScope. | |
|
haraken
2017/03/14 20:33:02
Mention that it is broken at AnimationWorkletGloba
majidvp
2017/05/18 21:05:03
Done.
| |
| 44 ScopedPersistent<v8::Function> m_constructor; | |
| 45 ScopedPersistent<v8::Function> m_animate; | |
| 46 }; | |
| 47 | |
| 48 } // namespace blink | |
| 49 | |
| 50 #endif // AnimatorDefinition_h | |
| OLD | NEW |