| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef CompositorPendingAnimations_h | 31 #ifndef CompositorPendingAnimations_h |
| 32 #define CompositorPendingAnimations_h | 32 #define CompositorPendingAnimations_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/animation/Animation.h" | 35 #include "core/animation/Animation.h" |
| 36 #include "core/dom/TaskRunnerHelper.h" |
| 36 #include "platform/Timer.h" | 37 #include "platform/Timer.h" |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 // Manages the starting of pending animations on the compositor following a | 43 // Manages the starting of pending animations on the compositor following a |
| 43 // compositing update. | 44 // compositing update. |
| 44 // For CSS Animations, used to synchronize the start of main-thread animations | 45 // For CSS Animations, used to synchronize the start of main-thread animations |
| 45 // with compositor animations when both classes of CSS Animations are triggered | 46 // with compositor animations when both classes of CSS Animations are triggered |
| 46 // by the same recalc | 47 // by the same recalc |
| 47 class CORE_EXPORT CompositorPendingAnimations final | 48 class CORE_EXPORT CompositorPendingAnimations final |
| 48 : public GarbageCollectedFinalized<CompositorPendingAnimations> { | 49 : public GarbageCollectedFinalized<CompositorPendingAnimations> { |
| 49 public: | 50 public: |
| 50 CompositorPendingAnimations() | 51 explicit CompositorPendingAnimations(Document& document) |
| 51 : m_timer(this, &CompositorPendingAnimations::timerFired), | 52 : m_timer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &document), |
| 53 this, |
| 54 &CompositorPendingAnimations::timerFired), |
| 52 m_compositorGroup(1) {} | 55 m_compositorGroup(1) {} |
| 53 | 56 |
| 54 void add(Animation*); | 57 void add(Animation*); |
| 55 // Returns whether we are waiting for an animation to start and should | 58 // Returns whether we are waiting for an animation to start and should |
| 56 // service again on the next frame. | 59 // service again on the next frame. |
| 57 bool update(bool startOnCompositor = true); | 60 bool update(bool startOnCompositor = true); |
| 58 void notifyCompositorAnimationStarted(double monotonicAnimationStartTime, | 61 void notifyCompositorAnimationStarted(double monotonicAnimationStartTime, |
| 59 int compositorGroup = 0); | 62 int compositorGroup = 0); |
| 60 | 63 |
| 61 DECLARE_TRACE(); | 64 DECLARE_TRACE(); |
| 62 | 65 |
| 63 private: | 66 private: |
| 64 void timerFired(TimerBase*) { update(false); } | 67 void timerFired(TimerBase*) { update(false); } |
| 65 | 68 |
| 66 HeapVector<Member<Animation>> m_pending; | 69 HeapVector<Member<Animation>> m_pending; |
| 67 HeapVector<Member<Animation>> m_waitingForCompositorAnimationStart; | 70 HeapVector<Member<Animation>> m_waitingForCompositorAnimationStart; |
| 68 Timer<CompositorPendingAnimations> m_timer; | 71 TaskRunnerTimer<CompositorPendingAnimations> m_timer; |
| 69 int m_compositorGroup; | 72 int m_compositorGroup; |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 } // namespace blink | 75 } // namespace blink |
| 73 | 76 |
| 74 #endif | 77 #endif |
| OLD | NEW |