Commit b7854d8c authored by haraken@chromium.org's avatar haraken@chromium.org

Oilpan: Move Interpolation's hierarchy to oilpan's heap

This CL moves Interpolation's hierarchy and InterpolationRecord to oilpan's heap. I'll move other Interpolation objects in a follow-up CL.

BUG=341032
NOTRY=true

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169919 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f9601fc8
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
virtual bool isAnimation() const OVERRIDE { return true; } virtual bool isAnimation() const OVERRIDE { return true; }
const Vector<RefPtr<Interpolation> >& activeInterpolations() const const WillBeHeapVector<RefPtrWillBeMember<Interpolation> >& activeInterpolations() const
{ {
ASSERT(m_activeInterpolations); ASSERT(m_activeInterpolations);
return *m_activeInterpolations; return *m_activeInterpolations;
...@@ -108,7 +108,7 @@ private: ...@@ -108,7 +108,7 @@ private:
RefPtrWillBePersistent<AnimationEffect> m_effect; RefPtrWillBePersistent<AnimationEffect> m_effect;
bool m_activeInAnimationStack; bool m_activeInAnimationStack;
OwnPtr<Vector<RefPtr<Interpolation> > > m_activeInterpolations; OwnPtrWillBePersistent<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > m_activeInterpolations;
Priority m_priority; Priority m_priority;
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
}; };
virtual ~AnimationEffect() { } virtual ~AnimationEffect() { }
virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, double fraction, double iterationDuration) const = 0; virtual PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > sample(int iteration, double fraction, double iterationDuration) const = 0;
virtual bool affects(CSSPropertyID) { return false; }; virtual bool affects(CSSPropertyID) { return false; };
virtual bool isKeyframeEffectModel() const { return false; } virtual bool isKeyframeEffectModel() const { return false; }
......
...@@ -38,10 +38,10 @@ namespace WebCore { ...@@ -38,10 +38,10 @@ namespace WebCore {
namespace { namespace {
void copyToActiveInterpolationMap(const Vector<RefPtr<WebCore::Interpolation> >& source, HashMap<CSSPropertyID, RefPtr<WebCore::Interpolation> >& target) void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<WebCore::Interpolation> >& source, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<WebCore::Interpolation> >& target)
{ {
for (Vector<RefPtr<WebCore::Interpolation> >::const_iterator iter = source.begin(); iter != source.end(); ++iter) { for (WillBeHeapVector<RefPtrWillBeMember<WebCore::Interpolation> >::const_iterator iter = source.begin(); iter != source.end(); ++iter) {
RefPtr<WebCore::Interpolation> interpolation = *iter; RefPtrWillBeRawPtr<WebCore::Interpolation> interpolation = *iter;
WebCore::StyleInterpolation *styleInterpolation = toStyleInterpolation(interpolation.get()); WebCore::StyleInterpolation *styleInterpolation = toStyleInterpolation(interpolation.get());
target.set(styleInterpolation->id(), styleInterpolation); target.set(styleInterpolation->id(), styleInterpolation);
} }
...@@ -67,9 +67,9 @@ bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con ...@@ -67,9 +67,9 @@ bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
return false; return false;
} }
HashMap<CSSPropertyID, RefPtr<Interpolation> > AnimationStack::activeInterpolations(const AnimationStack* animationStack, const Vector<InertAnimation*>* newAnimations, const HashSet<const AnimationPlayer*>* cancelledAnimationPlayers, Animation::Priority priority) WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > AnimationStack::activeInterpolations(const AnimationStack* animationStack, const Vector<InertAnimation*>* newAnimations, const HashSet<const AnimationPlayer*>* cancelledAnimationPlayers, Animation::Priority priority)
{ {
HashMap<CSSPropertyID, RefPtr<Interpolation> > result; WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result;
if (animationStack) { if (animationStack) {
const Vector<Animation*>& animations = animationStack->m_activeAnimations; const Vector<Animation*>& animations = animationStack->m_activeAnimations;
...@@ -85,7 +85,7 @@ HashMap<CSSPropertyID, RefPtr<Interpolation> > AnimationStack::activeInterpolati ...@@ -85,7 +85,7 @@ HashMap<CSSPropertyID, RefPtr<Interpolation> > AnimationStack::activeInterpolati
if (newAnimations) { if (newAnimations) {
for (size_t i = 0; i < newAnimations->size(); ++i) { for (size_t i = 0; i < newAnimations->size(); ++i) {
OwnPtr<Vector<RefPtr<Interpolation> > > sample = newAnimations->at(i)->sample(); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > sample = newAnimations->at(i)->sample();
if (sample) { if (sample) {
copyToActiveInterpolationMap(*sample, result); copyToActiveInterpolationMap(*sample, result);
} }
......
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
bool isEmpty() const { return m_activeAnimations.isEmpty(); } bool isEmpty() const { return m_activeAnimations.isEmpty(); }
bool affects(CSSPropertyID) const; bool affects(CSSPropertyID) const;
bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; bool hasActiveAnimationsOnCompositor(CSSPropertyID) const;
static HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolations(const AnimationStack*, const Vector<InertAnimation*>* newAnimations, const HashSet<const AnimationPlayer*>* cancelledAnimationPlayers, Animation::Priority); static WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > activeInterpolations(const AnimationStack*, const Vector<InertAnimation*>* newAnimations, const HashSet<const AnimationPlayer*>* cancelledAnimationPlayers, Animation::Priority);
private: private:
Vector<Animation*> m_activeAnimations; Vector<Animation*> m_activeAnimations;
......
...@@ -46,7 +46,7 @@ InertAnimation::InertAnimation(PassRefPtrWillBeRawPtr<AnimationEffect> effect, c ...@@ -46,7 +46,7 @@ InertAnimation::InertAnimation(PassRefPtrWillBeRawPtr<AnimationEffect> effect, c
{ {
} }
PassOwnPtr<Vector<RefPtr<Interpolation> > > InertAnimation::sample() PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > InertAnimation::sample()
{ {
updateInheritedTime(0); updateInheritedTime(0);
if (!isInEffect()) if (!isInEffect())
......
...@@ -41,7 +41,7 @@ class InertAnimation FINAL : public TimedItem { ...@@ -41,7 +41,7 @@ class InertAnimation FINAL : public TimedItem {
public: public:
static PassRefPtr<InertAnimation> create(PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&, bool paused); static PassRefPtr<InertAnimation> create(PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&, bool paused);
PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(); PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > sample();
AnimationEffect* effect() const { return m_effect.get(); } AnimationEffect* effect() const { return m_effect.get(); }
bool paused() const { return m_paused; } bool paused() const { return m_paused; }
......
...@@ -20,21 +20,21 @@ protected: ...@@ -20,21 +20,21 @@ protected:
double interpolateNumbers(double a, double b, double progress) double interpolateNumbers(double a, double b, double progress)
{ {
RefPtr<Interpolation> i = Interpolation::create(InterpolableNumber::create(a), InterpolableNumber::create(b)); RefPtrWillBeRawPtr<Interpolation> i = Interpolation::create(InterpolableNumber::create(a), InterpolableNumber::create(b));
i->interpolate(0, progress); i->interpolate(0, progress);
return toInterpolableNumber(interpolationValue(*i.get()))->value(); return toInterpolableNumber(interpolationValue(*i.get()))->value();
} }
bool interpolateBools(bool a, bool b, double progress) bool interpolateBools(bool a, bool b, double progress)
{ {
RefPtr<Interpolation> i = Interpolation::create(InterpolableBool::create(a), InterpolableBool::create(b)); RefPtrWillBeRawPtr<Interpolation> i = Interpolation::create(InterpolableBool::create(a), InterpolableBool::create(b));
i->interpolate(0, progress); i->interpolate(0, progress);
return toInterpolableBool(interpolationValue(*i.get()))->value(); return toInterpolableBool(interpolationValue(*i.get()))->value();
} }
PassRefPtr<Interpolation> interpolateLists(PassOwnPtr<InterpolableList> listA, PassOwnPtr<InterpolableList> listB, double progress) PassRefPtrWillBeRawPtr<Interpolation> interpolateLists(PassOwnPtr<InterpolableList> listA, PassOwnPtr<InterpolableList> listB, double progress)
{ {
RefPtr<Interpolation> i = Interpolation::create(listA, listB); RefPtrWillBeRawPtr<Interpolation> i = Interpolation::create(listA, listB);
i->interpolate(0, progress); i->interpolate(0, progress);
return i; return i;
} }
...@@ -72,7 +72,7 @@ TEST_F(AnimationInterpolableValueTest, SimpleList) ...@@ -72,7 +72,7 @@ TEST_F(AnimationInterpolableValueTest, SimpleList)
listB->set(1, InterpolableNumber::create(-200)); listB->set(1, InterpolableNumber::create(-200));
listB->set(2, InterpolableNumber::create(300)); listB->set(2, InterpolableNumber::create(300));
RefPtr<Interpolation> i = interpolateLists(listA.release(), listB.release(), 0.3); RefPtrWillBeRawPtr<Interpolation> i = interpolateLists(listA.release(), listB.release(), 0.3);
InterpolableList* outList = toInterpolableList(interpolationValue(*i.get())); InterpolableList* outList = toInterpolableList(interpolationValue(*i.get()));
EXPECT_FLOAT_EQ(30, toInterpolableNumber(outList->get(0))->value()); EXPECT_FLOAT_EQ(30, toInterpolableNumber(outList->get(0))->value());
EXPECT_FLOAT_EQ(-30.6f, toInterpolableNumber(outList->get(1))->value()); EXPECT_FLOAT_EQ(-30.6f, toInterpolableNumber(outList->get(1))->value());
...@@ -95,7 +95,7 @@ TEST_F(AnimationInterpolableValueTest, NestedList) ...@@ -95,7 +95,7 @@ TEST_F(AnimationInterpolableValueTest, NestedList)
listB->set(1, subListB.release()); listB->set(1, subListB.release());
listB->set(2, InterpolableBool::create(true)); listB->set(2, InterpolableBool::create(true));
RefPtr<Interpolation> i = interpolateLists(listA.release(), listB.release(), 0.5); RefPtrWillBeRawPtr<Interpolation> i = interpolateLists(listA.release(), listB.release(), 0.5);
InterpolableList* outList = toInterpolableList(interpolationValue(*i.get())); InterpolableList* outList = toInterpolableList(interpolationValue(*i.get()));
EXPECT_FLOAT_EQ(50, toInterpolableNumber(outList->get(0))->value()); EXPECT_FLOAT_EQ(50, toInterpolableNumber(outList->get(0))->value());
EXPECT_FLOAT_EQ(75, toInterpolableNumber(toInterpolableList(outList->get(1))->get(0))->value()); EXPECT_FLOAT_EQ(75, toInterpolableNumber(toInterpolableList(outList->get(1))->get(0))->value());
......
...@@ -54,10 +54,20 @@ void Interpolation::interpolate(int iteration, double fraction) const ...@@ -54,10 +54,20 @@ void Interpolation::interpolate(int iteration, double fraction) const
} }
} }
void StyleInterpolation::trace(Visitor* visitor)
{
Interpolation::trace(visitor);
}
void LegacyStyleInterpolation::apply(StyleResolverState& state) const void LegacyStyleInterpolation::apply(StyleResolverState& state) const
{ {
AnimatableValue* value = currentValue(); AnimatableValue* value = currentValue();
AnimatedStyleBuilder::applyProperty(m_id, state, value); AnimatedStyleBuilder::applyProperty(m_id, state, value);
} }
void LegacyStyleInterpolation::trace(Visitor* visitor)
{
StyleInterpolation::trace(visitor);
}
} }
...@@ -7,17 +7,18 @@ ...@@ -7,17 +7,18 @@
#include "CSSPropertyNames.h" #include "CSSPropertyNames.h"
#include "core/animation/InterpolableValue.h" #include "core/animation/InterpolableValue.h"
#include "heap/Handle.h"
#include "wtf/RefCounted.h" #include "wtf/RefCounted.h"
namespace WebCore { namespace WebCore {
class StyleResolverState; class StyleResolverState;
class Interpolation : public RefCounted<Interpolation> { class Interpolation : public RefCountedWillBeGarbageCollectedFinalized<Interpolation> {
public: public:
static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end)
{ {
return adoptRef(new Interpolation(start, end)); return adoptRefWillBeNoop(new Interpolation(start, end));
} }
void interpolate(int iteration, double fraction) const; void interpolate(int iteration, double fraction) const;
...@@ -25,8 +26,9 @@ public: ...@@ -25,8 +26,9 @@ public:
virtual bool isStyleInterpolation() const { return false; } virtual bool isStyleInterpolation() const { return false; }
virtual bool isLegacyStyleInterpolation() const { return false; } virtual bool isLegacyStyleInterpolation() const { return false; }
virtual ~Interpolation() virtual ~Interpolation() { }
{ }
virtual void trace(Visitor*) { }
protected: protected:
const OwnPtr<InterpolableValue> m_start; const OwnPtr<InterpolableValue> m_start;
...@@ -60,20 +62,23 @@ public: ...@@ -60,20 +62,23 @@ public:
CSSPropertyID id() const { return m_id; } CSSPropertyID id() const { return m_id; }
virtual void trace(Visitor*) OVERRIDE;
protected: protected:
CSSPropertyID m_id; CSSPropertyID m_id;
StyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id) StyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id)
: Interpolation(start, end) : Interpolation(start, end)
, m_id(id) , m_id(id)
{ } {
}
}; };
class LegacyStyleInterpolation : public StyleInterpolation { class LegacyStyleInterpolation : public StyleInterpolation {
public: public:
static PassRefPtr<LegacyStyleInterpolation> create(PassRefPtrWillBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, CSSPropertyID id) static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWillBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, CSSPropertyID id)
{ {
return adoptRef(new LegacyStyleInterpolation(InterpolableAnimatableValue::create(start), InterpolableAnimatableValue::create(end), id)); return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnimatableValue::create(start), InterpolableAnimatableValue::create(end), id));
} }
virtual void apply(StyleResolverState&) const; virtual void apply(StyleResolverState&) const;
...@@ -85,10 +90,13 @@ public: ...@@ -85,10 +90,13 @@ public:
return value->value(); return value->value();
} }
virtual void trace(Visitor*) OVERRIDE;
private: private:
LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id) LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id)
: StyleInterpolation(start, end, id) : StyleInterpolation(start, end, id)
{ } {
}
}; };
DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterpolation(), value.isStyleInterpolation()); DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterpolation(), value.isStyleInterpolation());
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
namespace WebCore { namespace WebCore {
PassOwnPtr<Vector<RefPtr<Interpolation> > > InterpolationEffect::getActiveInterpolations(double fraction, double iterationDuration) const PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > InterpolationEffect::getActiveInterpolations(double fraction, double iterationDuration) const
{ {
Vector<RefPtr<Interpolation> >* result = new Vector<RefPtr<Interpolation> >(); WillBeHeapVector<RefPtrWillBeMember<Interpolation> >* result = new WillBeHeapVector<RefPtrWillBeMember<Interpolation> >();
for (size_t i = 0; i < m_interpolations.size(); ++i) { for (size_t i = 0; i < m_interpolations.size(); ++i) {
const InterpolationRecord* record = m_interpolations[i].get(); const InterpolationRecord* record = m_interpolations[i].get();
if (fraction >= record->m_applyFrom && fraction < record->m_applyTo) { if (fraction >= record->m_applyFrom && fraction < record->m_applyTo) {
RefPtr<Interpolation> interpolation = record->m_interpolation; RefPtrWillBeRawPtr<Interpolation> interpolation = record->m_interpolation;
double localFraction = (fraction - record->m_start) / (record->m_end - record->m_start); double localFraction = (fraction - record->m_start) / (record->m_end - record->m_start);
if (record->m_easing) if (record->m_easing)
localFraction = record->m_easing->evaluate(localFraction, accuracyForDuration(iterationDuration)); localFraction = record->m_easing->evaluate(localFraction, accuracyForDuration(iterationDuration));
...@@ -24,7 +24,12 @@ PassOwnPtr<Vector<RefPtr<Interpolation> > > InterpolationEffect::getActiveInterp ...@@ -24,7 +24,12 @@ PassOwnPtr<Vector<RefPtr<Interpolation> > > InterpolationEffect::getActiveInterp
} }
} }
return adoptPtr(result); return adoptPtrWillBeNoop(result);
}
void InterpolationEffect::InterpolationRecord::trace(Visitor* visitor)
{
visitor->trace(m_interpolation);
} }
} }
...@@ -13,45 +13,50 @@ ...@@ -13,45 +13,50 @@
namespace WebCore { namespace WebCore {
class InterpolationEffect : public RefCounted<InterpolationEffect> { class InterpolationEffect : public RefCounted<InterpolationEffect> {
public: public:
static PassRefPtr<InterpolationEffect> create() { return adoptRef(new InterpolationEffect()); } static PassRefPtr<InterpolationEffect> create() { return adoptRef(new InterpolationEffect()); }
PassOwnPtr<Vector<RefPtr<Interpolation> > > getActiveInterpolations(double fraction, double iterationDuration) const; PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > getActiveInterpolations(double fraction, double iterationDuration) const;
void addInterpolation(PassRefPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom, double applyTo) void addInterpolation(PassRefPtrWillBeRawPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom, double applyTo)
{ {
m_interpolations.append(InterpolationRecord::create(interpolation, easing, start, end, applyFrom, applyTo)); m_interpolations.append(InterpolationRecord::create(interpolation, easing, start, end, applyFrom, applyTo));
} }
private: private:
InterpolationEffect() InterpolationEffect()
{ } {
}
class InterpolationRecord { class InterpolationRecord : public NoBaseWillBeGarbageCollected<InterpolationRecord> {
public: public:
RefPtr<Interpolation> m_interpolation; RefPtrWillBeMember<Interpolation> m_interpolation;
RefPtr<TimingFunction> m_easing; RefPtr<TimingFunction> m_easing;
double m_start; double m_start;
double m_end; double m_end;
double m_applyFrom; double m_applyFrom;
double m_applyTo; double m_applyTo;
static PassOwnPtr<InterpolationRecord> create(PassRefPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom, double applyTo)
static PassOwnPtrWillBeRawPtr<InterpolationRecord> create(PassRefPtrWillBeRawPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom, double applyTo)
{ {
return adoptPtr(new InterpolationRecord(interpolation, easing, start, end, applyFrom, applyTo)); return adoptPtrWillBeNoop(new InterpolationRecord(interpolation, easing, start, end, applyFrom, applyTo));
} }
void trace(Visitor*);
private: private:
InterpolationRecord(PassRefPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom, double applyTo) InterpolationRecord(PassRefPtrWillBeRawPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom, double applyTo)
: m_interpolation(interpolation) : m_interpolation(interpolation)
, m_easing(easing) , m_easing(easing)
, m_start(start) , m_start(start)
, m_end(end) , m_end(end)
, m_applyFrom(applyFrom) , m_applyFrom(applyFrom)
, m_applyTo(applyTo) , m_applyTo(applyTo)
{ } {
}
}; };
Vector<OwnPtr<InterpolationRecord> > m_interpolations; WillBePersistentHeapVector<OwnPtrWillBeMember<InterpolationRecord> > m_interpolations;
}; };
} }
......
...@@ -22,7 +22,7 @@ protected: ...@@ -22,7 +22,7 @@ protected:
return interpolation.getCachedValueForTesting(); return interpolation.getCachedValueForTesting();
} }
double getInterpolableNumber(PassRefPtr<Interpolation> value) double getInterpolableNumber(PassRefPtrWillBeRawPtr<Interpolation> value)
{ {
return toInterpolableNumber(interpolationValue(*value.get()))->value(); return toInterpolableNumber(interpolationValue(*value.get()))->value();
} }
...@@ -34,7 +34,7 @@ TEST_F(AnimationInterpolationEffectTest, SingleInterpolation) ...@@ -34,7 +34,7 @@ TEST_F(AnimationInterpolationEffectTest, SingleInterpolation)
interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumber::create(0), InterpolableNumber::create(10)), interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumber::create(0), InterpolableNumber::create(10)),
RefPtr<TimingFunction>(), 0, 1, -1, 2); RefPtr<TimingFunction>(), 0, 1, -1, 2);
OwnPtr<Vector<RefPtr<Interpolation> > > activeInterpolations = interpolationEffect->getActiveInterpolations(-2, duration); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > activeInterpolations = interpolationEffect->getActiveInterpolations(-2, duration);
EXPECT_EQ(0ul, activeInterpolations->size()); EXPECT_EQ(0ul, activeInterpolations->size());
activeInterpolations = interpolationEffect->getActiveInterpolations(-0.5, duration); activeInterpolations = interpolationEffect->getActiveInterpolations(-0.5, duration);
...@@ -63,7 +63,7 @@ TEST_F(AnimationInterpolationEffectTest, MultipleInterpolations) ...@@ -63,7 +63,7 @@ TEST_F(AnimationInterpolationEffectTest, MultipleInterpolations)
interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumber::create(1), InterpolableNumber::create(6)), interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumber::create(1), InterpolableNumber::create(6)),
CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease), 0.5, 1.5, 0.5, 1.5); CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease), 0.5, 1.5, 0.5, 1.5);
OwnPtr<Vector<RefPtr<Interpolation> > > activeInterpolations = interpolationEffect->getActiveInterpolations(-0.5, duration); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > activeInterpolations = interpolationEffect->getActiveInterpolations(-0.5, duration);
EXPECT_EQ(0ul, activeInterpolations->size()); EXPECT_EQ(0ul, activeInterpolations->size());
activeInterpolations = interpolationEffect->getActiveInterpolations(0, duration); activeInterpolations = interpolationEffect->getActiveInterpolations(0, duration);
......
...@@ -117,7 +117,7 @@ PropertySet KeyframeEffectModel::properties() const ...@@ -117,7 +117,7 @@ PropertySet KeyframeEffectModel::properties() const
return result; return result;
} }
PassOwnPtr<Vector<RefPtr<Interpolation> > > KeyframeEffectModel::sample(int iteration, double fraction, double iterationDuration) const PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > KeyframeEffectModel::sample(int iteration, double fraction, double iterationDuration) const
{ {
ASSERT(iteration >= 0); ASSERT(iteration >= 0);
ASSERT(!isNull(fraction)); ASSERT(!isNull(fraction));
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
} }
// AnimationEffect implementation. // AnimationEffect implementation.
virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, double fraction, double iterationDuration) const OVERRIDE; virtual PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > sample(int iteration, double fraction, double iterationDuration) const OVERRIDE;
// FIXME: Implement setFrames() // FIXME: Implement setFrames()
const KeyframeVector& getFrames() const { return m_keyframes; } const KeyframeVector& getFrames() const { return m_keyframes; }
......
...@@ -66,13 +66,13 @@ KeyframeEffectModel::KeyframeVector keyframesAtZeroAndOne(PassRefPtrWillBeRawPtr ...@@ -66,13 +66,13 @@ KeyframeEffectModel::KeyframeVector keyframesAtZeroAndOne(PassRefPtrWillBeRawPtr
return keyframes; return keyframes;
} }
void expectProperty(CSSPropertyID property, PassRefPtr<Interpolation> interpolationValue) void expectProperty(CSSPropertyID property, PassRefPtrWillBeRawPtr<Interpolation> interpolationValue)
{ {
LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpolationValue.get()); LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpolationValue.get());
ASSERT_EQ(property, interpolation->id()); ASSERT_EQ(property, interpolation->id());
} }
void expectDoubleValue(double expectedValue, PassRefPtr<Interpolation> interpolationValue) void expectDoubleValue(double expectedValue, PassRefPtrWillBeRawPtr<Interpolation> interpolationValue)
{ {
LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpolationValue.get()); LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpolationValue.get());
RefPtrWillBeRawPtr<AnimatableValue> value = interpolation->currentValue(); RefPtrWillBeRawPtr<AnimatableValue> value = interpolation->currentValue();
...@@ -88,7 +88,7 @@ void expectDoubleValue(double expectedValue, PassRefPtr<Interpolation> interpola ...@@ -88,7 +88,7 @@ void expectDoubleValue(double expectedValue, PassRefPtr<Interpolation> interpola
EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue);
} }
Interpolation* findValue(Vector<RefPtr<Interpolation> >& values, CSSPropertyID id) Interpolation* findValue(WillBeHeapVector<RefPtrWillBeMember<Interpolation> >& values, CSSPropertyID id)
{ {
for (size_t i = 0; i < values.size(); ++i) { for (size_t i = 0; i < values.size(); ++i) {
LegacyStyleInterpolation* value = toLegacyStyleInterpolation(values.at(i).get()); LegacyStyleInterpolation* value = toLegacyStyleInterpolation(values.at(i).get());
...@@ -103,7 +103,7 @@ TEST(AnimationKeyframeEffectModel, BasicOperation) ...@@ -103,7 +103,7 @@ TEST(AnimationKeyframeEffectModel, BasicOperation)
{ {
KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnimatableValue(3.0), unknownAnimatableValue(5.0)); KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnimatableValue(3.0), unknownAnimatableValue(5.0));
RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes); RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes);
OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6, duration); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > values = effect->sample(0, 0.6, duration);
ASSERT_EQ(1UL, values->size()); ASSERT_EQ(1UL, values->size());
expectProperty(CSSPropertyLeft, values->at(0)); expectProperty(CSSPropertyLeft, values->at(0));
expectDoubleValue(5.0, values->at(0)); expectDoubleValue(5.0, values->at(0));
...@@ -343,7 +343,7 @@ TEST(AnimationKeyframeEffectModel, MultipleProperties) ...@@ -343,7 +343,7 @@ TEST(AnimationKeyframeEffectModel, MultipleProperties)
keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0).get()); keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0).get());
RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes); RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes);
OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6, duration); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > values = effect->sample(0, 0.6, duration);
EXPECT_EQ(2UL, values->size()); EXPECT_EQ(2UL, values->size());
Interpolation* leftValue = findValue(*values.get(), CSSPropertyLeft); Interpolation* leftValue = findValue(*values.get(), CSSPropertyLeft);
ASSERT_TRUE(leftValue); ASSERT_TRUE(leftValue);
...@@ -360,7 +360,7 @@ TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) ...@@ -360,7 +360,7 @@ TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue)
keyframes[0]->setComposite(AnimationEffect::CompositeAdd); keyframes[0]->setComposite(AnimationEffect::CompositeAdd);
keyframes[1]->setComposite(AnimationEffect::CompositeAdd); keyframes[1]->setComposite(AnimationEffect::CompositeAdd);
RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes); RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes);
OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6, duration); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > values = effect->sample(0, 0.6, duration);
expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0));
expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0));
} }
......
...@@ -659,7 +659,7 @@ void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u ...@@ -659,7 +659,7 @@ void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u
AnimationStack* animationStack = activeAnimations ? &activeAnimations->defaultStack() : 0; AnimationStack* animationStack = activeAnimations ? &activeAnimations->defaultStack() : 0;
if (update->newAnimations().isEmpty() && update->cancelledAnimationAnimationPlayers().isEmpty()) { if (update->newAnimations().isEmpty() && update->cancelledAnimationAnimationPlayers().isEmpty()) {
HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolationsForAnimations(AnimationStack::activeInterpolations(animationStack, 0, 0, Animation::DefaultPriority)); WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > activeInterpolationsForAnimations(AnimationStack::activeInterpolations(animationStack, 0, 0, Animation::DefaultPriority));
update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimations); update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimations);
return; return;
} }
...@@ -670,7 +670,7 @@ void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u ...@@ -670,7 +670,7 @@ void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u
for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = animations.begin(); animationsIter != animations.end(); ++animationsIter) for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = animations.begin(); animationsIter != animations.end(); ++animationsIter)
newAnimations.append(animationsIter->get()); newAnimations.append(animationsIter->get());
} }
HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolationsForAnimations(AnimationStack::activeInterpolations(animationStack, &newAnimations, &update->cancelledAnimationAnimationPlayers(), Animation::DefaultPriority)); WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > activeInterpolationsForAnimations(AnimationStack::activeInterpolations(animationStack, &newAnimations, &update->cancelledAnimationAnimationPlayers(), Animation::DefaultPriority));
update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimations); update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimations);
} }
...@@ -679,7 +679,7 @@ void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate* ...@@ -679,7 +679,7 @@ void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate*
ActiveAnimations* activeAnimations = element ? element->activeAnimations() : 0; ActiveAnimations* activeAnimations = element ? element->activeAnimations() : 0;
AnimationStack* animationStack = activeAnimations ? &activeAnimations->defaultStack() : 0; AnimationStack* animationStack = activeAnimations ? &activeAnimations->defaultStack() : 0;
HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolationsForTransitions; WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > activeInterpolationsForTransitions;
if (update->newTransitions().isEmpty() && update->cancelledTransitions().isEmpty()) { if (update->newTransitions().isEmpty() && update->cancelledTransitions().isEmpty()) {
activeInterpolationsForTransitions = AnimationStack::activeInterpolations(animationStack, 0, 0, Animation::TransitionPriority); activeInterpolationsForTransitions = AnimationStack::activeInterpolations(animationStack, 0, 0, Animation::TransitionPriority);
} else { } else {
...@@ -702,7 +702,7 @@ void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate* ...@@ -702,7 +702,7 @@ void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate*
// Properties being animated by animations don't get values from transitions applied. // Properties being animated by animations don't get values from transitions applied.
if (!update->activeInterpolationsForAnimations().isEmpty() && !activeInterpolationsForTransitions.isEmpty()) { if (!update->activeInterpolationsForAnimations().isEmpty() && !activeInterpolationsForTransitions.isEmpty()) {
for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = update->activeInterpolationsForAnimations().begin(); iter != update->activeInterpolationsForAnimations().end(); ++iter) for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >::const_iterator iter = update->activeInterpolationsForAnimations().begin(); iter != update->activeInterpolationsForAnimations().end(); ++iter)
activeInterpolationsForTransitions.remove(iter->key); activeInterpolationsForTransitions.remove(iter->key);
} }
update->adoptActiveInterpolationsForTransitions(activeInterpolationsForTransitions); update->adoptActiveInterpolationsForTransitions(activeInterpolationsForTransitions);
......
...@@ -113,11 +113,11 @@ public: ...@@ -113,11 +113,11 @@ public:
const NewTransitionMap& newTransitions() const { return m_newTransitions; } const NewTransitionMap& newTransitions() const { return m_newTransitions; }
const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancelledTransitions; } const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancelledTransitions; }
void adoptActiveInterpolationsForAnimations(HashMap<CSSPropertyID, RefPtr<Interpolation> >& newMap) { newMap.swap(m_activeInterpolationsForAnimations); } void adoptActiveInterpolationsForAnimations(WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& newMap) { newMap.swap(m_activeInterpolationsForAnimations); }
void adoptActiveInterpolationsForTransitions(HashMap<CSSPropertyID, RefPtr<Interpolation> >& newMap) { newMap.swap(m_activeInterpolationsForTransitions); } void adoptActiveInterpolationsForTransitions(WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& newMap) { newMap.swap(m_activeInterpolationsForTransitions); }
const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnimations() const { return m_activeInterpolationsForAnimations; } const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForAnimations() const { return m_activeInterpolationsForAnimations; }
const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForTransitions() const { return m_activeInterpolationsForTransitions; } const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForTransitions() const { return m_activeInterpolationsForTransitions; }
HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnimations() { return m_activeInterpolationsForAnimations; } WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForAnimations() { return m_activeInterpolationsForAnimations; }
bool isEmpty() const bool isEmpty() const
{ {
...@@ -143,8 +143,8 @@ private: ...@@ -143,8 +143,8 @@ private:
NewTransitionMap m_newTransitions; NewTransitionMap m_newTransitions;
HashSet<CSSPropertyID> m_cancelledTransitions; HashSet<CSSPropertyID> m_cancelledTransitions;
HashMap<CSSPropertyID, RefPtr<Interpolation> > m_activeInterpolationsForAnimations; WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForAnimations;
HashMap<CSSPropertyID, RefPtr<Interpolation> > m_activeInterpolationsForTransitions; WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForTransitions;
}; };
class CSSAnimations FINAL { class CSSAnimations FINAL {
...@@ -189,7 +189,7 @@ private: ...@@ -189,7 +189,7 @@ private:
TransitionMap m_transitions; TransitionMap m_transitions;
OwnPtr<CSSAnimationUpdate> m_pendingUpdate; OwnPtr<CSSAnimationUpdate> m_pendingUpdate;
HashMap<CSSPropertyID, RefPtr<Interpolation> > m_previousActiveInterpolationsForAnimations; WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_previousActiveInterpolationsForAnimations;
static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const Element& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*); static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const Element& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*);
static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, const RenderStyle&); static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, const RenderStyle&);
......
...@@ -1083,8 +1083,8 @@ void StyleResolver::applyAnimatedProperties(StyleResolverState& state, Element* ...@@ -1083,8 +1083,8 @@ void StyleResolver::applyAnimatedProperties(StyleResolverState& state, Element*
if (!state.animationUpdate()) if (!state.animationUpdate())
return; return;
const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnimations = state.animationUpdate()->activeInterpolationsForAnimations(); const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForAnimations = state.animationUpdate()->activeInterpolationsForAnimations();
const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForTransitions = state.animationUpdate()->activeInterpolationsForTransitions(); const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForTransitions = state.animationUpdate()->activeInterpolationsForTransitions();
applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsForAnimations); applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsForAnimations);
applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsForTransitions); applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsForTransitions);
applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsForAnimations); applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsForAnimations);
...@@ -1102,11 +1102,11 @@ void StyleResolver::applyAnimatedProperties(StyleResolverState& state, Element* ...@@ -1102,11 +1102,11 @@ void StyleResolver::applyAnimatedProperties(StyleResolverState& state, Element*
} }
template <StyleResolver::StyleApplicationPass pass> template <StyleResolver::StyleApplicationPass pass>
void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolations)
{ {
ASSERT(pass != AnimationProperties); ASSERT(pass != AnimationProperties);
for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = activeInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >::const_iterator iter = activeInterpolations.begin(); iter != activeInterpolations.end(); ++iter) {
CSSPropertyID property = iter->key; CSSPropertyID property = iter->key;
if (!isPropertyForPass<pass>(property)) if (!isPropertyForPass<pass>(property))
continue; continue;
......
...@@ -275,7 +275,7 @@ private: ...@@ -275,7 +275,7 @@ private:
template <StyleApplicationPass pass> template <StyleApplicationPass pass>
void applyProperties(StyleResolverState&, const StylePropertySet* properties, StyleRule*, bool isImportant, bool inheritedOnly, PropertyWhitelistType = PropertyWhitelistNone); void applyProperties(StyleResolverState&, const StylePropertySet* properties, StyleRule*, bool isImportant, bool inheritedOnly, PropertyWhitelistType = PropertyWhitelistNone);
template <StyleApplicationPass pass> template <StyleApplicationPass pass>
void applyAnimatedProperties(StyleResolverState&, const HashMap<CSSPropertyID, RefPtr<Interpolation> >&); void applyAnimatedProperties(StyleResolverState&, const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&);
void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPage, const String& pageName); void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPage, const String& pageName);
void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >&, bool isLeftPage, bool isFirstPage, const String& pageName); void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >&, bool isLeftPage, bool isFirstPage, const String& pageName);
void collectViewportRules(); void collectViewportRules();
......
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