Chromium Code Reviews| Index: Source/core/animation/css/CSSAnimationUpdate.h |
| diff --git a/Source/core/animation/css/CSSAnimationUpdate.h b/Source/core/animation/css/CSSAnimationUpdate.h |
| index 6b70e3b9be2c4a74e6298b97f2818c7fe69d59a0..6328bd580362512814e3f89e1268fd728a6765ca 100644 |
| --- a/Source/core/animation/css/CSSAnimationUpdate.h |
| +++ b/Source/core/animation/css/CSSAnimationUpdate.h |
| @@ -6,6 +6,7 @@ |
| #define CSSAnimationUpdate_h |
| #include "core/animation/AnimationStack.h" |
| +#include "core/animation/InertEffect.h" |
| #include "core/animation/Interpolation.h" |
| #include "core/animation/KeyframeEffectModel.h" |
| #include "core/animation/css/CSSAnimatableValueFactory.h" |
| @@ -19,11 +20,11 @@ |
| namespace blink { |
| class Animation; |
| -class InertEffect; |
| // This class stores the CSS Animations/Transitions information we use during a style recalc. |
| // This includes updates to animations/transitions as well as the Interpolations to be applied. |
| -class CSSAnimationUpdate final : public NoBaseWillBeGarbageCollectedFinalized<CSSAnimationUpdate> { |
| +class CSSAnimationUpdate final { |
| + STACK_ALLOCATED(); |
| public: |
| class NewAnimation { |
| ALLOW_ONLY_INLINE_ALLOCATION(); |
| @@ -130,6 +131,21 @@ public: |
| CompositableStyleSnapshot snapshot; |
| }; |
| + ~CSSAnimationUpdate() |
| + { |
| +#if ENABLE(OILPAN) |
| + // For performance reasons, explicitly clear HeapVectors and |
| + // HeapHashMaps to avoid giving a pressure on Oilpan's GC. |
| + m_newAnimations.clear(); |
| + m_suppressedAnimations.clear(); |
| + m_animationsWithUpdates.clear(); |
| + m_animationsWithStyleUpdates.clear(); |
| + m_newTransitions.clear(); |
| + m_activeInterpolationsForAnimations.clear(); |
| + m_activeInterpolationsForTransitions.clear(); |
| +#endif |
| + } |
| + |
| void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertEffect> effect, const Timing& timing, PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule) |
| { |
| effect->setName(animationName); |
| @@ -230,8 +246,6 @@ public: |
| && m_activeInterpolationsForTransitions.isEmpty(); |
| } |
| - DECLARE_TRACE(); |
| - |
| private: |
| // Order is significant since it defines the order in which new animations |
| // will be started. Note that there may be multiple animations present |
| @@ -250,6 +264,88 @@ private: |
| ActiveInterpolationMap m_activeInterpolationsForAnimations; |
| ActiveInterpolationMap m_activeInterpolationsForTransitions; |
| + |
| + friend class PendingAnimationUpdate; |
| +}; |
| + |
| +class PendingAnimationUpdate final { |
| + DISALLOW_ALLOCATION(); |
|
alancutter (OOO until 2018)
2015/08/19 02:46:30
Can we make CSSAnimationUpdate DISALLOW_ALLOCATION
haraken
2015/08/19 05:46:08
That is a great suggestion :) Done.
|
| + WTF_MAKE_NONCOPYABLE(PendingAnimationUpdate); |
| +public: |
| + PendingAnimationUpdate() |
| + : m_isEmpty(true) |
| + { |
| + } |
| + |
| + void setPendingUpdate(const CSSAnimationUpdate& update) |
| + { |
| + ASSERT(m_isEmpty); |
| + m_isEmpty = false; |
| + m_newAnimations = update.newAnimations(); |
| + m_animationsWithUpdates = update.animationsWithUpdates(); |
| + m_animationsWithStyleUpdates = update.animationsWithStyleUpdates(); |
| + m_newTransitions = update.newTransitions(); |
| + m_activeInterpolationsForAnimations = update.activeInterpolationsForAnimations(); |
| + m_activeInterpolationsForTransitions = update.activeInterpolationsForTransitions(); |
| + m_cancelledAnimationNames = update.cancelledAnimationNames(); |
| + m_animationsWithPauseToggled = update.animationsWithPauseToggled(); |
| + m_cancelledTransitions = update.cancelledTransitions(); |
| + m_finishedTransitions = update.finishedTransitions(); |
| + } |
| + |
| + bool isEmpty() const { return m_isEmpty; } |
| + const WillBeHeapVector<CSSAnimationUpdate::NewAnimation>& newAnimations() const { return m_newAnimations; } |
| + const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; } |
| + const Vector<AtomicString>& animationsWithPauseToggled() const { return m_animationsWithPauseToggled; } |
| + const WillBeHeapVector<CSSAnimationUpdate::UpdatedAnimation>& animationsWithUpdates() const { return m_animationsWithUpdates; } |
| + const WillBeHeapVector<CSSAnimationUpdate::UpdatedAnimationStyle>& animationsWithStyleUpdates() const { return m_animationsWithStyleUpdates; } |
| + const CSSAnimationUpdate::NewTransitionMap& newTransitions() const { return m_newTransitions; } |
| + const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancelledTransitions; } |
| + const HashSet<CSSPropertyID>& finishedTransitions() const { return m_finishedTransitions; } |
| + |
| + const ActiveInterpolationMap& activeInterpolationsForAnimations() const { return m_activeInterpolationsForAnimations; } |
| + const ActiveInterpolationMap& activeInterpolationsForTransitions() const { return m_activeInterpolationsForTransitions; } |
| + ActiveInterpolationMap& activeInterpolationsForAnimations() { return m_activeInterpolationsForAnimations; } |
| + |
| + DEFINE_INLINE_TRACE() |
| + { |
| +#if ENABLE(OILPAN) |
|
alancutter (OOO until 2018)
2015/08/19 02:46:30
Is it necessary to #if here?
haraken
2015/08/19 05:46:08
Unfortunately yes. The current oilpan cannot handl
|
| + visitor->trace(m_newAnimations); |
| + visitor->trace(m_animationsWithUpdates); |
| + visitor->trace(m_animationsWithStyleUpdates); |
| + visitor->trace(m_newTransitions); |
| + visitor->trace(m_activeInterpolationsForAnimations); |
| + visitor->trace(m_activeInterpolationsForTransitions); |
| +#endif |
| + } |
| + |
| + void clear() |
| + { |
| + m_newAnimations.clear(); |
| + m_animationsWithUpdates.clear(); |
| + m_animationsWithStyleUpdates.clear(); |
| + m_newTransitions.clear(); |
| + m_activeInterpolationsForAnimations.clear(); |
| + m_activeInterpolationsForTransitions.clear(); |
| + m_cancelledAnimationNames.clear(); |
| + m_animationsWithPauseToggled.clear(); |
| + m_cancelledTransitions.clear(); |
| + m_finishedTransitions.clear(); |
| + m_isEmpty = true; |
| + } |
| + |
| +private: |
| + WillBeHeapVector<CSSAnimationUpdate::NewAnimation> m_newAnimations; |
| + WillBeHeapVector<CSSAnimationUpdate::UpdatedAnimation> m_animationsWithUpdates; |
| + WillBeHeapVector<CSSAnimationUpdate::UpdatedAnimationStyle> m_animationsWithStyleUpdates; |
| + CSSAnimationUpdate::NewTransitionMap m_newTransitions; |
| + ActiveInterpolationMap m_activeInterpolationsForAnimations; |
| + ActiveInterpolationMap m_activeInterpolationsForTransitions; |
| + Vector<AtomicString> m_cancelledAnimationNames; |
| + Vector<AtomicString> m_animationsWithPauseToggled; |
| + HashSet<CSSPropertyID> m_cancelledTransitions; |
| + HashSet<CSSPropertyID> m_finishedTransitions; |
| + bool m_isEmpty; |
| }; |
| } // namespace blink |