Commit 15f5977a authored by haraken@chromium.org's avatar haraken@chromium.org

Oilpan: Move CSSAnimations and CSSAnimationUpdate to oilpan's heap

BUG=341032

Review URL: https://codereview.chromium.org/211113002

git-svn-id: svn://svn.chromium.org/blink/trunk@169949 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8059218f
......@@ -320,9 +320,9 @@ const StyleRuleKeyframes* CSSAnimations::matchScopedKeyframesRule(StyleResolver*
return 0;
}
PassOwnPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(Element* element, const Element& parentElement, const RenderStyle& style, RenderStyle* parentStyle, StyleResolver* resolver)
PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(Element* element, const Element& parentElement, const RenderStyle& style, RenderStyle* parentStyle, StyleResolver* resolver)
{
OwnPtr<CSSAnimationUpdate> update = adoptPtr(new CSSAnimationUpdate());
OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAnimationUpdate());
calculateAnimationUpdate(update.get(), element, parentElement, style, parentStyle, resolver);
calculateAnimationActiveInterpolations(update.get(), element);
calculateTransitionUpdate(update.get(), element, style);
......@@ -412,7 +412,7 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
return;
}
OwnPtr<CSSAnimationUpdate> update = m_pendingUpdate.release();
OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = m_pendingUpdate.release();
m_previousActiveInterpolationsForAnimations.swap(update->activeInterpolationsForAnimations());
......@@ -896,4 +896,18 @@ const StylePropertyShorthand& CSSAnimations::animatableProperties()
return propertyShorthand;
}
void CSSAnimations::trace(Visitor* visitor)
{
visitor->trace(m_transitions);
visitor->trace(m_pendingUpdate);
visitor->trace(m_previousActiveInterpolationsForAnimations);
}
void CSSAnimationUpdate::trace(Visitor* visitor)
{
visitor->trace(m_newTransitions);
visitor->trace(m_activeInterpolationsForAnimations);
visitor->trace(m_activeInterpolationsForTransitions);
}
} // namespace WebCore
......@@ -52,7 +52,7 @@ class StyleRuleKeyframes;
// 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 {
class CSSAnimationUpdate FINAL : public NoBaseWillBeGarbageCollectedFinalized<CSSAnimationUpdate> {
public:
void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertAnimation> >& animations)
{
......@@ -109,7 +109,7 @@ public:
RawPtrWillBeMember<const AnimatableValue> to;
RefPtr<InertAnimation> animation;
};
typedef WillBePersistentHeapHashMap<CSSPropertyID, NewTransition> NewTransitionMap;
typedef WillBeHeapHashMap<CSSPropertyID, NewTransition> NewTransitionMap;
const NewTransitionMap& newTransitions() const { return m_newTransitions; }
const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancelledTransitions; }
......@@ -130,6 +130,9 @@ public:
&& m_activeInterpolationsForAnimations.isEmpty()
&& m_activeInterpolationsForTransitions.isEmpty();
}
void trace(Visitor*);
private:
// Order is significant since it defines the order in which new animations
// will be started. Note that there may be multiple animations present
......@@ -143,11 +146,11 @@ private:
NewTransitionMap m_newTransitions;
HashSet<CSSPropertyID> m_cancelledTransitions;
WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForAnimations;
WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForTransitions;
WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForAnimations;
WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForTransitions;
};
class CSSAnimations FINAL {
class CSSAnimations FINAL : public NoBaseWillBeGarbageCollectedFinalized<CSSAnimations> {
public:
// FIXME: This method is only used here and in the legacy animations
// implementation. It should be made private or file-scope when the legacy
......@@ -158,13 +161,15 @@ public:
static const StylePropertyShorthand& animatableProperties();
// FIXME: This should take a const ScopedStyleTree instead of a StyleResolver.
// We should also change the Element* to a const Element*
static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const Element& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*);
static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(Element*, const Element& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*);
void setPendingUpdate(PassOwnPtr<CSSAnimationUpdate> update) { m_pendingUpdate = update; }
void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m_pendingUpdate = update; }
void maybeApplyPendingUpdate(Element*);
bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpty() && !m_pendingUpdate; }
void cancel();
void trace(Visitor*);
private:
// Note that a single animation name may map to multiple players due to
// the way in which we split up animations with incomplete keyframes.
......@@ -184,12 +189,12 @@ private:
RawPtrWillBeMember<const AnimatableValue> from;
RawPtrWillBeMember<const AnimatableValue> to;
};
typedef WillBePersistentHeapHashMap<CSSPropertyID, RunningTransition> TransitionMap;
typedef WillBeHeapHashMap<CSSPropertyID, RunningTransition> TransitionMap;
AnimationMap m_animations;
TransitionMap m_transitions;
OwnPtr<CSSAnimationUpdate> m_pendingUpdate;
OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate;
WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_previousActiveInterpolationsForAnimations;
WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_previousActiveInterpolationsForAnimations;
static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const Element& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*);
static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, const RenderStyle&);
......
......@@ -56,12 +56,12 @@ StyleResolverState::~StyleResolverState()
{
}
void StyleResolverState::setAnimationUpdate(PassOwnPtr<CSSAnimationUpdate> update)
void StyleResolverState::setAnimationUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update)
{
m_animationUpdate = update;
}
PassOwnPtr<CSSAnimationUpdate> StyleResolverState::takeAnimationUpdate()
PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> StyleResolverState::takeAnimationUpdate()
{
return m_animationUpdate.release();
}
......
......@@ -67,9 +67,9 @@ public:
const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
void setAnimationUpdate(PassOwnPtr<CSSAnimationUpdate>);
void setAnimationUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate>);
const CSSAnimationUpdate* animationUpdate() { return m_animationUpdate.get(); }
PassOwnPtr<CSSAnimationUpdate> takeAnimationUpdate();
PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> takeAnimationUpdate();
void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = parentStyle; }
const RenderStyle* parentStyle() const { return m_parentStyle.get(); }
......@@ -153,7 +153,7 @@ private:
// so we keep it separate from m_elementContext.
RefPtr<RenderStyle> m_parentStyle;
OwnPtr<CSSAnimationUpdate> m_animationUpdate;
OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
bool m_applyPropertyToRegularStyle;
bool m_applyPropertyToVisitedLinkStyle;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment