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

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

Issue 2745823002: [animation-worklet] Implement registerAnimator in worklet scope (Closed)
Patch Set: remove empty array Created 3 years, 9 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/Animator.h
diff --git a/third_party/WebKit/Source/modules/compositorworker/Animator.h b/third_party/WebKit/Source/modules/compositorworker/Animator.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5e12890132df232cf96daa917a8a1c61be84094
--- /dev/null
+++ b/third_party/WebKit/Source/modules/compositorworker/Animator.h
@@ -0,0 +1,41 @@
+// 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 Animator_h
+#define Animator_h
+
+#include "bindings/core/v8/ScopedPersistent.h"
+#include "platform/heap/Handle.h"
+#include "v8/include/v8.h"
+
+namespace blink {
+
+class ScriptState;
+class AnimatorDefinition;
+
+class Animator final : public GarbageCollectedFinalized<Animator> {
+ public:
+ static Animator* create(ScriptState*,
+ AnimatorDefinition*,
+ v8::Local<v8::Object> instance);
+ ~Animator();
+ DECLARE_TRACE();
+
+ void animate() const;
+
+ private:
+ Animator(ScriptState*, AnimatorDefinition*, v8::Local<v8::Object> instance);
+
+ RefPtr<ScriptState> m_scriptState;
+
+ // This object keeps the definition object, and animator instance alive.
+ // It needs to be destroyed to break a reference cycle between it and the
+ // AnimationWorkletGlobalScope.
+ Member<AnimatorDefinition> m_definition;
+ ScopedPersistent<v8::Object> m_instance;
+};
+
+} // namespace blink
+
+#endif // Animator_h

Powered by Google App Engine
This is Rietveld 408576698