| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PageAnimator_h | 5 #ifndef PageAnimator_h |
| 6 #define PageAnimator_h | 6 #define PageAnimator_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/animation/AnimationClock.h" | 9 #include "core/animation/AnimationClock.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class LocalFrame; | 14 class LocalFrame; |
| 15 class Page; | 15 class Page; |
| 16 | 16 |
| 17 class CORE_EXPORT PageAnimator final : public GarbageCollected<PageAnimator> { | 17 class CORE_EXPORT PageAnimator final : public GarbageCollected<PageAnimator> { |
| 18 public: | 18 public: |
| 19 static PageAnimator* create(Page&); | 19 static PageAnimator* create(Page&); |
| 20 DECLARE_TRACE(); | 20 DECLARE_TRACE(); |
| 21 void scheduleVisualUpdate(LocalFrame*); | 21 void scheduleVisualUpdate(LocalFrame*); |
| 22 void serviceScriptedAnimations(double monotonicAnimationStartTime); | 22 void serviceScriptedAnimations(double monotonicAnimationStartTime); |
| 23 | 23 |
| 24 bool isServicingAnimations() const { return m_servicingAnimations; } | 24 bool isServicingAnimations() const { return m_servicingAnimations; } |
| 25 | 25 |
| 26 // See documents of methods with the same names in FrameView class. | 26 // See documents of methods with the same names in FrameView class. |
| 27 void updateAllLifecyclePhases(LocalFrame& rootFrame); | 27 void updateAllLifecyclePhases(LocalFrame& rootFrame); |
| 28 AnimationClock& clock() { return m_animationClock; } | 28 AnimationClock& clock() { return m_animationClock; } |
| 29 | 29 |
| 30 // TODO(alancutter): Remove the need for this by moving frame request |
| 31 // supression logic up to BeginMainFrame, outside of Blink entirely. This is |
| 32 // exposed as a temporary workaround for a perf regression (crbug.com/704763), |
| 33 // do not use this class outside of PageAnimator.cpp. |
| 34 class FrameRequestSuppressionScope { |
| 35 public: |
| 36 STACK_ALLOCATED(); |
| 37 FrameRequestSuppressionScope(PageAnimator*); |
| 38 ~FrameRequestSuppressionScope(); |
| 39 |
| 40 private: |
| 41 Member<PageAnimator> m_pageAnimator; |
| 42 }; |
| 43 |
| 30 private: | 44 private: |
| 31 explicit PageAnimator(Page&); | 45 explicit PageAnimator(Page&); |
| 32 | 46 |
| 33 Member<Page> m_page; | 47 Member<Page> m_page; |
| 34 bool m_servicingAnimations; | 48 bool m_servicingAnimations = false; |
| 35 bool m_updatingLayoutAndStyleForPainting; | 49 size_t m_frameRequestSuppressionDepth = 0; |
| 36 AnimationClock m_animationClock; | 50 AnimationClock m_animationClock; |
| 51 |
| 52 friend class FrameRequestSuppressionScope; |
| 37 }; | 53 }; |
| 38 | 54 |
| 39 } // namespace blink | 55 } // namespace blink |
| 40 | 56 |
| 41 #endif // PageAnimator_h | 57 #endif // PageAnimator_h |
| OLD | NEW |