Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(757)

Unified Diff: third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h

Issue 2745823002: [animation-worklet] Implement registerAnimator in worklet scope (Closed)
Patch Set: Address feedback and use new animationWorklet.addModule syntax Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f363178d5bd16b6aa7438ec5f3e0312550d4bceb
--- /dev/null
+++ b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h
@@ -0,0 +1,46 @@
+// 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 "platform/bindings/ScopedPersistent.h"
+#include "platform/heap/Handle.h"
+#include "v8/include/v8.h"
+
+namespace blink {
+
+// 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 on a given instance.
+class AnimatorDefinition final
+ : public GarbageCollectedFinalized<AnimatorDefinition> {
+ public:
+ static AnimatorDefinition* Create(v8::Isolate*,
+ v8::Local<v8::Function> constructor,
+ v8::Local<v8::Function> animate);
+
+ ~AnimatorDefinition();
+ DEFINE_INLINE_TRACE() {}
+
+ v8::Local<v8::Function> ConstructorLocal(v8::Isolate*);
+
+ private:
+ AnimatorDefinition(v8::Isolate*,
+ v8::Local<v8::Function> constructor,
+ v8::Local<v8::Function> animate);
+
+ // 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. This cycle is broken in
+ // |AnimationWorkletGlobalScope::Dispose()|.
+ ScopedPersistent<v8::Function> m_constructor;
+ 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
+};
+
+} // namespace blink
+
+#endif // AnimatorDefinition_h

Powered by Google App Engine
This is Rietveld 408576698