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/DocumentTimelineOrScrollTimeline.h" | |
| 10 #include "core/animation/KeyframeEffectReadOnly.h" | |
| 11 #include "core/animation/WorkletAnimationBase.h" | |
| 12 #include "modules/ModulesExport.h" | |
| 13 #include "platform/animation/CompositorAnimationDelegate.h" | |
| 14 #include "platform/animation/CompositorAnimationPlayer.h" | |
| 15 #include "platform/animation/CompositorAnimationPlayerClient.h" | |
| 16 #include "platform/bindings/ScriptWrappable.h" | |
| 17 | |
| 18 namespace blink { | |
| 19 | |
| 20 class MODULES_EXPORT WorkletAnimation : public WorkletAnimationBase, | |
| 21 public ScriptWrappable, | |
| 22 public CompositorAnimationPlayerClient, | |
| 23 public CompositorAnimationDelegate { | |
| 24 DEFINE_WRAPPERTYPEINFO(); | |
| 25 | |
| 26 public: | |
| 27 enum AnimationPlayState { | |
| 28 kIdle, | |
| 29 kPending, | |
| 30 kRunning, | |
| 31 }; | |
| 32 | |
| 33 static WorkletAnimation* Create( | |
| 34 String animator_name, | |
| 35 const HeapVector<Member<KeyframeEffectReadOnly>>&, | |
| 36 HeapVector<DocumentTimelineOrScrollTimeline>&, | |
| 37 RefPtr<SerializedScriptValue>, | |
| 38 ExceptionState&); | |
| 39 | |
| 40 virtual ~WorkletAnimation() {} | |
| 41 | |
| 42 String playState(); | |
| 43 void play(); | |
| 44 void cancel(); | |
| 45 | |
| 46 // WorkletAnimationBase implementation. | |
| 47 bool StartOnCompositor() override; | |
| 48 | |
| 49 // CompositorAnimationPlayerClient implementation. | |
| 50 CompositorAnimationPlayer* CompositorPlayer() const override { | |
| 51 return compositor_player_.get(); | |
| 52 } | |
| 53 | |
| 54 // CompositorAnimationDelegate implementation. | |
| 55 void NotifyAnimationStarted(double monotonic_time, int group) override {} | |
| 56 void NotifyAnimationFinished(double monotonic_time, int group) override {} | |
| 57 void NotifyAnimationAborted(double monotonic_time, int group) override {} | |
| 58 | |
| 59 void Dispose(); | |
|
flackr
2017/07/25 20:39:12
I think you need to declare USING_PRE_FINALIZER(Di
smcgruer
2017/08/01 14:35:50
Done.
| |
| 60 | |
| 61 String Name() { return animator_name_; } | |
| 62 | |
| 63 const HeapVector<DocumentTimelineOrScrollTimeline>& Timelines() { | |
| 64 return timelines_; | |
| 65 } | |
| 66 | |
| 67 const RefPtr<SerializedScriptValue> Options() { return options_; } | |
| 68 | |
| 69 DECLARE_VIRTUAL_TRACE(); | |
| 70 | |
| 71 private: | |
| 72 WorkletAnimation(String animator_name, | |
| 73 Document&, | |
| 74 const HeapVector<Member<KeyframeEffectReadOnly>>&, | |
| 75 HeapVector<DocumentTimelineOrScrollTimeline>&, | |
| 76 RefPtr<SerializedScriptValue>); | |
| 77 | |
| 78 String animator_name_; | |
| 79 AnimationPlayState play_state_; | |
| 80 | |
| 81 Member<Document> document_; | |
| 82 | |
| 83 HeapVector<Member<KeyframeEffectReadOnly>> effects_; | |
| 84 HeapVector<DocumentTimelineOrScrollTimeline> timelines_; | |
| 85 RefPtr<SerializedScriptValue> options_; | |
| 86 | |
| 87 std::unique_ptr<CompositorAnimationPlayer> compositor_player_; | |
| 88 }; | |
| 89 | |
| 90 } // namespace blink | |
| 91 | |
| 92 #endif | |
| OLD | NEW |