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

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.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 unified diff | Download patch
OLDNEW
(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.
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();
33
34 // Invoke the the Javascript 'animate' callback one the given instance.
flackr 2017/03/13 19:04:52 nit: s/one/on
majidvp 2017/03/13 22:07:54 removed.
35 // TODO(majidvp): should take a list of proxies
36 void animate(v8::Local<v8::Object> animatorInstance);
37
38 private:
39 AnimatorDefinition(ScriptState*,
40 v8::Local<v8::Function> constructor,
41 v8::Local<v8::Function> animate);
42
43 RefPtr<ScriptState> m_scriptState;
44
45 // This object keeps the constructor function, and animate function alive.
flackr 2017/03/13 19:04:52 Isn't the animate function kept alive through the
majidvp 2017/03/13 22:07:53 Mainly so it does not change. We can choose to loo
flackr 2017/03/14 18:30:29 Let's call out in the comment that we keep the ori
46 // It needs to be destroyed to break a reference cycle between it and the
47 // AnimationWorkletGlobalScope.
48 ScopedPersistent<v8::Function> m_constructor;
49 ScopedPersistent<v8::Function> m_animate;
50 };
51
52 } // namespace blink
53
54 #endif // AnimatorDefinition_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698