Chromium Code Reviews| Index: third_party/WebKit/Source/modules/compositorworker/WorkletAnimation.h |
| diff --git a/third_party/WebKit/Source/modules/compositorworker/WorkletAnimation.h b/third_party/WebKit/Source/modules/compositorworker/WorkletAnimation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..98343883dc5d0eb3b3657065ad297fc535e5bf7b |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/compositorworker/WorkletAnimation.h |
| @@ -0,0 +1,88 @@ |
| +// 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 WorkletAnimation_h |
| +#define WorkletAnimation_h |
| + |
| +#include "bindings/core/v8/serialization/SerializedScriptValue.h" |
| +#include "bindings/modules/v8/document_timeline_or_scroll_timeline.h" |
| +#include "core/animation/Animation.h" |
| +#include "core/animation/KeyframeEffectReadOnly.h" |
| +#include "core/animation/WorkletAnimationBase.h" |
| +#include "modules/ModulesExport.h" |
| +#include "platform/animation/CompositorAnimationDelegate.h" |
| +#include "platform/animation/CompositorAnimationPlayer.h" |
| +#include "platform/animation/CompositorAnimationPlayerClient.h" |
| +#include "platform/bindings/ScriptWrappable.h" |
| + |
| +namespace blink { |
| + |
| +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
|
| + public ScriptWrappable, |
| + public CompositorAnimationPlayerClient, |
| + public CompositorAnimationDelegate { |
| + DEFINE_WRAPPERTYPEINFO(); |
| + 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
|
| + |
| + public: |
| + static WorkletAnimation* Create( |
| + String animator_name, |
| + const HeapVector<Member<KeyframeEffectReadOnly>>&, |
| + HeapVector<DocumentTimelineOrScrollTimeline>&, |
| + RefPtr<SerializedScriptValue>, |
| + ExceptionState&); |
| + |
| + virtual ~WorkletAnimation() {} |
| + |
| + String playState(); |
| + void play(); |
| + void cancel(); |
| + |
| + // WorkletAnimationBase implementation. |
| + bool StartOnCompositor() override; |
| + |
| + // CompositorAnimationPlayerClient implementation. |
| + CompositorAnimationPlayer* CompositorPlayer() const override { |
| + return compositor_player_.get(); |
| + } |
| + |
| + // CompositorAnimationDelegate implementation. |
| + void NotifyAnimationStarted(double monotonic_time, int group) override {} |
| + void NotifyAnimationFinished(double monotonic_time, int group) override {} |
| + void NotifyAnimationAborted(double monotonic_time, int group) override {} |
| + |
| + void Dispose(); |
| + |
| + String Name() { return animator_name_; } |
| + |
| + const HeapVector<DocumentTimelineOrScrollTimeline>& Timelines() { |
| + return timelines_; |
| + } |
| + |
| + const RefPtr<SerializedScriptValue> Options() { return options_; } |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| + private: |
| + WorkletAnimation(String animator_name, |
| + Document&, |
| + const HeapVector<Member<KeyframeEffectReadOnly>>&, |
| + HeapVector<DocumentTimelineOrScrollTimeline>&, |
| + RefPtr<SerializedScriptValue>); |
| + |
| + String animator_name_; |
|
nhiroki
2017/09/08 03:58:22
const?
smcgruer
2017/09/11 18:19:00
Done.
|
| + Animation::AnimationPlayState play_state_; |
| + |
| + Member<Document> document_; |
| + |
| + HeapVector<Member<KeyframeEffectReadOnly>> effects_; |
| + HeapVector<DocumentTimelineOrScrollTimeline> timelines_; |
| + RefPtr<SerializedScriptValue> options_; |
| + |
| + std::unique_ptr<CompositorAnimationPlayer> compositor_player_; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif |