diff options
30 files changed, 328 insertions, 315 deletions
diff --git a/cc/CCActiveAnimation.cpp b/cc/CCActiveAnimation.cpp index b1817d1..e99bd42 100644 --- a/cc/CCActiveAnimation.cpp +++ b/cc/CCActiveAnimation.cpp @@ -42,13 +42,13 @@ COMPILE_ASSERT(static_cast<int>(cc::CCActiveAnimation::TargetPropertyEnumSize) = namespace cc { -scoped_ptr<CCActiveAnimation> CCActiveAnimation::create(scoped_ptr<CCAnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) +PassOwnPtr<CCActiveAnimation> CCActiveAnimation::create(PassOwnPtr<CCAnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) { - return make_scoped_ptr(new CCActiveAnimation(curve.Pass(), animationId, groupId, targetProperty)); + return adoptPtr(new CCActiveAnimation(curve, animationId, groupId, targetProperty)); } -CCActiveAnimation::CCActiveAnimation(scoped_ptr<CCAnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) - : m_curve(curve.Pass()) +CCActiveAnimation::CCActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) + : m_curve(curve) , m_id(animationId) , m_group(groupId) , m_targetProperty(targetProperty) @@ -180,14 +180,14 @@ double CCActiveAnimation::trimTimeToCurrentIteration(double monotonicTime) const return trimmed; } -scoped_ptr<CCActiveAnimation> CCActiveAnimation::clone(InstanceType instanceType) const +PassOwnPtr<CCActiveAnimation> CCActiveAnimation::clone(InstanceType instanceType) const { return cloneAndInitialize(instanceType, m_runState, m_startTime); } -scoped_ptr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType instanceType, RunState initialRunState, double startTime) const +PassOwnPtr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType instanceType, RunState initialRunState, double startTime) const { - scoped_ptr<CCActiveAnimation> toReturn(new CCActiveAnimation(m_curve->clone(), m_id, m_group, m_targetProperty)); + OwnPtr<CCActiveAnimation> toReturn(adoptPtr(new CCActiveAnimation(m_curve->clone(), m_id, m_group, m_targetProperty))); toReturn->m_runState = initialRunState; toReturn->m_iterations = m_iterations; toReturn->m_startTime = startTime; @@ -196,7 +196,7 @@ scoped_ptr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType toReturn->m_timeOffset = m_timeOffset; toReturn->m_alternatesDirection = m_alternatesDirection; toReturn->m_isControllingInstance = instanceType == ControllingInstance; - return toReturn.Pass(); + return toReturn.release(); } void CCActiveAnimation::pushPropertiesTo(CCActiveAnimation* other) const diff --git a/cc/CCActiveAnimation.h b/cc/CCActiveAnimation.h index b8d3607..213b510 100644 --- a/cc/CCActiveAnimation.h +++ b/cc/CCActiveAnimation.h @@ -6,7 +6,8 @@ #define CCActiveAnimation_h #include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace cc { @@ -46,7 +47,7 @@ public: TargetPropertyEnumSize }; - static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty); + static PassOwnPtr<CCActiveAnimation> create(PassOwnPtr<CCAnimationCurve>, int animationId, int groupId, TargetProperty); virtual ~CCActiveAnimation(); @@ -99,16 +100,16 @@ public: NonControllingInstance }; - scoped_ptr<CCActiveAnimation> clone(InstanceType) const; - scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const; + PassOwnPtr<CCActiveAnimation> clone(InstanceType) const; + PassOwnPtr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const; bool isControllingInstance() const { return m_isControllingInstance; } void pushPropertiesTo(CCActiveAnimation*) const; private: - CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty); + CCActiveAnimation(PassOwnPtr<CCAnimationCurve>, int animationId, int groupId, TargetProperty); - scoped_ptr<CCAnimationCurve> m_curve; + OwnPtr<CCAnimationCurve> m_curve; // IDs are not necessarily unique. int m_id; diff --git a/cc/CCActiveAnimationTest.cpp b/cc/CCActiveAnimationTest.cpp index c3076c9..bac66c7 100644 --- a/cc/CCActiveAnimationTest.cpp +++ b/cc/CCActiveAnimationTest.cpp @@ -15,21 +15,21 @@ using namespace cc; namespace { -scoped_ptr<CCActiveAnimation> createActiveAnimation(int iterations, double duration) +PassOwnPtr<CCActiveAnimation> createActiveAnimation(int iterations, double duration) { - scoped_ptr<CCActiveAnimation> toReturn(CCActiveAnimation::create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)).PassAs<CCAnimationCurve>(), 0, 1, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toReturn(CCActiveAnimation::create(adoptPtr(new FakeFloatAnimationCurve(duration)), 0, 1, CCActiveAnimation::Opacity)); toReturn->setIterations(iterations); - return toReturn.Pass(); + return toReturn.release(); } -scoped_ptr<CCActiveAnimation> createActiveAnimation(int iterations) +PassOwnPtr<CCActiveAnimation> createActiveAnimation(int iterations) { return createActiveAnimation(iterations, 1); } TEST(CCActiveAnimationTest, TrimTimeZeroIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); @@ -37,7 +37,7 @@ TEST(CCActiveAnimationTest, TrimTimeZeroIterations) TEST(CCActiveAnimationTest, TrimTimeOneIteration) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); @@ -46,7 +46,7 @@ TEST(CCActiveAnimationTest, TrimTimeOneIteration) TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); @@ -55,7 +55,7 @@ TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) TEST(CCActiveAnimationTest, TrimTimeAlternating) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); anim->setAlternatesDirection(true); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); @@ -65,7 +65,7 @@ TEST(CCActiveAnimationTest, TrimTimeAlternating) TEST(CCActiveAnimationTest, TrimTimeStartTime) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setStartTime(4); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(4)); @@ -76,7 +76,7 @@ TEST(CCActiveAnimationTest, TrimTimeStartTime) TEST(CCActiveAnimationTest, TrimTimeTimeOffset) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setTimeOffset(4); anim->setStartTime(4); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); @@ -87,7 +87,7 @@ TEST(CCActiveAnimationTest, TrimTimeTimeOffset) TEST(CCActiveAnimationTest, TrimTimePauseResume) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); @@ -100,7 +100,7 @@ TEST(CCActiveAnimationTest, TrimTimePauseResume) TEST(CCActiveAnimationTest, TrimTimeSuspendResume) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); @@ -113,7 +113,7 @@ TEST(CCActiveAnimationTest, TrimTimeSuspendResume) TEST(CCActiveAnimationTest, TrimTimeZeroDuration) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0, 0)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0, 0)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); @@ -122,7 +122,7 @@ TEST(CCActiveAnimationTest, TrimTimeZeroDuration) TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinishedAt(-1)); EXPECT_TRUE(anim->isFinishedAt(0)); @@ -131,7 +131,7 @@ TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations) TEST(CCActiveAnimationTest, IsFinishedAtOneIteration) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinishedAt(-1)); EXPECT_FALSE(anim->isFinishedAt(0)); @@ -141,7 +141,7 @@ TEST(CCActiveAnimationTest, IsFinishedAtOneIteration) TEST(CCActiveAnimationTest, IsFinishedAtInfiniteIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinishedAt(0)); EXPECT_FALSE(anim->isFinishedAt(0.5)); @@ -151,7 +151,7 @@ TEST(CCActiveAnimationTest, IsFinishedAtInfiniteIterations) TEST(CCActiveAnimationTest, IsFinishedAtNotRunning) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_TRUE(anim->isFinishedAt(0)); anim->setRunState(CCActiveAnimation::Paused, 0); @@ -170,7 +170,7 @@ TEST(CCActiveAnimationTest, IsFinishedAtNotRunning) TEST(CCActiveAnimationTest, IsFinished) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setRunState(CCActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinished()); anim->setRunState(CCActiveAnimation::Paused, 0); @@ -189,7 +189,7 @@ TEST(CCActiveAnimationTest, IsFinished) TEST(CCActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->setRunState(CCActiveAnimation::Running, 2); EXPECT_FALSE(anim->isFinished()); anim->setRunState(CCActiveAnimation::Paused, 2); @@ -208,7 +208,7 @@ TEST(CCActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime) TEST(CCActiveAnimationTest, RunStateChangesIgnoredWhileSuspended) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); anim->suspend(0); EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); anim->setRunState(CCActiveAnimation::Running, 0); diff --git a/cc/CCAnimationCurve.h b/cc/CCAnimationCurve.h index 7ed6e7a..c177d23 100644 --- a/cc/CCAnimationCurve.h +++ b/cc/CCAnimationCurve.h @@ -5,8 +5,8 @@ #ifndef CCAnimationCurve_h #define CCAnimationCurve_h -#include "base/memory/scoped_ptr.h" #include <public/WebTransformationMatrix.h> +#include <wtf/PassOwnPtr.h> namespace cc { @@ -25,7 +25,7 @@ public: virtual double duration() const = 0; virtual Type type() const = 0; - virtual scoped_ptr<CCAnimationCurve> clone() const = 0; + virtual PassOwnPtr<CCAnimationCurve> clone() const = 0; const CCFloatAnimationCurve* toFloatAnimationCurve() const; const CCTransformAnimationCurve* toTransformAnimationCurve() const; diff --git a/cc/CCKeyframedAnimationCurve.cpp b/cc/CCKeyframedAnimationCurve.cpp index a6b368e..5357976 100644 --- a/cc/CCKeyframedAnimationCurve.cpp +++ b/cc/CCKeyframedAnimationCurve.cpp @@ -6,6 +6,8 @@ #include "CCKeyframedAnimationCurve.h" +#include <wtf/OwnPtr.h> + using WebKit::WebTransformationMatrix; namespace cc { @@ -13,34 +15,36 @@ namespace cc { namespace { template <class Keyframe> -void insertKeyframe(scoped_ptr<Keyframe> keyframe, ScopedPtrVector<Keyframe>& keyframes) +void insertKeyframe(PassOwnPtr<Keyframe> popKeyframe, OwnPtrVector<Keyframe>& keyframes) { + OwnPtr<Keyframe> keyframe = popKeyframe; + // Usually, the keyframes will be added in order, so this loop would be unnecessary and // we should skip it if possible. if (!keyframes.isEmpty() && keyframe->time() < keyframes.last()->time()) { for (size_t i = 0; i < keyframes.size(); ++i) { if (keyframe->time() < keyframes[i]->time()) { - keyframes.insert(i, keyframe.Pass()); + keyframes.insert(i, keyframe.release()); return; } } } - keyframes.append(keyframe.Pass()); + keyframes.append(keyframe.release()); } -scoped_ptr<CCTimingFunction> cloneTimingFunction(const CCTimingFunction* timingFunction) +PassOwnPtr<CCTimingFunction> cloneTimingFunction(const CCTimingFunction* timingFunction) { ASSERT(timingFunction); - scoped_ptr<CCAnimationCurve> curve(timingFunction->clone()); - return scoped_ptr<CCTimingFunction>(static_cast<CCTimingFunction*>(curve.release())); + OwnPtr<CCAnimationCurve> curve(timingFunction->clone()); + return adoptPtr(static_cast<CCTimingFunction*>(curve.leakPtr())); } } // namespace -CCKeyframe::CCKeyframe(double time, scoped_ptr<CCTimingFunction> timingFunction) +CCKeyframe::CCKeyframe(double time, PassOwnPtr<CCTimingFunction> timingFunction) : m_time(time) - , m_timingFunction(timingFunction.Pass()) + , m_timingFunction(timingFunction) { } @@ -58,13 +62,13 @@ const CCTimingFunction* CCKeyframe::timingFunction() const return m_timingFunction.get(); } -scoped_ptr<CCFloatKeyframe> CCFloatKeyframe::create(double time, float value, scoped_ptr<CCTimingFunction> timingFunction) +PassOwnPtr<CCFloatKeyframe> CCFloatKeyframe::create(double time, float value, PassOwnPtr<CCTimingFunction> timingFunction) { - return make_scoped_ptr(new CCFloatKeyframe(time, value, timingFunction.Pass())); + return adoptPtr(new CCFloatKeyframe(time, value, timingFunction)); } -CCFloatKeyframe::CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction> timingFunction) - : CCKeyframe(time, timingFunction.Pass()) +CCFloatKeyframe::CCFloatKeyframe(double time, float value, PassOwnPtr<CCTimingFunction> timingFunction) + : CCKeyframe(time, timingFunction) , m_value(value) { } @@ -78,21 +82,18 @@ float CCFloatKeyframe::value() const return m_value; } -scoped_ptr<CCFloatKeyframe> CCFloatKeyframe::clone() const +PassOwnPtr<CCFloatKeyframe> CCFloatKeyframe::clone() const { - scoped_ptr<CCTimingFunction> func; - if (timingFunction()) - func = cloneTimingFunction(timingFunction()); - return CCFloatKeyframe::create(time(), value(), func.Pass()); + return CCFloatKeyframe::create(time(), value(), timingFunction() ? cloneTimingFunction(timingFunction()) : nullptr); } -scoped_ptr<CCTransformKeyframe> CCTransformKeyframe::create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction> timingFunction) +PassOwnPtr<CCTransformKeyframe> CCTransformKeyframe::create(double time, const WebKit::WebTransformOperations& value, PassOwnPtr<CCTimingFunction> timingFunction) { - return make_scoped_ptr(new CCTransformKeyframe(time, value, timingFunction.Pass())); + return adoptPtr(new CCTransformKeyframe(time, value, timingFunction)); } -CCTransformKeyframe::CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction> timingFunction) - : CCKeyframe(time, timingFunction.Pass()) +CCTransformKeyframe::CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, PassOwnPtr<CCTimingFunction> timingFunction) + : CCKeyframe(time, timingFunction) , m_value(value) { } @@ -106,17 +107,14 @@ const WebKit::WebTransformOperations& CCTransformKeyframe::value() const return m_value; } -scoped_ptr<CCTransformKeyframe> CCTransformKeyframe::clone() const +PassOwnPtr<CCTransformKeyframe> CCTransformKeyframe::clone() const { - scoped_ptr<CCTimingFunction> func; - if (timingFunction()) - func = cloneTimingFunction(timingFunction()); - return CCTransformKeyframe::create(time(), value(), func.Pass()); + return CCTransformKeyframe::create(time(), value(), timingFunction() ? cloneTimingFunction(timingFunction()) : nullptr); } -scoped_ptr<CCKeyframedFloatAnimationCurve> CCKeyframedFloatAnimationCurve::create() +PassOwnPtr<CCKeyframedFloatAnimationCurve> CCKeyframedFloatAnimationCurve::create() { - return make_scoped_ptr(new CCKeyframedFloatAnimationCurve); + return adoptPtr(new CCKeyframedFloatAnimationCurve); } CCKeyframedFloatAnimationCurve::CCKeyframedFloatAnimationCurve() @@ -127,9 +125,9 @@ CCKeyframedFloatAnimationCurve::~CCKeyframedFloatAnimationCurve() { } -void CCKeyframedFloatAnimationCurve::addKeyframe(scoped_ptr<CCFloatKeyframe> keyframe) +void CCKeyframedFloatAnimationCurve::addKeyframe(PassOwnPtr<CCFloatKeyframe> keyframe) { - insertKeyframe(keyframe.Pass(), m_keyframes); + insertKeyframe(keyframe, m_keyframes); } double CCKeyframedFloatAnimationCurve::duration() const @@ -137,12 +135,12 @@ double CCKeyframedFloatAnimationCurve::duration() const return m_keyframes.last()->time() - m_keyframes.first()->time(); } -scoped_ptr<CCAnimationCurve> CCKeyframedFloatAnimationCurve::clone() const +PassOwnPtr<CCAnimationCurve> CCKeyframedFloatAnimationCurve::clone() const { - scoped_ptr<CCKeyframedFloatAnimationCurve> toReturn(CCKeyframedFloatAnimationCurve::create()); + OwnPtr<CCKeyframedFloatAnimationCurve> toReturn(CCKeyframedFloatAnimationCurve::create()); for (size_t i = 0; i < m_keyframes.size(); ++i) toReturn->addKeyframe(m_keyframes[i]->clone()); - return toReturn.PassAs<CCAnimationCurve>(); + return toReturn.release(); } float CCKeyframedFloatAnimationCurve::getValue(double t) const @@ -167,9 +165,9 @@ float CCKeyframedFloatAnimationCurve::getValue(double t) const return m_keyframes[i]->value() + (m_keyframes[i+1]->value() - m_keyframes[i]->value()) * progress; } -scoped_ptr<CCKeyframedTransformAnimationCurve> CCKeyframedTransformAnimationCurve::create() +PassOwnPtr<CCKeyframedTransformAnimationCurve> CCKeyframedTransformAnimationCurve::create() { - return make_scoped_ptr(new CCKeyframedTransformAnimationCurve); + return adoptPtr(new CCKeyframedTransformAnimationCurve); } CCKeyframedTransformAnimationCurve::CCKeyframedTransformAnimationCurve() @@ -180,9 +178,9 @@ CCKeyframedTransformAnimationCurve::~CCKeyframedTransformAnimationCurve() { } -void CCKeyframedTransformAnimationCurve::addKeyframe(scoped_ptr<CCTransformKeyframe> keyframe) +void CCKeyframedTransformAnimationCurve::addKeyframe(PassOwnPtr<CCTransformKeyframe> keyframe) { - insertKeyframe(keyframe.Pass(), m_keyframes); + insertKeyframe(keyframe, m_keyframes); } double CCKeyframedTransformAnimationCurve::duration() const @@ -190,12 +188,12 @@ double CCKeyframedTransformAnimationCurve::duration() const return m_keyframes.last()->time() - m_keyframes.first()->time(); } -scoped_ptr<CCAnimationCurve> CCKeyframedTransformAnimationCurve::clone() const +PassOwnPtr<CCAnimationCurve> CCKeyframedTransformAnimationCurve::clone() const { - scoped_ptr<CCKeyframedTransformAnimationCurve> toReturn(CCKeyframedTransformAnimationCurve::create()); + OwnPtr<CCKeyframedTransformAnimationCurve> toReturn(CCKeyframedTransformAnimationCurve::create()); for (size_t i = 0; i < m_keyframes.size(); ++i) toReturn->addKeyframe(m_keyframes[i]->clone()); - return toReturn.PassAs<CCAnimationCurve>(); + return toReturn.release(); } WebTransformationMatrix CCKeyframedTransformAnimationCurve::getValue(double t) const diff --git a/cc/CCKeyframedAnimationCurve.h b/cc/CCKeyframedAnimationCurve.h index 066e5c6..33cee77 100644 --- a/cc/CCKeyframedAnimationCurve.h +++ b/cc/CCKeyframedAnimationCurve.h @@ -7,8 +7,10 @@ #include "CCAnimationCurve.h" #include "CCTimingFunction.h" -#include "scoped_ptr_vector.h" +#include "cc/own_ptr_vector.h" #include <public/WebTransformOperations.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace cc { @@ -18,40 +20,40 @@ public: const CCTimingFunction* timingFunction() const; protected: - CCKeyframe(double time, scoped_ptr<CCTimingFunction>); + CCKeyframe(double time, PassOwnPtr<CCTimingFunction>); virtual ~CCKeyframe(); private: double m_time; - scoped_ptr<CCTimingFunction> m_timingFunction; + OwnPtr<CCTimingFunction> m_timingFunction; }; class CCFloatKeyframe : public CCKeyframe { public: - static scoped_ptr<CCFloatKeyframe> create(double time, float value, scoped_ptr<CCTimingFunction>); + static PassOwnPtr<CCFloatKeyframe> create(double time, float value, PassOwnPtr<CCTimingFunction>); virtual ~CCFloatKeyframe(); float value() const; - scoped_ptr<CCFloatKeyframe> clone() const; + PassOwnPtr<CCFloatKeyframe> clone() const; private: - CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction>); + CCFloatKeyframe(double time, float value, PassOwnPtr<CCTimingFunction>); float m_value; }; class CCTransformKeyframe : public CCKeyframe { public: - static scoped_ptr<CCTransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>); + static PassOwnPtr<CCTransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, PassOwnPtr<CCTimingFunction>); virtual ~CCTransformKeyframe(); const WebKit::WebTransformOperations& value() const; - scoped_ptr<CCTransformKeyframe> clone() const; + PassOwnPtr<CCTransformKeyframe> clone() const; private: - CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>); + CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, PassOwnPtr<CCTimingFunction>); WebKit::WebTransformOperations m_value; }; @@ -59,15 +61,15 @@ private: class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve { public: // It is required that the keyframes be sorted by time. - static scoped_ptr<CCKeyframedFloatAnimationCurve> create(); + static PassOwnPtr<CCKeyframedFloatAnimationCurve> create(); virtual ~CCKeyframedFloatAnimationCurve(); - void addKeyframe(scoped_ptr<CCFloatKeyframe>); + void addKeyframe(PassOwnPtr<CCFloatKeyframe>); // CCAnimationCurve implementation virtual double duration() const OVERRIDE; - virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; + virtual PassOwnPtr<CCAnimationCurve> clone() const OVERRIDE; // CCFloatAnimationCurve implementation virtual float getValue(double t) const OVERRIDE; @@ -77,21 +79,21 @@ private: // Always sorted in order of increasing time. No two keyframes have the // same time. - ScopedPtrVector<CCFloatKeyframe> m_keyframes; + OwnPtrVector<CCFloatKeyframe> m_keyframes; }; class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve { public: // It is required that the keyframes be sorted by time. - static scoped_ptr<CCKeyframedTransformAnimationCurve> create(); + static PassOwnPtr<CCKeyframedTransformAnimationCurve> create(); virtual ~CCKeyframedTransformAnimationCurve(); - void addKeyframe(scoped_ptr<CCTransformKeyframe>); + void addKeyframe(PassOwnPtr<CCTransformKeyframe>); // CCAnimationCurve implementation virtual double duration() const OVERRIDE; - virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; + virtual PassOwnPtr<CCAnimationCurve> clone() const OVERRIDE; // CCTransformAnimationCurve implementation virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; @@ -101,7 +103,7 @@ private: // Always sorted in order of increasing time. No two keyframes have the // same time. - ScopedPtrVector<CCTransformKeyframe> m_keyframes; + OwnPtrVector<CCTransformKeyframe> m_keyframes; }; } // namespace cc diff --git a/cc/CCKeyframedAnimationCurveTest.cpp b/cc/CCKeyframedAnimationCurveTest.cpp index 9dca26a..21353ed 100644 --- a/cc/CCKeyframedAnimationCurveTest.cpp +++ b/cc/CCKeyframedAnimationCurveTest.cpp @@ -10,6 +10,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include <public/WebTransformOperations.h> #include <public/WebTransformationMatrix.h> +#include <wtf/OwnPtr.h> using namespace cc; using WebKit::WebTransformationMatrix; @@ -24,8 +25,8 @@ void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) // Tests that a float animation with one keyframe works as expected. TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); @@ -36,9 +37,9 @@ TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) // Tests that a float animation with two keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -49,10 +50,10 @@ TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) // Tests that a float animation with three keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(2, 8, scoped_ptr<CCTimingFunction>())); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -65,11 +66,11 @@ TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) // Tests that a float animation with multiple keys at a given time works sanely. TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 4, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 6, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(2, 6, scoped_ptr<CCTimingFunction>())); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 4, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 6, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(2, 6, nullptr)); EXPECT_FLOAT_EQ(4, curve->getValue(-1)); EXPECT_FLOAT_EQ(4, curve->getValue(0)); @@ -88,10 +89,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) // Tests that a transform animation with one keyframe works as expected. TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); WebKit::WebTransformOperations operations; operations.appendTranslate(2, 0, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, operations, scoped_ptr<CCTimingFunction>())); + curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr)); expectTranslateX(2, curve->getValue(-1)); expectTranslateX(2, curve->getValue(0)); @@ -103,14 +104,14 @@ TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) // Tests that a transform animation with two keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(2, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(4, 0, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); expectTranslateX(2, curve->getValue(-1)); expectTranslateX(2, curve->getValue(0)); expectTranslateX(3, curve->getValue(0.5)); @@ -121,16 +122,16 @@ TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) // Tests that a transform animation with three keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(2, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(4, 0, 0); WebKit::WebTransformOperations operations3; operations3.appendTranslate(8, 0, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCTransformKeyframe::create(2, operations3, scoped_ptr<CCTimingFunction>())); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr)); expectTranslateX(2, curve->getValue(-1)); expectTranslateX(2, curve->getValue(0)); expectTranslateX(3, curve->getValue(0.5)); @@ -143,7 +144,7 @@ TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) // Tests that a transform animation with multiple keys at a given time works sanely. TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); // A step function. WebKit::WebTransformOperations operations1; operations1.appendTranslate(4, 0, 0); @@ -153,10 +154,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) operations3.appendTranslate(6, 0, 0); WebKit::WebTransformOperations operations4; operations4.appendTranslate(6, 0, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCTransformKeyframe::create(1, operations3, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCTransformKeyframe::create(2, operations4, scoped_ptr<CCTimingFunction>())); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations3, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(2, operations4, nullptr)); expectTranslateX(4, curve->getValue(-1)); expectTranslateX(4, curve->getValue(0)); @@ -174,10 +175,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) // Tests that the keyframes may be added out of order. TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(2, 8, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -190,9 +191,9 @@ TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) // Tests that a cubic bezier timing function works as expected. TEST(CCKeyframedAnimationCurveTest, CubicBezierTimingFunction) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1).PassAs<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 1, scoped_ptr<CCTimingFunction>())); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1))); + curve->addKeyframe(CCFloatKeyframe::create(1, 1, nullptr)); EXPECT_FLOAT_EQ(0, curve->getValue(0)); EXPECT_LT(0, curve->getValue(0.25)); diff --git a/cc/CCLayerAnimationController.cpp b/cc/CCLayerAnimationController.cpp index 2025db8..83e5223 100644 --- a/cc/CCLayerAnimationController.cpp +++ b/cc/CCLayerAnimationController.cpp @@ -26,9 +26,9 @@ CCLayerAnimationController::~CCLayerAnimationController() { } -scoped_ptr<CCLayerAnimationController> CCLayerAnimationController::create(CCLayerAnimationControllerClient* client) +PassOwnPtr<CCLayerAnimationController> CCLayerAnimationController::create(CCLayerAnimationControllerClient* client) { - return make_scoped_ptr(new CCLayerAnimationController(client)); + return adoptPtr(new CCLayerAnimationController(client)); } void CCLayerAnimationController::pauseAnimation(int animationId, double timeOffset) @@ -108,9 +108,9 @@ void CCLayerAnimationController::animate(double monotonicTime, CCAnimationEvents startAnimationsWaitingForTargetAvailability(monotonicTime, events); } -void CCLayerAnimationController::addAnimation(scoped_ptr<CCActiveAnimation> animation) +void CCLayerAnimationController::addAnimation(PassOwnPtr<CCActiveAnimation> animation) { - m_activeAnimations.append(animation.Pass()); + m_activeAnimations.append(animation); } CCActiveAnimation* CCLayerAnimationController::getActiveAnimation(int groupId, CCActiveAnimation::TargetProperty targetProperty) const @@ -183,9 +183,9 @@ void CCLayerAnimationController::pushNewAnimationsToImplThread(CCLayerAnimationC // The new animation should be set to run as soon as possible. CCActiveAnimation::RunState initialRunState = CCActiveAnimation::WaitingForTargetAvailability; double startTime = 0; - scoped_ptr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime)); + OwnPtr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime)); ASSERT(!toAdd->needsSynchronizedStartTime()); - controllerImpl->addAnimation(toAdd.Pass()); + controllerImpl->addAnimation(toAdd.release()); } } @@ -348,17 +348,17 @@ void CCLayerAnimationController::replaceImplThreadAnimations(CCLayerAnimationCon { controllerImpl->m_activeAnimations.clear(); for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - scoped_ptr<CCActiveAnimation> toAdd; + OwnPtr<CCActiveAnimation> toAdd; if (m_activeAnimations[i]->needsSynchronizedStartTime()) { // We haven't received an animation started notification yet, so it // is important that we add it in a 'waiting' and not 'running' state. CCActiveAnimation::RunState initialRunState = CCActiveAnimation::WaitingForTargetAvailability; double startTime = 0; - toAdd = m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime).Pass(); + toAdd = m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime); } else - toAdd = m_activeAnimations[i]->clone(CCActiveAnimation::ControllingInstance).Pass(); + toAdd = m_activeAnimations[i]->clone(CCActiveAnimation::ControllingInstance); - controllerImpl->addAnimation(toAdd.Pass()); + controllerImpl->addAnimation(toAdd.release()); } } diff --git a/cc/CCLayerAnimationController.h b/cc/CCLayerAnimationController.h index 2fdb91c..f295d90 100644 --- a/cc/CCLayerAnimationController.h +++ b/cc/CCLayerAnimationController.h @@ -9,8 +9,9 @@ #include "base/basictypes.h" #include "base/hash_tables.h" -#include "base/memory/scoped_ptr.h" -#include "cc/scoped_ptr_vector.h" +#include "cc/own_ptr_vector.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { class WebTransformationMatrix; @@ -35,12 +36,12 @@ public: class CCLayerAnimationController { public: - static scoped_ptr<CCLayerAnimationController> create(CCLayerAnimationControllerClient*); + static PassOwnPtr<CCLayerAnimationController> create(CCLayerAnimationControllerClient*); virtual ~CCLayerAnimationController(); // These methods are virtual for testing. - virtual void addAnimation(scoped_ptr<CCActiveAnimation>); + virtual void addAnimation(PassOwnPtr<CCActiveAnimation>); virtual void pauseAnimation(int animationId, double timeOffset); virtual void removeAnimation(int animationId); virtual void removeAnimation(int animationId, CCActiveAnimation::TargetProperty); @@ -102,7 +103,7 @@ private: bool m_forceSync; CCLayerAnimationControllerClient* m_client; - ScopedPtrVector<CCActiveAnimation> m_activeAnimations; + OwnPtrVector<CCActiveAnimation> m_activeAnimations; DISALLOW_COPY_AND_ASSIGN(CCLayerAnimationController); }; diff --git a/cc/CCLayerAnimationControllerTest.cpp b/cc/CCLayerAnimationControllerTest.cpp index 4d9e575..b6004a0 100644 --- a/cc/CCLayerAnimationControllerTest.cpp +++ b/cc/CCLayerAnimationControllerTest.cpp @@ -24,17 +24,17 @@ void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) EXPECT_FLOAT_EQ(translateX, matrix.m41()); } -scoped_ptr<CCActiveAnimation> createActiveAnimation(scoped_ptr<CCAnimationCurve> curve, int id, CCActiveAnimation::TargetProperty property) +PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int id, CCActiveAnimation::TargetProperty property) { - return CCActiveAnimation::create(curve.Pass(), 0, id, property); + return CCActiveAnimation::create(curve, 0, id, property); } TEST(CCLayerAnimationControllerTest, syncNewAnimation) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); @@ -51,9 +51,9 @@ TEST(CCLayerAnimationControllerTest, syncNewAnimation) TEST(CCLayerAnimationControllerTest, doNotClobberStartTimes) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); @@ -80,9 +80,9 @@ TEST(CCLayerAnimationControllerTest, doNotClobberStartTimes) TEST(CCLayerAnimationControllerTest, syncPauseAndResume) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); @@ -120,9 +120,9 @@ TEST(CCLayerAnimationControllerTest, syncPauseAndResume) TEST(CCLayerAnimationControllerTest, doNotSyncFinishedAnimation) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); @@ -151,14 +151,14 @@ TEST(CCLayerAnimationControllerTest, doNotSyncFinishedAnimation) // Tests that transitioning opacity from 0 to 1 works as expected. TEST(CCLayerAnimationControllerTest, TrivialTransition) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0, dummy.opacity()); @@ -170,16 +170,16 @@ TEST(CCLayerAnimationControllerTest, TrivialTransition) // Tests animations that are waiting for a synchronized start time do not finish. TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); toAdd->setNeedsSynchronizedStartTime(true); // We should pause at the first keyframe indefinitely waiting for that animation to start. - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0, dummy.opacity()); @@ -200,13 +200,13 @@ TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfT // Tests that two queued animations affecting the same property run in sequence. TEST(CCLayerAnimationControllerTest, TrivialQueuing) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -222,18 +222,18 @@ TEST(CCLayerAnimationControllerTest, TrivialQueuing) // Tests interrupting a transition with another transition. TEST(CCLayerAnimationControllerTest, Interrupt) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0, dummy.opacity()); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity)); toAdd->setRunState(CCActiveAnimation::WaitingForNextTick, 0); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); // Since the animation was in the WaitingForNextTick state, it should start right in // this call to animate. @@ -248,14 +248,14 @@ TEST(CCLayerAnimationControllerTest, Interrupt) // Tests scheduling two animations to run together when only one property is free. TEST(CCLayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Transform)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Transform)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), 1, CCActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), 2, CCActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 2, CCActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_EQ(0, dummy.opacity()); @@ -275,14 +275,14 @@ TEST(CCLayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) // for both to finish). TEST(CCLayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(2)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Transform)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(2)), 1, CCActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity)); // Animations with id 1 should both start now. controller->animate(0, events.get()); @@ -305,15 +305,15 @@ TEST(CCLayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) // Tests scheduling an animation to start in the future. TEST(CCLayerAnimationControllerTest, ScheduleAnimation) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); toAdd->setStartTime(1); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -329,17 +329,17 @@ TEST(CCLayerAnimationControllerTest, ScheduleAnimation) // Tests scheduling an animation to start in the future that's interrupting a running animation. TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimation) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0.5, 0)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0.5, 0)), 2, CCActiveAnimation::Opacity)); toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); toAdd->setStartTime(1); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); // First 2s opacity transition should start immediately. controller->animate(0, events.get()); @@ -360,19 +360,19 @@ TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimatio // and there is yet another animation queued to start later. TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0.5, 0)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0.5, 0)), 2, CCActiveAnimation::Opacity)); toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); toAdd->setStartTime(1); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 0.75)).PassAs<CCAnimationCurve>(), 3, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 0.75)), 3, CCActiveAnimation::Opacity)); // First 2s opacity transition should start immediately. controller->animate(0, events.get()); @@ -396,14 +396,14 @@ TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimatio // Test that a looping animation loops and for the correct number of iterations. TEST(CCLayerAnimationControllerTest, TrivialLooping) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); toAdd->setIterations(3); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -432,15 +432,15 @@ TEST(CCLayerAnimationControllerTest, TrivialLooping) // Test that an infinitely looping animation does indeed go until aborted. TEST(CCLayerAnimationControllerTest, InfiniteLooping) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); const int id = 1; - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), id, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity)); toAdd->setIterations(-1); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -468,13 +468,13 @@ TEST(CCLayerAnimationControllerTest, InfiniteLooping) // Test that pausing and resuming work as expected. TEST(CCLayerAnimationControllerTest, PauseResume) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); const int id = 1; - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), id, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -503,15 +503,15 @@ TEST(CCLayerAnimationControllerTest, PauseResume) TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); const int id = 1; - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<CCAnimationCurve>(), id, CCActiveAnimation::Transform)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), id, CCActiveAnimation::Opacity)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.75)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), id, CCActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), id, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.75)), 2, CCActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -533,15 +533,15 @@ TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation) TEST(CCLayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( + OwnPtr<CCLayerAnimationController> controller( CCLayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), 0, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 0, CCActiveAnimation::Opacity)); toAdd->setNeedsSynchronizedStartTime(true); - controller->addAnimation(toAdd.Pass()); + controller->addAnimation(toAdd.release()); controller->animate(0, 0); EXPECT_TRUE(controller->hasActiveAnimation()); diff --git a/cc/CCLayerImpl.h b/cc/CCLayerImpl.h index 441ef6e..665b000 100644 --- a/cc/CCLayerImpl.h +++ b/cc/CCLayerImpl.h @@ -387,7 +387,7 @@ private: FloatRect m_updateRect; // Manages animations for this layer. - scoped_ptr<CCLayerAnimationController> m_layerAnimationController; + OwnPtr<CCLayerAnimationController> m_layerAnimationController; // Manages scrollbars for this layer OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController; diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp index fbb46f4..129fa61 100644 --- a/cc/CCLayerTreeHostTest.cpp +++ b/cc/CCLayerTreeHostTest.cpp @@ -2188,9 +2188,9 @@ public: layer->setLayerAnimationDelegate(this); // Any valid CCAnimationCurve will do here. - scoped_ptr<CCAnimationCurve> curve(CCEaseTimingFunction::create()); - scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.Pass(), 1, 1, CCActiveAnimation::Opacity)); - layer->layerAnimationController()->addAnimation(animation.Pass()); + OwnPtr<CCAnimationCurve> curve(CCEaseTimingFunction::create()); + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), 1, 1, CCActiveAnimation::Opacity)); + layer->layerAnimationController()->addAnimation(animation.release()); // We add the animation *before* attaching the layer to the tree. m_layerTreeHost->rootLayer()->addChild(layer); diff --git a/cc/CCTimingFunction.cpp b/cc/CCTimingFunction.cpp index 3a4ecd4..224a0ba 100644 --- a/cc/CCTimingFunction.cpp +++ b/cc/CCTimingFunction.cpp @@ -6,6 +6,8 @@ #include "CCTimingFunction.h" +#include <wtf/OwnPtr.h> + namespace { const double epsilon = 1e-6; } // namespace @@ -25,9 +27,9 @@ double CCTimingFunction::duration() const return 1.0; } -scoped_ptr<CCCubicBezierTimingFunction> CCCubicBezierTimingFunction::create(double x1, double y1, double x2, double y2) +PassOwnPtr<CCCubicBezierTimingFunction> CCCubicBezierTimingFunction::create(double x1, double y1, double x2, double y2) { - return make_scoped_ptr(new CCCubicBezierTimingFunction(x1, y1, x2, y2)); + return adoptPtr(new CCCubicBezierTimingFunction(x1, y1, x2, y2)); } CCCubicBezierTimingFunction::CCCubicBezierTimingFunction(double x1, double y1, double x2, double y2) @@ -45,30 +47,30 @@ float CCCubicBezierTimingFunction::getValue(double x) const return static_cast<float>(temp.solve(x, epsilon)); } -scoped_ptr<CCAnimationCurve> CCCubicBezierTimingFunction::clone() const +PassOwnPtr<CCAnimationCurve> CCCubicBezierTimingFunction::clone() const { - return make_scoped_ptr(new CCCubicBezierTimingFunction(*this)).PassAs<CCAnimationCurve>(); + return adoptPtr(new CCCubicBezierTimingFunction(*this)); } // These numbers come from http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. -scoped_ptr<CCTimingFunction> CCEaseTimingFunction::create() +PassOwnPtr<CCTimingFunction> CCEaseTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1).PassAs<CCTimingFunction>(); + return CCCubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1); } -scoped_ptr<CCTimingFunction> CCEaseInTimingFunction::create() +PassOwnPtr<CCTimingFunction> CCEaseInTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0.42, 0, 1.0, 1).PassAs<CCTimingFunction>(); + return CCCubicBezierTimingFunction::create(0.42, 0, 1.0, 1); } -scoped_ptr<CCTimingFunction> CCEaseOutTimingFunction::create() +PassOwnPtr<CCTimingFunction> CCEaseOutTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0, 0, 0.58, 1).PassAs<CCTimingFunction>(); + return CCCubicBezierTimingFunction::create(0, 0, 0.58, 1); } -scoped_ptr<CCTimingFunction> CCEaseInOutTimingFunction::create() +PassOwnPtr<CCTimingFunction> CCEaseInOutTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0.42, 0, 0.58, 1).PassAs<CCTimingFunction>(); + return CCCubicBezierTimingFunction::create(0.42, 0, 0.58, 1); } } // namespace cc diff --git a/cc/CCTimingFunction.h b/cc/CCTimingFunction.h index 993ab87..990403a 100644 --- a/cc/CCTimingFunction.h +++ b/cc/CCTimingFunction.h @@ -7,6 +7,7 @@ #include "CCAnimationCurve.h" #include "UnitBezier.h" +#include <wtf/PassOwnPtr.h> namespace cc { @@ -24,12 +25,12 @@ protected: class CCCubicBezierTimingFunction : public CCTimingFunction { public: - static scoped_ptr<CCCubicBezierTimingFunction> create(double x1, double y1, double x2, double y2); + static PassOwnPtr<CCCubicBezierTimingFunction> create(double x1, double y1, double x2, double y2); virtual ~CCCubicBezierTimingFunction(); // Partial implementation of CCFloatAnimationCurve. virtual float getValue(double time) const OVERRIDE; - virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; + virtual PassOwnPtr<CCAnimationCurve> clone() const OVERRIDE; protected: CCCubicBezierTimingFunction(double x1, double y1, double x2, double y2); @@ -39,22 +40,22 @@ protected: class CCEaseTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static PassOwnPtr<CCTimingFunction> create(); }; class CCEaseInTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static PassOwnPtr<CCTimingFunction> create(); }; class CCEaseOutTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static PassOwnPtr<CCTimingFunction> create(); }; class CCEaseInOutTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static PassOwnPtr<CCTimingFunction> create(); }; } // namespace cc diff --git a/cc/LayerChromium.cpp b/cc/LayerChromium.cpp index 55093d6..43145b6 100644 --- a/cc/LayerChromium.cpp +++ b/cc/LayerChromium.cpp @@ -657,7 +657,7 @@ void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) void LayerChromium::createRenderSurface() { ASSERT(!m_renderSurface); - m_renderSurface = make_scoped_ptr(new RenderSurfaceChromium(this)); + m_renderSurface = adoptPtr(new RenderSurfaceChromium(this)); setRenderTarget(this); } @@ -701,7 +701,7 @@ void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra m_transform = transform; } -bool LayerChromium::addAnimation(scoped_ptr <CCActiveAnimation> animation) +bool LayerChromium::addAnimation(PassOwnPtr<CCActiveAnimation> animation) { // WebCore currently assumes that accelerated animations will start soon // after the animation is added. However we cannot guarantee that if we do @@ -712,7 +712,7 @@ bool LayerChromium::addAnimation(scoped_ptr <CCActiveAnimation> animation) if (!CCSettings::acceleratedAnimationEnabled()) return false; - m_layerAnimationController->addAnimation(animation.Pass()); + m_layerAnimationController->addAnimation(animation); if (m_layerTreeHost) { m_layerTreeHost->didAddAnimation(); setNeedsCommit(); @@ -744,9 +744,9 @@ void LayerChromium::resumeAnimations(double monotonicTime) setNeedsCommit(); } -void LayerChromium::setLayerAnimationController(scoped_ptr<CCLayerAnimationController> layerAnimationController) +void LayerChromium::setLayerAnimationController(PassOwnPtr<CCLayerAnimationController> layerAnimationController) { - m_layerAnimationController = layerAnimationController.Pass(); + m_layerAnimationController = layerAnimationController; if (m_layerAnimationController) { m_layerAnimationController->setClient(this); m_layerAnimationController->setForceSync(); @@ -754,11 +754,11 @@ void LayerChromium::setLayerAnimationController(scoped_ptr<CCLayerAnimationContr setNeedsCommit(); } -scoped_ptr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationController() +PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationController() { - scoped_ptr<CCLayerAnimationController> toReturn = m_layerAnimationController.Pass(); + OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.release(); m_layerAnimationController = CCLayerAnimationController::create(this); - return toReturn.Pass(); + return toReturn.release(); } bool LayerChromium::hasActiveAnimation() const diff --git a/cc/LayerChromium.h b/cc/LayerChromium.h index dedc707..aecb520 100644 --- a/cc/LayerChromium.h +++ b/cc/LayerChromium.h @@ -197,7 +197,7 @@ public: virtual void pushPropertiesTo(CCLayerImpl*); - void clearRenderSurface() { m_renderSurface.reset(); } + void clearRenderSurface() { m_renderSurface.clear(); } RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get(); } void createRenderSurface(); @@ -249,7 +249,7 @@ public: // Set the priority of all desired textures in this layer. virtual void setTexturePriorities(const CCPriorityCalculator&) { } - bool addAnimation(scoped_ptr<CCActiveAnimation>); + bool addAnimation(PassOwnPtr<CCActiveAnimation>); void pauseAnimation(int animationId, double timeOffset); void removeAnimation(int animationId); @@ -257,8 +257,8 @@ public: void resumeAnimations(double monotonicTime); CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } - void setLayerAnimationController(scoped_ptr<CCLayerAnimationController>); - scoped_ptr<CCLayerAnimationController> releaseLayerAnimationController(); + void setLayerAnimationController(PassOwnPtr<CCLayerAnimationController>); + PassOwnPtr<CCLayerAnimationController> releaseLayerAnimationController(); void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; } @@ -323,7 +323,7 @@ private: // updated via setLayerTreeHost() if a layer moves between trees. CCLayerTreeHost* m_layerTreeHost; - scoped_ptr<CCLayerAnimationController> m_layerAnimationController; + OwnPtr<CCLayerAnimationController> m_layerAnimationController; // Layer properties. IntSize m_bounds; @@ -367,7 +367,7 @@ private: scoped_refptr<LayerChromium> m_replicaLayer; // Transient properties. - scoped_ptr<RenderSurfaceChromium> m_renderSurface; + OwnPtr<RenderSurfaceChromium> m_renderSurface; float m_drawOpacity; bool m_drawOpacityIsAnimating; diff --git a/cc/LayerChromiumTest.cpp b/cc/LayerChromiumTest.cpp index b1ca80e..867e4db 100644 --- a/cc/LayerChromiumTest.cpp +++ b/cc/LayerChromiumTest.cpp @@ -791,12 +791,12 @@ TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer) static bool addTestAnimation(LayerChromium* layer) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 0.3f, scoped_ptr<CCTimingFunction>())); - curve->addKeyframe(CCFloatKeyframe::create(1, 0.7f, scoped_ptr<CCTimingFunction>())); - scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.PassAs<CCAnimationCurve>(), 0, 0, CCActiveAnimation::Opacity)); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 0.3f, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 0.7f, nullptr)); + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), 0, 0, CCActiveAnimation::Opacity)); - return layer->addAnimation(animation.Pass()); + return layer->addAnimation(animation.release()); } TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) diff --git a/cc/TreeSynchronizerTest.cpp b/cc/TreeSynchronizerTest.cpp index abc38e6..e1c811b8 100644 --- a/cc/TreeSynchronizerTest.cpp +++ b/cc/TreeSynchronizerTest.cpp @@ -77,9 +77,9 @@ private: class FakeLayerAnimationController : public CCLayerAnimationController { public: - static scoped_ptr<FakeLayerAnimationController> create(CCLayerAnimationControllerClient* client) + static PassOwnPtr<FakeLayerAnimationController> create(CCLayerAnimationControllerClient* client) { - return make_scoped_ptr(new FakeLayerAnimationController(client)); + return adoptPtr(new FakeLayerAnimationController(client)); } bool synchronizedAnimations() const { return m_synchronizedAnimations; } @@ -392,7 +392,7 @@ TEST(TreeSynchronizerTest, synchronizeAnimations) scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); FakeLayerAnimationControllerClient dummy; - layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy).PassAs<CCLayerAnimationController>()); + layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy)); EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); diff --git a/cc/test/CCAnimationTestCommon.cpp b/cc/test/CCAnimationTestCommon.cpp index 884b9fe..6b7801c 100644 --- a/cc/test/CCAnimationTestCommon.cpp +++ b/cc/test/CCAnimationTestCommon.cpp @@ -19,38 +19,38 @@ namespace { template <class Target> void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity, bool useTimingFunction) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); if (duration > 0) - curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, useTimingFunction ? scoped_ptr<CCTimingFunction>(): CCEaseTimingFunction::create())); - curve->addKeyframe(CCFloatKeyframe::create(duration, endOpacity, scoped_ptr<cc::CCTimingFunction>())); + curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, useTimingFunction ? nullptr : CCEaseTimingFunction::create())); + curve->addKeyframe(CCFloatKeyframe::create(duration, endOpacity, nullptr)); - scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.PassAs<CCAnimationCurve>(), 0, 0, CCActiveAnimation::Opacity)); + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), 0, 0, CCActiveAnimation::Opacity)); animation->setNeedsSynchronizedStartTime(true); - target.addAnimation(animation.Pass()); + target.addAnimation(animation.release()); } template <class Target> void addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY) { static int id = 0; - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); if (duration > 0) { WebKit::WebTransformOperations startOperations; startOperations.appendTranslate(deltaX, deltaY, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, startOperations, scoped_ptr<cc::CCTimingFunction>())); + curve->addKeyframe(CCTransformKeyframe::create(0, startOperations, nullptr)); } WebKit::WebTransformOperations operations; operations.appendTranslate(deltaX, deltaY, 0); - curve->addKeyframe(CCTransformKeyframe::create(duration, operations, scoped_ptr<cc::CCTimingFunction>())); + curve->addKeyframe(CCTransformKeyframe::create(duration, operations, nullptr)); - scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.PassAs<CCAnimationCurve>(), id++, 0, CCActiveAnimation::Transform)); + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), id++, 0, CCActiveAnimation::Transform)); animation->setNeedsSynchronizedStartTime(true); - target.addAnimation(animation.Pass()); + target.addAnimation(animation.release()); } } // namespace @@ -81,9 +81,9 @@ float FakeFloatAnimationCurve::getValue(double now) const return 0; } -scoped_ptr<cc::CCAnimationCurve> FakeFloatAnimationCurve::clone() const +PassOwnPtr<cc::CCAnimationCurve> FakeFloatAnimationCurve::clone() const { - return make_scoped_ptr(new FakeFloatAnimationCurve).PassAs<cc::CCAnimationCurve>(); + return adoptPtr(new FakeFloatAnimationCurve); } FakeTransformTransition::FakeTransformTransition(double duration) @@ -105,9 +105,9 @@ WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c return WebKit::WebTransformationMatrix(); } -scoped_ptr<cc::CCAnimationCurve> FakeTransformTransition::clone() const +PassOwnPtr<cc::CCAnimationCurve> FakeTransformTransition::clone() const { - return make_scoped_ptr(new FakeTransformTransition(*this)).PassAs<cc::CCAnimationCurve>(); + return adoptPtr(new FakeTransformTransition(*this)); } @@ -169,9 +169,9 @@ const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans return m_transform; } -scoped_ptr<cc::CCAnimationCurve> FakeFloatTransition::clone() const +PassOwnPtr<cc::CCAnimationCurve> FakeFloatTransition::clone() const { - return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::CCAnimationCurve>(); + return adoptPtr(new FakeFloatTransition(*this)); } void addOpacityTransitionToController(cc::CCLayerAnimationController& controller, double duration, float startOpacity, float endOpacity, bool useTimingFunction) diff --git a/cc/test/CCAnimationTestCommon.h b/cc/test/CCAnimationTestCommon.h index a768930..6ebf199 100644 --- a/cc/test/CCAnimationTestCommon.h +++ b/cc/test/CCAnimationTestCommon.h @@ -10,6 +10,8 @@ #include "CCLayerAnimationController.h" #include "IntSize.h" +#include <wtf/OwnPtr.h> + namespace cc { class CCLayerImpl; class LayerChromium; @@ -25,7 +27,7 @@ public: virtual double duration() const OVERRIDE; virtual float getValue(double now) const OVERRIDE; - virtual scoped_ptr<cc::CCAnimationCurve> clone() const OVERRIDE; + virtual PassOwnPtr<cc::CCAnimationCurve> clone() const OVERRIDE; private: double m_duration; @@ -39,7 +41,7 @@ public: virtual double duration() const OVERRIDE; virtual WebKit::WebTransformationMatrix getValue(double time) const OVERRIDE; - virtual scoped_ptr<cc::CCAnimationCurve> clone() const OVERRIDE; + virtual PassOwnPtr<cc::CCAnimationCurve> clone() const OVERRIDE; private: double m_duration; @@ -53,7 +55,7 @@ public: virtual double duration() const OVERRIDE; virtual float getValue(double time) const OVERRIDE; - virtual scoped_ptr<cc::CCAnimationCurve> clone() const OVERRIDE; + virtual PassOwnPtr<cc::CCAnimationCurve> clone() const OVERRIDE; private: double m_duration; diff --git a/webkit/compositor_bindings/WebAnimationCurveCommon.cpp b/webkit/compositor_bindings/WebAnimationCurveCommon.cpp index 2cd5ac2..d13750e 100644 --- a/webkit/compositor_bindings/WebAnimationCurveCommon.cpp +++ b/webkit/compositor_bindings/WebAnimationCurveCommon.cpp @@ -8,9 +8,12 @@ #include "CCTimingFunction.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + namespace WebKit { -scoped_ptr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType type) +PassOwnPtr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType type) { switch (type) { case WebAnimationCurve::TimingFunctionTypeEase: @@ -22,9 +25,9 @@ scoped_ptr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingF case WebAnimationCurve::TimingFunctionTypeEaseInOut: return cc::CCEaseInOutTimingFunction::create(); case WebAnimationCurve::TimingFunctionTypeLinear: - return scoped_ptr<cc::CCTimingFunction>(); + return nullptr; } - return scoped_ptr<cc::CCTimingFunction>(); + return nullptr; } } // namespace WebKit diff --git a/webkit/compositor_bindings/WebAnimationCurveCommon.h b/webkit/compositor_bindings/WebAnimationCurveCommon.h index 1278830..2df8b5f 100644 --- a/webkit/compositor_bindings/WebAnimationCurveCommon.h +++ b/webkit/compositor_bindings/WebAnimationCurveCommon.h @@ -5,7 +5,6 @@ #ifndef WebAnimationCurveCommon_h #define WebAnimationCurveCommon_h -#include "base/memory/scoped_ptr.h" #include <public/WebAnimationCurve.h> #include <wtf/Forward.h> @@ -14,7 +13,7 @@ class CCTimingFunction; } namespace WebKit { -scoped_ptr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType); +PassOwnPtr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType); } #endif // WebAnimationCurveCommon_h diff --git a/webkit/compositor_bindings/WebAnimationImpl.cpp b/webkit/compositor_bindings/WebAnimationImpl.cpp index cf401e9..b915082 100644 --- a/webkit/compositor_bindings/WebAnimationImpl.cpp +++ b/webkit/compositor_bindings/WebAnimationImpl.cpp @@ -13,6 +13,7 @@ #include <public/WebAnimation.h> #include <public/WebAnimationCurve.h> #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> using cc::CCActiveAnimation; @@ -33,7 +34,7 @@ WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp groupId = nextGroupId++; WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); - scoped_ptr<cc::CCAnimationCurve> curve; + OwnPtr<cc::CCAnimationCurve> curve; switch (curveType) { case WebAnimationCurve::AnimationCurveTypeFloat: { const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const WebFloatAnimationCurveImpl*>(&webCurve); @@ -46,7 +47,7 @@ WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp break; } } - m_animation = CCActiveAnimation::create(curve.Pass(), animationId, groupId, static_cast<cc::CCActiveAnimation::TargetProperty>(targetProperty)); + m_animation = CCActiveAnimation::create(curve.release(), animationId, groupId, static_cast<cc::CCActiveAnimation::TargetProperty>(targetProperty)); } WebAnimationImpl::~WebAnimationImpl() @@ -103,11 +104,11 @@ void WebAnimationImpl::setAlternatesDirection(bool alternates) m_animation->setAlternatesDirection(alternates); } -scoped_ptr<cc::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() +PassOwnPtr<cc::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() { - scoped_ptr<cc::CCActiveAnimation> toReturn(m_animation->clone(cc::CCActiveAnimation::NonControllingInstance)); + OwnPtr<cc::CCActiveAnimation> toReturn(m_animation->clone(cc::CCActiveAnimation::NonControllingInstance)); toReturn->setNeedsSynchronizedStartTime(true); - return toReturn.Pass(); + return toReturn.release(); } } // namespace WebKit diff --git a/webkit/compositor_bindings/WebAnimationImpl.h b/webkit/compositor_bindings/WebAnimationImpl.h index d15eeb3..a4abfc9 100644 --- a/webkit/compositor_bindings/WebAnimationImpl.h +++ b/webkit/compositor_bindings/WebAnimationImpl.h @@ -5,7 +5,6 @@ #ifndef WebAnimationImpl_h #define WebAnimationImpl_h -#include "base/memory/scoped_ptr.h" #include <public/WebAnimation.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -33,10 +32,9 @@ public: virtual bool alternatesDirection() const OVERRIDE; virtual void setAlternatesDirection(bool) OVERRIDE; - scoped_ptr<cc::CCActiveAnimation> cloneToCCAnimation(); - + PassOwnPtr<cc::CCActiveAnimation> cloneToCCAnimation(); private: - scoped_ptr<cc::CCActiveAnimation> m_animation; + OwnPtr<cc::CCActiveAnimation> m_animation; }; } diff --git a/webkit/compositor_bindings/WebFloatAnimationCurveImpl.cpp b/webkit/compositor_bindings/WebFloatAnimationCurveImpl.cpp index 8bce2ce..15351e1 100644 --- a/webkit/compositor_bindings/WebFloatAnimationCurveImpl.cpp +++ b/webkit/compositor_bindings/WebFloatAnimationCurveImpl.cpp @@ -10,6 +10,8 @@ #include "CCKeyframedAnimationCurve.h" #include "CCTimingFunction.h" #include "WebAnimationCurveCommon.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { @@ -44,7 +46,7 @@ void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFun void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1, double y1, double x2, double y2) { - m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.value, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTimingFunction>())); + m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.value, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); } float WebFloatAnimationCurveImpl::getValue(double time) const @@ -52,7 +54,7 @@ float WebFloatAnimationCurveImpl::getValue(double time) const return m_curve->getValue(time); } -scoped_ptr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationCurve() const +PassOwnPtr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationCurve() const { return m_curve->clone(); } diff --git a/webkit/compositor_bindings/WebFloatAnimationCurveImpl.h b/webkit/compositor_bindings/WebFloatAnimationCurveImpl.h index 757d3e6..be6d80c 100644 --- a/webkit/compositor_bindings/WebFloatAnimationCurveImpl.h +++ b/webkit/compositor_bindings/WebFloatAnimationCurveImpl.h @@ -5,8 +5,9 @@ #ifndef WebFloatAnimationCurveImpl_h #define WebFloatAnimationCurveImpl_h -#include "base/memory/scoped_ptr.h" #include <public/WebFloatAnimationCurve.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace cc { class CCAnimationCurve; @@ -30,10 +31,10 @@ public: virtual float getValue(double time) const OVERRIDE; - scoped_ptr<cc::CCAnimationCurve> cloneToCCAnimationCurve() const; + PassOwnPtr<cc::CCAnimationCurve> cloneToCCAnimationCurve() const; private: - scoped_ptr<cc::CCKeyframedFloatAnimationCurve> m_curve; + OwnPtr<cc::CCKeyframedFloatAnimationCurve> m_curve; }; } diff --git a/webkit/compositor_bindings/WebFloatAnimationCurveTest.cpp b/webkit/compositor_bindings/WebFloatAnimationCurveTest.cpp index 8cb12e5..c358886e 100644 --- a/webkit/compositor_bindings/WebFloatAnimationCurveTest.cpp +++ b/webkit/compositor_bindings/WebFloatAnimationCurveTest.cpp @@ -119,7 +119,7 @@ TEST(WebFloatAnimationCurveTest, EaseTimingFunction) curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEase); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -146,7 +146,7 @@ TEST(WebFloatAnimationCurveTest, EaseInTimingFunction) curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseIn); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseInTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseInTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -160,7 +160,7 @@ TEST(WebFloatAnimationCurveTest, EaseOutTimingFunction) curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseOut); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseOutTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -174,7 +174,7 @@ TEST(WebFloatAnimationCurveTest, EaseInOutTimingFunction) curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseInOut); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseInOutTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseInOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -192,7 +192,7 @@ TEST(WebFloatAnimationCurveTest, CustomBezierTimingFunction) curve->add(WebFloatKeyframe(0, 0), x1, y1, x2, y2); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -206,7 +206,7 @@ TEST(WebFloatAnimationCurveTest, DefaultTimingFunction) curve->add(WebFloatKeyframe(0, 0)); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); diff --git a/webkit/compositor_bindings/WebTransformAnimationCurveImpl.cpp b/webkit/compositor_bindings/WebTransformAnimationCurveImpl.cpp index e6b732f..dae0bd1 100644 --- a/webkit/compositor_bindings/WebTransformAnimationCurveImpl.cpp +++ b/webkit/compositor_bindings/WebTransformAnimationCurveImpl.cpp @@ -45,7 +45,7 @@ void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, double x1, double y1, double x2, double y2) { - m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe.value, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTimingFunction>())); + m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe.value, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); } WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) const @@ -53,7 +53,7 @@ WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co return m_curve->getValue(time); } -scoped_ptr<cc::CCAnimationCurve> WebTransformAnimationCurveImpl::cloneToCCAnimationCurve() const +PassOwnPtr<cc::CCAnimationCurve> WebTransformAnimationCurveImpl::cloneToCCAnimationCurve() const { return m_curve->clone(); } diff --git a/webkit/compositor_bindings/WebTransformAnimationCurveImpl.h b/webkit/compositor_bindings/WebTransformAnimationCurveImpl.h index 88f1c3e..8631ef9 100644 --- a/webkit/compositor_bindings/WebTransformAnimationCurveImpl.h +++ b/webkit/compositor_bindings/WebTransformAnimationCurveImpl.h @@ -5,8 +5,9 @@ #ifndef WebTransformAnimationCurveImpl_h #define WebTransformAnimationCurveImpl_h -#include "base/memory/scoped_ptr.h" #include <public/WebTransformAnimationCurve.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace cc { class CCAnimationCurve; @@ -30,10 +31,10 @@ public: virtual WebTransformationMatrix getValue(double time) const OVERRIDE; - scoped_ptr<cc::CCAnimationCurve> cloneToCCAnimationCurve() const; + PassOwnPtr<cc::CCAnimationCurve> cloneToCCAnimationCurve() const; private: - scoped_ptr<cc::CCKeyframedTransformAnimationCurve> m_curve; + OwnPtr<cc::CCKeyframedTransformAnimationCurve> m_curve; }; } diff --git a/webkit/compositor_bindings/WebTransformAnimationCurveTest.cpp b/webkit/compositor_bindings/WebTransformAnimationCurveTest.cpp index fe0ab80..09021c7 100644 --- a/webkit/compositor_bindings/WebTransformAnimationCurveTest.cpp +++ b/webkit/compositor_bindings/WebTransformAnimationCurveTest.cpp @@ -156,7 +156,7 @@ TEST(WebTransformAnimationCurveTest, EaseTimingFunction) curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEase); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -191,7 +191,7 @@ TEST(WebTransformAnimationCurveTest, EaseInTimingFunction) curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseIn); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseInTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseInTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -209,7 +209,7 @@ TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction) curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseOut); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseOutTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -227,7 +227,7 @@ TEST(WebTransformAnimationCurveTest, EaseInOutTimingFunction) curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseInOutTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseInOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -249,7 +249,7 @@ TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction) curve->add(WebTransformKeyframe(0, operations1), x1, y1, x2, y2); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -267,7 +267,7 @@ TEST(WebTransformAnimationCurveTest, DefaultTimingFunction) curve->add(WebTransformKeyframe(0, operations1)); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); + OwnPtr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); |