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 WorkletAnimation_h | |
| 6 #define WorkletAnimation_h | |
| 7 | |
| 8 #include "bindings/core/v8/serialization/SerializedScriptValue.h" | |
| 9 #include "bindings/modules/v8/document_timeline_or_scroll_timeline.h" | |
| 10 #include "core/animation/Animation.h" | |
| 11 #include "core/animation/KeyframeEffectReadOnly.h" | |
| 12 #include "core/animation/WorkletAnimationBase.h" | |
| 13 #include "modules/ModulesExport.h" | |
| 14 #include "platform/animation/CompositorAnimationDelegate.h" | |
| 15 #include "platform/animation/CompositorAnimationPlayer.h" | |
| 16 #include "platform/animation/CompositorAnimationPlayerClient.h" | |
| 17 #include "platform/bindings/ScriptWrappable.h" | |
| 18 | |
| 19 namespace blink { | |
| 20 | |
| 21 class MODULES_EXPORT WorkletAnimation : public WorkletAnimationBase, | |
|
nhiroki
2017/09/08 03:58:22
Can you add class-level comments? Which thread doe
smcgruer
2017/09/11 18:19:00
Added some comments + DCHECKS, let me know if they
| |
| 22 public ScriptWrappable, | |
| 23 public CompositorAnimationPlayerClient, | |
| 24 public CompositorAnimationDelegate { | |
| 25 DEFINE_WRAPPERTYPEINFO(); | |
| 26 USING_PRE_FINALIZER(WorkletAnimation, Dispose); | |
|
haraken
2017/09/08 01:11:23
Would you help me understand why you need to call
smcgruer
2017/09/11 18:19:00
My understanding is that you cannot access any hea
| |
| 27 | |
| 28 public: | |
| 29 static WorkletAnimation* Create( | |
| 30 String animator_name, | |
| 31 const HeapVector<Member<KeyframeEffectReadOnly>>&, | |
| 32 HeapVector<DocumentTimelineOrScrollTimeline>&, | |
| 33 RefPtr<SerializedScriptValue>, | |
| 34 ExceptionState&); | |
| 35 | |
| 36 virtual ~WorkletAnimation() {} | |
| 37 | |
| 38 String playState(); | |
| 39 void play(); | |
| 40 void cancel(); | |
| 41 | |
| 42 // WorkletAnimationBase implementation. | |
| 43 bool StartOnCompositor() override; | |
| 44 | |
| 45 // CompositorAnimationPlayerClient implementation. | |
| 46 CompositorAnimationPlayer* CompositorPlayer() const override { | |
| 47 return compositor_player_.get(); | |
| 48 } | |
| 49 | |
| 50 // CompositorAnimationDelegate implementation. | |
| 51 void NotifyAnimationStarted(double monotonic_time, int group) override {} | |
| 52 void NotifyAnimationFinished(double monotonic_time, int group) override {} | |
| 53 void NotifyAnimationAborted(double monotonic_time, int group) override {} | |
| 54 | |
| 55 void Dispose(); | |
| 56 | |
| 57 String Name() { return animator_name_; } | |
| 58 | |
| 59 const HeapVector<DocumentTimelineOrScrollTimeline>& Timelines() { | |
| 60 return timelines_; | |
| 61 } | |
| 62 | |
| 63 const RefPtr<SerializedScriptValue> Options() { return options_; } | |
| 64 | |
| 65 DECLARE_VIRTUAL_TRACE(); | |
| 66 | |
| 67 private: | |
| 68 WorkletAnimation(String animator_name, | |
| 69 Document&, | |
| 70 const HeapVector<Member<KeyframeEffectReadOnly>>&, | |
| 71 HeapVector<DocumentTimelineOrScrollTimeline>&, | |
| 72 RefPtr<SerializedScriptValue>); | |
| 73 | |
| 74 String animator_name_; | |
|
nhiroki
2017/09/08 03:58:22
const?
smcgruer
2017/09/11 18:19:00
Done.
| |
| 75 Animation::AnimationPlayState play_state_; | |
| 76 | |
| 77 Member<Document> document_; | |
| 78 | |
| 79 HeapVector<Member<KeyframeEffectReadOnly>> effects_; | |
| 80 HeapVector<DocumentTimelineOrScrollTimeline> timelines_; | |
| 81 RefPtr<SerializedScriptValue> options_; | |
| 82 | |
| 83 std::unique_ptr<CompositorAnimationPlayer> compositor_player_; | |
| 84 }; | |
| 85 | |
| 86 } // namespace blink | |
| 87 | |
| 88 #endif | |
| OLD | NEW |