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

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') | no next file with comments »
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 6b70e3b9be2c4a74e6298b97f2818c7fe69d59a0..c3a6be8e2b643cdefcd60d826aa07bead5053e39 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 {
+ DISALLOW_ALLOCATION();
public:
class NewAnimation {
ALLOW_ONLY_INLINE_ALLOCATION();
@@ -130,6 +131,53 @@ public:
CompositableStyleSnapshot snapshot;
};
+ CSSAnimationUpdate()
+ : m_isEmpty(true)
+ {
+ }
+
+ ~CSSAnimationUpdate()
+ {
+#if ENABLE(OILPAN)
+ // For performance reasons, explicitly clear HeapVectors and
+ // HeapHashMaps to avoid giving a pressure on Oilpan's GC.
+ clear();
+#endif
+ }
+
+ void setPendingUpdate(const CSSAnimationUpdate& update)
alancutter (OOO until 2018) 2015/08/19 07:26:43 s/setPendingUpdate/copy/ ?
haraken 2015/08/19 12:08:11 Done.
+ {
+ 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();
+ }
+
+ 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;
+ }
+
+ bool isEmpty() const { return m_isEmpty; }
alancutter (OOO until 2018) 2015/08/19 07:26:43 This function should remain as it was otherwise th
haraken 2015/08/19 12:08:11 Done.
+
void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertEffect> effect, const Timing& timing, PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule)
{
effect->setName(animationName);
@@ -215,23 +263,6 @@ public:
const ActiveInterpolationMap& activeInterpolationsForTransitions() const { return m_activeInterpolationsForTransitions; }
ActiveInterpolationMap& activeInterpolationsForAnimations() { return m_activeInterpolationsForAnimations; }
- bool isEmpty() const
- {
- return m_newAnimations.isEmpty()
- && m_cancelledAnimationNames.isEmpty()
- && m_suppressedAnimations.isEmpty()
- && m_animationsWithPauseToggled.isEmpty()
- && m_animationsWithUpdates.isEmpty()
- && m_animationsWithStyleUpdates.isEmpty()
- && m_newTransitions.isEmpty()
- && m_cancelledTransitions.isEmpty()
- && m_finishedTransitions.isEmpty()
- && m_activeInterpolationsForAnimations.isEmpty()
- && 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 +281,10 @@ private:
ActiveInterpolationMap m_activeInterpolationsForAnimations;
ActiveInterpolationMap m_activeInterpolationsForTransitions;
+
+ bool m_isEmpty;
+
+ friend class PendingAnimationUpdate;
alancutter (OOO until 2018) 2015/08/19 07:26:43 No need for friend class.
haraken 2015/08/19 12:08:11 Done.
};
} // namespace blink
« no previous file with comments | « no previous file | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698