| 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 17 matching lines...) Expand all Loading... |
| 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 "core/dom/TaskRunnerHelper.h" |
| 37 #include "platform/Timer.h" | 37 #include "platform/Timer.h" |
| 38 #include "platform/graphics/CompositorElementId.h" |
| 38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 40 #include "wtf/Optional.h" |
| 39 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 40 | 42 |
| 41 namespace blink { | 43 namespace blink { |
| 42 | 44 |
| 43 // Manages the starting of pending animations on the compositor following a | 45 // Manages the starting of pending animations on the compositor following a |
| 44 // compositing update. | 46 // compositing update. |
| 45 // For CSS Animations, used to synchronize the start of main-thread animations | 47 // For CSS Animations, used to synchronize the start of main-thread animations |
| 46 // with compositor animations when both classes of CSS Animations are triggered | 48 // with compositor animations when both classes of CSS Animations are triggered |
| 47 // by the same recalc | 49 // by the same recalc |
| 48 class CORE_EXPORT CompositorPendingAnimations final | 50 class CORE_EXPORT CompositorPendingAnimations final |
| 49 : public GarbageCollectedFinalized<CompositorPendingAnimations> { | 51 : public GarbageCollectedFinalized<CompositorPendingAnimations> { |
| 50 public: | 52 public: |
| 51 explicit CompositorPendingAnimations(Document& document) | 53 explicit CompositorPendingAnimations(Document& document) |
| 52 : m_timer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &document), | 54 : m_timer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &document), |
| 53 this, | 55 this, |
| 54 &CompositorPendingAnimations::timerFired), | 56 &CompositorPendingAnimations::timerFired), |
| 55 m_compositorGroup(1) {} | 57 m_compositorGroup(1) {} |
| 56 | 58 |
| 57 void add(Animation*); | 59 void add(Animation*); |
| 58 // Returns whether we are waiting for an animation to start and should | 60 // Returns whether we are waiting for an animation to start and should |
| 59 // service again on the next frame. | 61 // service again on the next frame. |
| 60 bool update(bool startOnCompositor = true); | 62 bool update(const Optional<CompositorElementIdSet>&, |
| 63 bool startOnCompositor = true); |
| 61 void notifyCompositorAnimationStarted(double monotonicAnimationStartTime, | 64 void notifyCompositorAnimationStarted(double monotonicAnimationStartTime, |
| 62 int compositorGroup = 0); | 65 int compositorGroup = 0); |
| 63 | 66 |
| 64 DECLARE_TRACE(); | 67 DECLARE_TRACE(); |
| 65 | 68 |
| 66 private: | 69 private: |
| 67 void timerFired(TimerBase*) { update(false); } | 70 void timerFired(TimerBase*) { |
| 71 update(Optional<CompositorElementIdSet>(), false); |
| 72 } |
| 68 | 73 |
| 69 HeapVector<Member<Animation>> m_pending; | 74 HeapVector<Member<Animation>> m_pending; |
| 70 HeapVector<Member<Animation>> m_waitingForCompositorAnimationStart; | 75 HeapVector<Member<Animation>> m_waitingForCompositorAnimationStart; |
| 71 TaskRunnerTimer<CompositorPendingAnimations> m_timer; | 76 TaskRunnerTimer<CompositorPendingAnimations> m_timer; |
| 72 int m_compositorGroup; | 77 int m_compositorGroup; |
| 73 }; | 78 }; |
| 74 | 79 |
| 75 } // namespace blink | 80 } // namespace blink |
| 76 | 81 |
| 77 #endif | 82 #endif |
| OLD | NEW |