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 "platform/bindings/ScopedPersistent.h" | |
| 9 #include "platform/heap/Handle.h" | |
| 10 #include "v8/include/v8.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 // This class represents a valid registered Javascript animator. Note that it | |
| 15 // assumed the argument passed to its constructor have been validated to have | |
| 16 // proper type. | |
| 17 // It can be used to instantiate new animators and also to call the Javascript | |
| 18 // 'animate' callback on a given instance. | |
| 19 class AnimatorDefinition final | |
| 20 : public GarbageCollectedFinalized<AnimatorDefinition> { | |
| 21 public: | |
| 22 static AnimatorDefinition* Create(v8::Isolate*, | |
| 23 v8::Local<v8::Function> constructor, | |
| 24 v8::Local<v8::Function> animate); | |
| 25 | |
| 26 ~AnimatorDefinition(); | |
| 27 DEFINE_INLINE_TRACE() {} | |
| 28 | |
| 29 v8::Local<v8::Function> ConstructorLocal(v8::Isolate*); | |
| 30 | |
| 31 private: | |
| 32 AnimatorDefinition(v8::Isolate*, | |
| 33 v8::Local<v8::Function> constructor, | |
| 34 v8::Local<v8::Function> animate); | |
| 35 | |
| 36 // This object keeps the constructor function, and animate function alive. | |
| 37 // It needs to be destroyed to break a reference cycle between it and the | |
| 38 // AnimationWorkletGlobalScope. This cycle is broken in | |
| 39 // |AnimationWorkletGlobalScope::Dispose()|. | |
| 40 ScopedPersistent<v8::Function> m_constructor; | |
| 41 ScopedPersistent<v8::Function> m_animate; | |
|
haraken
2017/05/20 00:35:29
m_animate is not used...?
haraken
2017/05/20 00:35:29
Ditto. We should consider using the wrapper tracin
majidvp
2017/05/24 14:24:16
The patch is adding the validation code for |m_ani
| |
| 42 }; | |
| 43 | |
| 44 } // namespace blink | |
| 45 | |
| 46 #endif // AnimatorDefinition_h | |
| OLD | NEW |