Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: Source/core/animation/css/CSSAnimationUpdate.h

Issue 1281493004: Make CSSAnimationUpdate stack-allocated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/animation/css/CSSAnimations.h » ('j') | Source/core/animation/css/CSSAnimations.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/css/CSSAnimationUpdate.h
diff --git a/Source/core/animation/css/CSSAnimationUpdate.h b/Source/core/animation/css/CSSAnimationUpdate.h
index 034f41922412a68ca1b4b2e7695263f94435bdec..21a3e674ade2eda601ded4c3c16cbdc5c42d316d 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"
@@ -20,16 +21,13 @@
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> {
- WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSAnimationUpdate);
+class CSSAnimationUpdate final {
+ DISALLOW_ALLOCATION();
WTF_MAKE_NONCOPYABLE(CSSAnimationUpdate);
public:
- CSSAnimationUpdate() { }
-
class NewAnimation {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
@@ -135,6 +133,57 @@ public:
CompositableStyleSnapshot snapshot;
};
+ CSSAnimationUpdate()
+#if ENABLE(ASSERT)
+ : m_isCleared(true)
+#endif
+ {
+ }
+
+ ~CSSAnimationUpdate()
+ {
+#if ENABLE(OILPAN)
+ // For performance reasons, explicitly clear HeapVectors and
+ // HeapHashMaps to avoid giving a pressure on Oilpan's GC.
+ clear();
+#endif
+ }
+
+ void copy(const CSSAnimationUpdate& update)
+ {
+#if ENABLE(ASSERT)
+ ASSERT(m_isCleared);
+ m_isCleared = false;
+#endif
alancutter (OOO until 2018) 2015/08/20 02:06:58 I'm not sure it's worthwhile adding 4 ifdefs for a
haraken 2015/08/20 03:01:25 Done.
+ 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();
+ }
+
+ 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();
+#if ENABLE(ASSERT)
+ m_isCleared = true;
+#endif
+ }
+
void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertEffect> effect, const Timing& timing, PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule)
{
effect->setName(animationName);
@@ -235,7 +284,18 @@ public:
&& m_activeInterpolationsForTransitions.isEmpty();
}
- DECLARE_TRACE();
+ DEFINE_INLINE_TRACE()
+ {
+#if ENABLE(OILPAN)
+ visitor->trace(m_newTransitions);
+ visitor->trace(m_activeInterpolationsForAnimations);
+ visitor->trace(m_activeInterpolationsForTransitions);
+ visitor->trace(m_newAnimations);
+ visitor->trace(m_suppressedAnimations);
+ visitor->trace(m_animationsWithUpdates);
+ visitor->trace(m_animationsWithStyleUpdates);
+#endif
+ }
private:
// Order is significant since it defines the order in which new animations
@@ -255,6 +315,10 @@ private:
ActiveInterpolationMap m_activeInterpolationsForAnimations;
ActiveInterpolationMap m_activeInterpolationsForTransitions;
+
+#if ENABLE(ASSERT)
+ bool m_isCleared;
+#endif
};
} // namespace blink
« no previous file with comments | « no previous file | Source/core/animation/css/CSSAnimations.h » ('j') | Source/core/animation/css/CSSAnimations.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698