diff options
291 files changed, 7949 insertions, 7949 deletions
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h index 61a269f..79b9008 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -30,7 +30,7 @@ class NonFrontendDataTypeController; class UIModelWorker; } namespace cc { -class CCCompletionEvent; +class CompletionEvent; } namespace chromeos { class AudioMixerAlsa; @@ -171,7 +171,7 @@ class BASE_EXPORT ThreadRestrictions { friend class ::HistogramSynchronizer; friend class ::ScopedAllowWaitForLegacyWebViewApi; friend class ::TestingAutomationProvider; - friend class cc::CCCompletionEvent; + friend class cc::CompletionEvent; friend class remoting::AutoThread; friend class SequencedWorkerPool; friend class SimpleThread; diff --git a/cc/active_animation.cc b/cc/active_animation.cc index 565553b..9721bdb 100644 --- a/cc/active_animation.cc +++ b/cc/active_animation.cc @@ -25,7 +25,7 @@ static const char* const s_runStateNames[] = { "Aborted" }; -COMPILE_ASSERT(static_cast<int>(cc::CCActiveAnimation::RunStateEnumSize) == arraysize(s_runStateNames), RunState_names_match_enum); +COMPILE_ASSERT(static_cast<int>(cc::ActiveAnimation::RunStateEnumSize) == arraysize(s_runStateNames), RunState_names_match_enum); // This should match the TargetProperty enum. static const char* const s_targetPropertyNames[] = { @@ -33,18 +33,18 @@ static const char* const s_targetPropertyNames[] = { "Opacity" }; -COMPILE_ASSERT(static_cast<int>(cc::CCActiveAnimation::TargetPropertyEnumSize) == arraysize(s_targetPropertyNames), TargetProperty_names_match_enum); +COMPILE_ASSERT(static_cast<int>(cc::ActiveAnimation::TargetPropertyEnumSize) == arraysize(s_targetPropertyNames), TargetProperty_names_match_enum); } // namespace namespace cc { -scoped_ptr<CCActiveAnimation> CCActiveAnimation::create(scoped_ptr<CCAnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) +scoped_ptr<ActiveAnimation> ActiveAnimation::create(scoped_ptr<AnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) { - return make_scoped_ptr(new CCActiveAnimation(curve.Pass(), animationId, groupId, targetProperty)); + return make_scoped_ptr(new ActiveAnimation(curve.Pass(), animationId, groupId, targetProperty)); } -CCActiveAnimation::CCActiveAnimation(scoped_ptr<CCAnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) +ActiveAnimation::ActiveAnimation(scoped_ptr<AnimationCurve> curve, int animationId, int groupId, TargetProperty targetProperty) : m_curve(curve.Pass()) , m_id(animationId) , m_group(groupId) @@ -62,13 +62,13 @@ CCActiveAnimation::CCActiveAnimation(scoped_ptr<CCAnimationCurve> curve, int ani { } -CCActiveAnimation::~CCActiveAnimation() +ActiveAnimation::~ActiveAnimation() { if (m_runState == Running || m_runState == Paused) setRunState(Aborted, 0); } -void CCActiveAnimation::setRunState(RunState runState, double monotonicTime) +void ActiveAnimation::setRunState(RunState runState, double monotonicTime) { if (m_suspended) return; @@ -81,7 +81,7 @@ void CCActiveAnimation::setRunState(RunState runState, double monotonicTime) || m_runState == WaitingForStartTime; if (isWaitingToStart && runState == Running) - TRACE_EVENT_ASYNC_BEGIN1("cc", "CCActiveAnimation", this, "Name", TRACE_STR_COPY(nameBuffer)); + TRACE_EVENT_ASYNC_BEGIN1("cc", "ActiveAnimation", this, "Name", TRACE_STR_COPY(nameBuffer)); bool wasFinished = isFinished(); @@ -96,27 +96,27 @@ void CCActiveAnimation::setRunState(RunState runState, double monotonicTime) const char* newRunStateName = s_runStateNames[runState]; if (!wasFinished && isFinished()) - TRACE_EVENT_ASYNC_END0("cc", "CCActiveAnimation", this); + TRACE_EVENT_ASYNC_END0("cc", "ActiveAnimation", this); char stateBuffer[256]; base::snprintf(stateBuffer, sizeof(stateBuffer), "%s->%s", oldRunStateName, newRunStateName); - TRACE_EVENT_INSTANT2("cc", "CCLayerAnimationController::setRunState", "Name", TRACE_STR_COPY(nameBuffer), "State", TRACE_STR_COPY(stateBuffer)); + TRACE_EVENT_INSTANT2("cc", "LayerAnimationController::setRunState", "Name", TRACE_STR_COPY(nameBuffer), "State", TRACE_STR_COPY(stateBuffer)); } -void CCActiveAnimation::suspend(double monotonicTime) +void ActiveAnimation::suspend(double monotonicTime) { setRunState(Paused, monotonicTime); m_suspended = true; } -void CCActiveAnimation::resume(double monotonicTime) +void ActiveAnimation::resume(double monotonicTime) { m_suspended = false; setRunState(Running, monotonicTime); } -bool CCActiveAnimation::isFinishedAt(double monotonicTime) const +bool ActiveAnimation::isFinishedAt(double monotonicTime) const { if (isFinished()) return true; @@ -129,7 +129,7 @@ bool CCActiveAnimation::isFinishedAt(double monotonicTime) const && m_iterations * m_curve->duration() <= monotonicTime - startTime() - m_totalPausedTime; } -double CCActiveAnimation::trimTimeToCurrentIteration(double monotonicTime) const +double ActiveAnimation::trimTimeToCurrentIteration(double monotonicTime) const { double trimmed = monotonicTime + m_timeOffset; @@ -177,14 +177,14 @@ double CCActiveAnimation::trimTimeToCurrentIteration(double monotonicTime) const return trimmed; } -scoped_ptr<CCActiveAnimation> CCActiveAnimation::clone(InstanceType instanceType) const +scoped_ptr<ActiveAnimation> ActiveAnimation::clone(InstanceType instanceType) const { return cloneAndInitialize(instanceType, m_runState, m_startTime); } -scoped_ptr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType instanceType, RunState initialRunState, double startTime) const +scoped_ptr<ActiveAnimation> ActiveAnimation::cloneAndInitialize(InstanceType instanceType, RunState initialRunState, double startTime) const { - scoped_ptr<CCActiveAnimation> toReturn(new CCActiveAnimation(m_curve->clone(), m_id, m_group, m_targetProperty)); + scoped_ptr<ActiveAnimation> toReturn(new ActiveAnimation(m_curve->clone(), m_id, m_group, m_targetProperty)); toReturn->m_runState = initialRunState; toReturn->m_iterations = m_iterations; toReturn->m_startTime = startTime; @@ -196,10 +196,10 @@ scoped_ptr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType return toReturn.Pass(); } -void CCActiveAnimation::pushPropertiesTo(CCActiveAnimation* other) const +void ActiveAnimation::pushPropertiesTo(ActiveAnimation* other) const { // Currently, we only push changes due to pausing and resuming animations on the main thread. - if (m_runState == CCActiveAnimation::Paused || other->m_runState == CCActiveAnimation::Paused) { + if (m_runState == ActiveAnimation::Paused || other->m_runState == ActiveAnimation::Paused) { other->m_runState = m_runState; other->m_pauseTime = m_pauseTime; other->m_totalPausedTime = m_totalPausedTime; diff --git a/cc/active_animation.h b/cc/active_animation.h index b8d3607..01f3a27 100644 --- a/cc/active_animation.h +++ b/cc/active_animation.h @@ -10,12 +10,12 @@ namespace cc { -class CCAnimationCurve; +class AnimationCurve; -// A CCActiveAnimation, contains all the state required to play a CCAnimationCurve. +// An ActiveAnimation, contains all the state required to play an AnimationCurve. // Specifically, the affected property, the run state (paused, finished, etc.), // loop count, last pause time, and the total time spent paused. -class CCActiveAnimation { +class ActiveAnimation { public: // Animations begin in one of the 'waiting' states. Animations waiting for the next tick // will start the next time the controller animates. Animations waiting for target @@ -46,9 +46,9 @@ public: TargetPropertyEnumSize }; - static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty); + static scoped_ptr<ActiveAnimation> create(scoped_ptr<AnimationCurve>, int animationId, int groupId, TargetProperty); - virtual ~CCActiveAnimation(); + virtual ~ActiveAnimation(); int id() const { return m_id; } int group() const { return m_group; } @@ -82,8 +82,8 @@ public: || m_runState == Aborted || m_runState == WaitingForDeletion; } - CCAnimationCurve* curve() { return m_curve.get(); } - const CCAnimationCurve* curve() const { return m_curve.get(); } + AnimationCurve* curve() { return m_curve.get(); } + const AnimationCurve* curve() const { return m_curve.get(); } // If this is true, even if the animation is running, it will not be tickable until // it is given a start time. This is true for animations running on the main thread. @@ -99,16 +99,16 @@ public: NonControllingInstance }; - scoped_ptr<CCActiveAnimation> clone(InstanceType) const; - scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const; + scoped_ptr<ActiveAnimation> clone(InstanceType) const; + scoped_ptr<ActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const; bool isControllingInstance() const { return m_isControllingInstance; } - void pushPropertiesTo(CCActiveAnimation*) const; + void pushPropertiesTo(ActiveAnimation*) const; private: - CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty); + ActiveAnimation(scoped_ptr<AnimationCurve>, int animationId, int groupId, TargetProperty); - scoped_ptr<CCAnimationCurve> m_curve; + scoped_ptr<AnimationCurve> m_curve; // IDs are not necessarily unique. int m_id; @@ -146,14 +146,14 @@ private: // Animations lead dual lives. An active animation will be conceptually owned by // two controllers, one on the impl thread and one on the main. In reality, there - // will be two separate CCActiveAnimation instances for the same animation. They + // will be two separate ActiveAnimation instances for the same animation. They // will have the same group id and the same target property (these two values // uniquely identify an animation). The instance on the impl thread is the instance // that ultimately controls the values of the animating layer and so we will refer // to it as the 'controlling instance'. bool m_isControllingInstance; - DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation); + DISALLOW_COPY_AND_ASSIGN(ActiveAnimation); }; } // namespace cc diff --git a/cc/active_animation_unittest.cc b/cc/active_animation_unittest.cc index a70e5b0..919f2a2 100644 --- a/cc/active_animation_unittest.cc +++ b/cc/active_animation_unittest.cc @@ -15,47 +15,47 @@ using namespace cc; namespace { -scoped_ptr<CCActiveAnimation> createActiveAnimation(int iterations, double duration) +scoped_ptr<ActiveAnimation> createActiveAnimation(int iterations, double duration) { - scoped_ptr<CCActiveAnimation> toReturn(CCActiveAnimation::create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)).PassAs<CCAnimationCurve>(), 0, 1, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> toReturn(ActiveAnimation::create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)).PassAs<AnimationCurve>(), 0, 1, ActiveAnimation::Opacity)); toReturn->setIterations(iterations); return toReturn.Pass(); } -scoped_ptr<CCActiveAnimation> createActiveAnimation(int iterations) +scoped_ptr<ActiveAnimation> createActiveAnimation(int iterations) { return createActiveAnimation(iterations, 1); } -TEST(CCActiveAnimationTest, TrimTimeZeroIterations) +TEST(ActiveAnimationTest, TrimTimeZeroIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); } -TEST(CCActiveAnimationTest, TrimTimeOneIteration) +TEST(ActiveAnimationTest, TrimTimeOneIteration) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); EXPECT_EQ(1, anim->trimTimeToCurrentIteration(2)); } -TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) +TEST(ActiveAnimationTest, TrimTimeInfiniteIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1.5)); } -TEST(CCActiveAnimationTest, TrimTimeAlternating) +TEST(ActiveAnimationTest, TrimTimeAlternating) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(-1)); anim->setAlternatesDirection(true); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); @@ -63,9 +63,9 @@ TEST(CCActiveAnimationTest, TrimTimeAlternating) EXPECT_EQ(0.75, anim->trimTimeToCurrentIteration(1.25)); } -TEST(CCActiveAnimationTest, TrimTimeStartTime) +TEST(ActiveAnimationTest, TrimTimeStartTime) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); anim->setStartTime(4); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(4)); @@ -74,9 +74,9 @@ TEST(CCActiveAnimationTest, TrimTimeStartTime) EXPECT_EQ(1, anim->trimTimeToCurrentIteration(6)); } -TEST(CCActiveAnimationTest, TrimTimeTimeOffset) +TEST(ActiveAnimationTest, TrimTimeTimeOffset) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); anim->setTimeOffset(4); anim->setStartTime(4); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); @@ -85,23 +85,23 @@ TEST(CCActiveAnimationTest, TrimTimeTimeOffset) EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); } -TEST(CCActiveAnimationTest, TrimTimePauseResume) +TEST(ActiveAnimationTest, TrimTimePauseResume) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); - anim->setRunState(CCActiveAnimation::Paused, 0.5); + anim->setRunState(ActiveAnimation::Paused, 0.5); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); - anim->setRunState(CCActiveAnimation::Running, 1024); + anim->setRunState(ActiveAnimation::Running, 1024); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); } -TEST(CCActiveAnimationTest, TrimTimeSuspendResume) +TEST(ActiveAnimationTest, TrimTimeSuspendResume) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); anim->suspend(0.5); @@ -111,111 +111,111 @@ TEST(CCActiveAnimationTest, TrimTimeSuspendResume) EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); } -TEST(CCActiveAnimationTest, TrimTimeZeroDuration) +TEST(ActiveAnimationTest, TrimTimeZeroDuration) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0, 0)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(0, 0)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); } -TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations) +TEST(ActiveAnimationTest, IsFinishedAtZeroIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(0)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinishedAt(-1)); EXPECT_TRUE(anim->isFinishedAt(0)); EXPECT_TRUE(anim->isFinishedAt(1)); } -TEST(CCActiveAnimationTest, IsFinishedAtOneIteration) +TEST(ActiveAnimationTest, IsFinishedAtOneIteration) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinishedAt(-1)); EXPECT_FALSE(anim->isFinishedAt(0)); EXPECT_TRUE(anim->isFinishedAt(1)); EXPECT_TRUE(anim->isFinishedAt(2)); } -TEST(CCActiveAnimationTest, IsFinishedAtInfiniteIterations) +TEST(ActiveAnimationTest, IsFinishedAtInfiniteIterations) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(-1)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinishedAt(0)); EXPECT_FALSE(anim->isFinishedAt(0.5)); EXPECT_FALSE(anim->isFinishedAt(1)); EXPECT_FALSE(anim->isFinishedAt(1.5)); } -TEST(CCActiveAnimationTest, IsFinishedAtNotRunning) +TEST(ActiveAnimationTest, IsFinishedAtNotRunning) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(0)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_TRUE(anim->isFinishedAt(0)); - anim->setRunState(CCActiveAnimation::Paused, 0); + anim->setRunState(ActiveAnimation::Paused, 0); EXPECT_FALSE(anim->isFinishedAt(0)); - anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); + anim->setRunState(ActiveAnimation::WaitingForNextTick, 0); EXPECT_FALSE(anim->isFinishedAt(0)); - anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); + anim->setRunState(ActiveAnimation::WaitingForTargetAvailability, 0); EXPECT_FALSE(anim->isFinishedAt(0)); - anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + anim->setRunState(ActiveAnimation::WaitingForStartTime, 0); EXPECT_FALSE(anim->isFinishedAt(0)); - anim->setRunState(CCActiveAnimation::Finished, 0); + anim->setRunState(ActiveAnimation::Finished, 0); EXPECT_TRUE(anim->isFinishedAt(0)); - anim->setRunState(CCActiveAnimation::Aborted, 0); + anim->setRunState(ActiveAnimation::Aborted, 0); EXPECT_TRUE(anim->isFinishedAt(0)); } -TEST(CCActiveAnimationTest, IsFinished) +TEST(ActiveAnimationTest, IsFinished) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); - anim->setRunState(CCActiveAnimation::Running, 0); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(ActiveAnimation::Running, 0); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::Paused, 0); + anim->setRunState(ActiveAnimation::Paused, 0); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); + anim->setRunState(ActiveAnimation::WaitingForNextTick, 0); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); + anim->setRunState(ActiveAnimation::WaitingForTargetAvailability, 0); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + anim->setRunState(ActiveAnimation::WaitingForStartTime, 0); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::Finished, 0); + anim->setRunState(ActiveAnimation::Finished, 0); EXPECT_TRUE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::Aborted, 0); + anim->setRunState(ActiveAnimation::Aborted, 0); EXPECT_TRUE(anim->isFinished()); } -TEST(CCActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime) +TEST(ActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); - anim->setRunState(CCActiveAnimation::Running, 2); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(ActiveAnimation::Running, 2); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::Paused, 2); + anim->setRunState(ActiveAnimation::Paused, 2); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::WaitingForNextTick, 2); + anim->setRunState(ActiveAnimation::WaitingForNextTick, 2); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 2); + anim->setRunState(ActiveAnimation::WaitingForTargetAvailability, 2); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::WaitingForStartTime, 2); + anim->setRunState(ActiveAnimation::WaitingForStartTime, 2); EXPECT_FALSE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::Finished, 0); + anim->setRunState(ActiveAnimation::Finished, 0); EXPECT_TRUE(anim->isFinished()); - anim->setRunState(CCActiveAnimation::Aborted, 0); + anim->setRunState(ActiveAnimation::Aborted, 0); EXPECT_TRUE(anim->isFinished()); } -TEST(CCActiveAnimationTest, RunStateChangesIgnoredWhileSuspended) +TEST(ActiveAnimationTest, RunStateChangesIgnoredWhileSuspended) { - scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); + scoped_ptr<ActiveAnimation> anim(createActiveAnimation(1)); anim->suspend(0); - EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); - anim->setRunState(CCActiveAnimation::Running, 0); - EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); + EXPECT_EQ(ActiveAnimation::Paused, anim->runState()); + anim->setRunState(ActiveAnimation::Running, 0); + EXPECT_EQ(ActiveAnimation::Paused, anim->runState()); anim->resume(0); - anim->setRunState(CCActiveAnimation::Running, 0); - EXPECT_EQ(CCActiveAnimation::Running, anim->runState()); + anim->setRunState(ActiveAnimation::Running, 0); + EXPECT_EQ(ActiveAnimation::Running, anim->runState()); } } // namespace diff --git a/cc/animation_curve.cc b/cc/animation_curve.cc index c2c3dc0..eaeaa85 100644 --- a/cc/animation_curve.cc +++ b/cc/animation_curve.cc @@ -10,24 +10,24 @@ namespace cc { -const CCFloatAnimationCurve* CCAnimationCurve::toFloatAnimationCurve() const +const FloatAnimationCurve* AnimationCurve::toFloatAnimationCurve() const { - DCHECK(type() == CCAnimationCurve::Float); - return static_cast<const CCFloatAnimationCurve*>(this); + DCHECK(type() == AnimationCurve::Float); + return static_cast<const FloatAnimationCurve*>(this); } -CCAnimationCurve::Type CCFloatAnimationCurve::type() const +AnimationCurve::Type FloatAnimationCurve::type() const { return Float; } -const CCTransformAnimationCurve* CCAnimationCurve::toTransformAnimationCurve() const +const TransformAnimationCurve* AnimationCurve::toTransformAnimationCurve() const { - DCHECK(type() == CCAnimationCurve::Transform); - return static_cast<const CCTransformAnimationCurve*>(this); + DCHECK(type() == AnimationCurve::Transform); + return static_cast<const TransformAnimationCurve*>(this); } -CCAnimationCurve::Type CCTransformAnimationCurve::type() const +AnimationCurve::Type TransformAnimationCurve::type() const { return Transform; } diff --git a/cc/animation_curve.h b/cc/animation_curve.h index 7ed6e7a..50dde07 100644 --- a/cc/animation_curve.h +++ b/cc/animation_curve.h @@ -10,44 +10,44 @@ namespace cc { -class CCFloatAnimationCurve; -class CCTransformAnimationCurve; +class FloatAnimationCurve; +class TransformAnimationCurve; class IntSize; class TransformOperations; // An animation curve is a function that returns a value given a time. // There are currently only two types of curve, float and transform. -class CCAnimationCurve { +class AnimationCurve { public: enum Type { Float, Transform }; - virtual ~CCAnimationCurve() { } + virtual ~AnimationCurve() { } virtual double duration() const = 0; virtual Type type() const = 0; - virtual scoped_ptr<CCAnimationCurve> clone() const = 0; + virtual scoped_ptr<AnimationCurve> clone() const = 0; - const CCFloatAnimationCurve* toFloatAnimationCurve() const; - const CCTransformAnimationCurve* toTransformAnimationCurve() const; + const FloatAnimationCurve* toFloatAnimationCurve() const; + const TransformAnimationCurve* toTransformAnimationCurve() const; }; -class CCFloatAnimationCurve : public CCAnimationCurve { +class FloatAnimationCurve : public AnimationCurve { public: - virtual ~CCFloatAnimationCurve() { } + virtual ~FloatAnimationCurve() { } virtual float getValue(double t) const = 0; - // Partial CCAnimation implementation. + // Partial Animation implementation. virtual Type type() const OVERRIDE; }; -class CCTransformAnimationCurve : public CCAnimationCurve { +class TransformAnimationCurve : public AnimationCurve { public: - virtual ~CCTransformAnimationCurve() { } + virtual ~TransformAnimationCurve() { } virtual WebKit::WebTransformationMatrix getValue(double t) const = 0; - // Partial CCAnimation implementation. + // Partial Animation implementation. virtual Type type() const OVERRIDE; }; diff --git a/cc/animation_events.h b/cc/animation_events.h index 5e86ef7..52c99d3 100644 --- a/cc/animation_events.h +++ b/cc/animation_events.h @@ -11,10 +11,10 @@ namespace cc { -struct CCAnimationEvent { +struct AnimationEvent { enum Type { Started, Finished }; - CCAnimationEvent(Type type, int layerId, int groupId, CCActiveAnimation::TargetProperty targetProperty, double monotonicTime) + AnimationEvent(Type type, int layerId, int groupId, ActiveAnimation::TargetProperty targetProperty, double monotonicTime) : type(type) , layerId(layerId) , groupId(groupId) @@ -26,11 +26,11 @@ struct CCAnimationEvent { Type type; int layerId; int groupId; - CCActiveAnimation::TargetProperty targetProperty; + ActiveAnimation::TargetProperty targetProperty; double monotonicTime; }; -typedef std::vector<CCAnimationEvent> CCAnimationEventsVector; +typedef std::vector<AnimationEvent> AnimationEventsVector; } // namespace cc diff --git a/cc/append_quads_data.h b/cc/append_quads_data.h index b086de0..6bc167b 100644 --- a/cc/append_quads_data.h +++ b/cc/append_quads_data.h @@ -9,15 +9,15 @@ namespace cc { -struct CCAppendQuadsData { - CCAppendQuadsData() +struct AppendQuadsData { + AppendQuadsData() : hadOcclusionFromOutsideTargetSurface(false) , hadMissingTiles(false) , renderPassId(0, 0) { } - explicit CCAppendQuadsData(CCRenderPass::Id renderPassId) + explicit AppendQuadsData(RenderPass::Id renderPassId) : hadOcclusionFromOutsideTargetSurface(false) , hadMissingTiles(false) , renderPassId(renderPassId) @@ -29,7 +29,7 @@ struct CCAppendQuadsData { // Set by the layer appending quads. bool hadMissingTiles; // Given to the layer appending quads. - const CCRenderPass::Id renderPassId; + const RenderPass::Id renderPassId; }; } diff --git a/cc/bitmap_canvas_layer_texture_updater.cc b/cc/bitmap_canvas_layer_texture_updater.cc index 128df65..1f81c8e 100644 --- a/cc/bitmap_canvas_layer_texture_updater.cc +++ b/cc/bitmap_canvas_layer_texture_updater.cc @@ -14,7 +14,7 @@ namespace cc { -BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture) +BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<PrioritizedTexture> texture) : LayerTextureUpdater::Texture(texture.Pass()) , m_textureUpdater(textureUpdater) { @@ -24,17 +24,17 @@ BitmapCanvasLayerTextureUpdater::Texture::~Texture() { } -void BitmapCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) +void BitmapCanvasLayerTextureUpdater::Texture::update(TextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) { textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); } -scoped_refptr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainterChromium> painter) +scoped_refptr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainter> painter) { return make_scoped_refptr(new BitmapCanvasLayerTextureUpdater(painter.Pass())); } -BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) +BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) : CanvasLayerTextureUpdater(painter.Pass()) , m_opaque(false) { @@ -44,9 +44,9 @@ BitmapCanvasLayerTextureUpdater::~BitmapCanvasLayerTextureUpdater() { } -scoped_ptr<LayerTextureUpdater::Texture> BitmapCanvasLayerTextureUpdater::createTexture(CCPrioritizedTextureManager* manager) +scoped_ptr<LayerTextureUpdater::Texture> BitmapCanvasLayerTextureUpdater::createTexture(PrioritizedTextureManager* manager) { - return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); + return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); } LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampledTexelFormat(GLenum textureFormat) @@ -56,7 +56,7 @@ LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampled LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } -void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) +void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats) { if (m_canvasSize != contentRect.size()) { m_canvasSize = contentRect.size(); @@ -66,7 +66,7 @@ void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats); } -void BitmapCanvasLayerTextureUpdater::updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) +void BitmapCanvasLayerTextureUpdater::updateTexture(TextureUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) { ResourceUpdate upload = ResourceUpdate::Create( texture, diff --git a/cc/bitmap_canvas_layer_texture_updater.h b/cc/bitmap_canvas_layer_texture_updater.h index a484f7f..ad3b524 100644 --- a/cc/bitmap_canvas_layer_texture_updater.h +++ b/cc/bitmap_canvas_layer_texture_updater.h @@ -12,7 +12,7 @@ class SkCanvas; namespace cc { -class LayerPainterChromium; +class LayerPainter; // This class rasterizes the contentRect into a skia bitmap canvas. It then updates // textures by copying from the canvas into the texture, using MapSubImage if @@ -21,10 +21,10 @@ class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { public: class Texture : public LayerTextureUpdater::Texture { public: - Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>); + Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<PrioritizedTexture>); virtual ~Texture(); - virtual void update(CCTextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; private: BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -32,17 +32,17 @@ public: BitmapCanvasLayerTextureUpdater* m_textureUpdater; }; - static scoped_refptr<BitmapCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); + static scoped_refptr<BitmapCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainter>); - virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; + virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(PrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE; - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE; - void updateTexture(CCTextureUpdateQueue&, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&) OVERRIDE; + void updateTexture(TextureUpdateQueue&, PrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); virtual void setOpaque(bool) OVERRIDE; protected: - explicit BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); + explicit BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); virtual ~BitmapCanvasLayerTextureUpdater(); scoped_ptr<SkCanvas> m_canvas; diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.cc b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc index b94ebf7..7ee4c12 100644 --- a/cc/bitmap_skpicture_canvas_layer_texture_updater.cc +++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc @@ -16,13 +16,13 @@ namespace cc { -BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture) +BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<PrioritizedTexture> texture) : CanvasLayerTextureUpdater::Texture(texture.Pass()) , m_textureUpdater(textureUpdater) { } -void BitmapSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats& stats) +void BitmapSkPictureCanvasLayerTextureUpdater::Texture::update(TextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats& stats) { m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height()); m_bitmap.allocPixels(); @@ -41,12 +41,12 @@ void BitmapSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQu queue.appendFullUpload(upload); } -scoped_refptr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainterChromium> painter) +scoped_refptr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainter> painter) { return make_scoped_refptr(new BitmapSkPictureCanvasLayerTextureUpdater(painter.Pass())); } -BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) +BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) : SkPictureCanvasLayerTextureUpdater(painter.Pass()) { } @@ -55,9 +55,9 @@ BitmapSkPictureCanvasLayerTextureUpdater::~BitmapSkPictureCanvasLayerTextureUpda { } -scoped_ptr<LayerTextureUpdater::Texture> BitmapSkPictureCanvasLayerTextureUpdater::createTexture(CCPrioritizedTextureManager* manager) +scoped_ptr<LayerTextureUpdater::Texture> BitmapSkPictureCanvasLayerTextureUpdater::createTexture(PrioritizedTextureManager* manager) { - return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); + return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); } LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GLenum textureFormat) @@ -67,7 +67,7 @@ LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } -void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect, CCRenderingStats& stats) +void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect, RenderingStats& stats) { // Translate the origin of contentRect to that of sourceRect. canvas->translate(contentRect().x() - sourceRect.x(), diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.h b/cc/bitmap_skpicture_canvas_layer_texture_updater.h index f499129..64be17e 100644 --- a/cc/bitmap_skpicture_canvas_layer_texture_updater.h +++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.h @@ -11,14 +11,14 @@ namespace cc { // This class records the contentRect into an SkPicture, then software rasterizes -// the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting. +// the SkPicture into bitmaps for each tile. This implements Settings::perTilePainting. class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { public: class Texture : public CanvasLayerTextureUpdater::Texture { public: - Texture(BitmapSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>); + Texture(BitmapSkPictureCanvasLayerTextureUpdater*, scoped_ptr<PrioritizedTexture>); - virtual void update(CCTextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; private: BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -27,14 +27,14 @@ public: BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; - static scoped_refptr<BitmapSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); + static scoped_refptr<BitmapSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainter>); - virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; + virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(PrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE; - void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&); + void paintContentsRect(SkCanvas*, const IntRect& sourceRect, RenderingStats&); private: - explicit BitmapSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); + explicit BitmapSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); virtual ~BitmapSkPictureCanvasLayerTextureUpdater(); }; diff --git a/cc/caching_bitmap_canvas_layer_texture_updater.cc b/cc/caching_bitmap_canvas_layer_texture_updater.cc index 6e82c24..b6d6259 100644 --- a/cc/caching_bitmap_canvas_layer_texture_updater.cc +++ b/cc/caching_bitmap_canvas_layer_texture_updater.cc @@ -13,13 +13,13 @@ namespace cc { scoped_refptr<CachingBitmapCanvasLayerTextureUpdater> CachingBitmapCanvasLayerTextureUpdater::Create( - scoped_ptr<LayerPainterChromium> painter) { + scoped_ptr<LayerPainter> painter) { return make_scoped_refptr(new CachingBitmapCanvasLayerTextureUpdater( painter.Pass())); } CachingBitmapCanvasLayerTextureUpdater::CachingBitmapCanvasLayerTextureUpdater( - scoped_ptr<LayerPainterChromium> painter) + scoped_ptr<LayerPainter> painter) : BitmapCanvasLayerTextureUpdater(painter.Pass()), pixels_did_change_(false) { } @@ -35,7 +35,7 @@ void CachingBitmapCanvasLayerTextureUpdater::prepareToUpdate( float contents_width_scale, float contents_height_scale, IntRect& resulting_opaque_rect, - CCRenderingStats& stats) { + RenderingStats& stats) { BitmapCanvasLayerTextureUpdater::prepareToUpdate(content_rect, tile_size, contents_width_scale, diff --git a/cc/caching_bitmap_canvas_layer_texture_updater.h b/cc/caching_bitmap_canvas_layer_texture_updater.h index a7fbfec..48be15ca 100644 --- a/cc/caching_bitmap_canvas_layer_texture_updater.h +++ b/cc/caching_bitmap_canvas_layer_texture_updater.h @@ -14,20 +14,20 @@ class CachingBitmapCanvasLayerTextureUpdater : public BitmapCanvasLayerTextureUpdater { public: static scoped_refptr<CachingBitmapCanvasLayerTextureUpdater> Create( - scoped_ptr<LayerPainterChromium>); + scoped_ptr<LayerPainter>); virtual void prepareToUpdate(const IntRect& content_rect, const IntSize& tile_size, float contents_width_scale, float contents_height_scale, IntRect& resulting_opaque_rect, - CCRenderingStats&) OVERRIDE; + RenderingStats&) OVERRIDE; bool pixelsDidChange() const; private: explicit CachingBitmapCanvasLayerTextureUpdater( - scoped_ptr<LayerPainterChromium> painter); + scoped_ptr<LayerPainter> painter); virtual ~CachingBitmapCanvasLayerTextureUpdater(); bool pixels_did_change_; diff --git a/cc/canvas_layer_texture_updater.cc b/cc/canvas_layer_texture_updater.cc index 0a658dc..8afb1a6 100644 --- a/cc/canvas_layer_texture_updater.cc +++ b/cc/canvas_layer_texture_updater.cc @@ -18,7 +18,7 @@ namespace cc { -CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) +CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) : m_painter(painter.Pass()) { } @@ -27,16 +27,16 @@ CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater() { } -void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) +void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats) { TRACE_EVENT0("cc", "CanvasLayerTextureUpdater::paintContents"); canvas->save(); - canvas->translate(CCFloatToSkScalar(-contentRect.x()), CCFloatToSkScalar(-contentRect.y())); + canvas->translate(FloatToSkScalar(-contentRect.x()), FloatToSkScalar(-contentRect.y())); IntRect layerRect = contentRect; if (contentsWidthScale != 1 || contentsHeightScale != 1) { - canvas->scale(CCFloatToSkScalar(contentsWidthScale), CCFloatToSkScalar(contentsHeightScale)); + canvas->scale(FloatToSkScalar(contentsWidthScale), FloatToSkScalar(contentsHeightScale)); FloatRect rect = contentRect; rect.scale(1 / contentsWidthScale, 1 / contentsHeightScale); diff --git a/cc/canvas_layer_texture_updater.h b/cc/canvas_layer_texture_updater.h index bf67176..09da606 100644 --- a/cc/canvas_layer_texture_updater.h +++ b/cc/canvas_layer_texture_updater.h @@ -11,22 +11,22 @@ class SkCanvas; namespace cc { -class LayerPainterChromium; +class LayerPainter; // Base class for BitmapCanvasLayerTextureUpdater and // SkPictureCanvasLayerTextureUpdater that reduces code duplication between // their respective paintContents implementations. class CanvasLayerTextureUpdater : public LayerTextureUpdater { protected: - explicit CanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); + explicit CanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); virtual ~CanvasLayerTextureUpdater(); - void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&); + void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&); const IntRect& contentRect() const { return m_contentRect; } private: IntRect m_contentRect; - scoped_ptr<LayerPainterChromium> m_painter; + scoped_ptr<LayerPainter> m_painter; }; } // namespace cc diff --git a/cc/checkerboard_draw_quad.cc b/cc/checkerboard_draw_quad.cc index cba8813..a268ed1 100644 --- a/cc/checkerboard_draw_quad.cc +++ b/cc/checkerboard_draw_quad.cc @@ -10,21 +10,21 @@ namespace cc { -scoped_ptr<CCCheckerboardDrawQuad> CCCheckerboardDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) +scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) { - return make_scoped_ptr(new CCCheckerboardDrawQuad(sharedQuadState, quadRect, color)); + return make_scoped_ptr(new CheckerboardDrawQuad(sharedQuadState, quadRect, color)); } -CCCheckerboardDrawQuad::CCCheckerboardDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) - : CCDrawQuad(sharedQuadState, CCDrawQuad::Checkerboard, quadRect) +CheckerboardDrawQuad::CheckerboardDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) + : DrawQuad(sharedQuadState, DrawQuad::Checkerboard, quadRect) , m_color(color) { } -const CCCheckerboardDrawQuad* CCCheckerboardDrawQuad::materialCast(const CCDrawQuad* quad) +const CheckerboardDrawQuad* CheckerboardDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::Checkerboard); - return static_cast<const CCCheckerboardDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::Checkerboard); + return static_cast<const CheckerboardDrawQuad*>(quad); } } // namespace cc diff --git a/cc/checkerboard_draw_quad.h b/cc/checkerboard_draw_quad.h index c36bab0..0ac4a87 100644 --- a/cc/checkerboard_draw_quad.h +++ b/cc/checkerboard_draw_quad.h @@ -13,15 +13,15 @@ namespace cc { #pragma pack(push, 4) -class CCCheckerboardDrawQuad : public CCDrawQuad { +class CheckerboardDrawQuad : public DrawQuad { public: - static scoped_ptr<CCCheckerboardDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor); + static scoped_ptr<CheckerboardDrawQuad> create(const SharedQuadState*, const IntRect&, SkColor); SkColor color() const { return m_color; }; - static const CCCheckerboardDrawQuad* materialCast(const CCDrawQuad*); + static const CheckerboardDrawQuad* materialCast(const DrawQuad*); private: - CCCheckerboardDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor); + CheckerboardDrawQuad(const SharedQuadState*, const IntRect&, SkColor); SkColor m_color; }; diff --git a/cc/completion_event.h b/cc/completion_event.h index 6632ab1..fb7f429 100644 --- a/cc/completion_event.h +++ b/cc/completion_event.h @@ -15,9 +15,9 @@ namespace cc { // absolutely certain that doing-so will not lead to a deadlock. // // It is safe to destroy this object as soon as wait() returns. -class CCCompletionEvent { +class CompletionEvent { public: - CCCompletionEvent() + CompletionEvent() : m_event(false /* manual_reset */, false /* initially_signaled */) { #ifndef NDEBUG @@ -26,7 +26,7 @@ public: #endif } - ~CCCompletionEvent() + ~CompletionEvent() { #ifndef NDEBUG DCHECK(m_waited); diff --git a/cc/content_layer.cc b/cc/content_layer.cc index f99e2d3..7b47f45 100644 --- a/cc/content_layer.cc +++ b/cc/content_layer.cc @@ -18,12 +18,12 @@ namespace cc { -ContentLayerPainter::ContentLayerPainter(ContentLayerChromiumClient* client) +ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) : m_client(client) { } -scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerChromiumClient* client) +scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient* client) { return make_scoped_ptr(new ContentLayerPainter(client)); } @@ -38,56 +38,56 @@ void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, Fl HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); } -scoped_refptr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChromiumClient* client) +scoped_refptr<ContentLayer> ContentLayer::create(ContentLayerClient* client) { - return make_scoped_refptr(new ContentLayerChromium(client)); + return make_scoped_refptr(new ContentLayer(client)); } -ContentLayerChromium::ContentLayerChromium(ContentLayerChromiumClient* client) - : TiledLayerChromium() +ContentLayer::ContentLayer(ContentLayerClient* client) + : TiledLayer() , m_client(client) { } -ContentLayerChromium::~ContentLayerChromium() +ContentLayer::~ContentLayer() { } -bool ContentLayerChromium::drawsContent() const +bool ContentLayer::drawsContent() const { - return TiledLayerChromium::drawsContent() && m_client; + return TiledLayer::drawsContent() && m_client; } -void ContentLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc) +void ContentLayer::setTexturePriorities(const PriorityCalculator& priorityCalc) { // Update the tile data before creating all the layer's tiles. updateTileSizeAndTilingOption(); - TiledLayerChromium::setTexturePriorities(priorityCalc); + TiledLayer::setTexturePriorities(priorityCalc); } -void ContentLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) +void ContentLayer::update(TextureUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats) { createTextureUpdaterIfNeeded(); - TiledLayerChromium::update(queue, occlusion, stats); + TiledLayer::update(queue, occlusion, stats); m_needsDisplay = false; } -bool ContentLayerChromium::needMoreUpdates() +bool ContentLayer::needMoreUpdates() { return needsIdlePaint(); } -LayerTextureUpdater* ContentLayerChromium::textureUpdater() const +LayerTextureUpdater* ContentLayer::textureUpdater() const { return m_textureUpdater.get(); } -void ContentLayerChromium::createTextureUpdaterIfNeeded() +void ContentLayer::createTextureUpdaterIfNeeded() { if (m_textureUpdater) return; - scoped_ptr<LayerPainterChromium> painter = ContentLayerPainter::create(m_client).PassAs<LayerPainterChromium>(); + scoped_ptr<LayerPainter> painter = ContentLayerPainter::create(m_client).PassAs<LayerPainter>(); if (layerTreeHost()->settings().acceleratePainting) m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.Pass()); else if (Settings::perTilePaintingEnabled()) @@ -101,9 +101,9 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } -void ContentLayerChromium::setContentsOpaque(bool opaque) +void ContentLayer::setContentsOpaque(bool opaque) { - LayerChromium::setContentsOpaque(opaque); + Layer::setContentsOpaque(opaque); if (m_textureUpdater) m_textureUpdater->setOpaque(opaque); } diff --git a/cc/content_layer.h b/cc/content_layer.h index 991ff65..12cafa4 100644 --- a/cc/content_layer.h +++ b/cc/content_layer.h @@ -13,48 +13,48 @@ class SkCanvas; namespace cc { -class ContentLayerChromiumClient; +class ContentLayerClient; class FloatRect; class IntRect; class LayerTextureUpdater; -class ContentLayerPainter : public LayerPainterChromium { +class ContentLayerPainter : public LayerPainter { public: - static scoped_ptr<ContentLayerPainter> create(ContentLayerChromiumClient*); + static scoped_ptr<ContentLayerPainter> create(ContentLayerClient*); virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE; private: - explicit ContentLayerPainter(ContentLayerChromiumClient*); + explicit ContentLayerPainter(ContentLayerClient*); - ContentLayerChromiumClient* m_client; + ContentLayerClient* m_client; DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter); }; // A layer that renders its contents into an SkCanvas. -class ContentLayerChromium : public TiledLayerChromium { +class ContentLayer : public TiledLayer { public: - static scoped_refptr<ContentLayerChromium> create(ContentLayerChromiumClient*); + static scoped_refptr<ContentLayer> create(ContentLayerClient*); void clearClient() { m_client = 0; } virtual bool drawsContent() const OVERRIDE; - virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; + virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; virtual bool needMoreUpdates() OVERRIDE; virtual void setContentsOpaque(bool) OVERRIDE; protected: - explicit ContentLayerChromium(ContentLayerChromiumClient*); - virtual ~ContentLayerChromium(); + explicit ContentLayer(ContentLayerClient*); + virtual ~ContentLayer(); private: virtual LayerTextureUpdater* textureUpdater() const OVERRIDE; virtual void createTextureUpdaterIfNeeded() OVERRIDE; - ContentLayerChromiumClient* m_client; + ContentLayerClient* m_client; scoped_refptr<LayerTextureUpdater> m_textureUpdater; }; diff --git a/cc/content_layer_client.h b/cc/content_layer_client.h index 54a9267..1dbb1a9 100644 --- a/cc/content_layer_client.h +++ b/cc/content_layer_client.h @@ -11,12 +11,12 @@ namespace cc { class FloatRect; class IntRect; -class ContentLayerChromiumClient { +class ContentLayerClient { public: virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0; protected: - virtual ~ContentLayerChromiumClient() { } + virtual ~ContentLayerClient() { } }; } diff --git a/cc/content_layer_unittest.cc b/cc/content_layer_unittest.cc index 37d66be..a00dde8 100644 --- a/cc/content_layer_unittest.cc +++ b/cc/content_layer_unittest.cc @@ -20,9 +20,9 @@ using namespace WebKit; namespace { -class MockContentLayerChromiumClient : public ContentLayerChromiumClient { +class MockContentLayerClient : public ContentLayerClient { public: - explicit MockContentLayerChromiumClient(IntRect opaqueLayerRect) + explicit MockContentLayerClient(IntRect opaqueLayerRect) : m_opaqueLayerRect(opaqueLayerRect) { } @@ -36,18 +36,18 @@ private: IntRect m_opaqueLayerRect; }; -TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) +TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { float contentsScale = 2; IntRect contentRect(10, 10, 100, 100); IntRect opaqueRectInLayerSpace(5, 5, 20, 20); IntRect opaqueRectInContentSpace = opaqueRectInLayerSpace; opaqueRectInContentSpace.scale(contentsScale); - MockContentLayerChromiumClient client(opaqueRectInLayerSpace); - scoped_refptr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client).PassAs<LayerPainterChromium>()); + MockContentLayerClient client(opaqueRectInLayerSpace); + scoped_refptr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client).PassAs<LayerPainter>()); IntRect resultingOpaqueRect; - CCRenderingStats stats; + RenderingStats stats; updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect, stats); EXPECT_RECT_EQ(opaqueRectInContentSpace, resultingOpaqueRect); diff --git a/cc/damage_tracker.cc b/cc/damage_tracker.cc index f6ad5fb..a524772 100644 --- a/cc/damage_tracker.cc +++ b/cc/damage_tracker.cc @@ -16,19 +16,19 @@ using WebKit::WebTransformationMatrix; namespace cc { -scoped_ptr<CCDamageTracker> CCDamageTracker::create() +scoped_ptr<DamageTracker> DamageTracker::create() { - return make_scoped_ptr(new CCDamageTracker()); + return make_scoped_ptr(new DamageTracker()); } -CCDamageTracker::CCDamageTracker() +DamageTracker::DamageTracker() : m_forceFullDamageNextUpdate(false), m_currentRectHistory(new RectMap), m_nextRectHistory(new RectMap) { } -CCDamageTracker::~CCDamageTracker() +DamageTracker::~DamageTracker() { } @@ -51,7 +51,7 @@ static inline void expandDamageRectInsideRectWithFilters(FloatRect& damageRect, damageRect.unite(expandedDamageRect); } -void CCDamageTracker::updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters) +void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters) { // // This function computes the "damage rect" of a target surface, and updates the state @@ -147,7 +147,7 @@ void CCDamageTracker::updateDamageTrackingState(const std::vector<CCLayerImpl*>& swap(m_currentRectHistory, m_nextRectHistory); } -FloatRect CCDamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIsNew) +FloatRect DamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIsNew) { RectMap::iterator iter = m_currentRectHistory->find(layerID); layerIsNew = iter == m_currentRectHistory->end(); @@ -159,7 +159,7 @@ FloatRect CCDamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIs return ret; } -void CCDamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect) +void DamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect) { // This layer should not yet exist in next frame's history. DCHECK(layerID > 0); @@ -167,15 +167,15 @@ void CCDamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetS (*m_nextRectHistory)[layerID] = targetSpaceRect; } -FloatRect CCDamageTracker::trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID) +FloatRect DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID) { FloatRect damageRect = FloatRect(); for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { // Visit layers in back-to-front order. - CCLayerImpl* layer = layerList[layerIndex]; + LayerImpl* layer = layerList[layerIndex]; - if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerImpl>(layer, targetSurfaceLayerID)) + if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl>(layer, targetSurfaceLayerID)) extendDamageForRenderSurface(layer, damageRect); else extendDamageForLayer(layer, damageRect); @@ -184,7 +184,7 @@ FloatRect CCDamageTracker::trackDamageFromActiveLayers(const std::vector<CCLayer return damageRect; } -FloatRect CCDamageTracker::trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer) +FloatRect DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer) { FloatRect damageRect = FloatRect(); @@ -200,7 +200,7 @@ FloatRect CCDamageTracker::trackDamageFromSurfaceMask(CCLayerImpl* targetSurface return damageRect; } -FloatRect CCDamageTracker::trackDamageFromLeftoverRects() +FloatRect DamageTracker::trackDamageFromLeftoverRects() { // After computing damage for all active layers, any leftover items in the current // rect history correspond to layers/surfaces that no longer exist. So, these regions @@ -216,7 +216,7 @@ FloatRect CCDamageTracker::trackDamageFromLeftoverRects() return damageRect; } -static bool layerNeedsToRedrawOntoItsTargetSurface(CCLayerImpl* layer) +static bool layerNeedsToRedrawOntoItsTargetSurface(LayerImpl* layer) { // If the layer does NOT own a surface but has SurfacePropertyChanged, // this means that its target surface is affected and needs to be redrawn. @@ -228,7 +228,7 @@ static bool layerNeedsToRedrawOntoItsTargetSurface(CCLayerImpl* layer) return layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged(); } -void CCDamageTracker::extendDamageForLayer(CCLayerImpl* layer, FloatRect& targetDamageRect) +void DamageTracker::extendDamageForLayer(LayerImpl* layer, FloatRect& targetDamageRect) { // There are two ways that a layer can damage a region of the target surface: // 1. Property change (e.g. opacity, position, transforms): @@ -249,7 +249,7 @@ void CCDamageTracker::extendDamageForLayer(CCLayerImpl* layer, FloatRect& target bool layerIsNew = false; FloatRect oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), layerIsNew); - FloatRect rectInTargetSpace = CCMathUtil::mapClippedRect(layer->drawTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())); + FloatRect rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())); saveRectForNextFrame(layer->id(), rectInTargetSpace); if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) { @@ -267,12 +267,12 @@ void CCDamageTracker::extendDamageForLayer(CCLayerImpl* layer, FloatRect& target float heightScale = layer->contentBounds().height() / static_cast<float>(layer->bounds().height()); updateContentRect.scale(widthScale, heightScale); - FloatRect updateRectInTargetSpace = CCMathUtil::mapClippedRect(layer->drawTransform(), updateContentRect); + FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), updateContentRect); targetDamageRect.uniteIfNonZero(updateRectInTargetSpace); } } -void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect& targetDamageRect) +void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& targetDamageRect) { // There are two ways a "descendant surface" can damage regions of the "target surface": // 1. Property change: @@ -286,7 +286,7 @@ void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect // should propagate to the target surface. // - CCRenderSurface* renderSurface = layer->renderSurface(); + RenderSurfaceImpl* renderSurface = layer->renderSurface(); bool surfaceIsNew = false; FloatRect oldSurfaceRect = removeRectFromCurrentFrame(layer->id(), surfaceIsNew); @@ -309,24 +309,24 @@ void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect // If there was damage, transform it to target space, and possibly contribute its reflection if needed. if (!damageRectInLocalSpace.isEmpty()) { const WebTransformationMatrix& drawTransform = renderSurface->drawTransform(); - FloatRect damageRectInTargetSpace = CCMathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace); + FloatRect damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace); targetDamageRect.uniteIfNonZero(damageRectInTargetSpace); if (layer->replicaLayer()) { const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform(); - targetDamageRect.uniteIfNonZero(CCMathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace)); + targetDamageRect.uniteIfNonZero(MathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace)); } } // If there was damage on the replica's mask, then the target surface receives that damage as well. if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) { - CCLayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); + LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); bool replicaIsNew = false; removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform(); - FloatRect replicaMaskLayerRect = CCMathUtil::mapClippedRect(replicaDrawTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height()))); + FloatRect replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height()))); saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); // In the current implementation, a change in the replica mask damages the entire replica region. diff --git a/cc/damage_tracker.h b/cc/damage_tracker.h index 5121b06..f72c3f0 100644 --- a/cc/damage_tracker.h +++ b/cc/damage_tracker.h @@ -16,35 +16,35 @@ class WebFilterOperations; namespace cc { -class CCLayerImpl; -class CCRenderSurface; +class LayerImpl; +class RenderSurfaceImpl; -// Computes the region where pixels have actually changed on a RenderSurface. This region is used +// Computes the region where pixels have actually changed on a RenderSurfaceImpl. This region is used // to scissor what is actually drawn to the screen to save GPU computation and bandwidth. -class CCDamageTracker { +class DamageTracker { public: - static scoped_ptr<CCDamageTracker> create(); - ~CCDamageTracker(); + static scoped_ptr<DamageTracker> create(); + ~DamageTracker(); void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); } void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } - void updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&); + void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&); const FloatRect& currentDamageRect() { return m_currentDamageRect; } private: - CCDamageTracker(); + DamageTracker(); - FloatRect trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID); - FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer); + FloatRect trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID); + FloatRect trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer); FloatRect trackDamageFromLeftoverRects(); FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew); void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect); // These helper functions are used only in trackDamageFromActiveLayers(). - void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect); - void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect); + void extendDamageForLayer(LayerImpl*, FloatRect& targetDamageRect); + void extendDamageForRenderSurface(LayerImpl*, FloatRect& targetDamageRect); // To correctly track exposed regions, two hashtables of rects are maintained. // The "current" map is used to compute exposed regions of the current frame, while diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc index b266558..eb7150a 100644 --- a/cc/damage_tracker_unittest.cc +++ b/cc/damage_tracker_unittest.cc @@ -22,9 +22,9 @@ using namespace WebKitTests; namespace { -void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, std::vector<CCLayerImpl*>& renderSurfaceLayerList) +void executeCalculateDrawTransformsAndVisibility(LayerImpl* root, std::vector<LayerImpl*>& renderSurfaceLayerList) { - CCLayerSorter layerSorter; + LayerSorter layerSorter; int dummyMaxTextureSize = 512; // Sanity check: The test itself should create the root layer's render surface, so @@ -33,10 +33,10 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, std::vector< ASSERT_TRUE(root->renderSurface()); ASSERT_FALSE(renderSurfaceLayerList.size()); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); } -void clearDamageForAllSurfaces(CCLayerImpl* layer) +void clearDamageForAllSurfaces(LayerImpl* layer) { if (layer->renderSurface()) layer->renderSurface()->damageTracker()->didDrawDamagedArea(); @@ -46,29 +46,29 @@ void clearDamageForAllSurfaces(CCLayerImpl* layer) clearDamageForAllSurfaces(layer->children()[i]); } -void emulateDrawingOneFrame(CCLayerImpl* root) +void emulateDrawingOneFrame(LayerImpl* root) { // This emulates only the steps that are relevant to testing the damage tracker: // 1. computing the render passes and layerlists // 2. updating all damage trackers in the correct order // 3. resetting all updateRects and propertyChanged flags for all layers and surfaces. - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; executeCalculateDrawTransformsAndVisibility(root, renderSurfaceLayerList); // Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors. for (int i = renderSurfaceLayerList.size() - 1; i >= 0; --i) { - CCRenderSurface* targetSurface = renderSurfaceLayerList[i]->renderSurface(); + RenderSurfaceImpl* targetSurface = renderSurfaceLayerList[i]->renderSurface(); targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), targetSurface->surfacePropertyChangedOnlyFromDescendant(), targetSurface->contentRect(), renderSurfaceLayerList[i]->maskLayer(), renderSurfaceLayerList[i]->filters()); } root->resetAllChangeTrackingForSubtree(); } -scoped_ptr<CCLayerImpl> createTestTreeWithOneSurface() +scoped_ptr<LayerImpl> createTestTreeWithOneSurface() { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<LayerImpl> child = LayerImpl::create(2); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -88,17 +88,17 @@ scoped_ptr<CCLayerImpl> createTestTreeWithOneSurface() return root.Pass(); } -scoped_ptr<CCLayerImpl> createTestTreeWithTwoSurfaces() +scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces() { // This test tree has two render surfaces: one for the root, and one for // child1. Additionally, the root has a second child layer, and child1 has two // children of its own. - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); - scoped_ptr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<LayerImpl> child1 = LayerImpl::create(2); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); + scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4); + scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -141,9 +141,9 @@ scoped_ptr<CCLayerImpl> createTestTreeWithTwoSurfaces() return root.Pass(); } -scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() +scoped_ptr<LayerImpl> createAndSetUpTestTreeWithOneSurface() { - scoped_ptr<CCLayerImpl> root = createTestTreeWithOneSurface(); + scoped_ptr<LayerImpl> root = createTestTreeWithOneSurface(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. @@ -152,9 +152,9 @@ scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() return root.Pass(); } -scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() +scoped_ptr<LayerImpl> createAndSetUpTestTreeWithTwoSurfaces() { - scoped_ptr<CCLayerImpl> root = createTestTreeWithTwoSurfaces(); + scoped_ptr<LayerImpl> root = createTestTreeWithTwoSurfaces(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. @@ -163,18 +163,18 @@ scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() return root.Pass(); } -class CCDamageTrackerTest : public testing::Test { +class DamageTrackerTest : public testing::Test { private: // For testing purposes, fake that we are on the impl thread. DebugScopedSetImplThread setImplThread; }; -TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithOneSurface) +TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface) { // Sanity check that the simple test tree will actually produce the expected render // surfaces and layer lists. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); EXPECT_EQ(2u, root->renderSurface()->layerList().size()); EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id()); @@ -184,15 +184,15 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithOneSurface) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); } -TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) +TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) { // Sanity check that the complex test tree will actually produce the expected render // surfaces and layer lists. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* child2 = root->children()[1]; + LayerImpl* child1 = root->children()[0]; + LayerImpl* child2 = root->children()[1]; FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect(); FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect(); @@ -206,10 +206,10 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) +TEST_F(DamageTrackerTest, verifyDamageForUpdateRects) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; // CASE 1: Setting the update rect should cause the corresponding damage to the surface. // @@ -240,10 +240,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) EXPECT_FLOAT_RECT_EQ(FloatRect(120, 125, 1, 2), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges) +TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; // CASE 1: The layer's property changed flag takes priority over update rect. // @@ -281,13 +281,13 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges) EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) +TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer) { // If a layer is transformed, the damage rect should still enclose the entire // transformed layer. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; WebTransformationMatrix rotation; rotation.rotate(45); @@ -317,7 +317,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) +TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer) { // If a layer has a perspective transform that causes w < 0, then not clipping the // layer can cause an invalid damage rect. This test checks that the w < 0 case is @@ -329,8 +329,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // and positioned so that the right-most bound rect will be approximately 501 units in root surface space. // - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; WebTransformationMatrix transform; transform.translate3d(500, 500, 0); @@ -349,7 +349,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // otherwise this test is not actually testing the intended scenario. FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100))); bool clipped = false; - CCMathUtil::mapQuad(transform, testQuad, clipped); + MathUtil::mapQuad(transform, testQuad, clipped); EXPECT_TRUE(clipped); // Damage the child without moving it. @@ -364,10 +364,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) EXPECT_TRUE(rootDamageRect.contains(damageWeCareAbout)); } -TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface) +TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; WebFilterOperations filters; filters.append(WebFilterOperation::createBlurFilter(5)); @@ -392,11 +392,11 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface) EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild) +TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* child2 = root->children()[1]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; + LayerImpl* child2 = root->children()[1]; // Allow us to set damage on child1 too. child1->setDrawsContent(true); @@ -495,16 +495,16 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild) EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) +TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child1 = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child1 = root->children()[0]; // CASE 1: Adding a new layer should cause the appropriate damage. // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -535,16 +535,16 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) +TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer) { // If child2 is added to the layer tree, but it doesn't have any explicit damage of // its own, it should still indeed damage the target surface. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -566,15 +566,15 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) +TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child1 = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child1 = root->children()[0]; // In this test we don't want the above tree manipulation to be considered part of the same frame. clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -582,7 +582,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) child2->setDrawsContent(true); root->addChild(child2.Pass()); } - CCLayerImpl* child2 = root->children()[1]; + LayerImpl* child2 = root->children()[1]; emulateDrawingOneFrame(root.get()); // Damaging two layers simultaneously should cause combined damage. @@ -596,12 +596,12 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 303, 284), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces) +TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* child2 = root->children()[1]; - CCLayerImpl* grandChild1 = root->children()[0]->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; + LayerImpl* child2 = root->children()[1]; + LayerImpl* grandChild1 = root->children()[0]->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -628,7 +628,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces) EXPECT_FLOAT_RECT_EQ(FloatRect(11, 11, 295, 297), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) +TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) { // If descendant layer changes and affects the content bounds of the render surface, // then the entire descendant surface should be damaged, and it should damage its @@ -637,9 +637,9 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) // This is a tricky case, since only the first grandChild changes, but the entire // surface should be marked dirty. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* grandChild1 = root->children()[0]->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; + LayerImpl* grandChild1 = root->children()[0]->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -657,11 +657,11 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 23), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) +TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) { // An ancestor/owning layer changes that affects the position/transform of the render // surface. Note that in this case, the layerPropertyChanged flag already propagates - // to the subtree (tested in CCLayerImpltest), which damages the entire child1 + // to the subtree (tested in LayerImpltest), which damages the entire child1 // surface, but the damage tracker still needs the correct logic to compute the // exposed region on the root surface. @@ -670,8 +670,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) // should be completely unchanged, since we are only transforming it, while the // root surface would be damaged appropriately. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -690,10 +690,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(240, 240, 66, 68), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) +TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -734,10 +734,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) +TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -760,10 +760,10 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) EXPECT_TRUE(rootDamageRect.isEmpty()); } -TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) +TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -778,12 +778,12 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) EXPECT_TRUE(rootDamageRect.isEmpty()); } -TEST_F(CCDamageTrackerTest, verifyDamageForReplica) +TEST_F(DamageTrackerTest, verifyDamageForReplica) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* grandChild1 = child1->children()[0]; - CCLayerImpl* grandChild2 = child1->children()[1]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; + LayerImpl* grandChild1 = child1->children()[0]; + LayerImpl* grandChild2 = child1->children()[1]; // Damage on a surface that has a reflection should cause the target surface to // receive the surface's damage and the surface's reflected damage. @@ -793,7 +793,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // contentBounds of the surface. grandChild2->setPosition(FloatPoint(180, 180)); { - scoped_ptr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6); + scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6); grandChild3->setPosition(FloatPoint(240, 240)); grandChild3->setAnchorPoint(FloatPoint::zero()); grandChild3->setBounds(IntSize(10, 10)); @@ -808,7 +808,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); + scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(7); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; @@ -851,7 +851,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // CASE 3: removing the reflection should cause the entire region including reflection // to damage the target surface. clearDamageForAllSurfaces(root.get()); - grandChild1->setReplicaLayer(scoped_ptr<CCLayerImpl>()); + grandChild1->setReplicaLayer(scoped_ptr<LayerImpl>()); emulateDrawingOneFrame(root.get()); ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width()); ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height()); @@ -864,10 +864,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) EXPECT_FLOAT_RECT_EQ(FloatRect(289, 305, 12, 8), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForMask) +TEST_F(DamageTrackerTest, verifyDamageForMask) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; // In the current implementation of the damage tracker, changes to mask layers should // damage the entire corresponding surface. @@ -876,19 +876,19 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) // Set up the mask layer. { - scoped_ptr<CCLayerImpl> maskLayer = CCLayerImpl::create(3); + scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3); maskLayer->setPosition(child->position()); maskLayer->setAnchorPoint(FloatPoint::zero()); maskLayer->setBounds(child->bounds()); maskLayer->setContentBounds(child->bounds()); child->setMaskLayer(maskLayer.Pass()); } - CCLayerImpl* maskLayer = child->maskLayer(); + LayerImpl* maskLayer = child->maskLayer(); // Add opacity and a grandChild so that the render surface persists even after we remove the mask. child->setOpacity(0.5); { - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(4); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4); grandChild->setPosition(FloatPoint(2, 2)); grandChild->setAnchorPoint(FloatPoint::zero()); grandChild->setBounds(IntSize(2, 2)); @@ -937,7 +937,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) // Then test mask removal. clearDamageForAllSurfaces(root.get()); - child->setMaskLayer(scoped_ptr<CCLayerImpl>()); + child->setMaskLayer(scoped_ptr<LayerImpl>()); ASSERT_TRUE(child->layerPropertyChanged()); emulateDrawingOneFrame(root.get()); @@ -948,11 +948,11 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) +TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* grandChild1 = child1->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; + LayerImpl* grandChild1 = child1->children()[0]; // Changes to a replica's mask should not damage the original surface, because it is // not masked. But it does damage the ancestor target surface. @@ -961,7 +961,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) // Create a reflection about the left edge of grandChild1. { - scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); + scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; @@ -969,18 +969,18 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.Pass()); } - CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); + LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer { - scoped_ptr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); + scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); replicaMaskLayer->setBounds(grandChild1->bounds()); replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); } - CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); + LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); emulateDrawingOneFrame(root.get()); @@ -1001,7 +1001,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) // CASE 2: removing the replica mask damages only the reflected region on the target surface. // clearDamageForAllSurfaces(root.get()); - grandChild1Replica->setMaskLayer(scoped_ptr<CCLayerImpl>()); + grandChild1Replica->setMaskLayer(scoped_ptr<LayerImpl>()); emulateDrawingOneFrame(root.get()); grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect(); @@ -1011,11 +1011,11 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) +TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* grandChild1 = child1->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + LayerImpl* child1 = root->children()[0]; + LayerImpl* grandChild1 = child1->children()[0]; // Verify that the correct replicaOriginTransform is used for the replicaMask; clearDamageForAllSurfaces(root.get()); @@ -1023,7 +1023,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point. { - scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); + scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested. WebTransformationMatrix reflection; @@ -1031,18 +1031,18 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.Pass()); } - CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); + LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer { - scoped_ptr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); + scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. replicaMaskLayer->setBounds(grandChild1->bounds()); replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); } - CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); + LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); emulateDrawingOneFrame(root.get()); @@ -1059,10 +1059,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) EXPECT_FLOAT_RECT_EQ(FloatRect(206, 200, 6, 8), childDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage) +TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; // Case 1: This test ensures that when the tracker is forced to have full damage, that // it takes priority over any other partial damage. @@ -1084,16 +1084,16 @@ TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); } -TEST_F(CCDamageTrackerTest, verifyDamageForEmptyLayerList) +TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList) { // Though it should never happen, its a good idea to verify that the damage tracker // does not crash when it receives an empty layerList. - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->createRenderSurface(); ASSERT_TRUE(root == root->renderTarget()); - CCRenderSurface* targetSurface = root->renderSurface(); + RenderSurfaceImpl* targetSurface = root->renderSurface(); targetSurface->clearLayerLists(); targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, WebFilterOperations()); @@ -1101,12 +1101,12 @@ TEST_F(CCDamageTrackerTest, verifyDamageForEmptyLayerList) EXPECT_TRUE(damageRect.isEmpty()); } -TEST_F(CCDamageTrackerTest, verifyDamageAccumulatesUntilReset) +TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset) { // If damage is not cleared, it should accumulate. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - CCLayerImpl* child = root->children()[0]; + scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + LayerImpl* child = root->children()[0]; clearDamageForAllSurfaces(root.get()); child->setUpdateRect(FloatRect(10, 11, 1, 2)); diff --git a/cc/debug_border_draw_quad.cc b/cc/debug_border_draw_quad.cc index a8b9d35..fd0f5b3 100644 --- a/cc/debug_border_draw_quad.cc +++ b/cc/debug_border_draw_quad.cc @@ -10,13 +10,13 @@ namespace cc { -scoped_ptr<CCDebugBorderDrawQuad> CCDebugBorderDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) +scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) { - return make_scoped_ptr(new CCDebugBorderDrawQuad(sharedQuadState, quadRect, color, width)); + return make_scoped_ptr(new DebugBorderDrawQuad(sharedQuadState, quadRect, color, width)); } -CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) - : CCDrawQuad(sharedQuadState, CCDrawQuad::DebugBorder, quadRect) +DebugBorderDrawQuad::DebugBorderDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) + : DrawQuad(sharedQuadState, DrawQuad::DebugBorder, quadRect) , m_color(color) , m_width(width) { @@ -25,10 +25,10 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad m_needsBlending = true; } -const CCDebugBorderDrawQuad* CCDebugBorderDrawQuad::materialCast(const CCDrawQuad* quad) +const DebugBorderDrawQuad* DebugBorderDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::DebugBorder); - return static_cast<const CCDebugBorderDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::DebugBorder); + return static_cast<const DebugBorderDrawQuad*>(quad); } } // namespace cc diff --git a/cc/debug_border_draw_quad.h b/cc/debug_border_draw_quad.h index 32c228e..98c7809 100644 --- a/cc/debug_border_draw_quad.h +++ b/cc/debug_border_draw_quad.h @@ -13,16 +13,16 @@ namespace cc { #pragma pack(push, 4) -class CCDebugBorderDrawQuad : public CCDrawQuad { +class DebugBorderDrawQuad : public DrawQuad { public: - static scoped_ptr<CCDebugBorderDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor, int width); + static scoped_ptr<DebugBorderDrawQuad> create(const SharedQuadState*, const IntRect&, SkColor, int width); SkColor color() const { return m_color; }; int width() const { return m_width; } - static const CCDebugBorderDrawQuad* materialCast(const CCDrawQuad*); + static const DebugBorderDrawQuad* materialCast(const DrawQuad*); private: - CCDebugBorderDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor, int width); + DebugBorderDrawQuad(const SharedQuadState*, const IntRect&, SkColor, int width); SkColor m_color; int m_width; diff --git a/cc/debug_rect_history.cc b/cc/debug_rect_history.cc index 7ff9f75..fc835cb 100644 --- a/cc/debug_rect_history.cc +++ b/cc/debug_rect_history.cc @@ -14,19 +14,19 @@ namespace cc { // static -scoped_ptr<CCDebugRectHistory> CCDebugRectHistory::create() { - return make_scoped_ptr(new CCDebugRectHistory()); +scoped_ptr<DebugRectHistory> DebugRectHistory::create() { + return make_scoped_ptr(new DebugRectHistory()); } -CCDebugRectHistory::CCDebugRectHistory() +DebugRectHistory::DebugRectHistory() { } -CCDebugRectHistory::~CCDebugRectHistory() +DebugRectHistory::~DebugRectHistory() { } -void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings& settings) +void DebugRectHistory::saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const LayerTreeSettings& settings) { // For now, clear all rects from previous frames. In the future we may want to store // all debug rects for a history of many frames. @@ -49,7 +49,7 @@ void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, c } -void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer) +void DebugRectHistory::savePaintRects(LayerImpl* layer) { // We would like to visualize where any layer's paint rect (update rect) has changed, // regardless of whether this layer is skipped for actual drawing or not. Therefore @@ -58,65 +58,65 @@ void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer) if (!layer->updateRect().isEmpty() && layer->drawsContent()) { FloatRect updateContentRect = layer->updateRect(); updateContentRect.scale(layer->contentBounds().width() / static_cast<float>(layer->bounds().width()), layer->contentBounds().height() / static_cast<float>(layer->bounds().height())); - m_debugRects.append(CCDebugRect(PaintRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), updateContentRect))); + m_debugRects.append(DebugRect(PaintRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), updateContentRect))); } for (unsigned i = 0; i < layer->children().size(); ++i) savePaintRects(layer->children()[i]); } -void CCDebugRectHistory::savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList) +void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& renderSurfaceLayerList) { for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; - CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); DCHECK(renderSurface); - const std::vector<CCLayerImpl*>& layerList = renderSurface->layerList(); + const std::vector<LayerImpl*>& layerList = renderSurface->layerList(); for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { - CCLayerImpl* layer = layerList[layerIndex]; + LayerImpl* layer = layerList[layerIndex]; - if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerImpl>(layer, renderSurfaceLayer->id())) + if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl>(layer, renderSurfaceLayer->id())) continue; if (layer->layerIsAlwaysDamaged()) continue; if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged()) - m_debugRects.append(CCDebugRect(PropertyChangedRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())))); + m_debugRects.append(DebugRect(PropertyChangedRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())))); } } } -void CCDebugRectHistory::saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList) +void DebugRectHistory::saveSurfaceDamageRects(const std::vector<LayerImpl* >& renderSurfaceLayerList) { for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; - CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); DCHECK(renderSurface); - m_debugRects.append(CCDebugRect(SurfaceDamageRectType, CCMathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()->currentDamageRect()))); + m_debugRects.append(DebugRect(SurfaceDamageRectType, MathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()->currentDamageRect()))); } } -void CCDebugRectHistory::saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList) +void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& renderSurfaceLayerList) { for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; - CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); DCHECK(renderSurface); - m_debugRects.append(CCDebugRect(ScreenSpaceRectType, CCMathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect()))); + m_debugRects.append(DebugRect(ScreenSpaceRectType, MathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect()))); if (renderSurfaceLayer->replicaLayer()) - m_debugRects.append(CCDebugRect(ReplicaScreenSpaceRectType, CCMathUtil::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface->contentRect()))); + m_debugRects.append(DebugRect(ReplicaScreenSpaceRectType, MathUtil::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface->contentRect()))); } } -void CCDebugRectHistory::saveOccludingRects(const Vector<IntRect>& occludingRects) +void DebugRectHistory::saveOccludingRects(const Vector<IntRect>& occludingRects) { for (size_t i = 0; i < occludingRects.size(); ++i) - m_debugRects.append(CCDebugRect(OccludingRectType, occludingRects[i])); + m_debugRects.append(DebugRect(OccludingRectType, occludingRects[i])); } } // namespace cc diff --git a/cc/debug_rect_history.h b/cc/debug_rect_history.h index f193c64..79c5602 100644 --- a/cc/debug_rect_history.h +++ b/cc/debug_rect_history.h @@ -14,8 +14,8 @@ namespace cc { -class CCLayerImpl; -struct CCLayerTreeSettings; +class LayerImpl; +struct LayerTreeSettings; // There are currently six types of debug rects: // @@ -38,8 +38,8 @@ struct CCLayerTreeSettings; // enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType }; -struct CCDebugRect { - CCDebugRect(DebugRectType newType, FloatRect newRect) +struct DebugRect { + DebugRect(DebugRectType newType, FloatRect newRect) : type(newType) , rect(newRect) { } @@ -49,30 +49,30 @@ struct CCDebugRect { // This class maintains a history of rects of various types that can be used // for debugging purposes. The overhead of collecting rects is performed only if -// the appropriate CCLayerTreeSettings are enabled. -class CCDebugRectHistory { +// the appropriate LayerTreeSettings are enabled. +class DebugRectHistory { public: - static scoped_ptr<CCDebugRectHistory> create(); + static scoped_ptr<DebugRectHistory> create(); - ~CCDebugRectHistory(); + ~DebugRectHistory(); // Note: Saving debug rects must happen before layers' change tracking is reset. - void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&); + void saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const LayerTreeSettings&); - const Vector<CCDebugRect>& debugRects() { return m_debugRects; } + const Vector<DebugRect>& debugRects() { return m_debugRects; } private: - CCDebugRectHistory(); + DebugRectHistory(); - void savePaintRects(CCLayerImpl*); - void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList); - void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList); - void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList); + void savePaintRects(LayerImpl*); + void savePropertyChangedRects(const std::vector<LayerImpl*>& renderSurfaceLayerList); + void saveSurfaceDamageRects(const std::vector<LayerImpl* >& renderSurfaceLayerList); + void saveScreenSpaceRects(const std::vector<LayerImpl* >& renderSurfaceLayerList); void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects); - Vector<CCDebugRect> m_debugRects; + Vector<DebugRect> m_debugRects; - DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory); + DISALLOW_COPY_AND_ASSIGN(DebugRectHistory); }; } // namespace cc diff --git a/cc/delay_based_time_source.cc b/cc/delay_based_time_source.cc index 748b02b..397027f 100644 --- a/cc/delay_based_time_source.cc +++ b/cc/delay_based_time_source.cc @@ -29,12 +29,12 @@ const double phaseChangeThreshold = 0.25; } // namespace -scoped_refptr<CCDelayBasedTimeSource> CCDelayBasedTimeSource::create(base::TimeDelta interval, CCThread* thread) +scoped_refptr<DelayBasedTimeSource> DelayBasedTimeSource::create(base::TimeDelta interval, Thread* thread) { - return make_scoped_refptr(new CCDelayBasedTimeSource(interval, thread)); + return make_scoped_refptr(new DelayBasedTimeSource(interval, thread)); } -CCDelayBasedTimeSource::CCDelayBasedTimeSource(base::TimeDelta interval, CCThread* thread) +DelayBasedTimeSource::DelayBasedTimeSource(base::TimeDelta interval, Thread* thread) : m_client(0) , m_hasTickTarget(false) , m_currentParameters(interval, base::TimeTicks()) @@ -44,13 +44,13 @@ CCDelayBasedTimeSource::CCDelayBasedTimeSource(base::TimeDelta interval, CCThrea { } -CCDelayBasedTimeSource::~CCDelayBasedTimeSource() +DelayBasedTimeSource::~DelayBasedTimeSource() { } -void CCDelayBasedTimeSource::setActive(bool active) +void DelayBasedTimeSource::setActive(bool active) { - TRACE_EVENT1("cc", "CCDelayBasedTimeSource::setActive", "active", active); + TRACE_EVENT1("cc", "DelayBasedTimeSource::setActive", "active", active); if (!active) { m_state = STATE_INACTIVE; m_timer.stop(); @@ -74,22 +74,22 @@ void CCDelayBasedTimeSource::setActive(bool active) postNextTickTask(now()); } -bool CCDelayBasedTimeSource::active() const +bool DelayBasedTimeSource::active() const { return m_state != STATE_INACTIVE; } -base::TimeTicks CCDelayBasedTimeSource::lastTickTime() +base::TimeTicks DelayBasedTimeSource::lastTickTime() { return m_lastTickTime; } -base::TimeTicks CCDelayBasedTimeSource::nextTickTime() +base::TimeTicks DelayBasedTimeSource::nextTickTime() { return active() ? m_currentParameters.tickTarget : base::TimeTicks(); } -void CCDelayBasedTimeSource::onTimerFired() +void DelayBasedTimeSource::onTimerFired() { DCHECK(m_state != STATE_INACTIVE); @@ -108,12 +108,12 @@ void CCDelayBasedTimeSource::onTimerFired() m_client->onTimerTick(); } -void CCDelayBasedTimeSource::setClient(CCTimeSourceClient* client) +void DelayBasedTimeSource::setClient(TimeSourceClient* client) { m_client = client; } -void CCDelayBasedTimeSource::setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) +void DelayBasedTimeSource::setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) { m_nextParameters.interval = interval; m_nextParameters.tickTarget = timebase; @@ -149,7 +149,7 @@ void CCDelayBasedTimeSource::setTimebaseAndInterval(base::TimeTicks timebase, ba } } -base::TimeTicks CCDelayBasedTimeSource::now() const +base::TimeTicks DelayBasedTimeSource::now() const { return base::TimeTicks::Now(); } @@ -197,7 +197,7 @@ base::TimeTicks CCDelayBasedTimeSource::now() const // // For the really late delay, we we move to the next logical tick. The timebase is not reset. // now=37 tickTarget=16.667 newTarget=50.000 --> tick(), postDelayedTask(floor(50.000-37)) --> postDelayedTask(13) -base::TimeTicks CCDelayBasedTimeSource::nextTickTarget(base::TimeTicks now) +base::TimeTicks DelayBasedTimeSource::nextTickTarget(base::TimeTicks now) { base::TimeDelta newInterval = m_nextParameters.interval; int intervalsElapsed = static_cast<int>(floor((now - m_nextParameters.tickTarget).InSecondsF() / newInterval.InSecondsF())); @@ -214,7 +214,7 @@ base::TimeTicks CCDelayBasedTimeSource::nextTickTarget(base::TimeTicks now) return newTickTarget; } -void CCDelayBasedTimeSource::postNextTickTask(base::TimeTicks now) +void DelayBasedTimeSource::postNextTickTask(base::TimeTicks now) { base::TimeTicks newTickTarget = nextTickTarget(now); diff --git a/cc/delay_based_time_source.h b/cc/delay_based_time_source.h index 8469ea1..d4709f8 100644 --- a/cc/delay_based_time_source.h +++ b/cc/delay_based_time_source.h @@ -10,17 +10,17 @@ namespace cc { -class CCThread; +class Thread; // This timer implements a time source that achieves the specified interval // in face of millisecond-precision delayed callbacks and random queueing delays. -class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient { +class DelayBasedTimeSource : public TimeSource, TimerClient { public: - static scoped_refptr<CCDelayBasedTimeSource> create(base::TimeDelta interval, CCThread*); + static scoped_refptr<DelayBasedTimeSource> create(base::TimeDelta interval, Thread*); - virtual void setClient(CCTimeSourceClient* client) OVERRIDE; + virtual void setClient(TimeSourceClient* client) OVERRIDE; - // CCTimeSource implementation + // TimeSource implementation virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE; virtual void setActive(bool) OVERRIDE; @@ -31,15 +31,15 @@ public: virtual base::TimeTicks lastTickTime() OVERRIDE; virtual base::TimeTicks nextTickTime() OVERRIDE; - // CCTimerClient implementation. + // TimerClient implementation. virtual void onTimerFired() OVERRIDE; // Virtual for testing. virtual base::TimeTicks now() const; protected: - CCDelayBasedTimeSource(base::TimeDelta interval, CCThread*); - virtual ~CCDelayBasedTimeSource(); + DelayBasedTimeSource(base::TimeDelta interval, Thread*); + virtual ~DelayBasedTimeSource(); base::TimeTicks nextTickTarget(base::TimeTicks now); void postNextTickTask(base::TimeTicks now); @@ -58,7 +58,7 @@ protected: base::TimeTicks tickTarget; }; - CCTimeSourceClient* m_client; + TimeSourceClient* m_client; bool m_hasTickTarget; base::TimeTicks m_lastTickTime; @@ -70,8 +70,8 @@ protected: Parameters m_nextParameters; State m_state; - CCThread* m_thread; - CCTimer m_timer; + Thread* m_thread; + Timer m_timer; }; } // namespace cc diff --git a/cc/delay_based_time_source_unittest.cc b/cc/delay_based_time_source_unittest.cc index f8976ae..fc543a7 100644 --- a/cc/delay_based_time_source_unittest.cc +++ b/cc/delay_based_time_source_unittest.cc @@ -20,11 +20,11 @@ base::TimeDelta interval() return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); } -TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled) +TEST(DelayBasedTimeSourceTest, TaskPostedAndTickCalled) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); @@ -37,11 +37,11 @@ TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled) EXPECT_TRUE(client.tickCalled()); } -TEST(CCDelayBasedTimeSource, TickNotCalledWithTaskPosted) +TEST(DelayBasedTimeSource, TickNotCalledWithTaskPosted) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); EXPECT_TRUE(thread.hasPendingTask()); @@ -50,11 +50,11 @@ TEST(CCDelayBasedTimeSource, TickNotCalledWithTaskPosted) EXPECT_FALSE(client.tickCalled()); } -TEST(CCDelayBasedTimeSource, StartTwiceEnqueuesOneTask) +TEST(DelayBasedTimeSource, StartTwiceEnqueuesOneTask) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); EXPECT_TRUE(thread.hasPendingTask()); @@ -63,11 +63,11 @@ TEST(CCDelayBasedTimeSource, StartTwiceEnqueuesOneTask) EXPECT_FALSE(thread.hasPendingTask()); } -TEST(CCDelayBasedTimeSource, StartWhenRunningDoesntTick) +TEST(DelayBasedTimeSource, StartWhenRunningDoesntTick) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); thread.runPendingTask(); @@ -78,11 +78,11 @@ TEST(CCDelayBasedTimeSource, StartWhenRunningDoesntTick) // At 60Hz, when the tick returns at exactly the requested next time, make sure // a 16ms next delay is posted. -TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime) +TEST(DelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -98,11 +98,11 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime) // At 60Hz, when the tick returns at slightly after the requested next time, make sure // a 16ms next delay is posted. -TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime) +TEST(DelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -118,11 +118,11 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime) // At 60Hz, when the tick returns at exactly 2*interval after the requested next time, make sure // a 16ms next delay is posted. -TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime) +TEST(DelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -138,11 +138,11 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime) // At 60Hz, when the tick returns at 2*interval and a bit after the requested next time, make sure // a 16ms next delay is posted. -TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime) +TEST(DelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -158,11 +158,11 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime) // At 60Hz, when the tick returns halfway to the next frame time, make sure // a correct next delay value is posted. -TEST(CCDelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime) +TEST(DelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -178,11 +178,11 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime) // If the timebase and interval are updated with a jittery source, we want to // make sure we do not double tick. -TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase) +TEST(DelayBasedTimeSource, SaneHandlingOfJitteryTimebase) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -206,11 +206,11 @@ TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase) EXPECT_EQ(15, thread.pendingDelayMs()); } -TEST(CCDelayBasedTimeSource, HandlesSignificantTimebaseChangesImmediately) +TEST(DelayBasedTimeSource, HandlesSignificantTimebaseChangesImmediately) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -248,11 +248,11 @@ TEST(CCDelayBasedTimeSource, HandlesSignificantTimebaseChangesImmediately) EXPECT_EQ(16-7, thread.pendingDelayMs()); } -TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately) +TEST(DelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -289,13 +289,13 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately) EXPECT_EQ(16, thread.pendingDelayMs()); } -TEST(CCDelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise) +TEST(DelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise) { int numIterations = 10; - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); @@ -314,11 +314,11 @@ TEST(CCDelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise) EXPECT_NEAR(1.0 / 60.0, averageInterval, 0.1); } -TEST(CCDelayBasedTimeSource, TestDeactivateWhilePending) +TEST(DelayBasedTimeSource, TestDeactivateWhilePending) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Should post a task. timer->setActive(false); @@ -326,11 +326,11 @@ TEST(CCDelayBasedTimeSource, TestDeactivateWhilePending) thread.runPendingTask(); // Should run the posted task without crashing. } -TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime) +TEST(DelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); // Should run the activate task, and pick up a new timebase. @@ -350,11 +350,11 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime) EXPECT_EQ(12, thread.pendingDelayMs()); } -TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime) +TEST(DelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime) { - FakeCCThread thread; - FakeCCTimeSourceClient client; - scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + FakeThread thread; + FakeTimeSourceClient client; + scoped_refptr<FakeDelayBasedTimeSource> timer = FakeDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); // Should run the activate task, and pick up a new timebase. diff --git a/cc/delegated_renderer_layer.cc b/cc/delegated_renderer_layer.cc index 4323878..33f28ce 100644 --- a/cc/delegated_renderer_layer.cc +++ b/cc/delegated_renderer_layer.cc @@ -9,25 +9,25 @@ namespace cc { -scoped_refptr<DelegatedRendererLayerChromium> DelegatedRendererLayerChromium::create() +scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::create() { - return scoped_refptr<DelegatedRendererLayerChromium>(new DelegatedRendererLayerChromium()); + return scoped_refptr<DelegatedRendererLayer>(new DelegatedRendererLayer()); } -DelegatedRendererLayerChromium::DelegatedRendererLayerChromium() - : LayerChromium() +DelegatedRendererLayer::DelegatedRendererLayer() + : Layer() { setIsDrawable(true); setMasksToBounds(true); } -DelegatedRendererLayerChromium::~DelegatedRendererLayerChromium() +DelegatedRendererLayer::~DelegatedRendererLayer() { } -scoped_ptr<CCLayerImpl> DelegatedRendererLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> DelegatedRendererLayer::createLayerImpl() { - return CCDelegatedRendererLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return DelegatedRendererLayerImpl::create(m_layerId).PassAs<LayerImpl>(); } } diff --git a/cc/delegated_renderer_layer.h b/cc/delegated_renderer_layer.h index 0dbb01a..fdac4fd 100644 --- a/cc/delegated_renderer_layer.h +++ b/cc/delegated_renderer_layer.h @@ -9,17 +9,17 @@ namespace cc { -class DelegatedRendererLayerChromium : public LayerChromium { +class DelegatedRendererLayer : public Layer { public: - static scoped_refptr<DelegatedRendererLayerChromium> create(); + static scoped_refptr<DelegatedRendererLayer> create(); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; protected: - DelegatedRendererLayerChromium(); + DelegatedRendererLayer(); private: - virtual ~DelegatedRendererLayerChromium(); + virtual ~DelegatedRendererLayer(); }; } diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc index b6d1ab6..6ced800 100644 --- a/cc/delegated_renderer_layer_impl.cc +++ b/cc/delegated_renderer_layer_impl.cc @@ -14,27 +14,27 @@ namespace cc { -CCDelegatedRendererLayerImpl::CCDelegatedRendererLayerImpl(int id) - : CCLayerImpl(id) +DelegatedRendererLayerImpl::DelegatedRendererLayerImpl(int id) + : LayerImpl(id) { } -CCDelegatedRendererLayerImpl::~CCDelegatedRendererLayerImpl() +DelegatedRendererLayerImpl::~DelegatedRendererLayerImpl() { clearRenderPasses(); } -bool CCDelegatedRendererLayerImpl::descendantDrawsContent() +bool DelegatedRendererLayerImpl::descendantDrawsContent() { // FIXME: This could possibly return false even though there are some // quads present as they could all be from a single layer (or set of // layers without children). If this happens, then make a test that // ensures the opacity is being changed on quads in the root RenderPass - // when this layer doesn't own a RenderSurface. + // when this layer doesn't own a RenderSurfaceImpl. return !m_renderPassesInDrawOrder.isEmpty(); } -bool CCDelegatedRendererLayerImpl::hasContributingDelegatedRenderPasses() const +bool DelegatedRendererLayerImpl::hasContributingDelegatedRenderPasses() const { // The root RenderPass for the layer is merged with its target // RenderPass in each frame. So we only have extra RenderPasses @@ -42,7 +42,7 @@ bool CCDelegatedRendererLayerImpl::hasContributingDelegatedRenderPasses() const return m_renderPassesInDrawOrder.size() > 1; } -void CCDelegatedRendererLayerImpl::setRenderPasses(ScopedPtrVector<CCRenderPass>& renderPassesInDrawOrder) +void DelegatedRendererLayerImpl::setRenderPasses(ScopedPtrVector<RenderPass>& renderPassesInDrawOrder) { FloatRect oldRootDamage; if (!m_renderPassesInDrawOrder.isEmpty()) @@ -51,7 +51,7 @@ void CCDelegatedRendererLayerImpl::setRenderPasses(ScopedPtrVector<CCRenderPass> clearRenderPasses(); for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { - m_renderPassesIndexById.insert(std::pair<CCRenderPass::Id, int>(renderPassesInDrawOrder[i]->id(), i)); + m_renderPassesIndexById.insert(std::pair<RenderPass::Id, int>(renderPassesInDrawOrder[i]->id(), i)); m_renderPassesInDrawOrder.append(renderPassesInDrawOrder.take(i)); } renderPassesInDrawOrder.clear(); @@ -62,14 +62,14 @@ void CCDelegatedRendererLayerImpl::setRenderPasses(ScopedPtrVector<CCRenderPass> } } -void CCDelegatedRendererLayerImpl::clearRenderPasses() +void DelegatedRendererLayerImpl::clearRenderPasses() { // FIXME: Release the resources back to the nested compositor. m_renderPassesIndexById.clear(); m_renderPassesInDrawOrder.clear(); } -void CCDelegatedRendererLayerImpl::didLoseContext() +void DelegatedRendererLayerImpl::didLoseContext() { clearRenderPasses(); } @@ -77,44 +77,44 @@ void CCDelegatedRendererLayerImpl::didLoseContext() static inline int indexToId(int index) { return index + 1; } static inline int idToIndex(int id) { return id - 1; } -CCRenderPass::Id CCDelegatedRendererLayerImpl::firstContributingRenderPassId() const +RenderPass::Id DelegatedRendererLayerImpl::firstContributingRenderPassId() const { - return CCRenderPass::Id(id(), indexToId(0)); + return RenderPass::Id(id(), indexToId(0)); } -CCRenderPass::Id CCDelegatedRendererLayerImpl::nextContributingRenderPassId(CCRenderPass::Id previous) const +RenderPass::Id DelegatedRendererLayerImpl::nextContributingRenderPassId(RenderPass::Id previous) const { - return CCRenderPass::Id(previous.layerId, previous.index + 1); + return RenderPass::Id(previous.layerId, previous.index + 1); } -CCRenderPass::Id CCDelegatedRendererLayerImpl::convertDelegatedRenderPassId(CCRenderPass::Id delegatedRenderPassId) const +RenderPass::Id DelegatedRendererLayerImpl::convertDelegatedRenderPassId(RenderPass::Id delegatedRenderPassId) const { - base::hash_map<CCRenderPass::Id, int>::const_iterator it = m_renderPassesIndexById.find(delegatedRenderPassId); + base::hash_map<RenderPass::Id, int>::const_iterator it = m_renderPassesIndexById.find(delegatedRenderPassId); DCHECK(it != m_renderPassesIndexById.end()); unsigned delegatedRenderPassIndex = it->second; - return CCRenderPass::Id(id(), indexToId(delegatedRenderPassIndex)); + return RenderPass::Id(id(), indexToId(delegatedRenderPassIndex)); } -void CCDelegatedRendererLayerImpl::appendContributingRenderPasses(CCRenderPassSink& renderPassSink) +void DelegatedRendererLayerImpl::appendContributingRenderPasses(RenderPassSink& renderPassSink) { DCHECK(hasContributingDelegatedRenderPasses()); for (size_t i = 0; i < m_renderPassesInDrawOrder.size() - 1; ++i) { - CCRenderPass::Id outputRenderPassId = convertDelegatedRenderPassId(m_renderPassesInDrawOrder[i]->id()); + RenderPass::Id outputRenderPassId = convertDelegatedRenderPassId(m_renderPassesInDrawOrder[i]->id()); - // Don't clash with the RenderPass we generate if we own a RenderSurface. + // Don't clash with the RenderPass we generate if we own a RenderSurfaceImpl. DCHECK(outputRenderPassId.index > 0); renderPassSink.appendRenderPass(m_renderPassesInDrawOrder[i]->copy(outputRenderPassId)); } } -void CCDelegatedRendererLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void DelegatedRendererLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { if (m_renderPassesInDrawOrder.isEmpty()) return; - CCRenderPass::Id targetRenderPassId = appendQuadsData.renderPassId; + RenderPass::Id targetRenderPassId = appendQuadsData.renderPassId; // If the index of the renderPassId is 0, then it is a renderPass generated for a layer // in this compositor, not the delegated renderer. Then we want to merge our root renderPass with @@ -125,24 +125,24 @@ void CCDelegatedRendererLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQua // Verify that the renderPass we are appending to is created our renderTarget. DCHECK(targetRenderPassId.layerId == renderTarget()->id()); - CCRenderPass* rootDelegatedRenderPass = m_renderPassesInDrawOrder.last(); + RenderPass* rootDelegatedRenderPass = m_renderPassesInDrawOrder.last(); appendRenderPassQuads(quadSink, appendQuadsData, rootDelegatedRenderPass); } else { // Verify that the renderPass we are appending to was created by us. DCHECK(targetRenderPassId.layerId == id()); int renderPassIndex = idToIndex(targetRenderPassId.index); - CCRenderPass* delegatedRenderPass = m_renderPassesInDrawOrder[renderPassIndex]; + RenderPass* delegatedRenderPass = m_renderPassesInDrawOrder[renderPassIndex]; appendRenderPassQuads(quadSink, appendQuadsData, delegatedRenderPass); } } -void CCDelegatedRendererLayerImpl::appendRenderPassQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData, CCRenderPass* delegatedRenderPass) const +void DelegatedRendererLayerImpl::appendRenderPassQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData, RenderPass* delegatedRenderPass) const { - const CCSharedQuadState* currentSharedQuadState = 0; - CCSharedQuadState* copiedSharedQuadState = 0; + const SharedQuadState* currentSharedQuadState = 0; + SharedQuadState* copiedSharedQuadState = 0; for (size_t i = 0; i < delegatedRenderPass->quadList().size(); ++i) { - CCDrawQuad* quad = delegatedRenderPass->quadList()[i]; + DrawQuad* quad = delegatedRenderPass->quadList()[i]; if (quad->sharedQuadState() != currentSharedQuadState) { currentSharedQuadState = quad->sharedQuadState(); @@ -154,22 +154,22 @@ void CCDelegatedRendererLayerImpl::appendRenderPassQuads(CCQuadSink& quadSink, C // This layer must be drawing to a renderTarget other than itself. DCHECK(renderTarget() != this); - copiedSharedQuadState->clippedRectInTarget = CCMathUtil::mapClippedRect(drawTransform(), copiedSharedQuadState->clippedRectInTarget); + copiedSharedQuadState->clippedRectInTarget = MathUtil::mapClippedRect(drawTransform(), copiedSharedQuadState->clippedRectInTarget); copiedSharedQuadState->quadTransform = copiedSharedQuadState->quadTransform * drawTransform(); copiedSharedQuadState->opacity *= drawOpacity(); } } DCHECK(copiedSharedQuadState); - scoped_ptr<CCDrawQuad> copyQuad; - if (quad->material() != CCDrawQuad::RenderPass) + scoped_ptr<DrawQuad> copyQuad; + if (quad->material() != DrawQuad::RenderPass) copyQuad = quad->copy(copiedSharedQuadState); else { - CCRenderPass::Id contributingDelegatedRenderPassId = CCRenderPassDrawQuad::materialCast(quad)->renderPassId(); - CCRenderPass::Id contributingRenderPassId = convertDelegatedRenderPassId(contributingDelegatedRenderPassId); + RenderPass::Id contributingDelegatedRenderPassId = RenderPassDrawQuad::materialCast(quad)->renderPassId(); + RenderPass::Id contributingRenderPassId = convertDelegatedRenderPassId(contributingDelegatedRenderPassId); DCHECK(contributingRenderPassId != appendQuadsData.renderPassId); - copyQuad = CCRenderPassDrawQuad::materialCast(quad)->copy(copiedSharedQuadState, contributingRenderPassId).PassAs<CCDrawQuad>(); + copyQuad = RenderPassDrawQuad::materialCast(quad)->copy(copiedSharedQuadState, contributingRenderPassId).PassAs<DrawQuad>(); } DCHECK(copyQuad.get()); @@ -177,7 +177,7 @@ void CCDelegatedRendererLayerImpl::appendRenderPassQuads(CCQuadSink& quadSink, C } } -const char* CCDelegatedRendererLayerImpl::layerTypeAsString() const +const char* DelegatedRendererLayerImpl::layerTypeAsString() const { return "DelegatedRendererLayer"; } diff --git a/cc/delegated_renderer_layer_impl.h b/cc/delegated_renderer_layer_impl.h index 5487d02..36040aa00 100644 --- a/cc/delegated_renderer_layer_impl.h +++ b/cc/delegated_renderer_layer_impl.h @@ -10,37 +10,37 @@ namespace cc { -class CCDelegatedRendererLayerImpl : public CCLayerImpl { +class DelegatedRendererLayerImpl : public LayerImpl { public: - static scoped_ptr<CCDelegatedRendererLayerImpl> create(int id) { return make_scoped_ptr(new CCDelegatedRendererLayerImpl(id)); } - virtual ~CCDelegatedRendererLayerImpl(); + static scoped_ptr<DelegatedRendererLayerImpl> create(int id) { return make_scoped_ptr(new DelegatedRendererLayerImpl(id)); } + virtual ~DelegatedRendererLayerImpl(); virtual bool descendantDrawsContent() OVERRIDE; virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE; // This gives ownership of the RenderPasses to the layer. - void setRenderPasses(ScopedPtrVector<CCRenderPass>&); + void setRenderPasses(ScopedPtrVector<RenderPass>&); void clearRenderPasses(); virtual void didLoseContext() OVERRIDE; - virtual CCRenderPass::Id firstContributingRenderPassId() const OVERRIDE; - virtual CCRenderPass::Id nextContributingRenderPassId(CCRenderPass::Id) const OVERRIDE; + virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE; + virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const OVERRIDE; - void appendContributingRenderPasses(CCRenderPassSink&); - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; + void appendContributingRenderPasses(RenderPassSink&); + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; private: - explicit CCDelegatedRendererLayerImpl(int); + explicit DelegatedRendererLayerImpl(int); - CCRenderPass::Id convertDelegatedRenderPassId(CCRenderPass::Id delegatedRenderPassId) const; + RenderPass::Id convertDelegatedRenderPassId(RenderPass::Id delegatedRenderPassId) const; - void appendRenderPassQuads(CCQuadSink&, CCAppendQuadsData&, CCRenderPass* fromDelegatedRenderPass) const; + void appendRenderPassQuads(QuadSink&, AppendQuadsData&, RenderPass* fromDelegatedRenderPass) const; virtual const char* layerTypeAsString() const OVERRIDE; - ScopedPtrVector<CCRenderPass> m_renderPassesInDrawOrder; - base::hash_map<CCRenderPass::Id, int> m_renderPassesIndexById; + ScopedPtrVector<RenderPass> m_renderPassesInDrawOrder; + base::hash_map<RenderPass::Id, int> m_renderPassesIndexById; }; } diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc index ab873a3..9be4607 100644 --- a/cc/delegated_renderer_layer_impl_unittest.cc +++ b/cc/delegated_renderer_layer_impl_unittest.cc @@ -31,78 +31,78 @@ using namespace WebKitTests; namespace { -class CCDelegatedRendererLayerImplTest : public testing::Test, public CCLayerTreeHostImplClient { +class DelegatedRendererLayerImplTest : public testing::Test, public LayerTreeHostImplClient { public: - CCDelegatedRendererLayerImplTest() + DelegatedRendererLayerImplTest() { - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + m_hostImpl = LayerTreeHostImpl::create(settings, this); m_hostImpl->initializeRenderer(createContext()); m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); } - // CCLayerTreeHostImplClient implementation. + // LayerTreeHostImplClient implementation. virtual void didLoseContextOnImplThread() OVERRIDE { } virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } virtual void onVSyncParametersChanged(double, double) OVERRIDE { } virtual void onCanDrawStateChanged(bool) OVERRIDE { } virtual void setNeedsRedrawOnImplThread() OVERRIDE { } virtual void setNeedsCommitOnImplThread() OVERRIDE { } - virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { } + virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, double wallClockTime) OVERRIDE { } virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) OVERRIDE { return true; } protected: - scoped_ptr<CCGraphicsContext> createContext() + scoped_ptr<GraphicsContext> createContext() { - return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<CCGraphicsContext>(); + return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); } DebugScopedSetImplThread m_alwaysImplThread; DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; - scoped_ptr<CCLayerTreeHostImpl> m_hostImpl; + scoped_ptr<LayerTreeHostImpl> m_hostImpl; }; -static CCTestRenderPass* addRenderPass(ScopedPtrVector<CCRenderPass>& passList, CCRenderPass::Id id, IntRect outputRect, WebTransformationMatrix rootTransform) +static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, RenderPass::Id id, IntRect outputRect, WebTransformationMatrix rootTransform) { - scoped_ptr<CCRenderPass> pass(CCRenderPass::create(id, outputRect, rootTransform)); - CCTestRenderPass* testPass = static_cast<CCTestRenderPass*>(pass.get()); + scoped_ptr<RenderPass> pass(RenderPass::create(id, outputRect, rootTransform)); + TestRenderPass* testPass = static_cast<TestRenderPass*>(pass.get()); passList.append(pass.Pass()); return testPass; } -static CCSolidColorDrawQuad* addQuad(CCTestRenderPass* pass, IntRect rect, SkColor color) +static SolidColorDrawQuad* addQuad(TestRenderPass* pass, IntRect rect, SkColor color) { - MockCCQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList()); - CCAppendQuadsData data(pass->id()); - CCSharedQuadState* sharedState = quadSink.useSharedQuadState(CCSharedQuadState::create(WebTransformationMatrix(), rect, rect, 1, false)); - scoped_ptr<CCSolidColorDrawQuad> quad = CCSolidColorDrawQuad::create(sharedState, rect, color); - CCSolidColorDrawQuad* quadPtr = quad.get(); - quadSink.append(quad.PassAs<CCDrawQuad>(), data); + MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList()); + AppendQuadsData data(pass->id()); + SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), rect, rect, 1, false)); + scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::create(sharedState, rect, color); + SolidColorDrawQuad* quadPtr = quad.get(); + quadSink.append(quad.PassAs<DrawQuad>(), data); return quadPtr; } -static void addRenderPassQuad(CCTestRenderPass* toPass, CCTestRenderPass* contributingPass) +static void addRenderPassQuad(TestRenderPass* toPass, TestRenderPass* contributingPass) { - MockCCQuadCuller quadSink(toPass->quadList(), toPass->sharedQuadStateList()); - CCAppendQuadsData data(toPass->id()); + MockQuadCuller quadSink(toPass->quadList(), toPass->sharedQuadStateList()); + AppendQuadsData data(toPass->id()); IntRect outputRect = contributingPass->outputRect(); - CCSharedQuadState* sharedState = quadSink.useSharedQuadState(CCSharedQuadState::create(WebTransformationMatrix(), outputRect, outputRect, 1, false)); - scoped_ptr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(sharedState, outputRect, contributingPass->id(), false, 0, outputRect, 0, 0, 0, 0); - quadSink.append(quad.PassAs<CCDrawQuad>(), data); + SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), outputRect, outputRect, 1, false)); + scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::create(sharedState, outputRect, contributingPass->id(), false, 0, outputRect, 0, 0, 0, 0); + quadSink.append(quad.PassAs<DrawQuad>(), data); } -class CCDelegatedRendererLayerImplTestSimple : public CCDelegatedRendererLayerImplTest { +class DelegatedRendererLayerImplTestSimple : public DelegatedRendererLayerImplTest { public: - CCDelegatedRendererLayerImplTestSimple() - : CCDelegatedRendererLayerImplTest() + DelegatedRendererLayerImplTestSimple() + : DelegatedRendererLayerImplTest() { - scoped_ptr<CCLayerImpl> rootLayer = CCSolidColorLayerImpl::create(1).PassAs<CCLayerImpl>(); - scoped_ptr<CCLayerImpl> layerBefore = CCSolidColorLayerImpl::create(2).PassAs<CCLayerImpl>(); - scoped_ptr<CCLayerImpl> layerAfter = CCSolidColorLayerImpl::create(3).PassAs<CCLayerImpl>(); - scoped_ptr<CCDelegatedRendererLayerImpl> delegatedRendererLayer = CCDelegatedRendererLayerImpl::create(4); + scoped_ptr<LayerImpl> rootLayer = SolidColorLayerImpl::create(1).PassAs<LayerImpl>(); + scoped_ptr<LayerImpl> layerBefore = SolidColorLayerImpl::create(2).PassAs<LayerImpl>(); + scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(3).PassAs<LayerImpl>(); + scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(4); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); rootLayer->setBounds(IntSize(100, 100)); @@ -127,13 +127,13 @@ public: transform.translate(1, 1); delegatedRendererLayer->setTransform(transform); - ScopedPtrVector<CCRenderPass> delegatedRenderPasses; - CCTestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, CCRenderPass::Id(9, 6), IntRect(6, 6, 6, 6), WebTransformationMatrix()); + ScopedPtrVector<RenderPass> delegatedRenderPasses; + TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), IntRect(6, 6, 6, 6), WebTransformationMatrix()); addQuad(pass1, IntRect(0, 0, 6, 6), 33u); - CCTestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, CCRenderPass::Id(9, 7), IntRect(7, 7, 7, 7), WebTransformationMatrix()); + TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 7), IntRect(7, 7, 7, 7), WebTransformationMatrix()); addQuad(pass2, IntRect(0, 0, 7, 7), 22u); addRenderPassQuad(pass2, pass1); - CCTestRenderPass* pass3 = addRenderPass(delegatedRenderPasses, CCRenderPass::Id(9, 8), IntRect(8, 8, 8, 8), WebTransformationMatrix()); + TestRenderPass* pass3 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 8), IntRect(8, 8, 8, 8), WebTransformationMatrix()); addRenderPassQuad(pass3, pass2); delegatedRendererLayer->setRenderPasses(delegatedRenderPasses); @@ -146,7 +146,7 @@ public: m_delegatedRendererLayerPtr = delegatedRendererLayer.get(); // Force the delegated RenderPasses to come before the RenderPass from layerAfter. - layerAfter->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); + layerAfter->addChild(delegatedRendererLayer.PassAs<LayerImpl>()); rootLayer->addChild(layerAfter.Pass()); // Get the RenderPass generated by layerBefore to come before the delegated RenderPasses. @@ -156,15 +156,15 @@ public: } protected: - CCLayerImpl* m_rootLayerPtr; - CCLayerImpl* m_layerBeforePtr; - CCLayerImpl* m_layerAfterPtr; - CCDelegatedRendererLayerImpl* m_delegatedRendererLayerPtr; + LayerImpl* m_rootLayerPtr; + LayerImpl* m_layerBeforePtr; + LayerImpl* m_layerAfterPtr; + DelegatedRendererLayerImpl* m_delegatedRendererLayerPtr; }; -TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses) +TEST_F(DelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -190,9 +190,9 @@ TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses) EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[2]->outputRect()); } -TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses) +TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -218,9 +218,9 @@ TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPass EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect()); } -TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) +TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -229,7 +229,7 @@ TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) ASSERT_EQ(5u, frame.renderPasses.size()); // The layer's target is the RenderPass from m_layerAfter. - EXPECT_EQ(CCRenderPass::Id(3, 0), frame.renderPasses[3]->id()); + EXPECT_EQ(RenderPass::Id(3, 0), frame.renderPasses[3]->id()); // The DelegatedRendererLayer should have added copies of quads in its root RenderPass to its target RenderPass. // The m_layerAfter also adds one quad. @@ -242,9 +242,9 @@ TEST_F(CCDelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) EXPECT_RECT_EQ(IntRect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->quadRect()); } -TEST_F(CCDelegatedRendererLayerImplTestSimple, QuadsFromRootRenderPassAreModifiedForTheTarget) +TEST_F(DelegatedRendererLayerImplTestSimple, QuadsFromRootRenderPassAreModifiedForTheTarget) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -266,18 +266,18 @@ TEST_F(CCDelegatedRendererLayerImplTestSimple, QuadsFromRootRenderPassAreModifie EXPECT_TRANSFORMATION_MATRIX_EQ(WebTransformationMatrix(), frame.renderPasses[1]->quadList()[0]->quadTransform()); } -class CCDelegatedRendererLayerImplTestOwnSurface : public CCDelegatedRendererLayerImplTestSimple { +class DelegatedRendererLayerImplTestOwnSurface : public DelegatedRendererLayerImplTestSimple { public: - CCDelegatedRendererLayerImplTestOwnSurface() - : CCDelegatedRendererLayerImplTestSimple() + DelegatedRendererLayerImplTestOwnSurface() + : DelegatedRendererLayerImplTestSimple() { m_delegatedRendererLayerPtr->setForceRenderSurface(true); } }; -TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) +TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -306,9 +306,9 @@ TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[2]->outputRect()); } -TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsQuadsToContributingRenderPasses) +TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToContributingRenderPasses) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -334,9 +334,9 @@ TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsQuadsToContributingRender EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect()); } -TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) +TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -345,7 +345,7 @@ TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) ASSERT_EQ(6u, frame.renderPasses.size()); // The layer's target is the RenderPass owned by itself. - EXPECT_EQ(CCRenderPass::Id(4, 0), frame.renderPasses[3]->id()); + EXPECT_EQ(RenderPass::Id(4, 0), frame.renderPasses[3]->id()); // The DelegatedRendererLayer should have added copies of quads in its root RenderPass to its target RenderPass. // The m_layerAfter also adds one quad. @@ -355,9 +355,9 @@ TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect()); } -TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNotModifiedForTheTarget) +TEST_F(DelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNotModifiedForTheTarget) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -365,7 +365,7 @@ TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNot // Each non-DelegatedRendererLayer added one RenderPass. The DelegatedRendererLayer added two contributing passes and its owned surface added one pass. ASSERT_EQ(6u, frame.renderPasses.size()); - // Because the DelegatedRendererLayer owns a RenderSurface, its root RenderPass' quads do not need to be + // Because the DelegatedRendererLayer owns a RenderSurfaceImpl, its root RenderPass' quads do not need to be // modified at all. EXPECT_TRANSFORMATION_MATRIX_EQ(WebTransformationMatrix(), frame.renderPasses[3]->quadList()[0]->quadTransform()); @@ -377,13 +377,13 @@ TEST_F(CCDelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNot EXPECT_TRANSFORMATION_MATRIX_EQ(WebTransformationMatrix(), frame.renderPasses[1]->quadList()[0]->quadTransform()); } -class CCDelegatedRendererLayerImplTestSharedData : public CCDelegatedRendererLayerImplTest { +class DelegatedRendererLayerImplTestSharedData : public DelegatedRendererLayerImplTest { public: - CCDelegatedRendererLayerImplTestSharedData() - : CCDelegatedRendererLayerImplTest() + DelegatedRendererLayerImplTestSharedData() + : DelegatedRendererLayerImplTest() { - scoped_ptr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); - scoped_ptr<CCDelegatedRendererLayerImpl> delegatedRendererLayer = CCDelegatedRendererLayerImpl::create(2); + scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); + scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(2); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); rootLayer->setBounds(IntSize(100, 100)); @@ -396,16 +396,16 @@ public: transform.translate(10, 10); delegatedRendererLayer->setTransform(transform); - ScopedPtrVector<CCRenderPass> delegatedRenderPasses; + ScopedPtrVector<RenderPass> delegatedRenderPasses; IntRect passRect(0, 0, 50, 50); - CCTestRenderPass* pass = addRenderPass(delegatedRenderPasses, CCRenderPass::Id(9, 6), passRect, WebTransformationMatrix()); - MockCCQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList()); - CCAppendQuadsData data(pass->id()); - CCSharedQuadState* sharedState = quadSink.useSharedQuadState(CCSharedQuadState::create(WebTransformationMatrix(), passRect, passRect, 1, false)); - quadSink.append(CCSolidColorDrawQuad::create(sharedState, IntRect(0, 0, 10, 10), 1u).PassAs<CCDrawQuad>(), data); - quadSink.append(CCSolidColorDrawQuad::create(sharedState, IntRect(0, 10, 10, 10), 2u).PassAs<CCDrawQuad>(), data); - quadSink.append(CCSolidColorDrawQuad::create(sharedState, IntRect(10, 0, 10, 10), 3u).PassAs<CCDrawQuad>(), data); - quadSink.append(CCSolidColorDrawQuad::create(sharedState, IntRect(10, 10, 10, 10), 4u).PassAs<CCDrawQuad>(), data); + TestRenderPass* pass = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), passRect, WebTransformationMatrix()); + MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList()); + AppendQuadsData data(pass->id()); + SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), passRect, passRect, 1, false)); + quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(0, 0, 10, 10), 1u).PassAs<DrawQuad>(), data); + quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(0, 10, 10, 10), 2u).PassAs<DrawQuad>(), data); + quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(10, 0, 10, 10), 3u).PassAs<DrawQuad>(), data); + quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(10, 10, 10, 10), 4u).PassAs<DrawQuad>(), data); delegatedRendererLayer->setRenderPasses(delegatedRenderPasses); // The RenderPasses should be taken by the layer. @@ -414,19 +414,19 @@ public: m_rootLayerPtr = rootLayer.get(); m_delegatedRendererLayerPtr = delegatedRendererLayer.get(); - rootLayer->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>()); m_hostImpl->setRootLayer(rootLayer.Pass()); } protected: - CCLayerImpl* m_rootLayerPtr; - CCDelegatedRendererLayerImpl* m_delegatedRendererLayerPtr; + LayerImpl* m_rootLayerPtr; + DelegatedRendererLayerImpl* m_delegatedRendererLayerPtr; }; -TEST_F(CCDelegatedRendererLayerImplTestSharedData, SharedData) +TEST_F(DelegatedRendererLayerImplTestSharedData, SharedData) { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -435,11 +435,11 @@ TEST_F(CCDelegatedRendererLayerImplTestSharedData, SharedData) EXPECT_EQ(1, frame.renderPasses[0]->id().layerId); EXPECT_EQ(0, frame.renderPasses[0]->id().index); - const CCQuadList& quadList = frame.renderPasses[0]->quadList(); + const QuadList& quadList = frame.renderPasses[0]->quadList(); ASSERT_EQ(4u, quadList.size()); // All quads should share the same state. - const CCSharedQuadState* sharedState = quadList[0]->sharedQuadState(); + const SharedQuadState* sharedState = quadList[0]->sharedQuadState(); EXPECT_EQ(sharedState, quadList[1]->sharedQuadState()); EXPECT_EQ(sharedState, quadList[2]->sharedQuadState()); EXPECT_EQ(sharedState, quadList[3]->sharedQuadState()); diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc index 444c15f..e54bcb1 100644 --- a/cc/direct_renderer.cc +++ b/cc/direct_renderer.cc @@ -50,7 +50,7 @@ static WebTransformationMatrix windowMatrix(int x, int y, int width, int height) namespace cc { -CCDirectRenderer::DrawingFrame::DrawingFrame() +DirectRenderer::DrawingFrame::DrawingFrame() : rootRenderPass(0) , currentRenderPass(0) , currentTexture(0) @@ -58,19 +58,19 @@ CCDirectRenderer::DrawingFrame::DrawingFrame() { } -CCDirectRenderer::DrawingFrame::~DrawingFrame() +DirectRenderer::DrawingFrame::~DrawingFrame() { } // // static -FloatRect CCDirectRenderer::quadVertexRect() +FloatRect DirectRenderer::quadVertexRect() { return FloatRect(-0.5, -0.5, 1, 1); } // static -void CCDirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRectTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRect& quadRect) +void DirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRectTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRect& quadRect) { *quadRectTransform = quadTransform; quadRectTransform->translate(0.5 * quadRect.width() + quadRect.x(), 0.5 * quadRect.height() + quadRect.y()); @@ -78,7 +78,7 @@ void CCDirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRe } // static -void CCDirectRenderer::initializeMatrices(DrawingFrame& frame, const IntRect& drawRect, bool flipY) +void DirectRenderer::initializeMatrices(DrawingFrame& frame, const IntRect& drawRect, bool flipY) { if (flipY) frame.projectionMatrix = orthoProjectionMatrix(drawRect.x(), drawRect.maxX(), drawRect.maxY(), drawRect.y()); @@ -89,7 +89,7 @@ void CCDirectRenderer::initializeMatrices(DrawingFrame& frame, const IntRect& dr } // static -IntRect CCDirectRenderer::moveScissorToWindowSpace(const DrawingFrame& frame, FloatRect scissorRect) +IntRect DirectRenderer::moveScissorToWindowSpace(const DrawingFrame& frame, FloatRect scissorRect) { IntRect scissorRectInCanvasSpace = enclosingIntRect(scissorRect); // The scissor coordinates must be supplied in viewport space so we need to offset @@ -103,32 +103,32 @@ IntRect CCDirectRenderer::moveScissorToWindowSpace(const DrawingFrame& frame, Fl return scissorRectInCanvasSpace; } -CCDirectRenderer::CCDirectRenderer(CCRendererClient* client, CCResourceProvider* resourceProvider) - : CCRenderer(client) +DirectRenderer::DirectRenderer(RendererClient* client, ResourceProvider* resourceProvider) + : Renderer(client) , m_resourceProvider(resourceProvider) { } -CCDirectRenderer::~CCDirectRenderer() +DirectRenderer::~DirectRenderer() { } -void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) +void DirectRenderer::decideRenderPassAllocationsForFrame(const RenderPassList& renderPassesInDrawOrder) { - base::hash_map<CCRenderPass::Id, const CCRenderPass*> renderPassesInFrame; + base::hash_map<RenderPass::Id, const RenderPass*> renderPassesInFrame; for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) - renderPassesInFrame.insert(std::pair<CCRenderPass::Id, const CCRenderPass*>(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i])); + renderPassesInFrame.insert(std::pair<RenderPass::Id, const RenderPass*>(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i])); - std::vector<CCRenderPass::Id> passesToDelete; - ScopedPtrHashMap<CCRenderPass::Id, CachedTexture>::const_iterator passIterator; + std::vector<RenderPass::Id> passesToDelete; + ScopedPtrHashMap<RenderPass::Id, CachedTexture>::const_iterator passIterator; for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPassTextures.end(); ++passIterator) { - base::hash_map<CCRenderPass::Id, const CCRenderPass*>::const_iterator it = renderPassesInFrame.find(passIterator->first); + base::hash_map<RenderPass::Id, const RenderPass*>::const_iterator it = renderPassesInFrame.find(passIterator->first); if (it == renderPassesInFrame.end()) { passesToDelete.push_back(passIterator->first); continue; } - const CCRenderPass* renderPassInFrame = it->second; + const RenderPass* renderPassInFrame = it->second; const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame); CachedTexture* texture = passIterator->second; @@ -150,9 +150,9 @@ void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis } } -void CCDirectRenderer::drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById) +void DirectRenderer::drawFrame(const RenderPassList& renderPassesInDrawOrder, const RenderPassIdHashMap& renderPassesById) { - const CCRenderPass* rootRenderPass = renderPassesInDrawOrder.back(); + const RenderPass* rootRenderPass = renderPassesInDrawOrder.back(); DCHECK(rootRenderPass); DrawingFrame frame; @@ -167,7 +167,7 @@ void CCDirectRenderer::drawFrame(const CCRenderPassList& renderPassesInDrawOrder finishDrawingFrame(frame); } -void CCDirectRenderer::drawRenderPass(DrawingFrame& frame, const CCRenderPass* renderPass) +void DirectRenderer::drawRenderPass(DrawingFrame& frame, const RenderPass* renderPass) { if (!useRenderPass(frame, renderPass)) return; @@ -175,14 +175,14 @@ void CCDirectRenderer::drawRenderPass(DrawingFrame& frame, const CCRenderPass* r frame.scissorRectInRenderPassSpace = frame.currentRenderPass->outputRect(); if (frame.rootDamageRect != frame.rootRenderPass->outputRect()) { WebTransformationMatrix inverseTransformToRoot = frame.currentRenderPass->transformToRootTarget().inverse(); - frame.scissorRectInRenderPassSpace.intersect(CCMathUtil::projectClippedRect(inverseTransformToRoot, frame.rootDamageRect)); + frame.scissorRectInRenderPassSpace.intersect(MathUtil::projectClippedRect(inverseTransformToRoot, frame.rootDamageRect)); } enableScissorTestRect(moveScissorToWindowSpace(frame, frame.scissorRectInRenderPassSpace)); clearFramebuffer(frame); - const CCQuadList& quadList = renderPass->quadList(); - for (CCQuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) { + const QuadList& quadList = renderPass->quadList(); + for (QuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) { FloatRect quadScissorRect = frame.scissorRectInRenderPassSpace; quadScissorRect.intersect((*it)->clippedRectInTarget()); if (!quadScissorRect.isEmpty()) { @@ -196,7 +196,7 @@ void CCDirectRenderer::drawRenderPass(DrawingFrame& frame, const CCRenderPass* r texture->setIsComplete(!renderPass->hasOcclusionFromOutsideTargetSurface()); } -bool CCDirectRenderer::useRenderPass(DrawingFrame& frame, const CCRenderPass* renderPass) +bool DirectRenderer::useRenderPass(DrawingFrame& frame, const RenderPass* renderPass) { frame.currentRenderPass = renderPass; frame.currentTexture = 0; @@ -210,26 +210,26 @@ bool CCDirectRenderer::useRenderPass(DrawingFrame& frame, const CCRenderPass* re CachedTexture* texture = m_renderPassTextures.get(renderPass->id()); DCHECK(texture); - if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::TextureUsageFramebuffer)) + if (!texture->id() && !texture->allocate(Renderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), ResourceProvider::TextureUsageFramebuffer)) return false; return bindFramebufferToTexture(frame, texture, renderPass->outputRect()); } -bool CCDirectRenderer::haveCachedResourcesForRenderPassId(CCRenderPass::Id id) const +bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const { CachedTexture* texture = m_renderPassTextures.get(id); return texture && texture->id() && texture->isComplete(); } // static -IntSize CCDirectRenderer::renderPassTextureSize(const CCRenderPass* pass) +IntSize DirectRenderer::renderPassTextureSize(const RenderPass* pass) { return pass->outputRect().size(); } // static -GLenum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) +GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) { return GL_RGBA; } diff --git a/cc/direct_renderer.h b/cc/direct_renderer.h index edf4001..d3156ff 100644 --- a/cc/direct_renderer.h +++ b/cc/direct_renderer.h @@ -12,32 +12,32 @@ namespace cc { -class CCResourceProvider; +class ResourceProvider; // This is the base class for code shared between the GL and software // renderer implementations. "Direct" refers to the fact that it does not // delegate rendering to another compositor. -class CCDirectRenderer : public CCRenderer { +class DirectRenderer : public Renderer { public: - virtual ~CCDirectRenderer(); + virtual ~DirectRenderer(); - CCResourceProvider* resourceProvider() const { return m_resourceProvider; } + ResourceProvider* resourceProvider() const { return m_resourceProvider; } - virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) OVERRIDE; - virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const OVERRIDE; - virtual void drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById) OVERRIDE; + virtual void decideRenderPassAllocationsForFrame(const RenderPassList& renderPassesInDrawOrder) OVERRIDE; + virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id) const OVERRIDE; + virtual void drawFrame(const RenderPassList& renderPassesInDrawOrder, const RenderPassIdHashMap& renderPassesById) OVERRIDE; protected: - CCDirectRenderer(CCRendererClient* client, CCResourceProvider* resourceProvider); + DirectRenderer(RendererClient* client, ResourceProvider* resourceProvider); struct DrawingFrame { DrawingFrame(); ~DrawingFrame(); - const CCRenderPassIdHashMap* renderPassesById; - const CCRenderPass* rootRenderPass; - const CCRenderPass* currentRenderPass; - const CCScopedTexture* currentTexture; + const RenderPassIdHashMap* renderPassesById; + const RenderPass* rootRenderPass; + const RenderPass* currentRenderPass; + const ScopedTexture* currentTexture; FloatRect rootDamageRect; @@ -47,9 +47,9 @@ protected: FloatRect scissorRectInRenderPassSpace; }; - class CachedTexture : public CCScopedTexture { + class CachedTexture : public ScopedTexture { public: - static scoped_ptr<CachedTexture> create(CCResourceProvider* resourceProvider) { + static scoped_ptr<CachedTexture> create(ResourceProvider* resourceProvider) { return make_scoped_ptr(new CachedTexture(resourceProvider)); } virtual ~CachedTexture() {} @@ -58,8 +58,8 @@ protected: void setIsComplete(bool isComplete) { m_isComplete = isComplete; } protected: - explicit CachedTexture(CCResourceProvider* resourceProvider) - : CCScopedTexture(resourceProvider) + explicit CachedTexture(ResourceProvider* resourceProvider) + : ScopedTexture(resourceProvider) , m_isComplete(false) { } @@ -75,29 +75,29 @@ protected: static void initializeMatrices(DrawingFrame&, const IntRect& drawRect, bool flipY); static IntRect moveScissorToWindowSpace(const DrawingFrame&, FloatRect scissorRect); - bool haveCachedResources(CCRenderPass::Id) const; - static IntSize renderPassTextureSize(const CCRenderPass*); - static GLenum renderPassTextureFormat(const CCRenderPass*); + bool haveCachedResources(RenderPass::Id) const; + static IntSize renderPassTextureSize(const RenderPass*); + static GLenum renderPassTextureFormat(const RenderPass*); - void drawRenderPass(DrawingFrame&, const CCRenderPass*); - bool useRenderPass(DrawingFrame&, const CCRenderPass*); + void drawRenderPass(DrawingFrame&, const RenderPass*); + bool useRenderPass(DrawingFrame&, const RenderPass*); virtual void bindFramebufferToOutputSurface(DrawingFrame&) = 0; - virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) = 0; + virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, const IntRect& framebufferRect) = 0; virtual void setDrawViewportSize(const IntSize&) = 0; virtual void enableScissorTestRect(const IntRect& scissorRect) = 0; virtual void disableScissorTest() = 0; virtual void clearFramebuffer(DrawingFrame&) = 0; - virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) = 0; + virtual void drawQuad(DrawingFrame&, const DrawQuad*) = 0; virtual void beginDrawingFrame(DrawingFrame&) = 0; virtual void finishDrawingFrame(DrawingFrame&) = 0; virtual bool flippedFramebuffer() const = 0; - ScopedPtrHashMap<CCRenderPass::Id, CachedTexture> m_renderPassTextures; - CCResourceProvider* m_resourceProvider; + ScopedPtrHashMap<RenderPass::Id, CachedTexture> m_renderPassTextures; + ResourceProvider* m_resourceProvider; private: - DISALLOW_COPY_AND_ASSIGN(CCDirectRenderer); + DISALLOW_COPY_AND_ASSIGN(DirectRenderer); }; } // namespace cc diff --git a/cc/draw_quad.cc b/cc/draw_quad.cc index 65d2506..bf63b4a 100644 --- a/cc/draw_quad.cc +++ b/cc/draw_quad.cc @@ -20,7 +20,7 @@ namespace cc { -CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) +DrawQuad::DrawQuad(const SharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) : m_sharedQuadState(sharedQuadState) , m_sharedQuadStateId(sharedQuadState->id) , m_material(material) @@ -33,7 +33,7 @@ CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material materi DCHECK(m_material != Invalid); } -IntRect CCDrawQuad::opaqueRect() const +IntRect DrawQuad::opaqueRect() const { if (opacity() != 1) return IntRect(); @@ -42,43 +42,43 @@ IntRect CCDrawQuad::opaqueRect() const return m_opaqueRect; } -void CCDrawQuad::setQuadVisibleRect(const IntRect& quadVisibleRect) +void DrawQuad::setQuadVisibleRect(const IntRect& quadVisibleRect) { IntRect intersection = quadVisibleRect; intersection.intersect(m_quadRect); m_quadVisibleRect = intersection; } -unsigned CCDrawQuad::size() const +unsigned DrawQuad::size() const { switch (material()) { case Checkerboard: - return sizeof(CCCheckerboardDrawQuad); + return sizeof(CheckerboardDrawQuad); case DebugBorder: - return sizeof(CCDebugBorderDrawQuad); + return sizeof(DebugBorderDrawQuad); case IOSurfaceContent: - return sizeof(CCIOSurfaceDrawQuad); + return sizeof(IOSurfaceDrawQuad); case TextureContent: - return sizeof(CCTextureDrawQuad); + return sizeof(TextureDrawQuad); case SolidColor: - return sizeof(CCSolidColorDrawQuad); + return sizeof(SolidColorDrawQuad); case TiledContent: - return sizeof(CCTileDrawQuad); + return sizeof(TileDrawQuad); case StreamVideoContent: - return sizeof(CCStreamVideoDrawQuad); + return sizeof(StreamVideoDrawQuad); case RenderPass: - return sizeof(CCRenderPassDrawQuad); + return sizeof(RenderPassDrawQuad); case YUVVideoContent: - return sizeof(CCYUVVideoDrawQuad); + return sizeof(YUVVideoDrawQuad); case Invalid: break; } CRASH(); - return sizeof(CCDrawQuad); + return sizeof(DrawQuad); } -scoped_ptr<CCDrawQuad> CCDrawQuad::copy(const CCSharedQuadState* copiedSharedQuadState) const +scoped_ptr<DrawQuad> DrawQuad::copy(const SharedQuadState* copiedSharedQuadState) const { // RenderPass quads have their own copy() method. DCHECK(material() != RenderPass); @@ -86,14 +86,14 @@ scoped_ptr<CCDrawQuad> CCDrawQuad::copy(const CCSharedQuadState* copiedSharedQua unsigned bytes = size(); DCHECK(bytes > 0); - scoped_ptr<CCDrawQuad> copyQuad(reinterpret_cast<CCDrawQuad*>(new char[bytes])); + scoped_ptr<DrawQuad> copyQuad(reinterpret_cast<DrawQuad*>(new char[bytes])); memcpy(copyQuad.get(), this, bytes); copyQuad->setSharedQuadState(copiedSharedQuadState); return copyQuad.Pass(); } -void CCDrawQuad::setSharedQuadState(const CCSharedQuadState* sharedQuadState) +void DrawQuad::setSharedQuadState(const SharedQuadState* sharedQuadState) { m_sharedQuadState = sharedQuadState; m_sharedQuadStateId = sharedQuadState->id; diff --git a/cc/draw_quad.h b/cc/draw_quad.h index 89fc674..50f3dc2 100644 --- a/cc/draw_quad.h +++ b/cc/draw_quad.h @@ -9,7 +9,7 @@ namespace cc { -// WARNING! All CCXYZDrawQuad classes must remain PODs (plain old data). +// WARNING! All XYZDrawQuad classes must remain PODs (plain old data). // They are intended to be "serializable" by copying their raw bytes, so they // must not contain any non-bit-copyable member variables! // @@ -19,11 +19,11 @@ namespace cc { // transferring these classes over the wire. #pragma pack(push, 4) -// CCDrawQuad is a bag of data used for drawing a quad. Because different +// DrawQuad is a bag of data used for drawing a quad. Because different // materials need different bits of per-quad data to render, classes that derive -// from CCDrawQuad store additional data in their derived instance. The Material +// from DrawQuad store additional data in their derived instance. The Material // enum is used to "safely" downcast to the derived class. -class CCDrawQuad { +class DrawQuad { public: enum Material { Invalid, @@ -59,19 +59,19 @@ public: // looking at the material type). unsigned size() const; - scoped_ptr<CCDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState) const; + scoped_ptr<DrawQuad> copy(const SharedQuadState* copiedSharedQuadState) const; - const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; } + const SharedQuadState* sharedQuadState() const { return m_sharedQuadState; } int sharedQuadStateId() const { return m_sharedQuadStateId; } - void setSharedQuadState(const CCSharedQuadState*); + void setSharedQuadState(const SharedQuadState*); protected: - CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&); + DrawQuad(const SharedQuadState*, Material, const IntRect&); // Stores state common to a large bundle of quads; kept separate for memory // efficiency. There is special treatment to reconstruct these pointers // during serialization. - const CCSharedQuadState* m_sharedQuadState; + const SharedQuadState* m_sharedQuadState; int m_sharedQuadStateId; Material m_material; diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc index b7af099..7242c70 100644 --- a/cc/draw_quad_unittest.cc +++ b/cc/draw_quad_unittest.cc @@ -25,7 +25,7 @@ using namespace cc; namespace { -TEST(CCDrawQuadTest, copySharedQuadState) +TEST(DrawQuadTest, copySharedQuadState) { WebTransformationMatrix quadTransform(1, 0.5, 0, 1, 0.5, 0); IntRect visibleContentRect(10, 12, 14, 16); @@ -34,10 +34,10 @@ TEST(CCDrawQuadTest, copySharedQuadState) bool opaque = true; int id = 3; - scoped_ptr<CCSharedQuadState> state(CCSharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + scoped_ptr<SharedQuadState> state(SharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); state->id = id; - scoped_ptr<CCSharedQuadState> copy(state->copy()); + scoped_ptr<SharedQuadState> copy(state->copy()); EXPECT_EQ(id, copy->id); EXPECT_EQ(quadTransform, copy->quadTransform); EXPECT_RECT_EQ(visibleContentRect, copy->visibleContentRect); @@ -46,7 +46,7 @@ TEST(CCDrawQuadTest, copySharedQuadState) EXPECT_EQ(opaque, copy->opaque); } -scoped_ptr<CCSharedQuadState> createSharedQuadState() +scoped_ptr<SharedQuadState> createSharedQuadState() { WebTransformationMatrix quadTransform(1, 0.5, 0, 1, 0.5, 0); IntRect visibleContentRect(10, 12, 14, 16); @@ -55,12 +55,12 @@ scoped_ptr<CCSharedQuadState> createSharedQuadState() bool opaque = false; int id = 3; - scoped_ptr<CCSharedQuadState> state(CCSharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + scoped_ptr<SharedQuadState> state(SharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); state->id = id; return state.Pass(); } -void compareDrawQuad(CCDrawQuad* quad, CCDrawQuad* copy, CCSharedQuadState* copySharedState) +void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copySharedState) { EXPECT_EQ(quad->size(), copy->size()); EXPECT_EQ(quad->material(), copy->material()); @@ -78,8 +78,8 @@ void compareDrawQuad(CCDrawQuad* quad, CCDrawQuad* copy, CCSharedQuadState* copy } #define CREATE_SHARED_STATE() \ - scoped_ptr<CCSharedQuadState> sharedState(createSharedQuadState()); \ - scoped_ptr<CCSharedQuadState> copySharedState(sharedState->copy()); \ + scoped_ptr<SharedQuadState> sharedState(createSharedQuadState()); \ + scoped_ptr<SharedQuadState> copySharedState(sharedState->copy()); \ copySharedState->id = 5; #define QUAD_DATA \ @@ -88,13 +88,13 @@ void compareDrawQuad(CCDrawQuad* quad, CCDrawQuad* copy, CCSharedQuadState* copy #define SETUP_AND_COPY_QUAD(Type, quad) \ quad->setQuadVisibleRect(quadVisibleRect); \ - scoped_ptr<CCDrawQuad> copy(quad->copy(copySharedState.get())); \ + scoped_ptr<DrawQuad> copy(quad->copy(copySharedState.get())); \ compareDrawQuad(quad.get(), copy.get(), copySharedState.get()); \ const Type* copyQuad = Type::materialCast(copy.get()); #define SETUP_AND_COPY_QUAD_1(Type, quad, a) \ quad->setQuadVisibleRect(quadVisibleRect); \ - scoped_ptr<CCDrawQuad> copy(quad->copy(copySharedState.get(), a)); \ + scoped_ptr<DrawQuad> copy(quad->copy(copySharedState.get(), a)); \ compareDrawQuad(quad.get(), copy.get(), copySharedState.get()); \ const Type* copyQuad = Type::materialCast(copy.get()); @@ -159,52 +159,52 @@ void compareDrawQuad(CCDrawQuad* quad, CCDrawQuad* copy, CCSharedQuadState* copy scoped_ptr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h, i, j)); \ SETUP_AND_COPY_QUAD(Type, quad); -TEST(CCDrawQuadTest, copyCheckerboardDrawQuad) +TEST(DrawQuadTest, copyCheckerboardDrawQuad) { SkColor color = 0xfabb0011; CREATE_SHARED_STATE(); - CREATE_QUAD_1(CCCheckerboardDrawQuad, color); + CREATE_QUAD_1(CheckerboardDrawQuad, color); EXPECT_EQ(color, copyQuad->color()); } -TEST(CCDrawQuadTest, copyDebugBorderDrawQuad) +TEST(DrawQuadTest, copyDebugBorderDrawQuad) { SkColor color = 0xfabb0011; int width = 99; CREATE_SHARED_STATE(); - CREATE_QUAD_2(CCDebugBorderDrawQuad, color, width); + CREATE_QUAD_2(DebugBorderDrawQuad, color, width); EXPECT_EQ(color, copyQuad->color()); EXPECT_EQ(width, copyQuad->width()); } -TEST(CCDrawQuadTest, copyIOSurfaceDrawQuad) +TEST(DrawQuadTest, copyIOSurfaceDrawQuad) { IntSize size(58, 95); unsigned textureId = 72; - CCIOSurfaceDrawQuad::Orientation orientation = CCIOSurfaceDrawQuad::Unflipped; + IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::Unflipped; CREATE_SHARED_STATE(); - CREATE_QUAD_3(CCIOSurfaceDrawQuad, size, textureId, orientation); + CREATE_QUAD_3(IOSurfaceDrawQuad, size, textureId, orientation); EXPECT_EQ(size, copyQuad->ioSurfaceSize()); EXPECT_EQ(textureId, copyQuad->ioSurfaceTextureId()); EXPECT_EQ(orientation, copyQuad->orientation()); } -TEST(CCDrawQuadTest, copyRenderPassDrawQuad) +TEST(DrawQuadTest, copyRenderPassDrawQuad) { - CCRenderPass::Id renderPassId(22, 64); + RenderPass::Id renderPassId(22, 64); bool isReplica = true; - CCResourceProvider::ResourceId maskResourceId = 78; + ResourceProvider::ResourceId maskResourceId = 78; IntRect contentsChangedSinceLastFrame(42, 11, 74, 24); float maskTexCoordScaleX = 33; float maskTexCoordScaleY = 19; float maskTexCoordOffsetX = -45; float maskTexCoordOffsetY = -21; - CCRenderPass::Id copiedRenderPassId(235, 11); + RenderPass::Id copiedRenderPassId(235, 11); CREATE_SHARED_STATE(); - CREATE_QUAD_8_1(CCRenderPassDrawQuad, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY, copiedRenderPassId); + CREATE_QUAD_8_1(RenderPassDrawQuad, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY, copiedRenderPassId); EXPECT_EQ(copiedRenderPassId, copyQuad->renderPassId()); EXPECT_EQ(isReplica, copyQuad->isReplica()); EXPECT_EQ(maskResourceId, copyQuad->maskResourceId()); @@ -215,27 +215,27 @@ TEST(CCDrawQuadTest, copyRenderPassDrawQuad) EXPECT_EQ(maskTexCoordOffsetY, copyQuad->maskTexCoordOffsetY()); } -TEST(CCDrawQuadTest, copySolidColorDrawQuad) +TEST(DrawQuadTest, copySolidColorDrawQuad) { SkColor color = 0x49494949; CREATE_SHARED_STATE(); - CREATE_QUAD_1(CCSolidColorDrawQuad, color); + CREATE_QUAD_1(SolidColorDrawQuad, color); EXPECT_EQ(color, copyQuad->color()); } -TEST(CCDrawQuadTest, copyStreamVideoDrawQuad) +TEST(DrawQuadTest, copyStreamVideoDrawQuad) { unsigned textureId = 64; WebTransformationMatrix matrix(0.5, 1, 0.25, 0.75, 0, 1); CREATE_SHARED_STATE(); - CREATE_QUAD_2(CCStreamVideoDrawQuad, textureId, matrix); + CREATE_QUAD_2(StreamVideoDrawQuad, textureId, matrix); EXPECT_EQ(textureId, copyQuad->textureId()); EXPECT_EQ(matrix, copyQuad->matrix()); } -TEST(CCDrawQuadTest, copyTextureDrawQuad) +TEST(DrawQuadTest, copyTextureDrawQuad) { unsigned resourceId = 82; bool premultipliedAlpha = true; @@ -243,14 +243,14 @@ TEST(CCDrawQuadTest, copyTextureDrawQuad) bool flipped = true; CREATE_SHARED_STATE(); - CREATE_QUAD_4(CCTextureDrawQuad, resourceId, premultipliedAlpha, uvRect, flipped); + CREATE_QUAD_4(TextureDrawQuad, resourceId, premultipliedAlpha, uvRect, flipped); EXPECT_EQ(resourceId, copyQuad->resourceId()); EXPECT_EQ(premultipliedAlpha, copyQuad->premultipliedAlpha()); EXPECT_EQ(uvRect, copyQuad->uvRect()); EXPECT_EQ(flipped, copyQuad->flipped()); } -TEST(CCDrawQuadTest, copyTileDrawQuad) +TEST(DrawQuadTest, copyTileDrawQuad) { IntRect opaqueRect(33, 44, 22, 33); unsigned resourceId = 104; @@ -264,7 +264,7 @@ TEST(CCDrawQuadTest, copyTileDrawQuad) bool bottomEdgeAA = true; CREATE_SHARED_STATE(); - CREATE_QUAD_10(CCTileDrawQuad, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA); + CREATE_QUAD_10(TileDrawQuad, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA); EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect()); EXPECT_EQ(resourceId, copyQuad->resourceId()); EXPECT_EQ(textureOffset, copyQuad->textureOffset()); @@ -277,26 +277,26 @@ TEST(CCDrawQuadTest, copyTileDrawQuad) EXPECT_EQ(bottomEdgeAA, copyQuad->bottomEdgeAA()); } -TEST(CCDrawQuadTest, copyYUVVideoDrawQuad) +TEST(DrawQuadTest, copyYUVVideoDrawQuad) { - CCVideoLayerImpl::FramePlane yPlane; + VideoLayerImpl::FramePlane yPlane; yPlane.resourceId = 45; yPlane.size = IntSize(34, 23); yPlane.format = 8; yPlane.visibleSize = IntSize(623, 235); - CCVideoLayerImpl::FramePlane uPlane; + VideoLayerImpl::FramePlane uPlane; uPlane.resourceId = 532; uPlane.size = IntSize(134, 16); uPlane.format = 2; uPlane.visibleSize = IntSize(126, 27); - CCVideoLayerImpl::FramePlane vPlane; + VideoLayerImpl::FramePlane vPlane; vPlane.resourceId = 4; vPlane.size = IntSize(456, 486); vPlane.format = 46; vPlane.visibleSize = IntSize(19, 45); CREATE_SHARED_STATE(); - CREATE_QUAD_3(CCYUVVideoDrawQuad, yPlane, uPlane, vPlane); + CREATE_QUAD_3(YUVVideoDrawQuad, yPlane, uPlane, vPlane); EXPECT_EQ(yPlane.resourceId, copyQuad->yPlane().resourceId); EXPECT_EQ(yPlane.size, copyQuad->yPlane().size); EXPECT_EQ(yPlane.format, copyQuad->yPlane().format); diff --git a/cc/float_quad_unittest.cc b/cc/float_quad_unittest.cc index aac1a4a..908633f 100644 --- a/cc/float_quad_unittest.cc +++ b/cc/float_quad_unittest.cc @@ -30,7 +30,7 @@ TEST(FloatQuadTest, IsRectilinearTest) for (int i = 0; i < numRectilinear; ++i) { bool clipped = false; - FloatQuad quad = CCMathUtil::mapQuad(rectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + FloatQuad quad = MathUtil::mapQuad(rectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); ASSERT_TRUE(!clipped); EXPECT_TRUE(quad.isRectilinear()); } @@ -50,7 +50,7 @@ TEST(FloatQuadTest, IsRectilinearTest) for (int i = 0; i < numNonRectilinear; ++i) { bool clipped = false; - FloatQuad quad = CCMathUtil::mapQuad(nonRectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + FloatQuad quad = MathUtil::mapQuad(nonRectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); ASSERT_TRUE(!clipped); EXPECT_FALSE(quad.isRectilinear()); } diff --git a/cc/font_atlas.cc b/cc/font_atlas.cc index 9a48300..b733add 100644 --- a/cc/font_atlas.cc +++ b/cc/font_atlas.cc @@ -17,7 +17,7 @@ namespace cc { using namespace std; -CCFontAtlas::CCFontAtlas(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight) +FontAtlas::FontAtlas(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight) : m_atlas(bitmap) , m_fontHeight(fontHeight) { @@ -25,13 +25,13 @@ CCFontAtlas::CCFontAtlas(SkBitmap bitmap, IntRect asciiToRectTable[128], int fon m_asciiToRectTable[i] = asciiToRectTable[i]; } -CCFontAtlas::~CCFontAtlas() +FontAtlas::~FontAtlas() { } -void CCFontAtlas::drawText(SkCanvas* canvas, const SkPaint& paint, const std::string& text, const gfx::Point& destPosition, const IntSize& clip) const +void FontAtlas::drawText(SkCanvas* canvas, const SkPaint& paint, const std::string& text, const gfx::Point& destPosition, const IntSize& clip) const { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); std::vector<std::string> lines; base::SplitString(text, '\n', &lines); @@ -45,9 +45,9 @@ void CCFontAtlas::drawText(SkCanvas* canvas, const SkPaint& paint, const std::st } } -void CCFontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint, const std::string& textLine, const gfx::Point& destPosition) const +void FontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint, const std::string& textLine, const gfx::Point& destPosition) const { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); gfx::Point position = destPosition; for (unsigned i = 0; i < textLine.length(); ++i) { @@ -60,9 +60,9 @@ void CCFontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& pai } } -void CCFontAtlas::drawDebugAtlas(SkCanvas* canvas, const gfx::Point& destPosition) const +void FontAtlas::drawDebugAtlas(SkCanvas* canvas, const gfx::Point& destPosition) const { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); SkIRect source = SkIRect::MakeWH(m_atlas.width(), m_atlas.height()); canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(destPosition.x(), destPosition.y(), m_atlas.width(), m_atlas.height())); diff --git a/cc/font_atlas.h b/cc/font_atlas.h index 53a2370..f9baea1 100644 --- a/cc/font_atlas.h +++ b/cc/font_atlas.h @@ -23,13 +23,13 @@ namespace cc { class IntSize; // This class provides basic ability to draw text onto the heads-up display. -class CCFontAtlas { +class FontAtlas { public: - static scoped_ptr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight) + static scoped_ptr<FontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight) { - return make_scoped_ptr(new CCFontAtlas(bitmap, asciiToRectTable, fontHeight)); + return make_scoped_ptr(new FontAtlas(bitmap, asciiToRectTable, fontHeight)); } - ~CCFontAtlas(); + ~FontAtlas(); // Draws multiple lines of text where each line of text is separated by '\n'. // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any characters @@ -43,7 +43,7 @@ public: void drawDebugAtlas(SkCanvas*, const gfx::Point& destPosition) const; private: - CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight); + FontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight); void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&, const gfx::Point& destPosition) const; @@ -55,7 +55,7 @@ private: int m_fontHeight; - DISALLOW_COPY_AND_ASSIGN(CCFontAtlas); + DISALLOW_COPY_AND_ASSIGN(FontAtlas); }; } // namespace cc diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc index 2ad718c..eeed038 100644 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc +++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc @@ -10,7 +10,7 @@ namespace cc { -FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::Texture(FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture) +FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::Texture(FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<PrioritizedTexture> texture) : LayerTextureUpdater::Texture(texture.Pass()) , m_textureUpdater(textureUpdater) { @@ -20,17 +20,17 @@ FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture() { } -void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) +void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::update(TextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) { textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); } -scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainterChromium> painter) +scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainter> painter) { return make_scoped_refptr(new FrameBufferSkPictureCanvasLayerTextureUpdater(painter.Pass())); } -FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) +FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) : SkPictureCanvasLayerTextureUpdater(painter.Pass()) { } @@ -39,9 +39,9 @@ FrameBufferSkPictureCanvasLayerTextureUpdater::~FrameBufferSkPictureCanvasLayerT { } -scoped_ptr<LayerTextureUpdater::Texture> FrameBufferSkPictureCanvasLayerTextureUpdater::createTexture(CCPrioritizedTextureManager* manager) +scoped_ptr<LayerTextureUpdater::Texture> FrameBufferSkPictureCanvasLayerTextureUpdater::createTexture(PrioritizedTextureManager* manager) { - return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); + return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); } LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GLenum textureFormat) diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h index 0531637..aed0fef 100644 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h +++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h @@ -17,10 +17,10 @@ class FrameBufferSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLaye public: class Texture : public LayerTextureUpdater::Texture { public: - Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>); + Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, scoped_ptr<PrioritizedTexture>); virtual ~Texture(); - virtual void update(CCTextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; private: FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -28,13 +28,13 @@ public: FrameBufferSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; - static scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); + static scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainter>); - virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; + virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(PrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE; private: - explicit FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); + explicit FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater(); }; } // namespace cc diff --git a/cc/frame_rate_controller.cc b/cc/frame_rate_controller.cc index ba11e52..c6d0e90 100644 --- a/cc/frame_rate_controller.cc +++ b/cc/frame_rate_controller.cc @@ -15,32 +15,32 @@ namespace { // This will be the maximum number of pending frames unless -// CCFrameRateController::setMaxFramesPending is called. +// FrameRateController::setMaxFramesPending is called. const int defaultMaxFramesPending = 2; } // namespace namespace cc { -class CCFrameRateControllerTimeSourceAdapter : public CCTimeSourceClient { +class FrameRateControllerTimeSourceAdapter : public TimeSourceClient { public: - static scoped_ptr<CCFrameRateControllerTimeSourceAdapter> create(CCFrameRateController* frameRateController) { - return make_scoped_ptr(new CCFrameRateControllerTimeSourceAdapter(frameRateController)); + static scoped_ptr<FrameRateControllerTimeSourceAdapter> create(FrameRateController* frameRateController) { + return make_scoped_ptr(new FrameRateControllerTimeSourceAdapter(frameRateController)); } - virtual ~CCFrameRateControllerTimeSourceAdapter() {} + virtual ~FrameRateControllerTimeSourceAdapter() {} virtual void onTimerTick() OVERRIDE { m_frameRateController->onTimerTick(); } private: - explicit CCFrameRateControllerTimeSourceAdapter(CCFrameRateController* frameRateController) + explicit FrameRateControllerTimeSourceAdapter(FrameRateController* frameRateController) : m_frameRateController(frameRateController) {} - CCFrameRateController* m_frameRateController; + FrameRateController* m_frameRateController; }; -CCFrameRateController::CCFrameRateController(scoped_refptr<CCTimeSource> timer) +FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer) : m_client(0) , m_numFramesPending(0) , m_maxFramesPending(defaultMaxFramesPending) @@ -49,32 +49,32 @@ CCFrameRateController::CCFrameRateController(scoped_refptr<CCTimeSource> timer) , m_swapBuffersCompleteSupported(true) , m_isTimeSourceThrottling(true) { - m_timeSourceClientAdapter = CCFrameRateControllerTimeSourceAdapter::create(this); + m_timeSourceClientAdapter = FrameRateControllerTimeSourceAdapter::create(this); m_timeSource->setClient(m_timeSourceClientAdapter.get()); } -CCFrameRateController::CCFrameRateController(CCThread* thread) +FrameRateController::FrameRateController(Thread* thread) : m_client(0) , m_numFramesPending(0) , m_maxFramesPending(defaultMaxFramesPending) , m_active(false) , m_swapBuffersCompleteSupported(true) , m_isTimeSourceThrottling(false) - , m_manualTicker(new CCTimer(thread, this)) + , m_manualTicker(new Timer(thread, this)) { } -CCFrameRateController::~CCFrameRateController() +FrameRateController::~FrameRateController() { if (m_isTimeSourceThrottling) m_timeSource->setActive(false); } -void CCFrameRateController::setActive(bool active) +void FrameRateController::setActive(bool active) { if (m_active == active) return; - TRACE_EVENT1("cc", "CCFrameRateController::setActive", "active", active); + TRACE_EVENT1("cc", "FrameRateController::setActive", "active", active); m_active = active; if (m_isTimeSourceThrottling) @@ -87,24 +87,24 @@ void CCFrameRateController::setActive(bool active) } } -void CCFrameRateController::setMaxFramesPending(int maxFramesPending) +void FrameRateController::setMaxFramesPending(int maxFramesPending) { DCHECK(maxFramesPending > 0); m_maxFramesPending = maxFramesPending; } -void CCFrameRateController::setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) +void FrameRateController::setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) { if (m_isTimeSourceThrottling) m_timeSource->setTimebaseAndInterval(timebase, interval); } -void CCFrameRateController::setSwapBuffersCompleteSupported(bool supported) +void FrameRateController::setSwapBuffersCompleteSupported(bool supported) { m_swapBuffersCompleteSupported = supported; } -void CCFrameRateController::onTimerTick() +void FrameRateController::onTimerTick() { DCHECK(m_active); @@ -118,18 +118,18 @@ void CCFrameRateController::onTimerTick() postManualTick(); } -void CCFrameRateController::postManualTick() +void FrameRateController::postManualTick() { if (m_active) m_manualTicker->startOneShot(0); } -void CCFrameRateController::onTimerFired() +void FrameRateController::onTimerFired() { onTimerTick(); } -void CCFrameRateController::didBeginFrame() +void FrameRateController::didBeginFrame() { if (m_swapBuffersCompleteSupported) m_numFramesPending++; @@ -137,7 +137,7 @@ void CCFrameRateController::didBeginFrame() postManualTick(); } -void CCFrameRateController::didFinishFrame() +void FrameRateController::didFinishFrame() { DCHECK(m_swapBuffersCompleteSupported); @@ -146,12 +146,12 @@ void CCFrameRateController::didFinishFrame() postManualTick(); } -void CCFrameRateController::didAbortAllPendingFrames() +void FrameRateController::didAbortAllPendingFrames() { m_numFramesPending = 0; } -base::TimeTicks CCFrameRateController::nextTickTime() +base::TimeTicks FrameRateController::nextTickTime() { if (m_isTimeSourceThrottling) return m_timeSource->nextTickTime(); diff --git a/cc/frame_rate_controller.h b/cc/frame_rate_controller.h index 2352482..22acf96 100644 --- a/cc/frame_rate_controller.h +++ b/cc/frame_rate_controller.h @@ -12,28 +12,28 @@ namespace cc { -class CCThread; -class CCTimeSource; +class Thread; +class TimeSource; -class CCFrameRateControllerClient { +class FrameRateControllerClient { public: // Throttled is true when we have a maximum number of frames pending. virtual void vsyncTick(bool throttled) = 0; protected: - virtual ~CCFrameRateControllerClient() {} + virtual ~FrameRateControllerClient() {} }; -class CCFrameRateControllerTimeSourceAdapter; +class FrameRateControllerTimeSourceAdapter; -class CCFrameRateController : public CCTimerClient { +class FrameRateController : public TimerClient { public: - explicit CCFrameRateController(scoped_refptr<CCTimeSource>); - // Alternate form of CCFrameRateController with unthrottled frame-rate. - explicit CCFrameRateController(CCThread*); - virtual ~CCFrameRateController(); + explicit FrameRateController(scoped_refptr<TimeSource>); + // Alternate form of FrameRateController with unthrottled frame-rate. + explicit FrameRateController(Thread*); + virtual ~FrameRateController(); - void setClient(CCFrameRateControllerClient* client) { m_client = client; } + void setClient(FrameRateControllerClient* client) { m_client = client; } void setActive(bool); @@ -55,25 +55,25 @@ public: void setSwapBuffersCompleteSupported(bool); protected: - friend class CCFrameRateControllerTimeSourceAdapter; + friend class FrameRateControllerTimeSourceAdapter; void onTimerTick(); void postManualTick(); - // CCTimerClient implementation (used for unthrottled frame-rate). + // TimerClient implementation (used for unthrottled frame-rate). virtual void onTimerFired() OVERRIDE; - CCFrameRateControllerClient* m_client; + FrameRateControllerClient* m_client; int m_numFramesPending; int m_maxFramesPending; - scoped_refptr<CCTimeSource> m_timeSource; - scoped_ptr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter; + scoped_refptr<TimeSource> m_timeSource; + scoped_ptr<FrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter; bool m_active; bool m_swapBuffersCompleteSupported; // Members for unthrottled frame-rate. bool m_isTimeSourceThrottling; - scoped_ptr<CCTimer> m_manualTicker; + scoped_ptr<Timer> m_manualTicker; }; } // namespace cc diff --git a/cc/frame_rate_controller_unittest.cc b/cc/frame_rate_controller_unittest.cc index b0a6bd1..f3af465 100644 --- a/cc/frame_rate_controller_unittest.cc +++ b/cc/frame_rate_controller_unittest.cc @@ -14,9 +14,9 @@ using namespace WebKitTests; namespace { -class FakeCCFrameRateControllerClient : public cc::CCFrameRateControllerClient { +class FakeFrameRateControllerClient : public cc::FrameRateControllerClient { public: - FakeCCFrameRateControllerClient() { reset(); } + FakeFrameRateControllerClient() { reset(); } void reset() { m_vsyncTicked = false; } bool vsyncTicked() const { return m_vsyncTicked; } @@ -28,13 +28,13 @@ protected: }; -TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) +TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { - FakeCCThread thread; - FakeCCFrameRateControllerClient client; + FakeThread thread; + FakeFrameRateControllerClient client; base::TimeDelta interval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); - scoped_refptr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(interval, &thread); - CCFrameRateController controller(timeSource); + scoped_refptr<FakeDelayBasedTimeSource> timeSource = FakeDelayBasedTimeSource::create(interval, &thread); + FrameRateController controller(timeSource); controller.setClient(&client); controller.setActive(true); @@ -63,13 +63,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) EXPECT_TRUE(client.vsyncTicked()); } -TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) +TEST(FrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) { - FakeCCThread thread; - FakeCCFrameRateControllerClient client; + FakeThread thread; + FakeFrameRateControllerClient client; base::TimeDelta interval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); - scoped_refptr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(interval, &thread); - CCFrameRateController controller(timeSource); + scoped_refptr<FakeDelayBasedTimeSource> timeSource = FakeDelayBasedTimeSource::create(interval, &thread); + FrameRateController controller(timeSource); controller.setClient(&client); controller.setActive(true); @@ -120,11 +120,11 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) EXPECT_TRUE(client.vsyncTicked()); } -TEST(CCFrameRateControllerTest, TestFrameThrottling_Unthrottled) +TEST(FrameRateControllerTest, TestFrameThrottling_Unthrottled) { - FakeCCThread thread; - FakeCCFrameRateControllerClient client; - CCFrameRateController controller(&thread); + FakeThread thread; + FakeFrameRateControllerClient client; + FrameRateController controller(&thread); controller.setClient(&client); controller.setMaxFramesPending(2); @@ -135,7 +135,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_Unthrottled) EXPECT_TRUE(client.vsyncTicked()); client.reset(); - // Even if we don't call didBeginFrame, CCFrameRateController should + // Even if we don't call didBeginFrame, FrameRateController should // still attempt to vsync tick multiple times until it does result in // a didBeginFrame. thread.runPendingTask(); diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc index ee10b81..dcd393c 100644 --- a/cc/frame_rate_counter.cc +++ b/cc/frame_rate_counter.cc @@ -13,9 +13,9 @@ namespace cc { -const double CCFrameRateCounter::kFrameTooFast = 1.0 / 70.0; // measured in seconds -const double CCFrameRateCounter::kFrameTooSlow = 1.0 / 12.0; -const double CCFrameRateCounter::kDroppedFrameTime = 1.0 / 50.0; +const double FrameRateCounter::kFrameTooFast = 1.0 / 70.0; // measured in seconds +const double FrameRateCounter::kFrameTooSlow = 1.0 / 12.0; +const double FrameRateCounter::kDroppedFrameTime = 1.0 / 50.0; // safeMod works on -1, returning m-1 in that case. static inline int safeMod(int number, int modulus) @@ -24,22 +24,22 @@ static inline int safeMod(int number, int modulus) } // static -scoped_ptr<CCFrameRateCounter> CCFrameRateCounter::create() { - return make_scoped_ptr(new CCFrameRateCounter()); +scoped_ptr<FrameRateCounter> FrameRateCounter::create() { + return make_scoped_ptr(new FrameRateCounter()); } -inline base::TimeDelta CCFrameRateCounter::frameInterval(int frameNumber) const +inline base::TimeDelta FrameRateCounter::frameInterval(int frameNumber) const { return m_timeStampHistory[frameIndex(frameNumber)] - m_timeStampHistory[frameIndex(frameNumber - 1)]; } -inline int CCFrameRateCounter::frameIndex(int frameNumber) const +inline int FrameRateCounter::frameIndex(int frameNumber) const { return safeMod(frameNumber, kTimeStampHistorySize); } -CCFrameRateCounter::CCFrameRateCounter() +FrameRateCounter::FrameRateCounter() : m_currentFrameNumber(1) , m_droppedFrameCount(0) { @@ -49,12 +49,12 @@ CCFrameRateCounter::CCFrameRateCounter() m_timeStampHistory[i] = base::TimeTicks(); } -void CCFrameRateCounter::markBeginningOfFrame(base::TimeTicks timestamp) +void FrameRateCounter::markBeginningOfFrame(base::TimeTicks timestamp) { m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp; base::TimeDelta frameIntervalSeconds = frameInterval(m_currentFrameNumber); - if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) { + if (Proxy::hasImplThread() && m_currentFrameNumber > 0) { HISTOGRAM_CUSTOM_COUNTS("Renderer4.CompositorThreadImplDrawDelay", frameIntervalSeconds.InMilliseconds(), 1, 120, 60); } @@ -63,25 +63,25 @@ void CCFrameRateCounter::markBeginningOfFrame(base::TimeTicks timestamp) ++m_droppedFrameCount; } -void CCFrameRateCounter::markEndOfFrame() +void FrameRateCounter::markEndOfFrame() { m_currentFrameNumber += 1; } -bool CCFrameRateCounter::isBadFrameInterval(base::TimeDelta intervalBetweenConsecutiveFrames) const +bool FrameRateCounter::isBadFrameInterval(base::TimeDelta intervalBetweenConsecutiveFrames) const { - bool schedulerAllowsDoubleFrames = !CCProxy::hasImplThread(); + bool schedulerAllowsDoubleFrames = !Proxy::hasImplThread(); bool intervalTooFast = schedulerAllowsDoubleFrames && intervalBetweenConsecutiveFrames.InSecondsF() < kFrameTooFast; bool intervalTooSlow = intervalBetweenConsecutiveFrames.InSecondsF() > kFrameTooSlow; return intervalTooFast || intervalTooSlow; } -bool CCFrameRateCounter::isBadFrame(int frameNumber) const +bool FrameRateCounter::isBadFrame(int frameNumber) const { return isBadFrameInterval(frameInterval(frameNumber)); } -void CCFrameRateCounter::getAverageFPSAndStandardDeviation(double& averageFPS, double& standardDeviation) const +void FrameRateCounter::getAverageFPSAndStandardDeviation(double& averageFPS, double& standardDeviation) const { int frame = m_currentFrameNumber - 1; averageFPS = 0; @@ -123,7 +123,7 @@ void CCFrameRateCounter::getAverageFPSAndStandardDeviation(double& averageFPS, d standardDeviation = sqrt(fpsVarianceNumerator / averageFPSCount); } -base::TimeTicks CCFrameRateCounter::timeStampOfRecentFrame(int n) +base::TimeTicks FrameRateCounter::timeStampOfRecentFrame(int n) { DCHECK(n >= 0); DCHECK(n < kTimeStampHistorySize); diff --git a/cc/frame_rate_counter.h b/cc/frame_rate_counter.h index 3196c28..008c2f3 100644 --- a/cc/frame_rate_counter.h +++ b/cc/frame_rate_counter.h @@ -13,9 +13,9 @@ namespace cc { // This class maintains a history of timestamps, and provides functionality to // intelligently compute average frames per second (and standard deviation). -class CCFrameRateCounter { +class FrameRateCounter { public: - static scoped_ptr<CCFrameRateCounter> create(); + static scoped_ptr<FrameRateCounter> create(); void markBeginningOfFrame(base::TimeTicks timestamp); void markEndOfFrame(); @@ -34,7 +34,7 @@ public: int droppedFrameCount() const { return m_droppedFrameCount; } private: - CCFrameRateCounter(); + FrameRateCounter(); base::TimeDelta frameInterval(int frameNumber) const; int frameIndex(int frameNumber) const; @@ -58,7 +58,7 @@ private: int m_droppedFrameCount; - DISALLOW_COPY_AND_ASSIGN(CCFrameRateCounter); + DISALLOW_COPY_AND_ASSIGN(FrameRateCounter); }; } // namespace cc diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index ead4315..fa2eaad 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -60,18 +60,18 @@ bool needsIOSurfaceReadbackWorkaround() } // anonymous namespace -scoped_ptr<CCRendererGL> CCRendererGL::create(CCRendererClient* client, CCResourceProvider* resourceProvider) +scoped_ptr<GLRenderer> GLRenderer::create(RendererClient* client, ResourceProvider* resourceProvider) { - scoped_ptr<CCRendererGL> renderer(make_scoped_ptr(new CCRendererGL(client, resourceProvider))); + scoped_ptr<GLRenderer> renderer(make_scoped_ptr(new GLRenderer(client, resourceProvider))); if (!renderer->initialize()) - return scoped_ptr<CCRendererGL>(); + return scoped_ptr<GLRenderer>(); return renderer.Pass(); } -CCRendererGL::CCRendererGL(CCRendererClient* client, - CCResourceProvider* resourceProvider) - : CCDirectRenderer(client, resourceProvider) +GLRenderer::GLRenderer(RendererClient* client, + ResourceProvider* resourceProvider) + : DirectRenderer(client, resourceProvider) , m_offscreenFramebufferId(0) , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f)) , m_context(resourceProvider->graphicsContext3D()) @@ -84,7 +84,7 @@ CCRendererGL::CCRendererGL(CCRendererClient* client, DCHECK(m_context); } -bool CCRendererGL::initialize() +bool GLRenderer::initialize() { if (!m_context->makeContextCurrent()) return false; @@ -109,7 +109,7 @@ bool CCRendererGL::initialize() m_capabilities.usingPartialSwap = Settings::partialSwapEnabled() && extensions.count("GL_CHROMIUM_post_sub_buffer"); // Use the swapBuffers callback only with the threaded proxy. - if (CCProxy::hasImplThread()) + if (Proxy::hasImplThread()) m_capabilities.usingSwapCompleteCallback = extensions.count("GL_CHROMIUM_swapbuffers_complete_callback"); if (m_capabilities.usingSwapCompleteCallback) m_context->setSwapBuffersCompleteCallbackCHROMIUM(this); @@ -140,33 +140,33 @@ bool CCRendererGL::initialize() return true; } -CCRendererGL::~CCRendererGL() +GLRenderer::~GLRenderer() { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); m_context->setSwapBuffersCompleteCallbackCHROMIUM(0); m_context->setMemoryAllocationChangedCallbackCHROMIUM(0); m_context->setContextLostCallback(0); cleanupSharedObjects(); } -const RendererCapabilities& CCRendererGL::capabilities() const +const RendererCapabilities& GLRenderer::capabilities() const { return m_capabilities; } -WebGraphicsContext3D* CCRendererGL::context() +WebGraphicsContext3D* GLRenderer::context() { return m_context; } -void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) +void GLRenderer::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) { unsigned long error = context->getError(); if (error != GL_NO_ERROR) LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line << "\n\tcommand: " << command << ", error " << static_cast<int>(error) << "\n"; } -void CCRendererGL::setVisible(bool visible) +void GLRenderer::setVisible(bool visible) { if (m_visible == visible) return; @@ -180,17 +180,17 @@ void CCRendererGL::setVisible(bool visible) enforceMemoryPolicy(); } -void CCRendererGL::releaseRenderPassTextures() +void GLRenderer::releaseRenderPassTextures() { m_renderPassTextures.clear(); } -void CCRendererGL::viewportChanged() +void GLRenderer::viewportChanged() { m_isViewportChanged = true; } -void CCRendererGL::clearFramebuffer(DrawingFrame& frame) +void GLRenderer::clearFramebuffer(DrawingFrame& frame) { // On DEBUG builds, opaque render passes are cleared to blue to easily see regions that were not drawn on the screen. if (frame.currentRenderPass->hasTransparentBackground()) @@ -204,7 +204,7 @@ void CCRendererGL::clearFramebuffer(DrawingFrame& frame) m_context->clear(GL_COLOR_BUFFER_BIT); } -void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) +void GLRenderer::beginDrawingFrame(DrawingFrame& frame) { // FIXME: Remove this once framebuffer is automatically recreated on first use ensureFramebuffer(); @@ -212,7 +212,7 @@ void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) if (viewportSize().isEmpty()) return; - TRACE_EVENT0("cc", "CCRendererGL::drawLayers"); + TRACE_EVENT0("cc", "GLRenderer::drawLayers"); if (m_isViewportChanged) { // Only reshape when we know we are going to draw. Otherwise, the reshape // can leave the window at the wrong size if we never draw and the proper @@ -232,13 +232,13 @@ void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); } -void CCRendererGL::doNoOp() +void GLRenderer::doNoOp() { GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); GLC(m_context, m_context->flush()); } -void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) +void GLRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad) { if (quad->needsBlending()) GLC(m_context, m_context->enable(GL_BLEND)); @@ -246,40 +246,40 @@ void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) GLC(m_context, m_context->disable(GL_BLEND)); switch (quad->material()) { - case CCDrawQuad::Invalid: + case DrawQuad::Invalid: NOTREACHED(); break; - case CCDrawQuad::Checkerboard: - drawCheckerboardQuad(frame, CCCheckerboardDrawQuad::materialCast(quad)); + case DrawQuad::Checkerboard: + drawCheckerboardQuad(frame, CheckerboardDrawQuad::materialCast(quad)); break; - case CCDrawQuad::DebugBorder: - drawDebugBorderQuad(frame, CCDebugBorderDrawQuad::materialCast(quad)); + case DrawQuad::DebugBorder: + drawDebugBorderQuad(frame, DebugBorderDrawQuad::materialCast(quad)); break; - case CCDrawQuad::IOSurfaceContent: - drawIOSurfaceQuad(frame, CCIOSurfaceDrawQuad::materialCast(quad)); + case DrawQuad::IOSurfaceContent: + drawIOSurfaceQuad(frame, IOSurfaceDrawQuad::materialCast(quad)); break; - case CCDrawQuad::RenderPass: - drawRenderPassQuad(frame, CCRenderPassDrawQuad::materialCast(quad)); + case DrawQuad::RenderPass: + drawRenderPassQuad(frame, RenderPassDrawQuad::materialCast(quad)); break; - case CCDrawQuad::SolidColor: - drawSolidColorQuad(frame, CCSolidColorDrawQuad::materialCast(quad)); + case DrawQuad::SolidColor: + drawSolidColorQuad(frame, SolidColorDrawQuad::materialCast(quad)); break; - case CCDrawQuad::StreamVideoContent: - drawStreamVideoQuad(frame, CCStreamVideoDrawQuad::materialCast(quad)); + case DrawQuad::StreamVideoContent: + drawStreamVideoQuad(frame, StreamVideoDrawQuad::materialCast(quad)); break; - case CCDrawQuad::TextureContent: - drawTextureQuad(frame, CCTextureDrawQuad::materialCast(quad)); + case DrawQuad::TextureContent: + drawTextureQuad(frame, TextureDrawQuad::materialCast(quad)); break; - case CCDrawQuad::TiledContent: - drawTileQuad(frame, CCTileDrawQuad::materialCast(quad)); + case DrawQuad::TiledContent: + drawTileQuad(frame, TileDrawQuad::materialCast(quad)); break; - case CCDrawQuad::YUVVideoContent: - drawYUVVideoQuad(frame, CCYUVVideoDrawQuad::materialCast(quad)); + case DrawQuad::YUVVideoContent: + drawYUVVideoQuad(frame, YUVVideoDrawQuad::materialCast(quad)); break; } } -void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) +void GLRenderer::drawCheckerboardQuad(const DrawingFrame& frame, const CheckerboardDrawQuad* quad) { const TileCheckerboardProgram* program = tileCheckerboardProgram(); DCHECK(program && program->initialized()); @@ -304,7 +304,7 @@ void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheck drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); } -void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) +void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorderDrawQuad* quad) { static float glMatrix[16]; const SolidColorProgram* program = solidColorProgram(); @@ -316,7 +316,7 @@ void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB WebTransformationMatrix renderMatrix = quad->quadTransform(); renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y()); renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); - CCRendererGL::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); + GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLocation(), 1, false, &glMatrix[0])); SkColor color = quad->color(); @@ -330,25 +330,25 @@ void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB GLC(context(), context()->drawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 6 * sizeof(unsigned short))); } -static inline SkBitmap applyFilters(CCRendererGL* renderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) +static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilterOperations& filters, ScopedTexture* sourceTexture) { if (filters.isEmpty()) return SkBitmap(); - WebGraphicsContext3D* filterContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThreadContext(); - GrContext* filterGrContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrContext(); + WebGraphicsContext3D* filterContext = Proxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThreadContext(); + GrContext* filterGrContext = Proxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrContext(); if (!filterContext || !filterGrContext) return SkBitmap(); renderer->context()->flush(); - CCResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id()); - SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext); + ResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id()); + SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext); return source; } -scoped_ptr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& frame, const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) +scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters(DrawingFrame& frame, const RenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) { // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background. // The algorithm works as follows: @@ -364,19 +364,19 @@ scoped_ptr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr // // Pixel copies in this algorithm occur at steps 2, 3, 4, and 5. - // FIXME: When this algorithm changes, update CCLayerTreeHost::prioritizeTextures() accordingly. + // FIXME: When this algorithm changes, update LayerTreeHost::prioritizeTextures() accordingly. if (filters.isEmpty()) - return scoped_ptr<CCScopedTexture>(); + return scoped_ptr<ScopedTexture>(); // FIXME: We only allow background filters on an opaque render surface because other surfaces may contain // translucent pixels, and the contents behind those translucent pixels wouldn't have the filter applied. if (frame.currentRenderPass->hasTransparentBackground()) - return scoped_ptr<CCScopedTexture>(); + return scoped_ptr<ScopedTexture>(); DCHECK(!frame.currentTexture); // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused). - IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox())); + IntRect deviceRect = enclosingIntRect(MathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox())); int top, right, bottom, left; filters.getOutsets(top, right, bottom, left); @@ -385,22 +385,22 @@ scoped_ptr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr deviceRect.intersect(frame.currentRenderPass->outputRect()); - scoped_ptr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_resourceProvider); + scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_resourceProvider); if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) - return scoped_ptr<CCScopedTexture>(); + return scoped_ptr<ScopedTexture>(); SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get()); if (!filteredDeviceBackground.getTexture()) - return scoped_ptr<CCScopedTexture>(); + return scoped_ptr<ScopedTexture>(); GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.getTexture()); int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); - scoped_ptr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resourceProvider); - if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GL_RGBA, CCResourceProvider::TextureUsageFramebuffer)) - return scoped_ptr<CCScopedTexture>(); + scoped_ptr<ScopedTexture> backgroundTexture = ScopedTexture::create(m_resourceProvider); + if (!backgroundTexture->allocate(Renderer::ImplPool, quad->quadRect().size(), GL_RGBA, ResourceProvider::TextureUsageFramebuffer)) + return scoped_ptr<ScopedTexture>(); - const CCRenderPass* targetRenderPass = frame.currentRenderPass; + const RenderPass* targetRenderPass = frame.currentRenderPass; bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(), quad->quadRect()); if (usingBackgroundTexture) { @@ -415,17 +415,17 @@ scoped_ptr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr useRenderPass(frame, targetRenderPass); if (!usingBackgroundTexture) - return scoped_ptr<CCScopedTexture>(); + return scoped_ptr<ScopedTexture>(); return backgroundTexture.Pass(); } -void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDrawQuad* quad) +void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQuad* quad) { CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) return; - const CCRenderPass* renderPass = frame.renderPassesById->get(quad->renderPassId()); + const RenderPass* renderPass = frame.renderPassesById->get(quad->renderPassId()); DCHECK(renderPass); if (!renderPass) return; @@ -438,33 +438,33 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra if (!contentsDeviceTransform.isInvertible()) return; - scoped_ptr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(frame, quad, renderPass->backgroundFilters(), contentsDeviceTransform); + scoped_ptr<ScopedTexture> backgroundTexture = drawBackgroundFilters(frame, quad, renderPass->backgroundFilters(), contentsDeviceTransform); // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. // Apply filters to the contents texture. SkBitmap filterBitmap = applyFilters(this, renderPass->filters(), contentsTexture); - scoped_ptr<CCResourceProvider::ScopedReadLockGL> contentsResourceLock; + scoped_ptr<ResourceProvider::ScopedReadLockGL> contentsResourceLock; unsigned contentsTextureId = 0; if (filterBitmap.getTexture()) { GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture()); contentsTextureId = texture->getTextureHandle(); } else { - contentsResourceLock = make_scoped_ptr(new CCResourceProvider::ScopedReadLockGL(m_resourceProvider, contentsTexture->id())); + contentsResourceLock = make_scoped_ptr(new ResourceProvider::ScopedReadLockGL(m_resourceProvider, contentsTexture->id())); contentsTextureId = contentsResourceLock->textureId(); } // Draw the background texture if there is one. if (backgroundTexture) { DCHECK(backgroundTexture->size() == quad->quadRect().size()); - CCResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTexture->id()); + ResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTexture->id()); copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad->quadTransform()); } bool clipped = false; - FloatQuad deviceQuad = CCMathUtil::mapQuad(contentsDeviceTransform, sharedGeometryQuad(), clipped); + FloatQuad deviceQuad = MathUtil::mapQuad(contentsDeviceTransform, sharedGeometryQuad(), clipped); DCHECK(!clipped); - CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceQuad.boundingBox())); - CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceQuad); + LayerQuad deviceLayerBounds = LayerQuad(FloatQuad(deviceQuad.boundingBox())); + LayerQuad deviceLayerEdges = LayerQuad(deviceQuad); // Use anti-aliasing programs only when necessary. bool useAA = (!deviceQuad.isRectilinear() || !deviceQuad.boundingBox().isExpressibleAsIntRect()); @@ -473,10 +473,10 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra deviceLayerEdges.inflateAntiAliasingDistance(); } - scoped_ptr<CCResourceProvider::ScopedReadLockGL> maskResourceLock; + scoped_ptr<ResourceProvider::ScopedReadLockGL> maskResourceLock; unsigned maskTextureId = 0; if (quad->maskResourceId()) { - maskResourceLock.reset(new CCResourceProvider::ScopedReadLockGL(m_resourceProvider, quad->maskResourceId())); + maskResourceLock.reset(new ResourceProvider::ScopedReadLockGL(m_resourceProvider, quad->maskResourceId())); maskTextureId = maskResourceLock->textureId(); } @@ -551,7 +551,7 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra } // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. - FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); + FloatQuad surfaceQuad = MathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); DCHECK(!clipped); setShaderOpacity(quad->opacity(), shaderAlphaLocation); @@ -559,7 +559,7 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation); } -void CCRendererGL::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidColorDrawQuad* quad) +void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorDrawQuad* quad) { const SolidColorProgram* program = solidColorProgram(); GLC(context(), context()->useProgram(program->program())); @@ -598,7 +598,7 @@ static void tileUniformLocation(T program, TileProgramUniforms& uniforms) uniforms.edgeLocation = program->fragmentShader().edgeLocation(); } -void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) +void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* quad) { IntRect tileRect = quad->quadVisibleRect(); @@ -639,7 +639,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* return; bool clipped = false; - FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped); + FloatQuad deviceLayerQuad = MathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped); DCHECK(!clipped); TileProgramUniforms uniforms; @@ -667,17 +667,17 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* GLC(context(), context()->useProgram(uniforms.program)); GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); GLC(context(), context()->activeTexture(GL_TEXTURE0)); - CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId()); + ResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId()); GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textureId())); GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, quad->textureFilter())); GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, quad->textureFilter())); bool useAA = !clipped && quad->isAntialiased(); if (useAA) { - CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceLayerQuad.boundingBox())); + LayerQuad deviceLayerBounds = LayerQuad(FloatQuad(deviceLayerQuad.boundingBox())); deviceLayerBounds.inflateAntiAliasingDistance(); - CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceLayerQuad); + LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad); deviceLayerEdges.inflateAntiAliasingDistance(); float edge[24]; @@ -694,19 +694,19 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* FloatPoint topRight(tileRect.maxX(), tileRect.y()); // Map points to device space. - bottomRight = CCMathUtil::mapPoint(deviceTransform, bottomRight, clipped); + bottomRight = MathUtil::mapPoint(deviceTransform, bottomRight, clipped); DCHECK(!clipped); - bottomLeft = CCMathUtil::mapPoint(deviceTransform, bottomLeft, clipped); + bottomLeft = MathUtil::mapPoint(deviceTransform, bottomLeft, clipped); DCHECK(!clipped); - topLeft = CCMathUtil::mapPoint(deviceTransform, topLeft, clipped); + topLeft = MathUtil::mapPoint(deviceTransform, topLeft, clipped); DCHECK(!clipped); - topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped); + topRight = MathUtil::mapPoint(deviceTransform, topRight, clipped); DCHECK(!clipped); - CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft); - CCLayerQuad::Edge leftEdge(bottomLeft, topLeft); - CCLayerQuad::Edge topEdge(topLeft, topRight); - CCLayerQuad::Edge rightEdge(topRight, bottomRight); + LayerQuad::Edge bottomEdge(bottomRight, bottomLeft); + LayerQuad::Edge leftEdge(bottomLeft, topLeft); + LayerQuad::Edge topEdge(topLeft, topRight); + LayerQuad::Edge rightEdge(topRight, bottomRight); // Only apply anti-aliasing to edges not clipped by culling or scissoring. if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y()) @@ -725,11 +725,11 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* rightEdge.scale(sign); // Create device space quad. - CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); + LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse(); - localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); + localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. @@ -765,18 +765,18 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrixLocation); } -void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) +void GLRenderer::drawYUVVideoQuad(const DrawingFrame& frame, const YUVVideoDrawQuad* quad) { const VideoYUVProgram* program = videoYUVProgram(); DCHECK(program && program->initialized()); - const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane(); - const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); - const CCVideoLayerImpl::FramePlane& vPlane = quad->vPlane(); + const VideoLayerImpl::FramePlane& yPlane = quad->yPlane(); + const VideoLayerImpl::FramePlane& uPlane = quad->uPlane(); + const VideoLayerImpl::FramePlane& vPlane = quad->vPlane(); - CCResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.resourceId); - CCResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.resourceId); - CCResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.resourceId); + ResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.resourceId); + ResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.resourceId); + ResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.resourceId); GLC(context(), context()->activeTexture(GL_TEXTURE1)); GLC(context(), context()->bindTexture(GL_TEXTURE_2D, yPlaneLock.textureId())); GLC(context(), context()->activeTexture(GL_TEXTURE2)); @@ -803,7 +803,7 @@ void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoD 0.f, -.391f, 2.018f, 1.596f, -.813f, 0.f, }; - GLC(context(), context()->uniformMatrix3fv(program->fragmentShader().ccMatrixLocation(), 1, 0, yuv2RGB)); + GLC(context(), context()->uniformMatrix3fv(program->fragmentShader().matrixLocation(), 1, 0, yuv2RGB)); // These values map to 16, 128, and 128 respectively, and are computed // as a fraction over 256 (e.g. 16 / 256 = 0.0625). @@ -825,7 +825,7 @@ void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoD GLC(context(), context()->activeTexture(GL_TEXTURE0)); } -void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) +void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVideoDrawQuad* quad) { static float glMatrix[16]; @@ -870,9 +870,9 @@ struct TexTransformTextureProgramBinding : TextureProgramBinding { int texTransformLocation; }; -void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) +void GLRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureDrawQuad* quad) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); TexTransformTextureProgramBinding binding; if (quad->flipped()) @@ -885,7 +885,7 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height())); GLC(context(), context()->activeTexture(GL_TEXTURE0)); - CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId()); + ResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId()); GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textureId())); // FIXME: setting the texture parameters every time is redundant. Move this code somewhere @@ -914,15 +914,15 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); } -void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) +void GLRenderer::drawIOSurfaceQuad(const DrawingFrame& frame, const IOSurfaceDrawQuad* quad) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); TexTransformTextureProgramBinding binding; binding.set(textureIOSurfaceProgram()); GLC(context(), context()->useProgram(binding.programId)); GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); - if (quad->orientation() == CCIOSurfaceDrawQuad::Flipped) + if (quad->orientation() == IOSurfaceDrawQuad::Flipped) GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, quad->ioSurfaceSize().height(), quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height() * -1.0)); else GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); @@ -936,7 +936,7 @@ void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); } -void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) +void GLRenderer::finishDrawingFrame(DrawingFrame& frame) { m_currentFramebufferLock.reset(); m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); @@ -945,12 +945,12 @@ void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) GLC(m_context, m_context->disable(GL_BLEND)); } -bool CCRendererGL::flippedFramebuffer() const +bool GLRenderer::flippedFramebuffer() const { return true; } -void CCRendererGL::toGLMatrix(float* flattened, const WebTransformationMatrix& m) +void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m) { flattened[0] = m.m11(); flattened[1] = m.m12(); @@ -970,7 +970,7 @@ void CCRendererGL::toGLMatrix(float* flattened, const WebTransformationMatrix& m flattened[15] = m.m44(); } -void CCRendererGL::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) +void GLRenderer::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) { if (quadLocation == -1) return; @@ -987,13 +987,13 @@ void CCRendererGL::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); } -void CCRendererGL::setShaderOpacity(float opacity, int alphaLocation) +void GLRenderer::setShaderOpacity(float opacity, int alphaLocation) { if (alphaLocation != -1) GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); } -void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) +void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) { WebTransformationMatrix quadRectMatrix; quadRectTransform(&quadRectMatrix, drawTransform, quadRect); @@ -1004,7 +1004,7 @@ void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); } -void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) +void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) { const RenderPassProgram* program = renderPassProgram(); @@ -1021,18 +1021,18 @@ void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textu drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLocation()); } -void CCRendererGL::finish() +void GLRenderer::finish() { - TRACE_EVENT0("cc", "CCRendererGL::finish"); + TRACE_EVENT0("cc", "GLRenderer::finish"); m_context->finish(); } -bool CCRendererGL::swapBuffers() +bool GLRenderer::swapBuffers() { DCHECK(m_visible); DCHECK(!m_isFramebufferDiscarded); - TRACE_EVENT0("cc", "CCRendererGL::swapBuffers"); + TRACE_EVENT0("cc", "GLRenderer::swapBuffers"); // We're done! Time to swapbuffers! if (m_capabilities.usingPartialSwap) { @@ -1051,25 +1051,25 @@ bool CCRendererGL::swapBuffers() return true; } -void CCRendererGL::onSwapBuffersComplete() +void GLRenderer::onSwapBuffersComplete() { m_client->onSwapBuffersComplete(); } -void CCRendererGL::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation) +void GLRenderer::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation) { // FIXME: This is called on the main thread in single threaded mode, but we expect it on the impl thread. - if (!CCProxy::hasImplThread()) { - DCHECK(CCProxy::isMainThread()); + if (!Proxy::hasImplThread()) { + DCHECK(Proxy::isMainThread()); DebugScopedSetImplThread impl; onMemoryAllocationChangedOnImplThread(allocation); } else { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); onMemoryAllocationChangedOnImplThread(allocation); } } -void CCRendererGL::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation) +void GLRenderer::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation) { m_discardFramebufferWhenNotVisible = !allocation.suggestHaveBackbuffer; // Just ignore the memory manager when it says to set the limit to zero @@ -1080,10 +1080,10 @@ void CCRendererGL::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemo enforceMemoryPolicy(); } -void CCRendererGL::enforceMemoryPolicy() +void GLRenderer::enforceMemoryPolicy() { if (!m_visible) { - TRACE_EVENT0("cc", "CCRendererGL::enforceMemoryPolicy dropping resources"); + TRACE_EVENT0("cc", "GLRenderer::enforceMemoryPolicy dropping resources"); releaseRenderPassTextures(); if (m_discardFramebufferWhenNotVisible) discardFramebuffer(); @@ -1091,7 +1091,7 @@ void CCRendererGL::enforceMemoryPolicy() } } -void CCRendererGL::discardFramebuffer() +void GLRenderer::discardFramebuffer() { if (m_isFramebufferDiscarded) return; @@ -1107,7 +1107,7 @@ void CCRendererGL::discardFramebuffer() m_client->setFullRootLayerDamage(); } -void CCRendererGL::ensureFramebuffer() +void GLRenderer::ensureFramebuffer() { if (!m_isFramebufferDiscarded) return; @@ -1119,13 +1119,13 @@ void CCRendererGL::ensureFramebuffer() m_isFramebufferDiscarded = false; } -void CCRendererGL::onContextLost() +void GLRenderer::onContextLost() { m_client->didLoseContext(); } -void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) +void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect) { DCHECK(rect.maxX() <= viewportWidth()); DCHECK(rect.maxY() <= viewportHeight()); @@ -1193,21 +1193,21 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) enforceMemoryPolicy(); } -bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) +bool GLRenderer::getFramebufferTexture(ScopedTexture* texture, const IntRect& deviceRect) { DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GL_RGB)); - if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GL_RGB, CCResourceProvider::TextureUsageAny)) + if (!texture->id() && !texture->allocate(Renderer::ImplPool, deviceRect.size(), GL_RGB, ResourceProvider::TextureUsageAny)) return false; - CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()); + ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()); GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId())); GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format(), deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0)); return true; } -bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) +bool GLRenderer::useScopedTexture(DrawingFrame& frame, const ScopedTexture* texture, const IntRect& viewportRect) { DCHECK(texture->id()); frame.currentRenderPass = 0; @@ -1216,18 +1216,18 @@ bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* return bindFramebufferToTexture(frame, texture, viewportRect); } -void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) +void GLRenderer::bindFramebufferToOutputSurface(DrawingFrame& frame) { m_currentFramebufferLock.reset(); GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); } -bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) +bool GLRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedTexture* texture, const IntRect& framebufferRect) { DCHECK(texture->id()); GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebufferId)); - m_currentFramebufferLock = make_scoped_ptr(new CCResourceProvider::ScopedWriteLockGL(m_resourceProvider, texture->id())); + m_currentFramebufferLock = make_scoped_ptr(new ResourceProvider::ScopedWriteLockGL(m_resourceProvider, texture->id())); unsigned textureId = m_currentFramebufferLock->textureId(); GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0)); @@ -1239,30 +1239,30 @@ bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT return true; } -void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) +void GLRenderer::enableScissorTestRect(const IntRect& scissorRect) { GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorRect.width(), scissorRect.height())); } -void CCRendererGL::disableScissorTest() +void GLRenderer::disableScissorTest() { GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); } -void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) +void GLRenderer::setDrawViewportSize(const IntSize& viewportSize) { GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.height())); } -bool CCRendererGL::makeContextCurrent() +bool GLRenderer::makeContextCurrent() { return m_context->makeContextCurrent(); } -bool CCRendererGL::initializeSharedObjects() +bool GLRenderer::initializeSharedObjects() { - TRACE_EVENT0("cc", "CCRendererGL::initializeSharedObjects"); + TRACE_EVENT0("cc", "GLRenderer::initializeSharedObjects"); makeContextCurrent(); // Create an FBO for doing offscreen rendering. @@ -1280,191 +1280,191 @@ bool CCRendererGL::initializeSharedObjects() return true; } -const CCRendererGL::TileCheckerboardProgram* CCRendererGL::tileCheckerboardProgram() +const GLRenderer::TileCheckerboardProgram* GLRenderer::tileCheckerboardProgram() { if (!m_tileCheckerboardProgram) m_tileCheckerboardProgram = make_scoped_ptr(new TileCheckerboardProgram(m_context)); if (!m_tileCheckerboardProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::checkerboardProgram::initalize"); + TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize"); m_tileCheckerboardProgram->initialize(m_context, m_isUsingBindUniform); } return m_tileCheckerboardProgram.get(); } -const CCRendererGL::SolidColorProgram* CCRendererGL::solidColorProgram() +const GLRenderer::SolidColorProgram* GLRenderer::solidColorProgram() { if (!m_solidColorProgram) m_solidColorProgram = make_scoped_ptr(new SolidColorProgram(m_context)); if (!m_solidColorProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::solidColorProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); m_solidColorProgram->initialize(m_context, m_isUsingBindUniform); } return m_solidColorProgram.get(); } -const CCRendererGL::RenderPassProgram* CCRendererGL::renderPassProgram() +const GLRenderer::RenderPassProgram* GLRenderer::renderPassProgram() { DCHECK(m_renderPassProgram); if (!m_renderPassProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::renderPassProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); m_renderPassProgram->initialize(m_context, m_isUsingBindUniform); } return m_renderPassProgram.get(); } -const CCRendererGL::RenderPassProgramAA* CCRendererGL::renderPassProgramAA() +const GLRenderer::RenderPassProgramAA* GLRenderer::renderPassProgramAA() { if (!m_renderPassProgramAA) m_renderPassProgramAA = make_scoped_ptr(new RenderPassProgramAA(m_context)); if (!m_renderPassProgramAA->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::renderPassProgramAA::initialize"); + TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); m_renderPassProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_renderPassProgramAA.get(); } -const CCRendererGL::RenderPassMaskProgram* CCRendererGL::renderPassMaskProgram() +const GLRenderer::RenderPassMaskProgram* GLRenderer::renderPassMaskProgram() { if (!m_renderPassMaskProgram) m_renderPassMaskProgram = make_scoped_ptr(new RenderPassMaskProgram(m_context)); if (!m_renderPassMaskProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::renderPassMaskProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); m_renderPassMaskProgram->initialize(m_context, m_isUsingBindUniform); } return m_renderPassMaskProgram.get(); } -const CCRendererGL::RenderPassMaskProgramAA* CCRendererGL::renderPassMaskProgramAA() +const GLRenderer::RenderPassMaskProgramAA* GLRenderer::renderPassMaskProgramAA() { if (!m_renderPassMaskProgramAA) m_renderPassMaskProgramAA = make_scoped_ptr(new RenderPassMaskProgramAA(m_context)); if (!m_renderPassMaskProgramAA->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::renderPassMaskProgramAA::initialize"); + TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); m_renderPassMaskProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_renderPassMaskProgramAA.get(); } -const CCRendererGL::TileProgram* CCRendererGL::tileProgram() +const GLRenderer::TileProgram* GLRenderer::tileProgram() { DCHECK(m_tileProgram); if (!m_tileProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::tileProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize"); m_tileProgram->initialize(m_context, m_isUsingBindUniform); } return m_tileProgram.get(); } -const CCRendererGL::TileProgramOpaque* CCRendererGL::tileProgramOpaque() +const GLRenderer::TileProgramOpaque* GLRenderer::tileProgramOpaque() { DCHECK(m_tileProgramOpaque); if (!m_tileProgramOpaque->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::tileProgramOpaque::initialize"); + TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize"); m_tileProgramOpaque->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramOpaque.get(); } -const CCRendererGL::TileProgramAA* CCRendererGL::tileProgramAA() +const GLRenderer::TileProgramAA* GLRenderer::tileProgramAA() { if (!m_tileProgramAA) m_tileProgramAA = make_scoped_ptr(new TileProgramAA(m_context)); if (!m_tileProgramAA->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::tileProgramAA::initialize"); + TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); m_tileProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramAA.get(); } -const CCRendererGL::TileProgramSwizzle* CCRendererGL::tileProgramSwizzle() +const GLRenderer::TileProgramSwizzle* GLRenderer::tileProgramSwizzle() { if (!m_tileProgramSwizzle) m_tileProgramSwizzle = make_scoped_ptr(new TileProgramSwizzle(m_context)); if (!m_tileProgramSwizzle->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzle::initialize"); + TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); m_tileProgramSwizzle->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzle.get(); } -const CCRendererGL::TileProgramSwizzleOpaque* CCRendererGL::tileProgramSwizzleOpaque() +const GLRenderer::TileProgramSwizzleOpaque* GLRenderer::tileProgramSwizzleOpaque() { if (!m_tileProgramSwizzleOpaque) m_tileProgramSwizzleOpaque = make_scoped_ptr(new TileProgramSwizzleOpaque(m_context)); if (!m_tileProgramSwizzleOpaque->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzleOpaque::initialize"); + TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); m_tileProgramSwizzleOpaque->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzleOpaque.get(); } -const CCRendererGL::TileProgramSwizzleAA* CCRendererGL::tileProgramSwizzleAA() +const GLRenderer::TileProgramSwizzleAA* GLRenderer::tileProgramSwizzleAA() { if (!m_tileProgramSwizzleAA) m_tileProgramSwizzleAA = make_scoped_ptr(new TileProgramSwizzleAA(m_context)); if (!m_tileProgramSwizzleAA->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzleAA::initialize"); + TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); m_tileProgramSwizzleAA->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzleAA.get(); } -const CCRendererGL::TextureProgram* CCRendererGL::textureProgram() +const GLRenderer::TextureProgram* GLRenderer::textureProgram() { if (!m_textureProgram) m_textureProgram = make_scoped_ptr(new TextureProgram(m_context)); if (!m_textureProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::textureProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); m_textureProgram->initialize(m_context, m_isUsingBindUniform); } return m_textureProgram.get(); } -const CCRendererGL::TextureProgramFlip* CCRendererGL::textureProgramFlip() +const GLRenderer::TextureProgramFlip* GLRenderer::textureProgramFlip() { if (!m_textureProgramFlip) m_textureProgramFlip = make_scoped_ptr(new TextureProgramFlip(m_context)); if (!m_textureProgramFlip->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::textureProgramFlip::initialize"); + TRACE_EVENT0("cc", "GLRenderer::textureProgramFlip::initialize"); m_textureProgramFlip->initialize(m_context, m_isUsingBindUniform); } return m_textureProgramFlip.get(); } -const CCRendererGL::TextureIOSurfaceProgram* CCRendererGL::textureIOSurfaceProgram() +const GLRenderer::TextureIOSurfaceProgram* GLRenderer::textureIOSurfaceProgram() { if (!m_textureIOSurfaceProgram) m_textureIOSurfaceProgram = make_scoped_ptr(new TextureIOSurfaceProgram(m_context)); if (!m_textureIOSurfaceProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::textureIOSurfaceProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize"); m_textureIOSurfaceProgram->initialize(m_context, m_isUsingBindUniform); } return m_textureIOSurfaceProgram.get(); } -const CCRendererGL::VideoYUVProgram* CCRendererGL::videoYUVProgram() +const GLRenderer::VideoYUVProgram* GLRenderer::videoYUVProgram() { if (!m_videoYUVProgram) m_videoYUVProgram = make_scoped_ptr(new VideoYUVProgram(m_context)); if (!m_videoYUVProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::videoYUVProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); m_videoYUVProgram->initialize(m_context, m_isUsingBindUniform); } return m_videoYUVProgram.get(); } -const CCRendererGL::VideoStreamTextureProgram* CCRendererGL::videoStreamTextureProgram() +const GLRenderer::VideoStreamTextureProgram* GLRenderer::videoStreamTextureProgram() { if (!m_videoStreamTextureProgram) m_videoStreamTextureProgram = make_scoped_ptr(new VideoStreamTextureProgram(m_context)); if (!m_videoStreamTextureProgram->initialized()) { - TRACE_EVENT0("cc", "CCRendererGL::streamTextureProgram::initialize"); + TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); m_videoStreamTextureProgram->initialize(m_context, m_isUsingBindUniform); } return m_videoStreamTextureProgram.get(); } -void CCRendererGL::cleanupSharedObjects() +void GLRenderer::cleanupSharedObjects() { makeContextCurrent(); @@ -1515,7 +1515,7 @@ void CCRendererGL::cleanupSharedObjects() releaseRenderPassTextures(); } -bool CCRendererGL::isContextLost() +bool GLRenderer::isContextLost() { return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); } diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h index e6d1652..fc9ddfb 100644 --- a/cc/gl_renderer.h +++ b/cc/gl_renderer.h @@ -21,21 +21,21 @@ class WebGraphicsContext3D; namespace cc { -class CCScopedTexture; -class CCStreamVideoDrawQuad; -class CCTextureDrawQuad; +class ScopedTexture; +class StreamVideoDrawQuad; +class TextureDrawQuad; class GeometryBinding; class ScopedEnsureFramebufferAllocation; // Class that handles drawing of composited render layers using GL. -class CCRendererGL : public CCDirectRenderer, +class GLRenderer : public DirectRenderer, public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM, public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM , public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { public: - static scoped_ptr<CCRendererGL> create(CCRendererClient*, CCResourceProvider*); + static scoped_ptr<GLRenderer> create(RendererClient*, ResourceProvider*); - virtual ~CCRendererGL(); + virtual ~GLRenderer(); virtual const RendererCapabilities& capabilities() const OVERRIDE; @@ -57,14 +57,14 @@ public: const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); } virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; - bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect); + bool getFramebufferTexture(ScopedTexture*, const IntRect& deviceRect); virtual bool isContextLost() OVERRIDE; virtual void setVisible(bool) OVERRIDE; protected: - CCRendererGL(CCRendererClient*, CCResourceProvider*); + GLRenderer(RendererClient*, ResourceProvider*); bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } bool initialize(); @@ -72,12 +72,12 @@ protected: void releaseRenderPassTextures(); virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; - virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE; + virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, const IntRect& framebufferRect) OVERRIDE; virtual void setDrawViewportSize(const IntSize&) OVERRIDE; virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; virtual void disableScissorTest() OVERRIDE; virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; - virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE; + virtual void drawQuad(DrawingFrame&, const DrawQuad*) OVERRIDE; virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; virtual bool flippedFramebuffer() const OVERRIDE; @@ -85,16 +85,16 @@ protected: private: static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); - void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad*); - void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*); - scoped_ptr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRenderPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformationMatrix& deviceTransform); - void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*); - void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*); - void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*); - void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*); - void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*); - void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*); - void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*); + void drawCheckerboardQuad(const DrawingFrame&, const CheckerboardDrawQuad*); + void drawDebugBorderQuad(const DrawingFrame&, const DebugBorderDrawQuad*); + scoped_ptr<ScopedTexture> drawBackgroundFilters(DrawingFrame&, const RenderPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformationMatrix& deviceTransform); + void drawRenderPassQuad(DrawingFrame&, const RenderPassDrawQuad*); + void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); + void drawStreamVideoQuad(const DrawingFrame&, const StreamVideoDrawQuad*); + void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); + void drawIOSurfaceQuad(const DrawingFrame&, const IOSurfaceDrawQuad*); + void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); + void drawYUVVideoQuad(const DrawingFrame&, const YUVVideoDrawQuad*); void setShaderOpacity(float opacity, int alphaLocation); void setShaderFloatQuad(const FloatQuad&, int quadLocation); @@ -102,7 +102,7 @@ private: void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const IntRect&, const WebKit::WebTransformationMatrix& drawMatrix); - bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& viewportRect); + bool useScopedTexture(DrawingFrame&, const ScopedTexture*, const IntRect& viewportRect); bool makeContextCurrent(); @@ -211,9 +211,9 @@ private: bool m_isUsingBindUniform; bool m_visible; - scoped_ptr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; + scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; - DISALLOW_COPY_AND_ASSIGN(CCRendererGL); + DISALLOW_COPY_AND_ASSIGN(GLRenderer); }; @@ -223,7 +223,7 @@ private: #define DEBUG_GL_CALLS 0 #if DEBUG_GL_CALLS && !defined(NDEBUG) -#define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, __LINE__)) +#define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __LINE__)) #else #define GLC(context, x) (x) #endif diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index b635620..cbc6dd4 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -43,7 +43,7 @@ public: int frameCount() { return m_frame; } void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); // In single threaded mode we expect this callback on main thread. DebugScopedSetMainThread main; m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation); @@ -54,23 +54,23 @@ private: WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChangedCallback; }; -class FakeCCRendererClient : public CCRendererClient { +class FakeRendererClient : public RendererClient { public: - FakeCCRendererClient() + FakeRendererClient() : m_setFullRootLayerDamageCount(0) - , m_rootLayer(CCLayerImpl::create(1)) - , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) + , m_rootLayer(LayerImpl::create(1)) + , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); - CCRenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId(); - scoped_ptr<CCRenderPass> rootRenderPass = CCRenderPass::create(renderPassId, IntRect(), WebTransformationMatrix()); + RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId(); + scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, IntRect(), WebTransformationMatrix()); m_renderPassesInDrawOrder.push_back(rootRenderPass.get()); m_renderPasses.set(renderPassId, rootRenderPass.Pass()); } - // CCRendererClient methods. + // RendererClient methods. virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize(1, 1); return fakeSize; } - virtual const CCLayerTreeSettings& settings() const OVERRIDE { static CCLayerTreeSettings fakeSettings; return fakeSettings; } + virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTreeSettings fakeSettings; return fakeSettings; } virtual void didLoseContext() OVERRIDE { } virtual void onSwapBuffersComplete() OVERRIDE { } virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCount++; } @@ -79,40 +79,40 @@ public: // Methods added for test. int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; } - CCRenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.back(); } - const CCRenderPassList& renderPassesInDrawOrder() const { return m_renderPassesInDrawOrder; } - const CCRenderPassIdHashMap& renderPasses() const { return m_renderPasses; } + RenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.back(); } + const RenderPassList& renderPassesInDrawOrder() const { return m_renderPassesInDrawOrder; } + const RenderPassIdHashMap& renderPasses() const { return m_renderPasses; } size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } private: int m_setFullRootLayerDamageCount; DebugScopedSetImplThread m_implThread; - scoped_ptr<CCLayerImpl> m_rootLayer; - CCRenderPassList m_renderPassesInDrawOrder; - CCRenderPassIdHashMap m_renderPasses; + scoped_ptr<LayerImpl> m_rootLayer; + RenderPassList m_renderPassesInDrawOrder; + RenderPassIdHashMap m_renderPasses; size_t m_memoryAllocationLimitBytes; }; -class FakeCCRendererGL : public CCRendererGL { +class FakeRendererGL : public GLRenderer { public: - FakeCCRendererGL(CCRendererClient* client, CCResourceProvider* resourceProvider) : CCRendererGL(client, resourceProvider) { } + FakeRendererGL(RendererClient* client, ResourceProvider* resourceProvider) : GLRenderer(client, resourceProvider) { } - // CCRendererGL methods. + // GLRenderer methods. // Changing visibility to public. - using CCRendererGL::initialize; - using CCRendererGL::isFramebufferDiscarded; + using GLRenderer::initialize; + using GLRenderer::isFramebufferDiscarded; }; -class CCRendererGLTest : public testing::Test { +class GLRendererTest : public testing::Test { protected: - CCRendererGLTest() + GLRendererTest() : m_suggestHaveBackbufferYes(1, true) , m_suggestHaveBackbufferNo(1, false) , m_compositorInitializer(0) , m_context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FrameCountingMemoryAllocationSettingContext()))) - , m_resourceProvider(CCResourceProvider::create(m_context.get())) + , m_resourceProvider(ResourceProvider::create(m_context.get())) , m_renderer(&m_mockClient, m_resourceProvider.get()) { } @@ -133,17 +133,17 @@ protected: WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo; WebCompositorInitializer m_compositorInitializer; - scoped_ptr<CCGraphicsContext> m_context; - FakeCCRendererClient m_mockClient; - scoped_ptr<CCResourceProvider> m_resourceProvider; - FakeCCRendererGL m_renderer; - CCScopedSettings m_scopedSettings; + scoped_ptr<GraphicsContext> m_context; + FakeRendererClient m_mockClient; + scoped_ptr<ResourceProvider> m_resourceProvider; + FakeRendererGL m_renderer; + ScopedSettings m_scopedSettings; }; -// Test CCRendererGL discardFramebuffer functionality: +// Test GLRenderer discardFramebuffer functionality: // Suggest recreating framebuffer when one already exists. // Expected: it does nothing. -TEST_F(CCRendererGLTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) +TEST_F(GLRendererTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) { context()->setMemoryAllocation(m_suggestHaveBackbufferYes); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); @@ -153,10 +153,10 @@ TEST_F(CCRendererGLTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) EXPECT_EQ(1, context()->frameCount()); } -// Test CCRendererGL discardFramebuffer functionality: +// Test GLRenderer discardFramebuffer functionality: // Suggest discarding framebuffer when one exists and the renderer is not visible. // Expected: it is discarded and damage tracker is reset. -TEST_F(CCRendererGLTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) +TEST_F(GLRendererTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) { m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); @@ -164,10 +164,10 @@ TEST_F(CCRendererGLTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRoot EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); } -// Test CCRendererGL discardFramebuffer functionality: +// Test GLRenderer discardFramebuffer functionality: // Suggest discarding framebuffer when one exists and the renderer is visible. // Expected: the allocation is ignored. -TEST_F(CCRendererGLTest, SuggestBackbufferNoDoNothingWhenVisible) +TEST_F(GLRendererTest, SuggestBackbufferNoDoNothingWhenVisible) { m_renderer.setVisible(true); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); @@ -176,10 +176,10 @@ TEST_F(CCRendererGLTest, SuggestBackbufferNoDoNothingWhenVisible) } -// Test CCRendererGL discardFramebuffer functionality: +// Test GLRenderer discardFramebuffer functionality: // Suggest discarding framebuffer when one does not exist. // Expected: it does nothing. -TEST_F(CCRendererGLTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) +TEST_F(GLRendererTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) { m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); @@ -191,10 +191,10 @@ TEST_F(CCRendererGLTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); } -// Test CCRendererGL discardFramebuffer functionality: +// Test GLRenderer discardFramebuffer functionality: // Begin drawing a frame while a framebuffer is discarded. // Expected: will recreate framebuffer. -TEST_F(CCRendererGLTest, DiscardedBackbufferIsRecreatedForScopeDuration) +TEST_F(GLRendererTest, DiscardedBackbufferIsRecreatedForScopeDuration) { m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); @@ -209,7 +209,7 @@ TEST_F(CCRendererGLTest, DiscardedBackbufferIsRecreatedForScopeDuration) EXPECT_EQ(1, context()->frameCount()); } -TEST_F(CCRendererGLTest, FramebufferDiscardedAfterReadbackWhenNotVisible) +TEST_F(GLRendererTest, FramebufferDiscardedAfterReadbackWhenNotVisible) { m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); @@ -291,14 +291,14 @@ public: virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) { ADD_FAILURE(); return 0; } }; -// This test isn't using the same fixture as CCRendererGLTest, and you can't mix TEST() and TEST_F() with the same name, hence LRC2. -TEST(CCRendererGLTest2, initializationDoesNotMakeSynchronousCalls) +// This test isn't using the same fixture as GLRendererTest, and you can't mix TEST() and TEST_F() with the same name, hence LRC2. +TEST(GLRendererTest2, initializationDoesNotMakeSynchronousCalls) { - CCScopedSettings scopedSettings; - FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ForbidSynchronousCallContext))); - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); + ScopedSettings scopedSettings; + FakeRendererClient mockClient; + scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ForbidSynchronousCallContext))); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); + FakeRendererGL renderer(&mockClient, resourceProvider.get()); EXPECT_TRUE(renderer.initialize()); } @@ -336,13 +336,13 @@ private: bool m_contextLost; }; -TEST(CCRendererGLTest2, initializationWithQuicklyLostContextDoesNotAssert) +TEST(GLRendererTest2, initializationWithQuicklyLostContextDoesNotAssert) { - CCScopedSettings scopedSettings; - FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new LoseContextOnFirstGetContext))); - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); + ScopedSettings scopedSettings; + FakeRendererClient mockClient; + scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new LoseContextOnFirstGetContext))); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); + FakeRendererGL renderer(&mockClient, resourceProvider.get()); renderer.initialize(); } @@ -359,12 +359,12 @@ public: virtual WebString getString(WebKit::WGC3Denum name) { return WebString(); } }; -TEST(CCRendererGLTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) +TEST(GLRendererTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { - FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions))); - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); + FakeRendererClient mockClient; + scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions))); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); + FakeRendererGL renderer(&mockClient, resourceProvider.get()); renderer.initialize(); @@ -386,13 +386,13 @@ private: int m_clear; }; -TEST(CCRendererGLTest2, opaqueBackground) +TEST(GLRendererTest2, opaqueBackground) { - FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); - ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); - FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); + FakeRendererClient mockClient; + scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); + ClearCountingContext* context = static_cast<ClearCountingContext*>(outputSurface->context3D()); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get())); + FakeRendererGL renderer(&mockClient, resourceProvider.get()); mockClient.rootRenderPass()->setHasTransparentBackground(false); @@ -409,13 +409,13 @@ TEST(CCRendererGLTest2, opaqueBackground) #endif } -TEST(CCRendererGLTest2, transparentBackground) +TEST(GLRendererTest2, transparentBackground) { - FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); - ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); - FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); + FakeRendererClient mockClient; + scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); + ClearCountingContext* context = static_cast<ClearCountingContext*>(outputSurface->context3D()); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get())); + FakeRendererGL renderer(&mockClient, resourceProvider.get()); mockClient.rootRenderPass()->setHasTransparentBackground(true); diff --git a/cc/graphics_context.h b/cc/graphics_context.h index 6eb5b34..0daabb0 100644 --- a/cc/graphics_context.h +++ b/cc/graphics_context.h @@ -10,8 +10,8 @@ namespace cc { -// FIXME: rename fully to CCOutputSurface. -typedef WebKit::WebCompositorOutputSurface CCGraphicsContext; +// FIXME: rename fully to OutputSurface. +typedef WebKit::WebCompositorOutputSurface GraphicsContext; } // namespace cc diff --git a/cc/heads_up_display_layer.cc b/cc/heads_up_display_layer.cc index 5e0439a..f767d93 100644 --- a/cc/heads_up_display_layer.cc +++ b/cc/heads_up_display_layer.cc @@ -12,25 +12,25 @@ namespace cc { -scoped_refptr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create() +scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() { - return make_scoped_refptr(new HeadsUpDisplayLayerChromium()); + return make_scoped_refptr(new HeadsUpDisplayLayer()); } -HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium() - : LayerChromium() +HeadsUpDisplayLayer::HeadsUpDisplayLayer() + : Layer() { setBounds(IntSize(512, 128)); } -HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium() +HeadsUpDisplayLayer::~HeadsUpDisplayLayer() { } -void HeadsUpDisplayLayerChromium::update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) +void HeadsUpDisplayLayer::update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) { - const CCLayerTreeSettings& settings = layerTreeHost()->settings(); + const LayerTreeSettings& settings = layerTreeHost()->settings(); int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; IntSize bounds; @@ -45,30 +45,30 @@ void HeadsUpDisplayLayerChromium::update(CCTextureUpdateQueue&, const CCOcclusio setBounds(bounds); } -bool HeadsUpDisplayLayerChromium::drawsContent() const +bool HeadsUpDisplayLayer::drawsContent() const { return true; } -void HeadsUpDisplayLayerChromium::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) +void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) { m_fontAtlas = fontAtlas.Pass(); setNeedsCommit(); } -scoped_ptr<CCLayerImpl> HeadsUpDisplayLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() { - return CCHeadsUpDisplayLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); } -void HeadsUpDisplayLayerChromium::pushPropertiesTo(CCLayerImpl* layerImpl) +void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) { - LayerChromium::pushPropertiesTo(layerImpl); + Layer::pushPropertiesTo(layerImpl); if (!m_fontAtlas.get()) return; - CCHeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<CCHeadsUpDisplayLayerImpl*>(layerImpl); + HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*>(layerImpl); hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); } diff --git a/cc/heads_up_display_layer.h b/cc/heads_up_display_layer.h index 9d087c0e..23d514b 100644 --- a/cc/heads_up_display_layer.h +++ b/cc/heads_up_display_layer.h @@ -12,25 +12,25 @@ namespace cc { -class HeadsUpDisplayLayerChromium : public LayerChromium { +class HeadsUpDisplayLayer : public Layer { public: - static scoped_refptr<HeadsUpDisplayLayerChromium> create(); + static scoped_refptr<HeadsUpDisplayLayer> create(); - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; virtual bool drawsContent() const OVERRIDE; - void setFontAtlas(scoped_ptr<CCFontAtlas>); + void setFontAtlas(scoped_ptr<FontAtlas>); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; - virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; + virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; protected: - HeadsUpDisplayLayerChromium(); + HeadsUpDisplayLayer(); private: - virtual ~HeadsUpDisplayLayerChromium(); + virtual ~HeadsUpDisplayLayer(); - scoped_ptr<CCFontAtlas> m_fontAtlas; + scoped_ptr<FontAtlas> m_fontAtlas; }; } // namespace cc diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc index 298c0cb..38fbad1 100644 --- a/cc/heads_up_display_layer_impl.cc +++ b/cc/heads_up_display_layer_impl.cc @@ -41,26 +41,26 @@ static inline SkPaint createPaint() return paint; } -CCHeadsUpDisplayLayerImpl::CCHeadsUpDisplayLayerImpl(int id) - : CCLayerImpl(id) +HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(int id) + : LayerImpl(id) { } -CCHeadsUpDisplayLayerImpl::~CCHeadsUpDisplayLayerImpl() +HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() { } -void CCHeadsUpDisplayLayerImpl::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) +void HeadsUpDisplayLayerImpl::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) { m_fontAtlas = fontAtlas.Pass(); } -void CCHeadsUpDisplayLayerImpl::willDraw(CCResourceProvider* resourceProvider) +void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) { - CCLayerImpl::willDraw(resourceProvider); + LayerImpl::willDraw(resourceProvider); if (!m_hudTexture) - m_hudTexture = CCScopedTexture::create(resourceProvider); + m_hudTexture = ScopedTexture::create(resourceProvider); // FIXME: Scale the HUD by deviceScale to make it more friendly under high DPI. @@ -68,24 +68,24 @@ void CCHeadsUpDisplayLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_hudTexture->free(); if (!m_hudTexture->id()) - m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GL_RGBA, CCResourceProvider::TextureUsageAny); + m_hudTexture->allocate(Renderer::ImplPool, bounds(), GL_RGBA, ResourceProvider::TextureUsageAny); } -void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { if (!m_hudTexture->id()) return; - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); IntRect quadRect(IntPoint(), bounds()); bool premultipliedAlpha = true; FloatRect uvRect(0, 0, 1, 1); bool flipped = false; - quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData); } -void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourceProvider) +void HeadsUpDisplayLayerImpl::updateHudTexture(ResourceProvider* resourceProvider) { if (!m_hudTexture->id()) return; @@ -110,9 +110,9 @@ void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourcePro resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bitmap->getPixels()), layerRect, layerRect, IntSize()); } -void CCHeadsUpDisplayLayerImpl::didDraw(CCResourceProvider* resourceProvider) +void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider) { - CCLayerImpl::didDraw(resourceProvider); + LayerImpl::didDraw(resourceProvider); if (!m_hudTexture->id()) return; @@ -123,19 +123,19 @@ void CCHeadsUpDisplayLayerImpl::didDraw(CCResourceProvider* resourceProvider) DCHECK(!resourceProvider->inUseByConsumer(m_hudTexture->id())); } -void CCHeadsUpDisplayLayerImpl::didLoseContext() +void HeadsUpDisplayLayerImpl::didLoseContext() { m_hudTexture.reset(); } -bool CCHeadsUpDisplayLayerImpl::layerIsAlwaysDamaged() const +bool HeadsUpDisplayLayerImpl::layerIsAlwaysDamaged() const { return true; } -void CCHeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas) +void HeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas) { - const CCLayerTreeSettings& settings = layerTreeHostImpl()->settings(); + const LayerTreeSettings& settings = layerTreeHostImpl()->settings(); if (settings.showPlatformLayerTree) { SkPaint paint = createPaint(); @@ -164,7 +164,7 @@ void CCHeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas) drawDebugRects(canvas, layerTreeHostImpl()->debugRectHistory()); } -void CCHeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, CCFrameRateCounter* fpsCounter, int top, int height) +void HeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, FrameRateCounter* fpsCounter, int top, int height) { float textWidth = 170; // so text fits on linux. float graphWidth = fpsCounter->timeStampHistorySize(); @@ -220,7 +220,7 @@ void CCHeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, CCFrameRateCoun canvas->drawPath(path, paint); } -void CCHeadsUpDisplayLayerImpl::drawFPSCounterText(SkCanvas* canvas, CCFrameRateCounter* fpsCounter, int top, int width, int height) +void HeadsUpDisplayLayerImpl::drawFPSCounterText(SkCanvas* canvas, FrameRateCounter* fpsCounter, int top, int width, int height) { double averageFPS, stdDeviation; fpsCounter->getAverageFPSAndStandardDeviation(averageFPS, stdDeviation); @@ -235,9 +235,9 @@ void CCHeadsUpDisplayLayerImpl::drawFPSCounterText(SkCanvas* canvas, CCFrameRate m_fontAtlas->drawText(canvas, createPaint(), base::StringPrintf("FPS: %4.1f +/- %3.1f", averageFPS, stdDeviation), gfx::Point(10, height / 3), IntSize(width, height)); } -void CCHeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, CCDebugRectHistory* debugRectHistory) +void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory) { - const Vector<CCDebugRect>& debugRects = debugRectHistory->debugRects(); + const Vector<DebugRect>& debugRects = debugRectHistory->debugRects(); for (size_t i = 0; i < debugRects.size(); ++i) { SkColor strokeColor = 0; @@ -289,7 +289,7 @@ void CCHeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, CCDebugRectHist } } -const char* CCHeadsUpDisplayLayerImpl::layerTypeAsString() const +const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const { return "HeadsUpDisplayLayer"; } diff --git a/cc/heads_up_display_layer_impl.h b/cc/heads_up_display_layer_impl.h index beb384b..1162e62b 100644 --- a/cc/heads_up_display_layer_impl.h +++ b/cc/heads_up_display_layer_impl.h @@ -14,41 +14,41 @@ class SkCanvas; namespace cc { -class CCDebugRectHistory; -class CCFontAtlas; -class CCFrameRateCounter; +class DebugRectHistory; +class FontAtlas; +class FrameRateCounter; -class CCHeadsUpDisplayLayerImpl : public CCLayerImpl { +class HeadsUpDisplayLayerImpl : public LayerImpl { public: - static scoped_ptr<CCHeadsUpDisplayLayerImpl> create(int id) + static scoped_ptr<HeadsUpDisplayLayerImpl> create(int id) { - return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id)); + return make_scoped_ptr(new HeadsUpDisplayLayerImpl(id)); } - virtual ~CCHeadsUpDisplayLayerImpl(); + virtual ~HeadsUpDisplayLayerImpl(); - void setFontAtlas(scoped_ptr<CCFontAtlas>); + void setFontAtlas(scoped_ptr<FontAtlas>); - virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; - void updateHudTexture(CCResourceProvider*); - virtual void didDraw(CCResourceProvider*) OVERRIDE; + virtual void willDraw(ResourceProvider*) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; + void updateHudTexture(ResourceProvider*); + virtual void didDraw(ResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; virtual bool layerIsAlwaysDamaged() const OVERRIDE; private: - explicit CCHeadsUpDisplayLayerImpl(int); + explicit HeadsUpDisplayLayerImpl(int); virtual const char* layerTypeAsString() const OVERRIDE; void drawHudContents(SkCanvas*); - void drawFPSCounter(SkCanvas*, CCFrameRateCounter*, int top, int height); - void drawFPSCounterText(SkCanvas*, CCFrameRateCounter*, int top, int width, int height); - void drawDebugRects(SkCanvas*, CCDebugRectHistory*); + void drawFPSCounter(SkCanvas*, FrameRateCounter*, int top, int height); + void drawFPSCounterText(SkCanvas*, FrameRateCounter*, int top, int width, int height); + void drawDebugRects(SkCanvas*, DebugRectHistory*); - scoped_ptr<CCFontAtlas> m_fontAtlas; - scoped_ptr<CCScopedTexture> m_hudTexture; + scoped_ptr<FontAtlas> m_fontAtlas; + scoped_ptr<ScopedTexture> m_hudTexture; scoped_ptr<SkCanvas> m_hudCanvas; }; diff --git a/cc/heads_up_display_unittest.cc b/cc/heads_up_display_unittest.cc index 2c55fcf..d947864 100644 --- a/cc/heads_up_display_unittest.cc +++ b/cc/heads_up_display_unittest.cc @@ -14,32 +14,32 @@ using namespace WebKitTests; namespace { -class CCHeadsUpDisplayTest : public CCThreadedTest { +class HeadsUpDisplayTest : public ThreadedTest { protected: - virtual void initializeSettings(CCLayerTreeSettings& settings) OVERRIDE + virtual void initializeSettings(LayerTreeSettings& settings) OVERRIDE { // Enable the HUD without requiring text. settings.showPropertyChangedRects = true; } }; -class DrawsContentLayerChromium : public LayerChromium { +class DrawsContentLayer : public Layer { public: - static scoped_refptr<DrawsContentLayerChromium> create() { return make_scoped_refptr(new DrawsContentLayerChromium()); } + static scoped_refptr<DrawsContentLayer> create() { return make_scoped_refptr(new DrawsContentLayer()); } virtual bool drawsContent() const OVERRIDE { return true; } private: - DrawsContentLayerChromium() : LayerChromium() { } - virtual ~DrawsContentLayerChromium() + DrawsContentLayer() : Layer() { } + virtual ~DrawsContentLayer() { } }; -class CCHudWithRootLayerChange : public CCHeadsUpDisplayTest { +class HudWithRootLayerChange : public HeadsUpDisplayTest { public: - CCHudWithRootLayerChange() - : m_rootLayer1(DrawsContentLayerChromium::create()) - , m_rootLayer2(DrawsContentLayerChromium::create()) + HudWithRootLayerChange() + : m_rootLayer1(DrawsContentLayer::create()) + , m_rootLayer2(DrawsContentLayer::create()) , m_numCommits(0) { } @@ -100,12 +100,12 @@ public: } private: - scoped_refptr<DrawsContentLayerChromium> m_rootLayer1; - scoped_refptr<DrawsContentLayerChromium> m_rootLayer2; + scoped_refptr<DrawsContentLayer> m_rootLayer1; + scoped_refptr<DrawsContentLayer> m_rootLayer2; int m_numCommits; }; -TEST_F(CCHudWithRootLayerChange, runMultiThread) +TEST_F(HudWithRootLayerChange, runMultiThread) { runTest(true); } diff --git a/cc/image_layer.cc b/cc/image_layer.cc index 2ddc4f8..752ad65 100644 --- a/cc/image_layer.cc +++ b/cc/image_layer.cc @@ -18,13 +18,13 @@ class ImageLayerTextureUpdater : public LayerTextureUpdater { public: class Texture : public LayerTextureUpdater::Texture { public: - Texture(ImageLayerTextureUpdater* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture) + Texture(ImageLayerTextureUpdater* textureUpdater, scoped_ptr<PrioritizedTexture> texture) : LayerTextureUpdater::Texture(texture.Pass()) , m_textureUpdater(textureUpdater) { } - virtual void update(CCTextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) OVERRIDE + virtual void update(TextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE { textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); } @@ -41,9 +41,9 @@ public: } virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture( - CCPrioritizedTextureManager* manager) OVERRIDE + PrioritizedTextureManager* manager) OVERRIDE { - return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); + return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); } virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE @@ -52,7 +52,7 @@ public: LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } - void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) + void updateTexture(TextureUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) { // Source rect should never go outside the image pixels, even if this // is requested because the texture extends outside the image. @@ -85,21 +85,21 @@ private: SkBitmap m_bitmap; }; -scoped_refptr<ImageLayerChromium> ImageLayerChromium::create() +scoped_refptr<ImageLayer> ImageLayer::create() { - return make_scoped_refptr(new ImageLayerChromium()); + return make_scoped_refptr(new ImageLayer()); } -ImageLayerChromium::ImageLayerChromium() - : TiledLayerChromium() +ImageLayer::ImageLayer() + : TiledLayer() { } -ImageLayerChromium::~ImageLayerChromium() +ImageLayer::~ImageLayer() { } -void ImageLayerChromium::setBitmap(const SkBitmap& bitmap) +void ImageLayer::setBitmap(const SkBitmap& bitmap) { // setBitmap() currently gets called whenever there is any // style change that affects the layer even if that change doesn't @@ -112,15 +112,15 @@ void ImageLayerChromium::setBitmap(const SkBitmap& bitmap) setNeedsDisplay(); } -void ImageLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc) +void ImageLayer::setTexturePriorities(const PriorityCalculator& priorityCalc) { // Update the tile data before creating all the layer's tiles. updateTileSizeAndTilingOption(); - TiledLayerChromium::setTexturePriorities(priorityCalc); + TiledLayer::setTexturePriorities(priorityCalc); } -void ImageLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) +void ImageLayer::update(TextureUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats) { createTextureUpdaterIfNeeded(); if (m_needsDisplay) { @@ -129,10 +129,10 @@ void ImageLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTr invalidateContentRect(IntRect(IntPoint(), contentBounds())); m_needsDisplay = false; } - TiledLayerChromium::update(queue, occlusion, stats); + TiledLayer::update(queue, occlusion, stats); } -void ImageLayerChromium::createTextureUpdaterIfNeeded() +void ImageLayer::createTextureUpdaterIfNeeded() { if (m_textureUpdater) return; @@ -143,22 +143,22 @@ void ImageLayerChromium::createTextureUpdaterIfNeeded() setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } -LayerTextureUpdater* ImageLayerChromium::textureUpdater() const +LayerTextureUpdater* ImageLayer::textureUpdater() const { return m_textureUpdater.get(); } -IntSize ImageLayerChromium::contentBounds() const +IntSize ImageLayer::contentBounds() const { return IntSize(m_bitmap.width(), m_bitmap.height()); } -bool ImageLayerChromium::drawsContent() const +bool ImageLayer::drawsContent() const { - return !m_bitmap.isNull() && TiledLayerChromium::drawsContent(); + return !m_bitmap.isNull() && TiledLayer::drawsContent(); } -bool ImageLayerChromium::needsContentsScale() const +bool ImageLayer::needsContentsScale() const { // Contents scale is not need for image layer because this can be done in compositor more efficiently. return false; diff --git a/cc/image_layer.h b/cc/image_layer.h index 404aed4..833a278 100644 --- a/cc/image_layer.h +++ b/cc/image_layer.h @@ -13,20 +13,20 @@ namespace cc { class ImageLayerTextureUpdater; // A Layer that contains only an Image element. -class ImageLayerChromium : public TiledLayerChromium { +class ImageLayer : public TiledLayer { public: - static scoped_refptr<ImageLayerChromium> create(); + static scoped_refptr<ImageLayer> create(); virtual bool drawsContent() const OVERRIDE; - virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; + virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; virtual bool needsContentsScale() const OVERRIDE; void setBitmap(const SkBitmap& image); private: - ImageLayerChromium(); - virtual ~ImageLayerChromium(); + ImageLayer(); + virtual ~ImageLayer(); void setTilingOption(TilingOption); diff --git a/cc/input_handler.h b/cc/input_handler.h index ab525c9..0e1e44c 100644 --- a/cc/input_handler.h +++ b/cc/input_handler.h @@ -12,15 +12,15 @@ namespace cc { class IntPoint; class IntSize; -// The CCInputHandler is a way for the embedders to interact with +// The InputHandler is a way for the embedders to interact with // the impl thread side of the compositor implementation. // -// There is one CCInputHandler for every CCLayerTreeHost. It is +// There is one InputHandler for every LayerTreeHost. It is // created on the main thread and used only on the impl thread. // -// The CCInputHandler is constructed with a CCInputHandlerClient, which is the +// The InputHandler is constructed with a InputHandlerClient, which is the // interface by which the handler can manipulate the LayerTree. -class CCInputHandlerClient { +class InputHandlerClient { public: enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; enum ScrollInputType { Gesture, Wheel }; @@ -55,29 +55,29 @@ public: double startTime, double duration) = 0; - // Request another callback to CCInputHandler::animate(). + // Request another callback to InputHandler::animate(). virtual void scheduleAnimation() = 0; protected: - CCInputHandlerClient() { } - virtual ~CCInputHandlerClient() { } + InputHandlerClient() { } + virtual ~InputHandlerClient() { } private: - DISALLOW_COPY_AND_ASSIGN(CCInputHandlerClient); + DISALLOW_COPY_AND_ASSIGN(InputHandlerClient); }; -class CCInputHandler { +class InputHandler { public: - virtual ~CCInputHandler() { } + virtual ~InputHandler() { } - virtual void bindToClient(CCInputHandlerClient*) = 0; + virtual void bindToClient(InputHandlerClient*) = 0; virtual void animate(double monotonicTime) = 0; protected: - CCInputHandler() { } + InputHandler() { } private: - DISALLOW_COPY_AND_ASSIGN(CCInputHandler); + DISALLOW_COPY_AND_ASSIGN(InputHandler); }; } diff --git a/cc/io_surface_draw_quad.cc b/cc/io_surface_draw_quad.cc index 2cd2ca6..14294b8 100644 --- a/cc/io_surface_draw_quad.cc +++ b/cc/io_surface_draw_quad.cc @@ -10,23 +10,23 @@ namespace cc { -scoped_ptr<CCIOSurfaceDrawQuad> CCIOSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) +scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) { - return make_scoped_ptr(new CCIOSurfaceDrawQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId, orientation)); + return make_scoped_ptr(new IOSurfaceDrawQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId, orientation)); } -CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) - : CCDrawQuad(sharedQuadState, CCDrawQuad::IOSurfaceContent, quadRect) +IOSurfaceDrawQuad::IOSurfaceDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) + : DrawQuad(sharedQuadState, DrawQuad::IOSurfaceContent, quadRect) , m_ioSurfaceSize(ioSurfaceSize) , m_ioSurfaceTextureId(ioSurfaceTextureId) , m_orientation(orientation) { } -const CCIOSurfaceDrawQuad* CCIOSurfaceDrawQuad::materialCast(const CCDrawQuad* quad) +const IOSurfaceDrawQuad* IOSurfaceDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::IOSurfaceContent); - return static_cast<const CCIOSurfaceDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::IOSurfaceContent); + return static_cast<const IOSurfaceDrawQuad*>(quad); } } // namespace cc diff --git a/cc/io_surface_draw_quad.h b/cc/io_surface_draw_quad.h index bb5b028..24ef87e 100644 --- a/cc/io_surface_draw_quad.h +++ b/cc/io_surface_draw_quad.h @@ -13,22 +13,22 @@ namespace cc { #pragma pack(push, 4) -class CCIOSurfaceDrawQuad : public CCDrawQuad { +class IOSurfaceDrawQuad : public DrawQuad { public: enum Orientation { Flipped, Unflipped }; - static scoped_ptr<CCIOSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation); + static scoped_ptr<IOSurfaceDrawQuad> create(const SharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation); IntSize ioSurfaceSize() const { return m_ioSurfaceSize; } unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; } Orientation orientation() const { return m_orientation; } - static const CCIOSurfaceDrawQuad* materialCast(const CCDrawQuad*); + static const IOSurfaceDrawQuad* materialCast(const DrawQuad*); private: - CCIOSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation); + IOSurfaceDrawQuad(const SharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation); IntSize m_ioSurfaceSize; unsigned m_ioSurfaceTextureId; diff --git a/cc/io_surface_layer.cc b/cc/io_surface_layer.cc index df125d1..a96dcca 100644 --- a/cc/io_surface_layer.cc +++ b/cc/io_surface_layer.cc @@ -10,43 +10,43 @@ namespace cc { -scoped_refptr<IOSurfaceLayerChromium> IOSurfaceLayerChromium::create() +scoped_refptr<IOSurfaceLayer> IOSurfaceLayer::create() { - return make_scoped_refptr(new IOSurfaceLayerChromium()); + return make_scoped_refptr(new IOSurfaceLayer()); } -IOSurfaceLayerChromium::IOSurfaceLayerChromium() - : LayerChromium() +IOSurfaceLayer::IOSurfaceLayer() + : Layer() , m_ioSurfaceId(0) { } -IOSurfaceLayerChromium::~IOSurfaceLayerChromium() +IOSurfaceLayer::~IOSurfaceLayer() { } -void IOSurfaceLayerChromium::setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize& size) +void IOSurfaceLayer::setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize& size) { m_ioSurfaceId = ioSurfaceId; m_ioSurfaceSize = size; setNeedsCommit(); } -scoped_ptr<CCLayerImpl> IOSurfaceLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> IOSurfaceLayer::createLayerImpl() { - return CCIOSurfaceLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return IOSurfaceLayerImpl::create(m_layerId).PassAs<LayerImpl>(); } -bool IOSurfaceLayerChromium::drawsContent() const +bool IOSurfaceLayer::drawsContent() const { - return m_ioSurfaceId && LayerChromium::drawsContent(); + return m_ioSurfaceId && Layer::drawsContent(); } -void IOSurfaceLayerChromium::pushPropertiesTo(CCLayerImpl* layer) +void IOSurfaceLayer::pushPropertiesTo(LayerImpl* layer) { - LayerChromium::pushPropertiesTo(layer); + Layer::pushPropertiesTo(layer); - CCIOSurfaceLayerImpl* textureLayer = static_cast<CCIOSurfaceLayerImpl*>(layer); + IOSurfaceLayerImpl* textureLayer = static_cast<IOSurfaceLayerImpl*>(layer); textureLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize); } diff --git a/cc/io_surface_layer.h b/cc/io_surface_layer.h index afea279..9d728a0 100644 --- a/cc/io_surface_layer.h +++ b/cc/io_surface_layer.h @@ -9,21 +9,21 @@ namespace cc { -class IOSurfaceLayerChromium : public LayerChromium { +class IOSurfaceLayer : public Layer { public: - static scoped_refptr<IOSurfaceLayerChromium> create(); + static scoped_refptr<IOSurfaceLayer> create(); void setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize&); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; virtual bool drawsContent() const OVERRIDE; - virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; + virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; protected: - IOSurfaceLayerChromium(); + IOSurfaceLayer(); private: - virtual ~IOSurfaceLayerChromium(); + virtual ~IOSurfaceLayer(); uint32_t m_ioSurfaceId; IntSize m_ioSurfaceSize; diff --git a/cc/io_surface_layer_impl.cc b/cc/io_surface_layer_impl.cc index 35454df..3f5954f 100644 --- a/cc/io_surface_layer_impl.cc +++ b/cc/io_surface_layer_impl.cc @@ -18,29 +18,29 @@ namespace cc { -CCIOSurfaceLayerImpl::CCIOSurfaceLayerImpl(int id) - : CCLayerImpl(id) +IOSurfaceLayerImpl::IOSurfaceLayerImpl(int id) + : LayerImpl(id) , m_ioSurfaceId(0) , m_ioSurfaceChanged(false) , m_ioSurfaceTextureId(0) { } -CCIOSurfaceLayerImpl::~CCIOSurfaceLayerImpl() +IOSurfaceLayerImpl::~IOSurfaceLayerImpl() { if (!m_ioSurfaceTextureId) return; - CCGraphicsContext* context = layerTreeHostImpl()->context(); + GraphicsContext* context = layerTreeHostImpl()->context(); // FIXME: Implement this path for software compositing. WebKit::WebGraphicsContext3D* context3d = context->context3D(); if (context3d) context3d->deleteTexture(m_ioSurfaceTextureId); } -void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) +void IOSurfaceLayerImpl::willDraw(ResourceProvider* resourceProvider) { - CCLayerImpl::willDraw(resourceProvider); + LayerImpl::willDraw(resourceProvider); if (m_ioSurfaceChanged) { WebKit::WebGraphicsContext3D* context3d = resourceProvider->graphicsContext3D(); @@ -74,23 +74,23 @@ void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) } } -void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void IOSurfaceLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); IntRect quadRect(IntPoint(), contentBounds()); - quadSink.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(IOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>(), appendQuadsData); } -void CCIOSurfaceLayerImpl::dumpLayerProperties(std::string* str, int indent) const +void IOSurfaceLayerImpl::dumpLayerProperties(std::string* str, int indent) const { str->append(indentString(indent)); base::StringAppendF(str, "iosurface id: %u texture id: %u\n", m_ioSurfaceId, m_ioSurfaceTextureId); - CCLayerImpl::dumpLayerProperties(str, indent); + LayerImpl::dumpLayerProperties(str, indent); } -void CCIOSurfaceLayerImpl::didLoseContext() +void IOSurfaceLayerImpl::didLoseContext() { // We don't have a valid texture ID in the new context; however, // the IOSurface is still valid. @@ -98,7 +98,7 @@ void CCIOSurfaceLayerImpl::didLoseContext() m_ioSurfaceChanged = true; } -void CCIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize& size) +void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize& size) { if (m_ioSurfaceId != ioSurfaceId) m_ioSurfaceChanged = true; @@ -107,7 +107,7 @@ void CCIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const In m_ioSurfaceSize = size; } -const char* CCIOSurfaceLayerImpl::layerTypeAsString() const +const char* IOSurfaceLayerImpl::layerTypeAsString() const { return "IOSurfaceLayer"; } diff --git a/cc/io_surface_layer_impl.h b/cc/io_surface_layer_impl.h index 238e27e..656cb15 100644 --- a/cc/io_surface_layer_impl.h +++ b/cc/io_surface_layer_impl.h @@ -10,25 +10,25 @@ namespace cc { -class CCIOSurfaceLayerImpl : public CCLayerImpl { +class IOSurfaceLayerImpl : public LayerImpl { public: - static scoped_ptr<CCIOSurfaceLayerImpl> create(int id) + static scoped_ptr<IOSurfaceLayerImpl> create(int id) { - return make_scoped_ptr(new CCIOSurfaceLayerImpl(id)); + return make_scoped_ptr(new IOSurfaceLayerImpl(id)); } - virtual ~CCIOSurfaceLayerImpl(); + virtual ~IOSurfaceLayerImpl(); void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&); - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; - virtual void willDraw(CCResourceProvider*) OVERRIDE; + virtual void willDraw(ResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; private: - explicit CCIOSurfaceLayerImpl(int); + explicit IOSurfaceLayerImpl(int); virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/keyframed_animation_curve.cc b/cc/keyframed_animation_curve.cc index b536095..3fa7dbb 100644 --- a/cc/keyframed_animation_curve.cc +++ b/cc/keyframed_animation_curve.cc @@ -29,123 +29,123 @@ void insertKeyframe(scoped_ptr<Keyframe> keyframe, ScopedPtrVector<Keyframe>& ke keyframes.append(keyframe.Pass()); } -scoped_ptr<CCTimingFunction> cloneTimingFunction(const CCTimingFunction* timingFunction) +scoped_ptr<TimingFunction> cloneTimingFunction(const TimingFunction* timingFunction) { DCHECK(timingFunction); - scoped_ptr<CCAnimationCurve> curve(timingFunction->clone()); - return scoped_ptr<CCTimingFunction>(static_cast<CCTimingFunction*>(curve.release())); + scoped_ptr<AnimationCurve> curve(timingFunction->clone()); + return scoped_ptr<TimingFunction>(static_cast<TimingFunction*>(curve.release())); } } // namespace -CCKeyframe::CCKeyframe(double time, scoped_ptr<CCTimingFunction> timingFunction) +Keyframe::Keyframe(double time, scoped_ptr<TimingFunction> timingFunction) : m_time(time) , m_timingFunction(timingFunction.Pass()) { } -CCKeyframe::~CCKeyframe() +Keyframe::~Keyframe() { } -double CCKeyframe::time() const +double Keyframe::time() const { return m_time; } -const CCTimingFunction* CCKeyframe::timingFunction() const +const TimingFunction* Keyframe::timingFunction() const { return m_timingFunction.get(); } -scoped_ptr<CCFloatKeyframe> CCFloatKeyframe::create(double time, float value, scoped_ptr<CCTimingFunction> timingFunction) +scoped_ptr<FloatKeyframe> FloatKeyframe::create(double time, float value, scoped_ptr<TimingFunction> timingFunction) { - return make_scoped_ptr(new CCFloatKeyframe(time, value, timingFunction.Pass())); + return make_scoped_ptr(new FloatKeyframe(time, value, timingFunction.Pass())); } -CCFloatKeyframe::CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction> timingFunction) - : CCKeyframe(time, timingFunction.Pass()) +FloatKeyframe::FloatKeyframe(double time, float value, scoped_ptr<TimingFunction> timingFunction) + : Keyframe(time, timingFunction.Pass()) , m_value(value) { } -CCFloatKeyframe::~CCFloatKeyframe() +FloatKeyframe::~FloatKeyframe() { } -float CCFloatKeyframe::value() const +float FloatKeyframe::value() const { return m_value; } -scoped_ptr<CCFloatKeyframe> CCFloatKeyframe::clone() const +scoped_ptr<FloatKeyframe> FloatKeyframe::clone() const { - scoped_ptr<CCTimingFunction> func; + scoped_ptr<TimingFunction> func; if (timingFunction()) func = cloneTimingFunction(timingFunction()); - return CCFloatKeyframe::create(time(), value(), func.Pass()); + return FloatKeyframe::create(time(), value(), func.Pass()); } -scoped_ptr<CCTransformKeyframe> CCTransformKeyframe::create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction> timingFunction) +scoped_ptr<TransformKeyframe> TransformKeyframe::create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction> timingFunction) { - return make_scoped_ptr(new CCTransformKeyframe(time, value, timingFunction.Pass())); + return make_scoped_ptr(new TransformKeyframe(time, value, timingFunction.Pass())); } -CCTransformKeyframe::CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction> timingFunction) - : CCKeyframe(time, timingFunction.Pass()) +TransformKeyframe::TransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction> timingFunction) + : Keyframe(time, timingFunction.Pass()) , m_value(value) { } -CCTransformKeyframe::~CCTransformKeyframe() +TransformKeyframe::~TransformKeyframe() { } -const WebKit::WebTransformOperations& CCTransformKeyframe::value() const +const WebKit::WebTransformOperations& TransformKeyframe::value() const { return m_value; } -scoped_ptr<CCTransformKeyframe> CCTransformKeyframe::clone() const +scoped_ptr<TransformKeyframe> TransformKeyframe::clone() const { - scoped_ptr<CCTimingFunction> func; + scoped_ptr<TimingFunction> func; if (timingFunction()) func = cloneTimingFunction(timingFunction()); - return CCTransformKeyframe::create(time(), value(), func.Pass()); + return TransformKeyframe::create(time(), value(), func.Pass()); } -scoped_ptr<CCKeyframedFloatAnimationCurve> CCKeyframedFloatAnimationCurve::create() +scoped_ptr<KeyframedFloatAnimationCurve> KeyframedFloatAnimationCurve::create() { - return make_scoped_ptr(new CCKeyframedFloatAnimationCurve); + return make_scoped_ptr(new KeyframedFloatAnimationCurve); } -CCKeyframedFloatAnimationCurve::CCKeyframedFloatAnimationCurve() +KeyframedFloatAnimationCurve::KeyframedFloatAnimationCurve() { } -CCKeyframedFloatAnimationCurve::~CCKeyframedFloatAnimationCurve() +KeyframedFloatAnimationCurve::~KeyframedFloatAnimationCurve() { } -void CCKeyframedFloatAnimationCurve::addKeyframe(scoped_ptr<CCFloatKeyframe> keyframe) +void KeyframedFloatAnimationCurve::addKeyframe(scoped_ptr<FloatKeyframe> keyframe) { insertKeyframe(keyframe.Pass(), m_keyframes); } -double CCKeyframedFloatAnimationCurve::duration() const +double KeyframedFloatAnimationCurve::duration() const { return m_keyframes.last()->time() - m_keyframes.first()->time(); } -scoped_ptr<CCAnimationCurve> CCKeyframedFloatAnimationCurve::clone() const +scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::clone() const { - scoped_ptr<CCKeyframedFloatAnimationCurve> toReturn(CCKeyframedFloatAnimationCurve::create()); + scoped_ptr<KeyframedFloatAnimationCurve> toReturn(KeyframedFloatAnimationCurve::create()); for (size_t i = 0; i < m_keyframes.size(); ++i) toReturn->addKeyframe(m_keyframes[i]->clone()); - return toReturn.PassAs<CCAnimationCurve>(); + return toReturn.PassAs<AnimationCurve>(); } -float CCKeyframedFloatAnimationCurve::getValue(double t) const +float KeyframedFloatAnimationCurve::getValue(double t) const { if (t <= m_keyframes.first()->time()) return m_keyframes.first()->value(); @@ -167,38 +167,38 @@ 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() +scoped_ptr<KeyframedTransformAnimationCurve> KeyframedTransformAnimationCurve::create() { - return make_scoped_ptr(new CCKeyframedTransformAnimationCurve); + return make_scoped_ptr(new KeyframedTransformAnimationCurve); } -CCKeyframedTransformAnimationCurve::CCKeyframedTransformAnimationCurve() +KeyframedTransformAnimationCurve::KeyframedTransformAnimationCurve() { } -CCKeyframedTransformAnimationCurve::~CCKeyframedTransformAnimationCurve() +KeyframedTransformAnimationCurve::~KeyframedTransformAnimationCurve() { } -void CCKeyframedTransformAnimationCurve::addKeyframe(scoped_ptr<CCTransformKeyframe> keyframe) +void KeyframedTransformAnimationCurve::addKeyframe(scoped_ptr<TransformKeyframe> keyframe) { insertKeyframe(keyframe.Pass(), m_keyframes); } -double CCKeyframedTransformAnimationCurve::duration() const +double KeyframedTransformAnimationCurve::duration() const { return m_keyframes.last()->time() - m_keyframes.first()->time(); } -scoped_ptr<CCAnimationCurve> CCKeyframedTransformAnimationCurve::clone() const +scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::clone() const { - scoped_ptr<CCKeyframedTransformAnimationCurve> toReturn(CCKeyframedTransformAnimationCurve::create()); + scoped_ptr<KeyframedTransformAnimationCurve> toReturn(KeyframedTransformAnimationCurve::create()); for (size_t i = 0; i < m_keyframes.size(); ++i) toReturn->addKeyframe(m_keyframes[i]->clone()); - return toReturn.PassAs<CCAnimationCurve>(); + return toReturn.PassAs<AnimationCurve>(); } -WebTransformationMatrix CCKeyframedTransformAnimationCurve::getValue(double t) const +WebTransformationMatrix KeyframedTransformAnimationCurve::getValue(double t) const { if (t <= m_keyframes.first()->time()) return m_keyframes.first()->value().apply(); diff --git a/cc/keyframed_animation_curve.h b/cc/keyframed_animation_curve.h index 066e5c6..14eb869 100644 --- a/cc/keyframed_animation_curve.h +++ b/cc/keyframed_animation_curve.h @@ -12,96 +12,96 @@ namespace cc { -class CCKeyframe { +class Keyframe { public: double time() const; - const CCTimingFunction* timingFunction() const; + const TimingFunction* timingFunction() const; protected: - CCKeyframe(double time, scoped_ptr<CCTimingFunction>); - virtual ~CCKeyframe(); + Keyframe(double time, scoped_ptr<TimingFunction>); + virtual ~Keyframe(); private: double m_time; - scoped_ptr<CCTimingFunction> m_timingFunction; + scoped_ptr<TimingFunction> m_timingFunction; }; -class CCFloatKeyframe : public CCKeyframe { +class FloatKeyframe : public Keyframe { public: - static scoped_ptr<CCFloatKeyframe> create(double time, float value, scoped_ptr<CCTimingFunction>); - virtual ~CCFloatKeyframe(); + static scoped_ptr<FloatKeyframe> create(double time, float value, scoped_ptr<TimingFunction>); + virtual ~FloatKeyframe(); float value() const; - scoped_ptr<CCFloatKeyframe> clone() const; + scoped_ptr<FloatKeyframe> clone() const; private: - CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction>); + FloatKeyframe(double time, float value, scoped_ptr<TimingFunction>); float m_value; }; -class CCTransformKeyframe : public CCKeyframe { +class TransformKeyframe : public Keyframe { public: - static scoped_ptr<CCTransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>); - virtual ~CCTransformKeyframe(); + static scoped_ptr<TransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction>); + virtual ~TransformKeyframe(); const WebKit::WebTransformOperations& value() const; - scoped_ptr<CCTransformKeyframe> clone() const; + scoped_ptr<TransformKeyframe> clone() const; private: - CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>); + TransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction>); WebKit::WebTransformOperations m_value; }; -class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve { +class KeyframedFloatAnimationCurve : public FloatAnimationCurve { public: // It is required that the keyframes be sorted by time. - static scoped_ptr<CCKeyframedFloatAnimationCurve> create(); + static scoped_ptr<KeyframedFloatAnimationCurve> create(); - virtual ~CCKeyframedFloatAnimationCurve(); + virtual ~KeyframedFloatAnimationCurve(); - void addKeyframe(scoped_ptr<CCFloatKeyframe>); + void addKeyframe(scoped_ptr<FloatKeyframe>); - // CCAnimationCurve implementation + // AnimationCurve implementation virtual double duration() const OVERRIDE; - virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; + virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; - // CCFloatAnimationCurve implementation + // FloatAnimationCurve implementation virtual float getValue(double t) const OVERRIDE; private: - CCKeyframedFloatAnimationCurve(); + KeyframedFloatAnimationCurve(); // Always sorted in order of increasing time. No two keyframes have the // same time. - ScopedPtrVector<CCFloatKeyframe> m_keyframes; + ScopedPtrVector<FloatKeyframe> m_keyframes; }; -class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve { +class KeyframedTransformAnimationCurve : public TransformAnimationCurve { public: // It is required that the keyframes be sorted by time. - static scoped_ptr<CCKeyframedTransformAnimationCurve> create(); + static scoped_ptr<KeyframedTransformAnimationCurve> create(); - virtual ~CCKeyframedTransformAnimationCurve(); + virtual ~KeyframedTransformAnimationCurve(); - void addKeyframe(scoped_ptr<CCTransformKeyframe>); + void addKeyframe(scoped_ptr<TransformKeyframe>); - // CCAnimationCurve implementation + // AnimationCurve implementation virtual double duration() const OVERRIDE; - virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; + virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; - // CCTransformAnimationCurve implementation + // TransformAnimationCurve implementation virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; private: - CCKeyframedTransformAnimationCurve(); + KeyframedTransformAnimationCurve(); // Always sorted in order of increasing time. No two keyframes have the // same time. - ScopedPtrVector<CCTransformKeyframe> m_keyframes; + ScopedPtrVector<TransformKeyframe> m_keyframes; }; } // namespace cc diff --git a/cc/keyframed_animation_curve_unittest.cc b/cc/keyframed_animation_curve_unittest.cc index 9dca26a..044dca7 100644 --- a/cc/keyframed_animation_curve_unittest.cc +++ b/cc/keyframed_animation_curve_unittest.cc @@ -22,10 +22,10 @@ void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) } // Tests that a float animation with one keyframe works as expected. -TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) +TEST(KeyframedAnimationCurveTest, OneFloatKeyframe) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(0, 2, scoped_ptr<TimingFunction>())); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); @@ -34,11 +34,11 @@ TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) } // Tests that a float animation with two keyframes works as expected. -TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) +TEST(KeyframedAnimationCurveTest, 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>())); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(0, 2, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 4, scoped_ptr<TimingFunction>())); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -47,12 +47,12 @@ TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) } // Tests that a float animation with three keyframes works as expected. -TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) +TEST(KeyframedAnimationCurveTest, 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>())); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(0, 2, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 4, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(2, 8, scoped_ptr<TimingFunction>())); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -63,13 +63,13 @@ TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) } // Tests that a float animation with multiple keys at a given time works sanely. -TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) +TEST(KeyframedAnimationCurveTest, 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>())); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(0, 4, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 4, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 6, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(2, 6, scoped_ptr<TimingFunction>())); EXPECT_FLOAT_EQ(4, curve->getValue(-1)); EXPECT_FLOAT_EQ(4, curve->getValue(0)); @@ -86,12 +86,12 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) // Tests that a transform animation with one keyframe works as expected. -TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) +TEST(KeyframedAnimationCurveTest, OneTransformKeyframe) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create()); WebKit::WebTransformOperations operations; operations.appendTranslate(2, 0, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, operations, scoped_ptr<CCTimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(0, operations, scoped_ptr<TimingFunction>())); expectTranslateX(2, curve->getValue(-1)); expectTranslateX(2, curve->getValue(0)); @@ -101,16 +101,16 @@ TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) } // Tests that a transform animation with two keyframes works as expected. -TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) +TEST(KeyframedAnimationCurveTest, TwoTransformKeyframe) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::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(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>())); expectTranslateX(2, curve->getValue(-1)); expectTranslateX(2, curve->getValue(0)); expectTranslateX(3, curve->getValue(0.5)); @@ -119,18 +119,18 @@ TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) } // Tests that a transform animation with three keyframes works as expected. -TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) +TEST(KeyframedAnimationCurveTest, ThreeTransformKeyframe) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::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(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(2, operations3, scoped_ptr<TimingFunction>())); expectTranslateX(2, curve->getValue(-1)); expectTranslateX(2, curve->getValue(0)); expectTranslateX(3, curve->getValue(0.5)); @@ -141,9 +141,9 @@ TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) } // Tests that a transform animation with multiple keys at a given time works sanely. -TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) +TEST(KeyframedAnimationCurveTest, RepeatedTransformKeyTimes) { - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create()); // A step function. WebKit::WebTransformOperations operations1; operations1.appendTranslate(4, 0, 0); @@ -153,10 +153,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(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(1, operations3, scoped_ptr<TimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(2, operations4, scoped_ptr<TimingFunction>())); expectTranslateX(4, curve->getValue(-1)); expectTranslateX(4, curve->getValue(0)); @@ -172,12 +172,12 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) } // Tests that the keyframes may be added out of order. -TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) +TEST(KeyframedAnimationCurveTest, 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>())); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(2, 8, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(0, 2, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 4, scoped_ptr<TimingFunction>())); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -188,11 +188,11 @@ TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) } // Tests that a cubic bezier timing function works as expected. -TEST(CCKeyframedAnimationCurveTest, CubicBezierTimingFunction) +TEST(KeyframedAnimationCurveTest, 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>())); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(0, 0, CubicBezierTimingFunction::create(0.25, 0, 0.75, 1).PassAs<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 1, scoped_ptr<TimingFunction>())); EXPECT_FLOAT_EQ(0, curve->getValue(0)); EXPECT_LT(0, curve->getValue(0.25)); diff --git a/cc/layer.cc b/cc/layer.cc index 2f53b09..18e489a 100644 --- a/cc/layer.cc +++ b/cc/layer.cc @@ -23,18 +23,18 @@ namespace cc { static int s_nextLayerId = 1; -scoped_refptr<LayerChromium> LayerChromium::create() +scoped_refptr<Layer> Layer::create() { - return make_scoped_refptr(new LayerChromium()); + return make_scoped_refptr(new Layer()); } -LayerChromium::LayerChromium() +Layer::Layer() : m_needsDisplay(false) , m_stackingOrderChanged(false) , m_layerId(s_nextLayerId++) , m_parent(0) , m_layerTreeHost(0) - , m_layerAnimationController(CCLayerAnimationController::create(this)) + , m_layerAnimationController(LayerAnimationController::create(this)) , m_scrollable(false) , m_shouldScrollOnMainThread(false) , m_haveWheelEventHandlers(false) @@ -73,7 +73,7 @@ LayerChromium::LayerChromium() } } -LayerChromium::~LayerChromium() +Layer::~Layer() { // Our parent should be holding a reference to us so there should be no // way for us to be destroyed while we still have a parent. @@ -83,12 +83,12 @@ LayerChromium::~LayerChromium() removeAllChildren(); } -void LayerChromium::setUseLCDText(bool useLCDText) +void Layer::setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; } -void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host) +void Layer::setLayerTreeHost(LayerTreeHost* host) { if (m_layerTreeHost == host) return; @@ -108,13 +108,13 @@ void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host) host->didAddAnimation(); } -void LayerChromium::setNeedsCommit() +void Layer::setNeedsCommit() { if (m_layerTreeHost) m_layerTreeHost->setNeedsCommit(); } -IntRect LayerChromium::layerRectToContentRect(const WebKit::WebRect& layerRect) +IntRect Layer::layerRectToContentRect(const WebKit::WebRect& layerRect) { float widthScale = static_cast<float>(contentBounds().width()) / bounds().width(); float heightScale = static_cast<float>(contentBounds().height()) / bounds().height(); @@ -123,28 +123,28 @@ IntRect LayerChromium::layerRectToContentRect(const WebKit::WebRect& layerRect) return enclosingIntRect(contentRect); } -void LayerChromium::setParent(LayerChromium* layer) +void Layer::setParent(Layer* layer) { DCHECK(!layer || !layer->hasAncestor(this)); m_parent = layer; setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0); } -bool LayerChromium::hasAncestor(LayerChromium* ancestor) const +bool Layer::hasAncestor(Layer* ancestor) const { - for (LayerChromium* layer = parent(); layer; layer = layer->parent()) { + for (Layer* layer = parent(); layer; layer = layer->parent()) { if (layer == ancestor) return true; } return false; } -void LayerChromium::addChild(scoped_refptr<LayerChromium> child) +void Layer::addChild(scoped_refptr<Layer> child) { insertChild(child, numChildren()); } -void LayerChromium::insertChild(scoped_refptr<LayerChromium> child, size_t index) +void Layer::insertChild(scoped_refptr<Layer> child, size_t index) { index = min(index, m_children.size()); child->removeFromParent(); @@ -156,13 +156,13 @@ void LayerChromium::insertChild(scoped_refptr<LayerChromium> child, size_t index setNeedsCommit(); } -void LayerChromium::removeFromParent() +void Layer::removeFromParent() { if (m_parent) m_parent->removeChild(this); } -void LayerChromium::removeChild(LayerChromium* child) +void Layer::removeChild(Layer* child) { for (LayerList::iterator iter = m_children.begin(); iter != m_children.end(); ++iter) { @@ -176,7 +176,7 @@ void LayerChromium::removeChild(LayerChromium* child) } } -void LayerChromium::replaceChild(LayerChromium* reference, scoped_refptr<LayerChromium> newLayer) +void Layer::replaceChild(Layer* reference, scoped_refptr<Layer> newLayer) { ASSERT_ARG(reference, reference); ASSERT_ARG(reference, reference->parent() == this); @@ -198,7 +198,7 @@ void LayerChromium::replaceChild(LayerChromium* reference, scoped_refptr<LayerCh } } -int LayerChromium::indexOfChild(const LayerChromium* reference) +int Layer::indexOfChild(const Layer* reference) { for (size_t i = 0; i < m_children.size(); i++) { if (m_children[i] == reference) @@ -207,7 +207,7 @@ int LayerChromium::indexOfChild(const LayerChromium* reference) return -1; } -void LayerChromium::setBounds(const IntSize& size) +void Layer::setBounds(const IntSize& size) { if (bounds() == size) return; @@ -222,24 +222,24 @@ void LayerChromium::setBounds(const IntSize& size) setNeedsCommit(); } -LayerChromium* LayerChromium::rootLayer() +Layer* Layer::rootLayer() { - LayerChromium* layer = this; + Layer* layer = this; while (layer->parent()) layer = layer->parent(); return layer; } -void LayerChromium::removeAllChildren() +void Layer::removeAllChildren() { while (m_children.size()) { - LayerChromium* layer = m_children[0].get(); + Layer* layer = m_children[0].get(); DCHECK(layer->parent()); layer->removeFromParent(); } } -void LayerChromium::setChildren(const LayerList& children) +void Layer::setChildren(const LayerList& children) { if (children == m_children) return; @@ -250,7 +250,7 @@ void LayerChromium::setChildren(const LayerList& children) addChild(children[i]); } -void LayerChromium::setAnchorPoint(const FloatPoint& anchorPoint) +void Layer::setAnchorPoint(const FloatPoint& anchorPoint) { if (m_anchorPoint == anchorPoint) return; @@ -258,7 +258,7 @@ void LayerChromium::setAnchorPoint(const FloatPoint& anchorPoint) setNeedsCommit(); } -void LayerChromium::setAnchorPointZ(float anchorPointZ) +void Layer::setAnchorPointZ(float anchorPointZ) { if (m_anchorPointZ == anchorPointZ) return; @@ -266,7 +266,7 @@ void LayerChromium::setAnchorPointZ(float anchorPointZ) setNeedsCommit(); } -void LayerChromium::setBackgroundColor(SkColor backgroundColor) +void Layer::setBackgroundColor(SkColor backgroundColor) { if (m_backgroundColor == backgroundColor) return; @@ -274,12 +274,12 @@ void LayerChromium::setBackgroundColor(SkColor backgroundColor) setNeedsCommit(); } -IntSize LayerChromium::contentBounds() const +IntSize Layer::contentBounds() const { return bounds(); } -void LayerChromium::setMasksToBounds(bool masksToBounds) +void Layer::setMasksToBounds(bool masksToBounds) { if (m_masksToBounds == masksToBounds) return; @@ -287,7 +287,7 @@ void LayerChromium::setMasksToBounds(bool masksToBounds) setNeedsCommit(); } -void LayerChromium::setMaskLayer(LayerChromium* maskLayer) +void Layer::setMaskLayer(Layer* maskLayer) { if (m_maskLayer == maskLayer) return; @@ -301,7 +301,7 @@ void LayerChromium::setMaskLayer(LayerChromium* maskLayer) setNeedsCommit(); } -void LayerChromium::setReplicaLayer(LayerChromium* layer) +void Layer::setReplicaLayer(Layer* layer) { if (m_replicaLayer == layer) return; @@ -313,32 +313,32 @@ void LayerChromium::setReplicaLayer(LayerChromium* layer) setNeedsCommit(); } -void LayerChromium::setFilters(const WebKit::WebFilterOperations& filters) +void Layer::setFilters(const WebKit::WebFilterOperations& filters) { if (m_filters == filters) return; m_filters = filters; setNeedsCommit(); if (!filters.isEmpty()) - CCLayerTreeHost::setNeedsFilterContext(true); + LayerTreeHost::setNeedsFilterContext(true); } -void LayerChromium::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFilters) +void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFilters) { if (m_backgroundFilters == backgroundFilters) return; m_backgroundFilters = backgroundFilters; setNeedsCommit(); if (!backgroundFilters.isEmpty()) - CCLayerTreeHost::setNeedsFilterContext(true); + LayerTreeHost::setNeedsFilterContext(true); } -bool LayerChromium::needsDisplay() const +bool Layer::needsDisplay() const { return m_needsDisplay; } -void LayerChromium::setOpacity(float opacity) +void Layer::setOpacity(float opacity) { if (m_opacity == opacity) return; @@ -346,12 +346,12 @@ void LayerChromium::setOpacity(float opacity) setNeedsCommit(); } -bool LayerChromium::opacityIsAnimating() const +bool Layer::opacityIsAnimating() const { - return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Opacity); + return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity); } -void LayerChromium::setContentsOpaque(bool opaque) +void Layer::setContentsOpaque(bool opaque) { if (m_contentsOpaque == opaque) return; @@ -359,7 +359,7 @@ void LayerChromium::setContentsOpaque(bool opaque) setNeedsDisplay(); } -void LayerChromium::setPosition(const FloatPoint& position) +void Layer::setPosition(const FloatPoint& position) { if (m_position == position) return; @@ -367,7 +367,7 @@ void LayerChromium::setPosition(const FloatPoint& position) setNeedsCommit(); } -void LayerChromium::setSublayerTransform(const WebTransformationMatrix& sublayerTransform) +void Layer::setSublayerTransform(const WebTransformationMatrix& sublayerTransform) { if (m_sublayerTransform == sublayerTransform) return; @@ -375,7 +375,7 @@ void LayerChromium::setSublayerTransform(const WebTransformationMatrix& sublayer setNeedsCommit(); } -void LayerChromium::setTransform(const WebTransformationMatrix& transform) +void Layer::setTransform(const WebTransformationMatrix& transform) { if (m_transform == transform) return; @@ -383,12 +383,12 @@ void LayerChromium::setTransform(const WebTransformationMatrix& transform) setNeedsCommit(); } -bool LayerChromium::transformIsAnimating() const +bool Layer::transformIsAnimating() const { - return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Transform); + return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Transform); } -void LayerChromium::setScrollPosition(const IntPoint& scrollPosition) +void Layer::setScrollPosition(const IntPoint& scrollPosition) { if (m_scrollPosition == scrollPosition) return; @@ -398,7 +398,7 @@ void LayerChromium::setScrollPosition(const IntPoint& scrollPosition) setNeedsCommit(); } -void LayerChromium::setMaxScrollPosition(const IntSize& maxScrollPosition) +void Layer::setMaxScrollPosition(const IntSize& maxScrollPosition) { if (m_maxScrollPosition == maxScrollPosition) return; @@ -406,7 +406,7 @@ void LayerChromium::setMaxScrollPosition(const IntSize& maxScrollPosition) setNeedsCommit(); } -void LayerChromium::setScrollable(bool scrollable) +void Layer::setScrollable(bool scrollable) { if (m_scrollable == scrollable) return; @@ -414,7 +414,7 @@ void LayerChromium::setScrollable(bool scrollable) setNeedsCommit(); } -void LayerChromium::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) +void Layer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) { if (m_shouldScrollOnMainThread == shouldScrollOnMainThread) return; @@ -422,7 +422,7 @@ void LayerChromium::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) setNeedsCommit(); } -void LayerChromium::setHaveWheelEventHandlers(bool haveWheelEventHandlers) +void Layer::setHaveWheelEventHandlers(bool haveWheelEventHandlers) { if (m_haveWheelEventHandlers == haveWheelEventHandlers) return; @@ -430,7 +430,7 @@ void LayerChromium::setHaveWheelEventHandlers(bool haveWheelEventHandlers) setNeedsCommit(); } -void LayerChromium::setNonFastScrollableRegion(const Region& region) +void Layer::setNonFastScrollableRegion(const Region& region) { if (m_nonFastScrollableRegion == region) return; @@ -439,7 +439,7 @@ void LayerChromium::setNonFastScrollableRegion(const Region& region) setNeedsCommit(); } -void LayerChromium::setDrawCheckerboardForMissingTiles(bool checkerboard) +void Layer::setDrawCheckerboardForMissingTiles(bool checkerboard) { if (m_drawCheckerboardForMissingTiles == checkerboard) return; @@ -447,7 +447,7 @@ void LayerChromium::setDrawCheckerboardForMissingTiles(bool checkerboard) setNeedsCommit(); } -void LayerChromium::setForceRenderSurface(bool force) +void Layer::setForceRenderSurface(bool force) { if (m_forceRenderSurface == force) return; @@ -455,7 +455,7 @@ void LayerChromium::setForceRenderSurface(bool force) setNeedsCommit(); } -void LayerChromium::setImplTransform(const WebTransformationMatrix& transform) +void Layer::setImplTransform(const WebTransformationMatrix& transform) { if (m_implTransform == transform) return; @@ -463,7 +463,7 @@ void LayerChromium::setImplTransform(const WebTransformationMatrix& transform) setNeedsCommit(); } -void LayerChromium::setDoubleSided(bool doubleSided) +void Layer::setDoubleSided(bool doubleSided) { if (m_doubleSided == doubleSided) return; @@ -471,7 +471,7 @@ void LayerChromium::setDoubleSided(bool doubleSided) setNeedsCommit(); } -void LayerChromium::setIsDrawable(bool isDrawable) +void Layer::setIsDrawable(bool isDrawable) { if (m_isDrawable == isDrawable) return; @@ -480,12 +480,12 @@ void LayerChromium::setIsDrawable(bool isDrawable) setNeedsCommit(); } -LayerChromium* LayerChromium::parent() const +Layer* Layer::parent() const { return m_parent; } -void LayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) +void Layer::setNeedsDisplayRect(const FloatRect& dirtyRect) { m_updateRect.unite(dirtyRect); @@ -498,7 +498,7 @@ void LayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) setNeedsCommit(); } -bool LayerChromium::descendantIsFixedToContainerLayer() const +bool Layer::descendantIsFixedToContainerLayer() const { for (size_t i = 0; i < m_children.size(); ++i) { if (m_children[i]->fixedToContainerLayer() || m_children[i]->descendantIsFixedToContainerLayer()) @@ -507,7 +507,7 @@ bool LayerChromium::descendantIsFixedToContainerLayer() const return false; } -void LayerChromium::setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) +void Layer::setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) { if (m_isContainerForFixedPositionLayers == isContainerForFixedPositionLayers) return; @@ -521,7 +521,7 @@ void LayerChromium::setIsContainerForFixedPositionLayers(bool isContainerForFixe setNeedsCommit(); } -void LayerChromium::setFixedToContainerLayer(bool fixedToContainerLayer) +void Layer::setFixedToContainerLayer(bool fixedToContainerLayer) { if (m_fixedToContainerLayer == fixedToContainerLayer) return; @@ -529,7 +529,7 @@ void LayerChromium::setFixedToContainerLayer(bool fixedToContainerLayer) setNeedsCommit(); } -void LayerChromium::pushPropertiesTo(CCLayerImpl* layer) +void Layer::pushPropertiesTo(LayerImpl* layer) { layer->setAnchorPoint(m_anchorPoint); layer->setAnchorPointZ(m_anchorPointZ); @@ -571,7 +571,7 @@ void LayerChromium::pushPropertiesTo(CCLayerImpl* layer) layer->setTransform(m_transform); // If the main thread commits multiple times before the impl thread actually draws, then damage tracking - // will become incorrect if we simply clobber the updateRect here. The CCLayerImpl's updateRect needs to + // will become incorrect if we simply clobber the updateRect here. The LayerImpl's updateRect needs to // accumulate (i.e. union) any update changes that have occurred on the main thread. m_updateRect.uniteIfNonZero(layer->updateRect()); layer->setUpdateRect(m_updateRect); @@ -593,45 +593,45 @@ void LayerChromium::pushPropertiesTo(CCLayerImpl* layer) m_updateRect = FloatRect(); } -scoped_ptr<CCLayerImpl> LayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> Layer::createLayerImpl() { - return CCLayerImpl::create(m_layerId); + return LayerImpl::create(m_layerId); } -bool LayerChromium::drawsContent() const +bool Layer::drawsContent() const { return m_isDrawable; } -bool LayerChromium::needMoreUpdates() +bool Layer::needMoreUpdates() { return false; } -bool LayerChromium::needsContentsScale() const +bool Layer::needsContentsScale() const { return false; } -void LayerChromium::setDebugBorderColor(SkColor color) +void Layer::setDebugBorderColor(SkColor color) { m_debugBorderColor = color; setNeedsCommit(); } -void LayerChromium::setDebugBorderWidth(float width) +void Layer::setDebugBorderWidth(float width) { m_debugBorderWidth = width; setNeedsCommit(); } -void LayerChromium::setDebugName(const std::string& debugName) +void Layer::setDebugName(const std::string& debugName) { m_debugName = debugName; setNeedsCommit(); } -void LayerChromium::setContentsScale(float contentsScale) +void Layer::setContentsScale(float contentsScale) { if (!needsContentsScale() || m_contentsScale == contentsScale) return; @@ -640,7 +640,7 @@ void LayerChromium::setContentsScale(float contentsScale) setNeedsDisplay(); } -void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) +void Layer::setBoundsContainPageScale(bool boundsContainPageScale) { for (size_t i = 0; i < m_children.size(); ++i) m_children[i]->setBoundsContainPageScale(boundsContainPageScale); @@ -652,14 +652,14 @@ void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) setNeedsDisplay(); } -void LayerChromium::createRenderSurface() +void Layer::createRenderSurface() { DCHECK(!m_renderSurface); - m_renderSurface = make_scoped_ptr(new RenderSurfaceChromium(this)); + m_renderSurface = make_scoped_ptr(new RenderSurface(this)); setRenderTarget(this); } -bool LayerChromium::descendantDrawsContent() +bool Layer::descendantDrawsContent() { for (size_t i = 0; i < m_children.size(); ++i) { if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsContent()) @@ -668,17 +668,17 @@ bool LayerChromium::descendantDrawsContent() return false; } -int LayerChromium::id() const +int Layer::id() const { return m_layerId; } -float LayerChromium::opacity() const +float Layer::opacity() const { return m_opacity; } -void LayerChromium::setOpacityFromAnimation(float opacity) +void Layer::setOpacityFromAnimation(float opacity) { // This is called due to an ongoing accelerated animation. Since this animation is // also being run on the impl thread, there is no need to request a commit to push @@ -686,12 +686,12 @@ void LayerChromium::setOpacityFromAnimation(float opacity) m_opacity = opacity; } -const WebKit::WebTransformationMatrix& LayerChromium::transform() const +const WebKit::WebTransformationMatrix& Layer::transform() const { return m_transform; } -void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& transform) +void Layer::setTransformFromAnimation(const WebTransformationMatrix& transform) { // This is called due to an ongoing accelerated animation. Since this animation is // also being run on the impl thread, there is no need to request a commit to push @@ -699,7 +699,7 @@ void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra m_transform = transform; } -bool LayerChromium::addAnimation(scoped_ptr <CCActiveAnimation> animation) +bool Layer::addAnimation(scoped_ptr <ActiveAnimation> animation) { // WebCore currently assumes that accelerated animations will start soon // after the animation is added. However we cannot guarantee that if we do @@ -718,31 +718,31 @@ bool LayerChromium::addAnimation(scoped_ptr <CCActiveAnimation> animation) return true; } -void LayerChromium::pauseAnimation(int animationId, double timeOffset) +void Layer::pauseAnimation(int animationId, double timeOffset) { m_layerAnimationController->pauseAnimation(animationId, timeOffset); setNeedsCommit(); } -void LayerChromium::removeAnimation(int animationId) +void Layer::removeAnimation(int animationId) { m_layerAnimationController->removeAnimation(animationId); setNeedsCommit(); } -void LayerChromium::suspendAnimations(double monotonicTime) +void Layer::suspendAnimations(double monotonicTime) { m_layerAnimationController->suspendAnimations(monotonicTime); setNeedsCommit(); } -void LayerChromium::resumeAnimations(double monotonicTime) +void Layer::resumeAnimations(double monotonicTime) { m_layerAnimationController->resumeAnimations(monotonicTime); setNeedsCommit(); } -void LayerChromium::setLayerAnimationController(scoped_ptr<CCLayerAnimationController> layerAnimationController) +void Layer::setLayerAnimationController(scoped_ptr<LayerAnimationController> layerAnimationController) { m_layerAnimationController = layerAnimationController.Pass(); if (m_layerAnimationController) { @@ -752,46 +752,46 @@ void LayerChromium::setLayerAnimationController(scoped_ptr<CCLayerAnimationContr setNeedsCommit(); } -scoped_ptr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationController() +scoped_ptr<LayerAnimationController> Layer::releaseLayerAnimationController() { - scoped_ptr<CCLayerAnimationController> toReturn = m_layerAnimationController.Pass(); - m_layerAnimationController = CCLayerAnimationController::create(this); + scoped_ptr<LayerAnimationController> toReturn = m_layerAnimationController.Pass(); + m_layerAnimationController = LayerAnimationController::create(this); return toReturn.Pass(); } -bool LayerChromium::hasActiveAnimation() const +bool Layer::hasActiveAnimation() const { return m_layerAnimationController->hasActiveAnimation(); } -void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double wallClockTime) +void Layer::notifyAnimationStarted(const AnimationEvent& event, double wallClockTime) { m_layerAnimationController->notifyAnimationStarted(event); if (m_layerAnimationDelegate) m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime); } -void LayerChromium::notifyAnimationFinished(double wallClockTime) +void Layer::notifyAnimationFinished(double wallClockTime) { if (m_layerAnimationDelegate) m_layerAnimationDelegate->notifyAnimationFinished(wallClockTime); } -Region LayerChromium::visibleContentOpaqueRegion() const +Region Layer::visibleContentOpaqueRegion() const { if (contentsOpaque()) return visibleContentRect(); return Region(); } -ScrollbarLayerChromium* LayerChromium::toScrollbarLayerChromium() +ScrollbarLayer* Layer::toScrollbarLayer() { return 0; } -void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vector<scoped_refptr<LayerChromium> >::iterator, void*) +void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped_refptr<Layer> >::iterator, void*) { - // Currently we don't use z-order to decide what to paint, so there's no need to actually sort LayerChromiums. + // Currently we don't use z-order to decide what to paint, so there's no need to actually sort Layers. } } @@ -24,26 +24,26 @@ class WebLayerScrollClient; namespace cc { -class CCActiveAnimation; -struct CCAnimationEvent; -class CCLayerAnimationDelegate; -class CCLayerImpl; -class CCLayerTreeHost; -class CCPriorityCalculator; -class CCTextureUpdateQueue; -class ScrollbarLayerChromium; -struct CCAnimationEvent; -struct CCRenderingStats; +class ActiveAnimation; +struct AnimationEvent; +class LayerAnimationDelegate; +class LayerImpl; +class LayerTreeHost; +class PriorityCalculator; +class TextureUpdateQueue; +class ScrollbarLayer; +struct AnimationEvent; +struct RenderingStats; // Base class for composited layers. Special layer types are derived from // this class. -class LayerChromium : public base::RefCounted<LayerChromium>, public CCLayerAnimationControllerClient { +class Layer : public base::RefCounted<Layer>, public LayerAnimationControllerClient { public: - typedef std::vector<scoped_refptr<LayerChromium> > LayerList; + typedef std::vector<scoped_refptr<Layer> > LayerList; - static scoped_refptr<LayerChromium> create(); + static scoped_refptr<Layer> create(); - // CCLayerAnimationControllerClient implementation + // LayerAnimationControllerClient implementation virtual int id() const OVERRIDE; virtual void setOpacityFromAnimation(float) OVERRIDE; virtual float opacity() const OVERRIDE; @@ -53,11 +53,11 @@ public: // The root layer is a special case -- it operates in physical pixels. virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; - LayerChromium* rootLayer(); - LayerChromium* parent() const; - void addChild(scoped_refptr<LayerChromium>); - void insertChild(scoped_refptr<LayerChromium>, size_t index); - void replaceChild(LayerChromium* reference, scoped_refptr<LayerChromium> newLayer); + Layer* rootLayer(); + Layer* parent() const; + void addChild(scoped_refptr<Layer>); + void insertChild(scoped_refptr<Layer>, size_t index); + void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer); void removeFromParent(); void removeAllChildren(); void setChildren(const LayerList&); @@ -82,8 +82,8 @@ public: void setMasksToBounds(bool); bool masksToBounds() const { return m_masksToBounds; } - void setMaskLayer(LayerChromium*); - LayerChromium* maskLayer() const { return m_maskLayer.get(); } + void setMaskLayer(Layer*); + Layer* maskLayer() const { return m_maskLayer.get(); } virtual void setNeedsDisplayRect(const FloatRect& dirtyRect); void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds())); } @@ -165,14 +165,14 @@ public: virtual void setUseLCDText(bool); bool useLCDText() const { return m_useLCDText; } - virtual void setLayerTreeHost(CCLayerTreeHost*); + virtual void setLayerTreeHost(LayerTreeHost*); bool hasContributingDelegatedRenderPasses() const { return false; } void setIsDrawable(bool); - void setReplicaLayer(LayerChromium*); - LayerChromium* replicaLayer() const { return m_replicaLayer.get(); } + void setReplicaLayer(Layer*); + Layer* replicaLayer() const { return m_replicaLayer.get(); } bool hasMask() const { return m_maskLayer; } bool hasReplica() const { return m_replicaLayer; } @@ -180,7 +180,7 @@ public: // These methods typically need to be overwritten by derived classes. virtual bool drawsContent() const; - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) { } + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) { } virtual bool needMoreUpdates(); virtual void setIsMask(bool) { } virtual void bindContentsTexture() { } @@ -190,10 +190,10 @@ public: void setDebugBorderWidth(float); void setDebugName(const std::string&); - virtual void pushPropertiesTo(CCLayerImpl*); + virtual void pushPropertiesTo(LayerImpl*); void clearRenderSurface() { m_renderSurface.reset(); } - RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get(); } + RenderSurface* renderSurface() const { return m_renderSurface.get(); } void createRenderSurface(); float drawOpacity() const { return m_drawOpacity; } @@ -202,8 +202,8 @@ public: bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } - LayerChromium* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } - void setRenderTarget(LayerChromium* target) { m_renderTarget = target; } + Layer* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } + void setRenderTarget(Layer* target) { m_renderTarget = target; } bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; } @@ -234,39 +234,39 @@ public: // Returns true if any of the layer's descendants has content to draw. bool descendantDrawsContent(); - CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost; } + LayerTreeHost* layerTreeHost() const { return m_layerTreeHost; } // Set the priority of all desired textures in this layer. - virtual void setTexturePriorities(const CCPriorityCalculator&) { } + virtual void setTexturePriorities(const PriorityCalculator&) { } - bool addAnimation(scoped_ptr<CCActiveAnimation>); + bool addAnimation(scoped_ptr<ActiveAnimation>); void pauseAnimation(int animationId, double timeOffset); void removeAnimation(int animationId); void suspendAnimations(double monotonicTime); void resumeAnimations(double monotonicTime); - CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } - void setLayerAnimationController(scoped_ptr<CCLayerAnimationController>); - scoped_ptr<CCLayerAnimationController> releaseLayerAnimationController(); + LayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } + void setLayerAnimationController(scoped_ptr<LayerAnimationController>); + scoped_ptr<LayerAnimationController> releaseLayerAnimationController(); void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; } bool hasActiveAnimation() const; - virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallClockTime); + virtual void notifyAnimationStarted(const AnimationEvent&, double wallClockTime); virtual void notifyAnimationFinished(double wallClockTime); virtual Region visibleContentOpaqueRegion() const; - virtual ScrollbarLayerChromium* toScrollbarLayerChromium(); + virtual ScrollbarLayer* toScrollbarLayer(); protected: - friend class CCLayerImpl; + friend class LayerImpl; friend class TreeSynchronizer; - virtual ~LayerChromium(); + virtual ~Layer(); - LayerChromium(); + Layer(); void setNeedsCommit(); @@ -284,36 +284,36 @@ protected: // Note this rect is in layer space (not content space). FloatRect m_updateRect; - scoped_refptr<LayerChromium> m_maskLayer; + scoped_refptr<Layer> m_maskLayer; - // Constructs a CCLayerImpl of the correct runtime type for this LayerChromium type. - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl(); + // Constructs a LayerImpl of the correct runtime type for this Layer type. + virtual scoped_ptr<LayerImpl> createLayerImpl(); int m_layerId; private: - friend class base::RefCounted<LayerChromium>; + friend class base::RefCounted<Layer>; - void setParent(LayerChromium*); - bool hasAncestor(LayerChromium*) const; + void setParent(Layer*); + bool hasAncestor(Layer*) const; bool descendantIsFixedToContainerLayer() const; size_t numChildren() const { return m_children.size(); } // Returns the index of the child or -1 if not found. - int indexOfChild(const LayerChromium*); + int indexOfChild(const Layer*); // This should only be called from removeFromParent. - void removeChild(LayerChromium*); + void removeChild(Layer*); LayerList m_children; - LayerChromium* m_parent; + Layer* m_parent; - // LayerChromium instances have a weak pointer to their CCLayerTreeHost. - // This pointer value is nil when a LayerChromium is not in a tree and is + // Layer instances have a weak pointer to their LayerTreeHost. + // This pointer value is nil when a Layer is not in a tree and is // updated via setLayerTreeHost() if a layer moves between trees. - CCLayerTreeHost* m_layerTreeHost; + LayerTreeHost* m_layerTreeHost; - scoped_ptr<CCLayerAnimationController> m_layerAnimationController; + scoped_ptr<LayerAnimationController> m_layerAnimationController; // Layer properties. IntSize m_bounds; @@ -354,14 +354,14 @@ private: WebKit::WebTransformationMatrix m_sublayerTransform; // Replica layer used for reflections. - scoped_refptr<LayerChromium> m_replicaLayer; + scoped_refptr<Layer> m_replicaLayer; // Transient properties. - scoped_ptr<RenderSurfaceChromium> m_renderSurface; + scoped_ptr<RenderSurface> m_renderSurface; float m_drawOpacity; bool m_drawOpacityIsAnimating; - LayerChromium* m_renderTarget; + Layer* m_renderTarget; WebKit::WebTransformationMatrix m_drawTransform; WebKit::WebTransformationMatrix m_screenSpaceTransform; @@ -379,7 +379,7 @@ private: WebKit::WebLayerScrollClient* m_layerScrollClient; }; -void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vector<scoped_refptr<LayerChromium> >::iterator, void*); +void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped_refptr<Layer> >::iterator, void*); } // namespace cc diff --git a/cc/layer_animation_controller.cc b/cc/layer_animation_controller.cc index 20e4984..d373bdf 100644 --- a/cc/layer_animation_controller.cc +++ b/cc/layer_animation_controller.cc @@ -16,30 +16,30 @@ using WebKit::WebTransformationMatrix; namespace cc { -CCLayerAnimationController::CCLayerAnimationController(CCLayerAnimationControllerClient* client) +LayerAnimationController::LayerAnimationController(LayerAnimationControllerClient* client) : m_forceSync(false) , m_client(client) { } -CCLayerAnimationController::~CCLayerAnimationController() +LayerAnimationController::~LayerAnimationController() { } -scoped_ptr<CCLayerAnimationController> CCLayerAnimationController::create(CCLayerAnimationControllerClient* client) +scoped_ptr<LayerAnimationController> LayerAnimationController::create(LayerAnimationControllerClient* client) { - return make_scoped_ptr(new CCLayerAnimationController(client)); + return make_scoped_ptr(new LayerAnimationController(client)); } -void CCLayerAnimationController::pauseAnimation(int animationId, double timeOffset) +void LayerAnimationController::pauseAnimation(int animationId, double timeOffset) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { if (m_activeAnimations[i]->id() == animationId) - m_activeAnimations[i]->setRunState(CCActiveAnimation::Paused, timeOffset + m_activeAnimations[i]->startTime()); + m_activeAnimations[i]->setRunState(ActiveAnimation::Paused, timeOffset + m_activeAnimations[i]->startTime()); } } -void CCLayerAnimationController::removeAnimation(int animationId) +void LayerAnimationController::removeAnimation(int animationId) { for (size_t i = 0; i < m_activeAnimations.size();) { if (m_activeAnimations[i]->id() == animationId) @@ -49,7 +49,7 @@ void CCLayerAnimationController::removeAnimation(int animationId) } } -void CCLayerAnimationController::removeAnimation(int animationId, CCActiveAnimation::TargetProperty targetProperty) +void LayerAnimationController::removeAnimation(int animationId, ActiveAnimation::TargetProperty targetProperty) { for (size_t i = 0; i < m_activeAnimations.size();) { if (m_activeAnimations[i]->id() == animationId && m_activeAnimations[i]->targetProperty() == targetProperty) @@ -60,26 +60,26 @@ void CCLayerAnimationController::removeAnimation(int animationId, CCActiveAnimat } // According to render layer backing, these are for testing only. -void CCLayerAnimationController::suspendAnimations(double monotonicTime) +void LayerAnimationController::suspendAnimations(double monotonicTime) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { if (!m_activeAnimations[i]->isFinished()) - m_activeAnimations[i]->setRunState(CCActiveAnimation::Paused, monotonicTime); + m_activeAnimations[i]->setRunState(ActiveAnimation::Paused, monotonicTime); } } // Looking at GraphicsLayerCA, this appears to be the analog to suspendAnimations, which is for testing. -void CCLayerAnimationController::resumeAnimations(double monotonicTime) +void LayerAnimationController::resumeAnimations(double monotonicTime) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::Paused) - m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monotonicTime); + if (m_activeAnimations[i]->runState() == ActiveAnimation::Paused) + m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monotonicTime); } } // Ensures that the list of active animations on the main thread and the impl thread // are kept in sync. -void CCLayerAnimationController::pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl) +void LayerAnimationController::pushAnimationUpdatesTo(LayerAnimationController* controllerImpl) { if (m_forceSync) { replaceImplThreadAnimations(controllerImpl); @@ -97,7 +97,7 @@ void CCLayerAnimationController::pushAnimationUpdatesTo(CCLayerAnimationControll } } -void CCLayerAnimationController::animate(double monotonicTime, CCAnimationEventsVector* events) +void LayerAnimationController::animate(double monotonicTime, AnimationEventsVector* events) { startAnimationsWaitingForNextTick(monotonicTime, events); startAnimationsWaitingForStartTime(monotonicTime, events); @@ -108,12 +108,12 @@ void CCLayerAnimationController::animate(double monotonicTime, CCAnimationEvents startAnimationsWaitingForTargetAvailability(monotonicTime, events); } -void CCLayerAnimationController::addAnimation(scoped_ptr<CCActiveAnimation> animation) +void LayerAnimationController::addAnimation(scoped_ptr<ActiveAnimation> animation) { m_activeAnimations.append(animation.Pass()); } -CCActiveAnimation* CCLayerAnimationController::getActiveAnimation(int groupId, CCActiveAnimation::TargetProperty targetProperty) const +ActiveAnimation* LayerAnimationController::getActiveAnimation(int groupId, ActiveAnimation::TargetProperty targetProperty) const { for (size_t i = 0; i < m_activeAnimations.size(); ++i) if (m_activeAnimations[i]->group() == groupId && m_activeAnimations[i]->targetProperty() == targetProperty) @@ -121,7 +121,7 @@ CCActiveAnimation* CCLayerAnimationController::getActiveAnimation(int groupId, C return 0; } -CCActiveAnimation* CCLayerAnimationController::getActiveAnimation(CCActiveAnimation::TargetProperty targetProperty) const +ActiveAnimation* LayerAnimationController::getActiveAnimation(ActiveAnimation::TargetProperty targetProperty) const { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { size_t index = m_activeAnimations.size() - i - 1; @@ -131,7 +131,7 @@ CCActiveAnimation* CCLayerAnimationController::getActiveAnimation(CCActiveAnimat return 0; } -bool CCLayerAnimationController::hasActiveAnimation() const +bool LayerAnimationController::hasActiveAnimation() const { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { if (!m_activeAnimations[i]->isFinished()) @@ -140,16 +140,16 @@ bool CCLayerAnimationController::hasActiveAnimation() const return false; } -bool CCLayerAnimationController::isAnimatingProperty(CCActiveAnimation::TargetProperty targetProperty) const +bool LayerAnimationController::isAnimatingProperty(ActiveAnimation::TargetProperty targetProperty) const { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() != CCActiveAnimation::Finished && m_activeAnimations[i]->runState() != CCActiveAnimation::Aborted && m_activeAnimations[i]->targetProperty() == targetProperty) + if (m_activeAnimations[i]->runState() != ActiveAnimation::Finished && m_activeAnimations[i]->runState() != ActiveAnimation::Aborted && m_activeAnimations[i]->targetProperty() == targetProperty) return true; } return false; } -void CCLayerAnimationController::notifyAnimationStarted(const CCAnimationEvent& event) +void LayerAnimationController::notifyAnimationStarted(const AnimationEvent& event) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty && m_activeAnimations[i]->needsSynchronizedStartTime()) { @@ -160,12 +160,12 @@ void CCLayerAnimationController::notifyAnimationStarted(const CCAnimationEvent& } } -void CCLayerAnimationController::setClient(CCLayerAnimationControllerClient* client) +void LayerAnimationController::setClient(LayerAnimationControllerClient* client) { m_client = client; } -void CCLayerAnimationController::pushNewAnimationsToImplThread(CCLayerAnimationController* controllerImpl) const +void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationController* controllerImpl) const { // Any new animations owned by the main thread's controller are cloned and adde to the impl thread's controller. for (size_t i = 0; i < m_activeAnimations.size(); ++i) { @@ -181,21 +181,21 @@ void CCLayerAnimationController::pushNewAnimationsToImplThread(CCLayerAnimationC continue; // The new animation should be set to run as soon as possible. - CCActiveAnimation::RunState initialRunState = CCActiveAnimation::WaitingForTargetAvailability; + ActiveAnimation::RunState initialRunState = ActiveAnimation::WaitingForTargetAvailability; double startTime = 0; - scoped_ptr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime)); + scoped_ptr<ActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndInitialize(ActiveAnimation::ControllingInstance, initialRunState, startTime)); DCHECK(!toAdd->needsSynchronizedStartTime()); controllerImpl->addAnimation(toAdd.Pass()); } } -void CCLayerAnimationController::removeAnimationsCompletedOnMainThread(CCLayerAnimationController* controllerImpl) const +void LayerAnimationController::removeAnimationsCompletedOnMainThread(LayerAnimationController* controllerImpl) const { // Delete all impl thread animations for which there is no corresponding main thread animation. // Each iteration, controller->m_activeAnimations.size() is decremented or i is incremented // guaranteeing progress towards loop termination. for (size_t i = 0; i < controllerImpl->m_activeAnimations.size();) { - CCActiveAnimation* current = getActiveAnimation(controllerImpl->m_activeAnimations[i]->group(), controllerImpl->m_activeAnimations[i]->targetProperty()); + ActiveAnimation* current = getActiveAnimation(controllerImpl->m_activeAnimations[i]->group(), controllerImpl->m_activeAnimations[i]->targetProperty()); if (!current) controllerImpl->m_activeAnimations.remove(i); else @@ -203,50 +203,50 @@ void CCLayerAnimationController::removeAnimationsCompletedOnMainThread(CCLayerAn } } -void CCLayerAnimationController::pushPropertiesToImplThread(CCLayerAnimationController* controllerImpl) const +void LayerAnimationController::pushPropertiesToImplThread(LayerAnimationController* controllerImpl) const { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - CCActiveAnimation* currentImpl = controllerImpl->getActiveAnimation(m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty()); + ActiveAnimation* currentImpl = controllerImpl->getActiveAnimation(m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty()); if (currentImpl) m_activeAnimations[i]->pushPropertiesTo(currentImpl); } } -void CCLayerAnimationController::startAnimationsWaitingForNextTick(double monotonicTime, CCAnimationEventsVector* events) +void LayerAnimationController::startAnimationsWaitingForNextTick(double monotonicTime, AnimationEventsVector* events) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForNextTick) { - m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monotonicTime); + if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForNextTick) { + m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monotonicTime); if (!m_activeAnimations[i]->hasSetStartTime()) m_activeAnimations[i]->setStartTime(monotonicTime); if (events) - events->push_back(CCAnimationEvent(CCAnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime)); + events->push_back(AnimationEvent(AnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime)); } } } -void CCLayerAnimationController::startAnimationsWaitingForStartTime(double monotonicTime, CCAnimationEventsVector* events) +void LayerAnimationController::startAnimationsWaitingForStartTime(double monotonicTime, AnimationEventsVector* events) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForStartTime && m_activeAnimations[i]->startTime() <= monotonicTime) { - m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monotonicTime); + if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForStartTime && m_activeAnimations[i]->startTime() <= monotonicTime) { + m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monotonicTime); if (events) - events->push_back(CCAnimationEvent(CCAnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime)); + events->push_back(AnimationEvent(AnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime)); } } } -void CCLayerAnimationController::startAnimationsWaitingForTargetAvailability(double monotonicTime, CCAnimationEventsVector* events) +void LayerAnimationController::startAnimationsWaitingForTargetAvailability(double monotonicTime, AnimationEventsVector* events) { // First collect running properties. TargetProperties blockedProperties; for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::Running || m_activeAnimations[i]->runState() == CCActiveAnimation::Finished) + if (m_activeAnimations[i]->runState() == ActiveAnimation::Running || m_activeAnimations[i]->runState() == ActiveAnimation::Finished) blockedProperties.insert(m_activeAnimations[i]->targetProperty()); } for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForTargetAvailability) { + if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForTargetAvailability) { // Collect all properties for animations with the same group id (they should all also be in the list of animations). TargetProperties enqueuedProperties; enqueuedProperties.insert(m_activeAnimations[i]->targetProperty()); @@ -266,14 +266,14 @@ void CCLayerAnimationController::startAnimationsWaitingForTargetAvailability(dou // If the intersection is null, then we are free to start the animations in the group. if (nullIntersection) { - m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monotonicTime); + m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monotonicTime); if (!m_activeAnimations[i]->hasSetStartTime()) m_activeAnimations[i]->setStartTime(monotonicTime); if (events) - events->push_back(CCAnimationEvent(CCAnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime)); + events->push_back(AnimationEvent(AnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime)); for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) { if (m_activeAnimations[i]->group() == m_activeAnimations[j]->group()) { - m_activeAnimations[j]->setRunState(CCActiveAnimation::Running, monotonicTime); + m_activeAnimations[j]->setRunState(ActiveAnimation::Running, monotonicTime); if (!m_activeAnimations[j]->hasSetStartTime()) m_activeAnimations[j]->setStartTime(monotonicTime); } @@ -283,7 +283,7 @@ void CCLayerAnimationController::startAnimationsWaitingForTargetAvailability(dou } } -void CCLayerAnimationController::resolveConflicts(double monotonicTime) +void LayerAnimationController::resolveConflicts(double monotonicTime) { // Find any animations that are animating the same property and resolve the // confict. We could eventually blend, but for now we'll just abort the @@ -291,20 +291,20 @@ void CCLayerAnimationController::resolveConflicts(double monotonicTime) // (2) has an equal start time, but was added to the queue earlier, i.e., // has a lower index in m_activeAnimations). for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::Running) { + if (m_activeAnimations[i]->runState() == ActiveAnimation::Running) { for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) { - if (m_activeAnimations[j]->runState() == CCActiveAnimation::Running && m_activeAnimations[i]->targetProperty() == m_activeAnimations[j]->targetProperty()) { + if (m_activeAnimations[j]->runState() == ActiveAnimation::Running && m_activeAnimations[i]->targetProperty() == m_activeAnimations[j]->targetProperty()) { if (m_activeAnimations[i]->startTime() > m_activeAnimations[j]->startTime()) - m_activeAnimations[j]->setRunState(CCActiveAnimation::Aborted, monotonicTime); + m_activeAnimations[j]->setRunState(ActiveAnimation::Aborted, monotonicTime); else - m_activeAnimations[i]->setRunState(CCActiveAnimation::Aborted, monotonicTime); + m_activeAnimations[i]->setRunState(ActiveAnimation::Aborted, monotonicTime); } } } } } -void CCLayerAnimationController::markAnimationsForDeletion(double monotonicTime, CCAnimationEventsVector* events) +void LayerAnimationController::markAnimationsForDeletion(double monotonicTime, AnimationEventsVector* events) { for (size_t i = 0; i < m_activeAnimations.size(); i++) { int groupId = m_activeAnimations[i]->group(); @@ -326,46 +326,46 @@ void CCLayerAnimationController::markAnimationsForDeletion(double monotonicTime, for (size_t j = i; j < m_activeAnimations.size(); j++) { if (groupId == m_activeAnimations[j]->group()) { if (events) - events->push_back(CCAnimationEvent(CCAnimationEvent::Finished, m_client->id(), m_activeAnimations[j]->group(), m_activeAnimations[j]->targetProperty(), monotonicTime)); - m_activeAnimations[j]->setRunState(CCActiveAnimation::WaitingForDeletion, monotonicTime); + events->push_back(AnimationEvent(AnimationEvent::Finished, m_client->id(), m_activeAnimations[j]->group(), m_activeAnimations[j]->targetProperty(), monotonicTime)); + m_activeAnimations[j]->setRunState(ActiveAnimation::WaitingForDeletion, monotonicTime); } } } } } -void CCLayerAnimationController::purgeAnimationsMarkedForDeletion() +void LayerAnimationController::purgeAnimationsMarkedForDeletion() { for (size_t i = 0; i < m_activeAnimations.size();) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForDeletion) + if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForDeletion) m_activeAnimations.remove(i); else i++; } } -void CCLayerAnimationController::replaceImplThreadAnimations(CCLayerAnimationController* controllerImpl) const +void LayerAnimationController::replaceImplThreadAnimations(LayerAnimationController* controllerImpl) const { controllerImpl->m_activeAnimations.clear(); for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - scoped_ptr<CCActiveAnimation> toAdd; + scoped_ptr<ActiveAnimation> 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; + ActiveAnimation::RunState initialRunState = ActiveAnimation::WaitingForTargetAvailability; double startTime = 0; - toAdd = m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime).Pass(); + toAdd = m_activeAnimations[i]->cloneAndInitialize(ActiveAnimation::ControllingInstance, initialRunState, startTime).Pass(); } else - toAdd = m_activeAnimations[i]->clone(CCActiveAnimation::ControllingInstance).Pass(); + toAdd = m_activeAnimations[i]->clone(ActiveAnimation::ControllingInstance).Pass(); controllerImpl->addAnimation(toAdd.Pass()); } } -void CCLayerAnimationController::tickAnimations(double monotonicTime) +void LayerAnimationController::tickAnimations(double monotonicTime) { for (size_t i = 0; i < m_activeAnimations.size(); ++i) { - if (m_activeAnimations[i]->runState() == CCActiveAnimation::Running || m_activeAnimations[i]->runState() == CCActiveAnimation::Paused) { + if (m_activeAnimations[i]->runState() == ActiveAnimation::Running || m_activeAnimations[i]->runState() == ActiveAnimation::Paused) { double trimmed = m_activeAnimations[i]->trimTimeToCurrentIteration(monotonicTime); // Animation assumes its initial value until it gets the synchronized start time @@ -375,28 +375,28 @@ void CCLayerAnimationController::tickAnimations(double monotonicTime) switch (m_activeAnimations[i]->targetProperty()) { - case CCActiveAnimation::Transform: { - const CCTransformAnimationCurve* transformAnimationCurve = m_activeAnimations[i]->curve()->toTransformAnimationCurve(); + case ActiveAnimation::Transform: { + const TransformAnimationCurve* transformAnimationCurve = m_activeAnimations[i]->curve()->toTransformAnimationCurve(); const WebTransformationMatrix matrix = transformAnimationCurve->getValue(trimmed); if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) - m_activeAnimations[i]->setRunState(CCActiveAnimation::Finished, monotonicTime); + m_activeAnimations[i]->setRunState(ActiveAnimation::Finished, monotonicTime); m_client->setTransformFromAnimation(matrix); break; } - case CCActiveAnimation::Opacity: { - const CCFloatAnimationCurve* floatAnimationCurve = m_activeAnimations[i]->curve()->toFloatAnimationCurve(); + case ActiveAnimation::Opacity: { + const FloatAnimationCurve* floatAnimationCurve = m_activeAnimations[i]->curve()->toFloatAnimationCurve(); const float opacity = floatAnimationCurve->getValue(trimmed); if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) - m_activeAnimations[i]->setRunState(CCActiveAnimation::Finished, monotonicTime); + m_activeAnimations[i]->setRunState(ActiveAnimation::Finished, monotonicTime); m_client->setOpacityFromAnimation(opacity); break; } // Do nothing for sentinel value. - case CCActiveAnimation::TargetPropertyEnumSize: + case ActiveAnimation::TargetPropertyEnumSize: NOTREACHED(); } } diff --git a/cc/layer_animation_controller.h b/cc/layer_animation_controller.h index 2fdb91c..ff6a359 100644 --- a/cc/layer_animation_controller.h +++ b/cc/layer_animation_controller.h @@ -22,9 +22,9 @@ class Animation; class IntSize; class KeyframeValueList; -class CCLayerAnimationControllerClient { +class LayerAnimationControllerClient { public: - virtual ~CCLayerAnimationControllerClient() { } + virtual ~LayerAnimationControllerClient() { } virtual int id() const = 0; virtual void setOpacityFromAnimation(float) = 0; @@ -33,67 +33,67 @@ public: virtual const WebKit::WebTransformationMatrix& transform() const = 0; }; -class CCLayerAnimationController { +class LayerAnimationController { public: - static scoped_ptr<CCLayerAnimationController> create(CCLayerAnimationControllerClient*); + static scoped_ptr<LayerAnimationController> create(LayerAnimationControllerClient*); - virtual ~CCLayerAnimationController(); + virtual ~LayerAnimationController(); // These methods are virtual for testing. - virtual void addAnimation(scoped_ptr<CCActiveAnimation>); + virtual void addAnimation(scoped_ptr<ActiveAnimation>); virtual void pauseAnimation(int animationId, double timeOffset); virtual void removeAnimation(int animationId); - virtual void removeAnimation(int animationId, CCActiveAnimation::TargetProperty); + virtual void removeAnimation(int animationId, ActiveAnimation::TargetProperty); virtual void suspendAnimations(double monotonicTime); virtual void resumeAnimations(double monotonicTime); // Ensures that the list of active animations on the main thread and the impl thread // are kept in sync. This function does not take ownership of the impl thread controller. - virtual void pushAnimationUpdatesTo(CCLayerAnimationController*); + virtual void pushAnimationUpdatesTo(LayerAnimationController*); - void animate(double monotonicTime, CCAnimationEventsVector*); + void animate(double monotonicTime, AnimationEventsVector*); // Returns the active animation in the given group, animating the given property, if such an // animation exists. - CCActiveAnimation* getActiveAnimation(int groupId, CCActiveAnimation::TargetProperty) const; + ActiveAnimation* getActiveAnimation(int groupId, ActiveAnimation::TargetProperty) const; // Returns the active animation animating the given property that is either running, or is // next to run, if such an animation exists. - CCActiveAnimation* getActiveAnimation(CCActiveAnimation::TargetProperty) const; + ActiveAnimation* getActiveAnimation(ActiveAnimation::TargetProperty) const; // Returns true if there are any animations that have neither finished nor aborted. bool hasActiveAnimation() const; // Returns true if there is an animation currently animating the given property, or // if there is an animation scheduled to animate this property in the future. - bool isAnimatingProperty(CCActiveAnimation::TargetProperty) const; + bool isAnimatingProperty(ActiveAnimation::TargetProperty) const; // This is called in response to an animation being started on the impl thread. This // function updates the corresponding main thread animation's start time. - void notifyAnimationStarted(const CCAnimationEvent&); + void notifyAnimationStarted(const AnimationEvent&); // If a sync is forced, then the next time animation updates are pushed to the impl // thread, all animations will be transferred. void setForceSync() { m_forceSync = true; } - void setClient(CCLayerAnimationControllerClient*); + void setClient(LayerAnimationControllerClient*); protected: - explicit CCLayerAnimationController(CCLayerAnimationControllerClient*); + explicit LayerAnimationController(LayerAnimationControllerClient*); private: typedef base::hash_set<int> TargetProperties; - void pushNewAnimationsToImplThread(CCLayerAnimationController*) const; - void removeAnimationsCompletedOnMainThread(CCLayerAnimationController*) const; - void pushPropertiesToImplThread(CCLayerAnimationController*) const; - void replaceImplThreadAnimations(CCLayerAnimationController*) const; + void pushNewAnimationsToImplThread(LayerAnimationController*) const; + void removeAnimationsCompletedOnMainThread(LayerAnimationController*) const; + void pushPropertiesToImplThread(LayerAnimationController*) const; + void replaceImplThreadAnimations(LayerAnimationController*) const; - void startAnimationsWaitingForNextTick(double monotonicTime, CCAnimationEventsVector*); - void startAnimationsWaitingForStartTime(double monotonicTime, CCAnimationEventsVector*); - void startAnimationsWaitingForTargetAvailability(double monotonicTime, CCAnimationEventsVector*); + void startAnimationsWaitingForNextTick(double monotonicTime, AnimationEventsVector*); + void startAnimationsWaitingForStartTime(double monotonicTime, AnimationEventsVector*); + void startAnimationsWaitingForTargetAvailability(double monotonicTime, AnimationEventsVector*); void resolveConflicts(double monotonicTime); - void markAnimationsForDeletion(double monotonicTime, CCAnimationEventsVector*); + void markAnimationsForDeletion(double monotonicTime, AnimationEventsVector*); void purgeAnimationsMarkedForDeletion(); void tickAnimations(double monotonicTime); @@ -101,10 +101,10 @@ private: // If this is true, we force a sync to the impl thread. bool m_forceSync; - CCLayerAnimationControllerClient* m_client; - ScopedPtrVector<CCActiveAnimation> m_activeAnimations; + LayerAnimationControllerClient* m_client; + ScopedPtrVector<ActiveAnimation> m_activeAnimations; - DISALLOW_COPY_AND_ASSIGN(CCLayerAnimationController); + DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); }; } // namespace cc diff --git a/cc/layer_animation_controller_unittest.cc b/cc/layer_animation_controller_unittest.cc index cd1450b..26158e9 100644 --- a/cc/layer_animation_controller_unittest.cc +++ b/cc/layer_animation_controller_unittest.cc @@ -24,139 +24,139 @@ 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) +scoped_ptr<ActiveAnimation> createActiveAnimation(scoped_ptr<AnimationCurve> curve, int id, ActiveAnimation::TargetProperty property) { - return CCActiveAnimation::create(curve.Pass(), 0, id, property); + return ActiveAnimation::create(curve.Pass(), 0, id, property); } -TEST(CCLayerAnimationControllerTest, syncNewAnimation) +TEST(LayerAnimationControllerTest, syncNewAnimation) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy)); - EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); + EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); addOpacityTransitionToController(*controller, 1, 0, 1, false); controller->pushAnimationUpdatesTo(controllerImpl.get()); - EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); - EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_TRUE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); + EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); } // If an animation is started on the impl thread before it is ticked on the main // thread, we must be sure to respect the synchronized start time. -TEST(CCLayerAnimationControllerTest, doNotClobberStartTimes) +TEST(LayerAnimationControllerTest, doNotClobberStartTimes) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy)); - EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); + EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); addOpacityTransitionToController(*controller, 1, 0, 1, false); controller->pushAnimationUpdatesTo(controllerImpl.get()); - EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); - EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_TRUE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); + EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); - CCAnimationEventsVector events; + AnimationEventsVector events; controllerImpl->animate(1, &events); // Synchronize the start times. EXPECT_EQ(1u, events.size()); controller->notifyAnimationStarted(events[0]); - EXPECT_EQ(controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime(), controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime()); + EXPECT_EQ(controller->getActiveAnimation(0, ActiveAnimation::Opacity)->startTime(), controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->startTime()); // Start the animation on the main thread. Should not affect the start time. controller->animate(1.5, 0); - EXPECT_EQ(controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime(), controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime()); + EXPECT_EQ(controller->getActiveAnimation(0, ActiveAnimation::Opacity)->startTime(), controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->startTime()); } -TEST(CCLayerAnimationControllerTest, syncPauseAndResume) +TEST(LayerAnimationControllerTest, syncPauseAndResume) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy)); - EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); + EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); addOpacityTransitionToController(*controller, 1, 0, 1, false); controller->pushAnimationUpdatesTo(controllerImpl.get()); - EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); - EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_TRUE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); + EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); // Start the animations on each controller. - CCAnimationEventsVector events; + AnimationEventsVector events; controllerImpl->animate(0, &events); controller->animate(0, 0); - EXPECT_EQ(CCActiveAnimation::Running, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); - EXPECT_EQ(CCActiveAnimation::Running, controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_EQ(ActiveAnimation::Running, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); + EXPECT_EQ(ActiveAnimation::Running, controller->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); // Pause the main-thread animation. controller->suspendAnimations(1); - EXPECT_EQ(CCActiveAnimation::Paused, controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_EQ(ActiveAnimation::Paused, controller->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); // The pause run state change should make it to the impl thread controller. controller->pushAnimationUpdatesTo(controllerImpl.get()); - EXPECT_EQ(CCActiveAnimation::Paused, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_EQ(ActiveAnimation::Paused, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); // Resume the main-thread animation. controller->resumeAnimations(2); - EXPECT_EQ(CCActiveAnimation::Running, controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_EQ(ActiveAnimation::Running, controller->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); // The pause run state change should make it to the impl thread controller. controller->pushAnimationUpdatesTo(controllerImpl.get()); - EXPECT_EQ(CCActiveAnimation::Running, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_EQ(ActiveAnimation::Running, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); } -TEST(CCLayerAnimationControllerTest, doNotSyncFinishedAnimation) +TEST(LayerAnimationControllerTest, doNotSyncFinishedAnimation) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); + scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy)); - EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); + EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); addOpacityTransitionToController(*controller, 1, 0, 1, false); controller->pushAnimationUpdatesTo(controllerImpl.get()); - EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); - EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState()); + EXPECT_TRUE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); + EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)->runState()); // Notify main thread controller that the animation has started. - CCAnimationEvent animationStartedEvent(CCAnimationEvent::Started, 0, 0, CCActiveAnimation::Opacity, 0); + AnimationEvent animationStartedEvent(AnimationEvent::Started, 0, 0, ActiveAnimation::Opacity, 0); controller->notifyAnimationStarted(animationStartedEvent); // Force animation to complete on impl thread. controllerImpl->removeAnimation(0); - EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); + EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); controller->pushAnimationUpdatesTo(controllerImpl.get()); // Even though the main thread has a 'new' animation, it should not be pushed because the animation has already completed on the impl thread. - EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)); + EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)); } // Tests that transitioning opacity from 0 to 1 works as expected. -TEST(CCLayerAnimationControllerTest, TrivialTransition) +TEST(LayerAnimationControllerTest, TrivialTransition) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); controller->addAnimation(toAdd.Pass()); controller->animate(0, events.get()); @@ -168,14 +168,14 @@ TEST(CCLayerAnimationControllerTest, TrivialTransition) } // Tests animations that are waiting for a synchronized start time do not finish. -TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration) +TEST(LayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); toAdd->setNeedsSynchronizedStartTime(true); // We should pause at the first keyframe indefinitely waiting for that animation to start. @@ -191,22 +191,22 @@ TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfT EXPECT_EQ(0, dummy.opacity()); // Send the synchronized start time. - controller->notifyAnimationStarted(CCAnimationEvent(CCAnimationEvent::Started, 0, 1, CCActiveAnimation::Opacity, 2)); + controller->notifyAnimationStarted(AnimationEvent(AnimationEvent::Started, 0, 1, ActiveAnimation::Opacity, 2)); controller->animate(5, events.get()); EXPECT_EQ(1, dummy.opacity()); EXPECT_FALSE(controller->hasActiveAnimation()); } // Tests that two queued animations affecting the same property run in sequence. -TEST(CCLayerAnimationControllerTest, TrivialQueuing) +TEST(LayerAnimationControllerTest, TrivialQueuing) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::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(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -220,19 +220,19 @@ TEST(CCLayerAnimationControllerTest, TrivialQueuing) } // Tests interrupting a transition with another transition. -TEST(CCLayerAnimationControllerTest, Interrupt) +TEST(LayerAnimationControllerTest, Interrupt) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::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)); - toAdd->setRunState(CCActiveAnimation::WaitingForNextTick, 0); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); + toAdd->setRunState(ActiveAnimation::WaitingForNextTick, 0); controller->addAnimation(toAdd.Pass()); // Since the animation was in the WaitingForNextTick state, it should start right in @@ -246,16 +246,16 @@ TEST(CCLayerAnimationControllerTest, Interrupt) } // Tests scheduling two animations to run together when only one property is free. -TEST(CCLayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) +TEST(LayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::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(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_EQ(0, dummy.opacity()); @@ -273,16 +273,16 @@ TEST(CCLayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) // Tests scheduling two animations to run together with different lengths and another // animation queued to start when the shorter animation finishes (should wait // for both to finish). -TEST(CCLayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) +TEST(LayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::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(make_scoped_ptr(new FakeTransformTransition(2)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); // Animations with id 1 should both start now. controller->animate(0, events.get()); @@ -303,15 +303,15 @@ TEST(CCLayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) } // Tests scheduling an animation to start in the future. -TEST(CCLayerAnimationControllerTest, ScheduleAnimation) +TEST(LayerAnimationControllerTest, ScheduleAnimation) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); - toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); + toAdd->setRunState(ActiveAnimation::WaitingForStartTime, 0); toAdd->setStartTime(1); controller->addAnimation(toAdd.Pass()); @@ -327,17 +327,17 @@ TEST(CCLayerAnimationControllerTest, ScheduleAnimation) } // Tests scheduling an animation to start in the future that's interrupting a running animation. -TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimation) +TEST(LayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimation) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0.5, 0)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); - toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0.5, 0)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); + toAdd->setRunState(ActiveAnimation::WaitingForStartTime, 0); toAdd->setStartTime(1); controller->addAnimation(toAdd.Pass()); @@ -358,21 +358,21 @@ TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimatio // Tests scheduling an animation to start in the future that interrupts a running animation // and there is yet another animation queued to start later. -TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue) +TEST(LayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0.5, 0)).PassAs<CCAnimationCurve>(), 2, CCActiveAnimation::Opacity)); - toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0.5, 0)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); + toAdd->setRunState(ActiveAnimation::WaitingForStartTime, 0); toAdd->setStartTime(1); controller->addAnimation(toAdd.Pass()); - controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 0.75)).PassAs<CCAnimationCurve>(), 3, CCActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 0.75)).PassAs<AnimationCurve>(), 3, ActiveAnimation::Opacity)); // First 2s opacity transition should start immediately. controller->animate(0, events.get()); @@ -394,14 +394,14 @@ TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimatio } // Test that a looping animation loops and for the correct number of iterations. -TEST(CCLayerAnimationControllerTest, TrivialLooping) +TEST(LayerAnimationControllerTest, TrivialLooping) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), 1, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity)); toAdd->setIterations(3); controller->addAnimation(toAdd.Pass()); @@ -430,15 +430,15 @@ TEST(CCLayerAnimationControllerTest, TrivialLooping) } // Test that an infinitely looping animation does indeed go until aborted. -TEST(CCLayerAnimationControllerTest, InfiniteLooping) +TEST(LayerAnimationControllerTest, InfiniteLooping) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); const int id = 1; - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<CCAnimationCurve>(), id, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Opacity)); toAdd->setIterations(-1); controller->addAnimation(toAdd.Pass()); @@ -459,22 +459,22 @@ TEST(CCLayerAnimationControllerTest, InfiniteLooping) EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0.75, dummy.opacity()); - EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); - controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 0.75); + EXPECT_TRUE(controller->getActiveAnimation(id, ActiveAnimation::Opacity)); + controller->getActiveAnimation(id, ActiveAnimation::Opacity)->setRunState(ActiveAnimation::Aborted, 0.75); EXPECT_FALSE(controller->hasActiveAnimation()); EXPECT_EQ(0.75, dummy.opacity()); } // Test that pausing and resuming work as expected. -TEST(CCLayerAnimationControllerTest, PauseResume) +TEST(LayerAnimationControllerTest, PauseResume) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::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(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -483,15 +483,15 @@ TEST(CCLayerAnimationControllerTest, PauseResume) EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0.5, dummy.opacity()); - EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); - controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Paused, 0.5); + EXPECT_TRUE(controller->getActiveAnimation(id, ActiveAnimation::Opacity)); + controller->getActiveAnimation(id, ActiveAnimation::Opacity)->setRunState(ActiveAnimation::Paused, 0.5); controller->animate(1024, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0.5, dummy.opacity()); - EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); - controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Running, 1024); + EXPECT_TRUE(controller->getActiveAnimation(id, ActiveAnimation::Opacity)); + controller->getActiveAnimation(id, ActiveAnimation::Opacity)->setRunState(ActiveAnimation::Running, 1024); controller->animate(1024.25, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -501,17 +501,17 @@ TEST(CCLayerAnimationControllerTest, PauseResume) EXPECT_EQ(1, dummy.opacity()); } -TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation) +TEST(LayerAnimationControllerTest, AbortAGroupedAnimation) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::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(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Transform)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Opacity)); + controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.75)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity)); controller->animate(0, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); @@ -520,8 +520,8 @@ TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation) EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(0.5, dummy.opacity()); - EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); - controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 1); + EXPECT_TRUE(controller->getActiveAnimation(id, ActiveAnimation::Opacity)); + controller->getActiveAnimation(id, ActiveAnimation::Opacity)->setRunState(ActiveAnimation::Aborted, 1); controller->animate(1, events.get()); EXPECT_TRUE(controller->hasActiveAnimation()); EXPECT_EQ(1, dummy.opacity()); @@ -530,22 +530,22 @@ TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation) EXPECT_EQ(0.75, dummy.opacity()); } -TEST(CCLayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded) +TEST(LayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded) { FakeLayerAnimationControllerClient dummyImpl; - scoped_ptr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl)); - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); FakeLayerAnimationControllerClient dummy; - scoped_ptr<CCLayerAnimationController> controller( - CCLayerAnimationController::create(&dummy)); + scoped_ptr<LayerAnimationController> controller( + LayerAnimationController::create(&dummy)); - scoped_ptr<CCActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<CCAnimationCurve>(), 0, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), 0, ActiveAnimation::Opacity)); toAdd->setNeedsSynchronizedStartTime(true); controller->addAnimation(toAdd.Pass()); controller->animate(0, 0); EXPECT_TRUE(controller->hasActiveAnimation()); - CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Opacity); + ActiveAnimation* activeAnimation = controller->getActiveAnimation(0, ActiveAnimation::Opacity); EXPECT_TRUE(activeAnimation); EXPECT_TRUE(activeAnimation->needsSynchronizedStartTime()); @@ -553,9 +553,9 @@ TEST(CCLayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded) controller->pushAnimationUpdatesTo(controllerImpl.get()); - activeAnimation = controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity); + activeAnimation = controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity); EXPECT_TRUE(activeAnimation); - EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, activeAnimation->runState()); + EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, activeAnimation->runState()); } } // namespace diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index f71cbca..4a70fe3 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -20,7 +20,7 @@ using WebKit::WebTransformationMatrix; namespace cc { -CCLayerImpl::CCLayerImpl(int id) +LayerImpl::LayerImpl(int id) : m_parent(0) , m_maskLayerId(-1) , m_replicaLayerId(-1) @@ -57,32 +57,32 @@ CCLayerImpl::CCLayerImpl(int id) #ifndef NDEBUG , m_betweenWillDrawAndDidDraw(false) #endif - , m_layerAnimationController(CCLayerAnimationController::create(this)) + , m_layerAnimationController(LayerAnimationController::create(this)) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(m_layerId > 0); } -CCLayerImpl::~CCLayerImpl() +LayerImpl::~LayerImpl() { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); #ifndef NDEBUG DCHECK(!m_betweenWillDrawAndDidDraw); #endif } -void CCLayerImpl::addChild(scoped_ptr<CCLayerImpl> child) +void LayerImpl::addChild(scoped_ptr<LayerImpl> child) { child->setParent(this); m_children.append(child.Pass()); } -void CCLayerImpl::removeFromParent() +void LayerImpl::removeFromParent() { if (!m_parent) return; - CCLayerImpl* parent = m_parent; + LayerImpl* parent = m_parent; m_parent = 0; for (size_t i = 0; i < parent->m_children.size(); ++i) { @@ -93,25 +93,25 @@ void CCLayerImpl::removeFromParent() } } -void CCLayerImpl::removeAllChildren() +void LayerImpl::removeAllChildren() { while (m_children.size()) m_children[0]->removeFromParent(); } -void CCLayerImpl::clearChildList() +void LayerImpl::clearChildList() { m_children.clear(); } -void CCLayerImpl::createRenderSurface() +void LayerImpl::createRenderSurface() { DCHECK(!m_renderSurface); - m_renderSurface = make_scoped_ptr(new CCRenderSurface(this)); + m_renderSurface = make_scoped_ptr(new RenderSurfaceImpl(this)); setRenderTarget(this); } -bool CCLayerImpl::descendantDrawsContent() +bool LayerImpl::descendantDrawsContent() { for (size_t i = 0; i < m_children.size(); ++i) { if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsContent()) @@ -120,12 +120,12 @@ bool CCLayerImpl::descendantDrawsContent() return false; } -scoped_ptr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const +scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const { - return CCSharedQuadState::create(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_contentsOpaque); + return SharedQuadState::create(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_contentsOpaque); } -void CCLayerImpl::willDraw(CCResourceProvider*) +void LayerImpl::willDraw(ResourceProvider*) { #ifndef NDEBUG // willDraw/didDraw must be matched. @@ -134,7 +134,7 @@ void CCLayerImpl::willDraw(CCResourceProvider*) #endif } -void CCLayerImpl::didDraw(CCResourceProvider*) +void LayerImpl::didDraw(ResourceProvider*) { #ifndef NDEBUG DCHECK(m_betweenWillDrawAndDidDraw); @@ -142,37 +142,37 @@ void CCLayerImpl::didDraw(CCResourceProvider*) #endif } -void CCLayerImpl::appendDebugBorderQuad(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, CCAppendQuadsData& appendQuadsData) const +void LayerImpl::appendDebugBorderQuad(QuadSink& quadList, const SharedQuadState* sharedQuadState, AppendQuadsData& appendQuadsData) const { if (!hasDebugBorders()) return; IntRect contentRect(IntPoint(), contentBounds()); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth()).PassAs<CCDrawQuad>(), appendQuadsData); + quadList.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth()).PassAs<DrawQuad>(), appendQuadsData); } -bool CCLayerImpl::hasContributingDelegatedRenderPasses() const +bool LayerImpl::hasContributingDelegatedRenderPasses() const { return false; } -CCRenderPass::Id CCLayerImpl::firstContributingRenderPassId() const +RenderPass::Id LayerImpl::firstContributingRenderPassId() const { - return CCRenderPass::Id(0, 0); + return RenderPass::Id(0, 0); } -CCRenderPass::Id CCLayerImpl::nextContributingRenderPassId(CCRenderPass::Id) const +RenderPass::Id LayerImpl::nextContributingRenderPassId(RenderPass::Id) const { - return CCRenderPass::Id(0, 0); + return RenderPass::Id(0, 0); } -CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const +ResourceProvider::ResourceId LayerImpl::contentsResourceId() const { NOTREACHED(); return 0; } -FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) +FloatSize LayerImpl::scrollBy(const FloatSize& scroll) { IntSize minDelta = -toSize(m_scrollPosition); IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); @@ -191,46 +191,46 @@ FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) return unscrolled; } -CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& screenSpacePoint, CCInputHandlerClient::ScrollInputType type) const +InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const IntPoint& screenSpacePoint, InputHandlerClient::ScrollInputType type) const { if (shouldScrollOnMainThread()) { - TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThread"); - return CCInputHandlerClient::ScrollOnMainThread; + TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed shouldScrollOnMainThread"); + return InputHandlerClient::ScrollOnMainThread; } if (!screenSpaceTransform().isInvertible()) { - TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Ignored nonInvertibleTransform"); - return CCInputHandlerClient::ScrollIgnored; + TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored nonInvertibleTransform"); + return InputHandlerClient::ScrollIgnored; } if (!nonFastScrollableRegion().isEmpty()) { bool clipped = false; - FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped); + FloatPoint hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped); if (!clipped && nonFastScrollableRegion().contains(flooredIntPoint(hitTestPointInLocalSpace))) { - TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed nonFastScrollableRegion"); - return CCInputHandlerClient::ScrollOnMainThread; + TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed nonFastScrollableRegion"); + return InputHandlerClient::ScrollOnMainThread; } } - if (type == CCInputHandlerClient::Wheel && haveWheelEventHandlers()) { - TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed wheelEventHandlers"); - return CCInputHandlerClient::ScrollOnMainThread; + if (type == InputHandlerClient::Wheel && haveWheelEventHandlers()) { + TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed wheelEventHandlers"); + return InputHandlerClient::ScrollOnMainThread; } if (!scrollable()) { - TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Ignored not scrollable"); - return CCInputHandlerClient::ScrollIgnored; + TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable"); + return InputHandlerClient::ScrollIgnored; } - return CCInputHandlerClient::ScrollStarted; + return InputHandlerClient::ScrollStarted; } -bool CCLayerImpl::drawCheckerboardForMissingTiles() const +bool LayerImpl::drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForMissingTiles && !Settings::backgroundColorInsteadOfCheckerboard(); } -IntRect CCLayerImpl::layerRectToContentRect(const WebKit::WebRect& layerRect) +IntRect LayerImpl::layerRectToContentRect(const WebKit::WebRect& layerRect) { float widthScale = static_cast<float>(contentBounds().width()) / bounds().width(); float heightScale = static_cast<float>(contentBounds().height()) / bounds().height(); @@ -239,7 +239,7 @@ IntRect CCLayerImpl::layerRectToContentRect(const WebKit::WebRect& layerRect) return enclosingIntRect(contentRect); } -std::string CCLayerImpl::indentString(int indent) +std::string LayerImpl::indentString(int indent) { std::string str; for (int i = 0; i != indent; ++i) @@ -247,7 +247,7 @@ std::string CCLayerImpl::indentString(int indent) return str; } -void CCLayerImpl::dumpLayerProperties(std::string* str, int indent) const +void LayerImpl::dumpLayerProperties(std::string* str, int indent) const { std::string indentStr = indentString(indent); str->append(indentStr); @@ -272,20 +272,20 @@ void CCLayerImpl::dumpLayerProperties(std::string* str, int indent) const base::StringAppendF(str, "drawsContent: %s\n", m_drawsContent ? "yes" : "no"); } -void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerImpl*>::iterator end, CCLayerSorter* layerSorter) +void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>::iterator end, LayerSorter* layerSorter) { - TRACE_EVENT0("cc", "CCLayerImpl::sortLayers"); + TRACE_EVENT0("cc", "LayerImpl::sortLayers"); layerSorter->sort(first, end); } -std::string CCLayerImpl::layerTreeAsText() const +std::string LayerImpl::layerTreeAsText() const { std::string str; dumpLayer(&str, 0); return str; } -void CCLayerImpl::dumpLayer(std::string* str, int indent) const +void LayerImpl::dumpLayer(std::string* str, int indent) const { str->append(indentString(indent)); base::StringAppendF(str, "%s(%s)\n", layerTypeAsString(), m_debugName.data()); @@ -304,14 +304,14 @@ void CCLayerImpl::dumpLayer(std::string* str, int indent) const m_children[i]->dumpLayer(str, indent+1); } -void CCLayerImpl::setStackingOrderChanged(bool stackingOrderChanged) +void LayerImpl::setStackingOrderChanged(bool stackingOrderChanged) { // We don't need to store this flag; we only need to track that the change occurred. if (stackingOrderChanged) noteLayerPropertyChangedForSubtree(); } -bool CCLayerImpl::layerSurfacePropertyChanged() const +bool LayerImpl::layerSurfacePropertyChanged() const { if (m_layerSurfacePropertyChanged) return true; @@ -321,7 +321,7 @@ bool CCLayerImpl::layerSurfacePropertyChanged() const // case when such parent layer does not draw content, and therefore will // not be traversed by the damage tracker. We need to make sure that // property change on such layer will be caught by its descendants. - CCLayerImpl* current = this->m_parent; + LayerImpl* current = this->m_parent; while (current && !current->m_renderSurface) { if (current->m_layerSurfacePropertyChanged) return true; @@ -331,24 +331,24 @@ bool CCLayerImpl::layerSurfacePropertyChanged() const return false; } -void CCLayerImpl::noteLayerPropertyChangedForSubtree() +void LayerImpl::noteLayerPropertyChangedForSubtree() { m_layerPropertyChanged = true; noteLayerPropertyChangedForDescendants(); } -void CCLayerImpl::noteLayerPropertyChangedForDescendants() +void LayerImpl::noteLayerPropertyChangedForDescendants() { for (size_t i = 0; i < m_children.size(); ++i) m_children[i]->noteLayerPropertyChangedForSubtree(); } -const char* CCLayerImpl::layerTypeAsString() const +const char* LayerImpl::layerTypeAsString() const { - return "LayerChromium"; + return "Layer"; } -void CCLayerImpl::resetAllChangeTrackingForSubtree() +void LayerImpl::resetAllChangeTrackingForSubtree() { m_layerPropertyChanged = false; m_layerSurfacePropertyChanged = false; @@ -368,37 +368,37 @@ void CCLayerImpl::resetAllChangeTrackingForSubtree() m_children[i]->resetAllChangeTrackingForSubtree(); } -bool CCLayerImpl::layerIsAlwaysDamaged() const +bool LayerImpl::layerIsAlwaysDamaged() const { return false; } -int CCLayerImpl::id() const +int LayerImpl::id() const { return m_layerId; } -float CCLayerImpl::opacity() const +float LayerImpl::opacity() const { return m_opacity; } -void CCLayerImpl::setOpacityFromAnimation(float opacity) +void LayerImpl::setOpacityFromAnimation(float opacity) { setOpacity(opacity); } -const WebKit::WebTransformationMatrix& CCLayerImpl::transform() const +const WebKit::WebTransformationMatrix& LayerImpl::transform() const { return m_transform; } -void CCLayerImpl::setTransformFromAnimation(const WebTransformationMatrix& transform) +void LayerImpl::setTransformFromAnimation(const WebTransformationMatrix& transform) { setTransform(transform); } -void CCLayerImpl::setBounds(const IntSize& bounds) +void LayerImpl::setBounds(const IntSize& bounds) { if (m_bounds == bounds) return; @@ -411,7 +411,7 @@ void CCLayerImpl::setBounds(const IntSize& bounds) m_layerPropertyChanged = true; } -void CCLayerImpl::setMaskLayer(scoped_ptr<CCLayerImpl> maskLayer) +void LayerImpl::setMaskLayer(scoped_ptr<LayerImpl> maskLayer) { m_maskLayer = maskLayer.Pass(); @@ -423,7 +423,7 @@ void CCLayerImpl::setMaskLayer(scoped_ptr<CCLayerImpl> maskLayer) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setReplicaLayer(scoped_ptr<CCLayerImpl> replicaLayer) +void LayerImpl::setReplicaLayer(scoped_ptr<LayerImpl> replicaLayer) { m_replicaLayer = replicaLayer.Pass(); @@ -435,7 +435,7 @@ void CCLayerImpl::setReplicaLayer(scoped_ptr<CCLayerImpl> replicaLayer) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setDrawsContent(bool drawsContent) +void LayerImpl::setDrawsContent(bool drawsContent) { if (m_drawsContent == drawsContent) return; @@ -444,7 +444,7 @@ void CCLayerImpl::setDrawsContent(bool drawsContent) m_layerPropertyChanged = true; } -void CCLayerImpl::setAnchorPoint(const FloatPoint& anchorPoint) +void LayerImpl::setAnchorPoint(const FloatPoint& anchorPoint) { if (m_anchorPoint == anchorPoint) return; @@ -453,7 +453,7 @@ void CCLayerImpl::setAnchorPoint(const FloatPoint& anchorPoint) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setAnchorPointZ(float anchorPointZ) +void LayerImpl::setAnchorPointZ(float anchorPointZ) { if (m_anchorPointZ == anchorPointZ) return; @@ -462,7 +462,7 @@ void CCLayerImpl::setAnchorPointZ(float anchorPointZ) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setBackgroundColor(SkColor backgroundColor) +void LayerImpl::setBackgroundColor(SkColor backgroundColor) { if (m_backgroundColor == backgroundColor) return; @@ -471,7 +471,7 @@ void CCLayerImpl::setBackgroundColor(SkColor backgroundColor) m_layerPropertyChanged = true; } -void CCLayerImpl::setFilters(const WebKit::WebFilterOperations& filters) +void LayerImpl::setFilters(const WebKit::WebFilterOperations& filters) { if (m_filters == filters) return; @@ -480,7 +480,7 @@ void CCLayerImpl::setFilters(const WebKit::WebFilterOperations& filters) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFilters) +void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFilters) { if (m_backgroundFilters == backgroundFilters) return; @@ -489,7 +489,7 @@ void CCLayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgr m_layerPropertyChanged = true; } -void CCLayerImpl::setMasksToBounds(bool masksToBounds) +void LayerImpl::setMasksToBounds(bool masksToBounds) { if (m_masksToBounds == masksToBounds) return; @@ -498,7 +498,7 @@ void CCLayerImpl::setMasksToBounds(bool masksToBounds) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setContentsOpaque(bool opaque) +void LayerImpl::setContentsOpaque(bool opaque) { if (m_contentsOpaque == opaque) return; @@ -507,7 +507,7 @@ void CCLayerImpl::setContentsOpaque(bool opaque) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setOpacity(float opacity) +void LayerImpl::setOpacity(float opacity) { if (m_opacity == opacity) return; @@ -516,12 +516,12 @@ void CCLayerImpl::setOpacity(float opacity) m_layerSurfacePropertyChanged = true; } -bool CCLayerImpl::opacityIsAnimating() const +bool LayerImpl::opacityIsAnimating() const { - return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Opacity); + return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity); } -void CCLayerImpl::setPosition(const FloatPoint& position) +void LayerImpl::setPosition(const FloatPoint& position) { if (m_position == position) return; @@ -530,7 +530,7 @@ void CCLayerImpl::setPosition(const FloatPoint& position) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setPreserves3D(bool preserves3D) +void LayerImpl::setPreserves3D(bool preserves3D) { if (m_preserves3D == preserves3D) return; @@ -539,7 +539,7 @@ void CCLayerImpl::setPreserves3D(bool preserves3D) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setSublayerTransform(const WebTransformationMatrix& sublayerTransform) +void LayerImpl::setSublayerTransform(const WebTransformationMatrix& sublayerTransform) { if (m_sublayerTransform == sublayerTransform) return; @@ -549,7 +549,7 @@ void CCLayerImpl::setSublayerTransform(const WebTransformationMatrix& sublayerTr noteLayerPropertyChangedForDescendants(); } -void CCLayerImpl::setTransform(const WebTransformationMatrix& transform) +void LayerImpl::setTransform(const WebTransformationMatrix& transform) { if (m_transform == transform) return; @@ -558,12 +558,12 @@ void CCLayerImpl::setTransform(const WebTransformationMatrix& transform) m_layerSurfacePropertyChanged = true; } -bool CCLayerImpl::transformIsAnimating() const +bool LayerImpl::transformIsAnimating() const { - return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Transform); + return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Transform); } -void CCLayerImpl::setDebugBorderColor(SkColor debugBorderColor) +void LayerImpl::setDebugBorderColor(SkColor debugBorderColor) { if (m_debugBorderColor == debugBorderColor) return; @@ -572,7 +572,7 @@ void CCLayerImpl::setDebugBorderColor(SkColor debugBorderColor) m_layerPropertyChanged = true; } -void CCLayerImpl::setDebugBorderWidth(float debugBorderWidth) +void LayerImpl::setDebugBorderWidth(float debugBorderWidth) { if (m_debugBorderWidth == debugBorderWidth) return; @@ -581,12 +581,12 @@ void CCLayerImpl::setDebugBorderWidth(float debugBorderWidth) m_layerPropertyChanged = true; } -bool CCLayerImpl::hasDebugBorders() const +bool LayerImpl::hasDebugBorders() const { return SkColorGetA(m_debugBorderColor) && debugBorderWidth() > 0; } -void CCLayerImpl::setContentBounds(const IntSize& contentBounds) +void LayerImpl::setContentBounds(const IntSize& contentBounds) { if (m_contentBounds == contentBounds) return; @@ -595,7 +595,7 @@ void CCLayerImpl::setContentBounds(const IntSize& contentBounds) m_layerPropertyChanged = true; } -void CCLayerImpl::setScrollPosition(const IntPoint& scrollPosition) +void LayerImpl::setScrollPosition(const IntPoint& scrollPosition) { if (m_scrollPosition == scrollPosition) return; @@ -604,7 +604,7 @@ void CCLayerImpl::setScrollPosition(const IntPoint& scrollPosition) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) +void LayerImpl::setScrollDelta(const FloatSize& scrollDelta) { if (m_scrollDelta == scrollDelta) return; @@ -613,7 +613,7 @@ void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setImplTransform(const WebKit::WebTransformationMatrix& transform) +void LayerImpl::setImplTransform(const WebKit::WebTransformationMatrix& transform) { if (m_implTransform == transform) return; @@ -622,7 +622,7 @@ void CCLayerImpl::setImplTransform(const WebKit::WebTransformationMatrix& transf noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setDoubleSided(bool doubleSided) +void LayerImpl::setDoubleSided(bool doubleSided) { if (m_doubleSided == doubleSided) return; @@ -631,18 +631,18 @@ void CCLayerImpl::setDoubleSided(bool doubleSided) noteLayerPropertyChangedForSubtree(); } -Region CCLayerImpl::visibleContentOpaqueRegion() const +Region LayerImpl::visibleContentOpaqueRegion() const { if (contentsOpaque()) return visibleContentRect(); return Region(); } -void CCLayerImpl::didLoseContext() +void LayerImpl::didLoseContext() { } -void CCLayerImpl::setMaxScrollPosition(const IntSize& maxScrollPosition) +void LayerImpl::setMaxScrollPosition(const IntSize& maxScrollPosition) { m_maxScrollPosition = maxScrollPosition; @@ -651,28 +651,28 @@ void CCLayerImpl::setMaxScrollPosition(const IntSize& maxScrollPosition) m_scrollbarAnimationController->updateScrollOffset(this); } -CCScrollbarLayerImpl* CCLayerImpl::horizontalScrollbarLayer() const +ScrollbarLayerImpl* LayerImpl::horizontalScrollbarLayer() const { return m_scrollbarAnimationController ? m_scrollbarAnimationController->horizontalScrollbarLayer() : 0; } -void CCLayerImpl::setHorizontalScrollbarLayer(CCScrollbarLayerImpl* scrollbarLayer) +void LayerImpl::setHorizontalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) { if (!m_scrollbarAnimationController) - m_scrollbarAnimationController = CCScrollbarAnimationController::create(this); + m_scrollbarAnimationController = ScrollbarAnimationController::create(this); m_scrollbarAnimationController->setHorizontalScrollbarLayer(scrollbarLayer); m_scrollbarAnimationController->updateScrollOffset(this); } -CCScrollbarLayerImpl* CCLayerImpl::verticalScrollbarLayer() const +ScrollbarLayerImpl* LayerImpl::verticalScrollbarLayer() const { return m_scrollbarAnimationController ? m_scrollbarAnimationController->verticalScrollbarLayer() : 0; } -void CCLayerImpl::setVerticalScrollbarLayer(CCScrollbarLayerImpl* scrollbarLayer) +void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) { if (!m_scrollbarAnimationController) - m_scrollbarAnimationController = CCScrollbarAnimationController::create(this); + m_scrollbarAnimationController = ScrollbarAnimationController::create(this); m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); m_scrollbarAnimationController->updateScrollOffset(this); } diff --git a/cc/layer_impl.h b/cc/layer_impl.h index f8a7e0b..a547d79 100644 --- a/cc/layer_impl.h +++ b/cc/layer_impl.h @@ -24,26 +24,26 @@ namespace cc { -class CCLayerSorter; -class CCLayerTreeHostImpl; -class CCQuadSink; -class CCRenderer; -class CCScrollbarAnimationController; -class CCScrollbarLayerImpl; -class LayerChromium; +class LayerSorter; +class LayerTreeHostImpl; +class QuadSink; +class Renderer; +class ScrollbarAnimationController; +class ScrollbarLayerImpl; +class Layer; -struct CCAppendQuadsData; +struct AppendQuadsData; -class CCLayerImpl : public CCLayerAnimationControllerClient { +class LayerImpl : public LayerAnimationControllerClient { public: - static scoped_ptr<CCLayerImpl> create(int id) + static scoped_ptr<LayerImpl> create(int id) { - return make_scoped_ptr(new CCLayerImpl(id)); + return make_scoped_ptr(new LayerImpl(id)); } - virtual ~CCLayerImpl(); + virtual ~LayerImpl(); - // CCLayerAnimationControllerClient implementation. + // LayerAnimationControllerClient implementation. virtual int id() const OVERRIDE; virtual void setOpacityFromAnimation(float) OVERRIDE; virtual float opacity() const OVERRIDE; @@ -51,39 +51,39 @@ public: virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; // Tree structure. - CCLayerImpl* parent() const { return m_parent; } - const ScopedPtrVector<CCLayerImpl>& children() const { return m_children; } - void addChild(scoped_ptr<CCLayerImpl>); + LayerImpl* parent() const { return m_parent; } + const ScopedPtrVector<LayerImpl>& children() const { return m_children; } + void addChild(scoped_ptr<LayerImpl>); void removeFromParent(); void removeAllChildren(); - void setMaskLayer(scoped_ptr<CCLayerImpl>); - CCLayerImpl* maskLayer() const { return m_maskLayer.get(); } + void setMaskLayer(scoped_ptr<LayerImpl>); + LayerImpl* maskLayer() const { return m_maskLayer.get(); } - void setReplicaLayer(scoped_ptr<CCLayerImpl>); - CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); } + void setReplicaLayer(scoped_ptr<LayerImpl>); + LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } bool hasMask() const { return m_maskLayer; } bool hasReplica() const { return m_replicaLayer; } bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); } - CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } - void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } + LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } + void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } - scoped_ptr<CCSharedQuadState> createSharedQuadState() const; + scoped_ptr<SharedQuadState> createSharedQuadState() const; // willDraw must be called before appendQuads. If willDraw is called, // didDraw is guaranteed to be called before another willDraw or before // the layer is destroyed. To enforce this, any class that overrides // willDraw/didDraw must call the base class version. - virtual void willDraw(CCResourceProvider*); - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) { } - virtual void didDraw(CCResourceProvider*); + virtual void willDraw(ResourceProvider*); + virtual void appendQuads(QuadSink&, AppendQuadsData&) { } + virtual void didDraw(ResourceProvider*); - virtual CCResourceProvider::ResourceId contentsResourceId() const; + virtual ResourceProvider::ResourceId contentsResourceId() const; virtual bool hasContributingDelegatedRenderPasses() const; - virtual CCRenderPass::Id firstContributingRenderPassId() const; - virtual CCRenderPass::Id nextContributingRenderPassId(CCRenderPass::Id) const; + virtual RenderPass::Id firstContributingRenderPassId() const; + virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const; // Returns true if this layer has content to draw. void setDrawsContent(bool); @@ -151,7 +151,7 @@ public: void setDebugName(const std::string& debugName) { m_debugName = debugName; } std::string debugName() const { return m_debugName; } - CCRenderSurface* renderSurface() const { return m_renderSurface.get(); } + RenderSurfaceImpl* renderSurface() const { return m_renderSurface.get(); } void createRenderSurface(); void clearRenderSurface() { m_renderSurface.reset(); } @@ -161,8 +161,8 @@ public: bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } - CCLayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } - void setRenderTarget(CCLayerImpl* target) { m_renderTarget = target; } + LayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } + void setRenderTarget(LayerImpl* target) { m_renderTarget = target; } void setBounds(const IntSize&); const IntSize& bounds() const { return m_bounds; } @@ -203,7 +203,7 @@ public: void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerboardForMissingTiles = checkerboard; } bool drawCheckerboardForMissingTiles() const; - CCInputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType) const; + InputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, InputHandlerClient::ScrollInputType) const; const IntRect& visibleContentRect() const { return m_visibleContentRect; } void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } @@ -240,7 +240,7 @@ public: virtual bool layerIsAlwaysDamaged() const; - CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } + LayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } virtual Region visibleContentOpaqueRegion() const; @@ -249,18 +249,18 @@ public: // until the new context has been created successfully. virtual void didLoseContext(); - CCScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); } + ScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); } - CCScrollbarLayerImpl* horizontalScrollbarLayer() const; - void setHorizontalScrollbarLayer(CCScrollbarLayerImpl*); + ScrollbarLayerImpl* horizontalScrollbarLayer() const; + void setHorizontalScrollbarLayer(ScrollbarLayerImpl*); - CCScrollbarLayerImpl* verticalScrollbarLayer() const; - void setVerticalScrollbarLayer(CCScrollbarLayerImpl*); + ScrollbarLayerImpl* verticalScrollbarLayer() const; + void setVerticalScrollbarLayer(ScrollbarLayerImpl*); protected: - explicit CCLayerImpl(int); + explicit LayerImpl(int); - void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*, CCAppendQuadsData&) const; + void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsData&) const; IntRect layerRectToContentRect(const WebKit::WebRect& layerRect); @@ -268,7 +268,7 @@ protected: static std::string indentString(int indent); private: - void setParent(CCLayerImpl* parent) { m_parent = parent; } + void setParent(LayerImpl* parent) { m_parent = parent; } friend class TreeSynchronizer; void clearChildList(); // Warning: This does not preserve tree structure invariants and so is only exposed to the tree synchronizer. @@ -281,18 +281,18 @@ private: void dumpLayer(std::string*, int indent) const; - // Properties internal to CCLayerImpl - CCLayerImpl* m_parent; - ScopedPtrVector<CCLayerImpl> m_children; + // Properties internal to LayerImpl + LayerImpl* m_parent; + ScopedPtrVector<LayerImpl> m_children; // m_maskLayer can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one int m_maskLayerId; - scoped_ptr<CCLayerImpl> m_maskLayer; + scoped_ptr<LayerImpl> m_maskLayer; int m_replicaLayerId; // ditto - scoped_ptr<CCLayerImpl> m_replicaLayer; + scoped_ptr<LayerImpl> m_replicaLayer; int m_layerId; - CCLayerTreeHostImpl* m_layerTreeHostImpl; + LayerTreeHostImpl* m_layerTreeHostImpl; - // Properties synchronized from the associated LayerChromium. + // Properties synchronized from the associated Layer. FloatPoint m_anchorPoint; float m_anchorPointZ; IntSize m_bounds; @@ -345,7 +345,7 @@ private: // The layer whose coordinate space this layer draws into. This can be // either the same layer (m_renderTarget == this) or an ancestor of this // layer. - CCLayerImpl* m_renderTarget; + LayerImpl* m_renderTarget; // The global depth value of the center of the layer. This value is used // to sort layers from back to front. @@ -374,7 +374,7 @@ private: // Render surface associated with this layer. The layer and its descendants // will render to this surface. - scoped_ptr<CCRenderSurface> m_renderSurface; + scoped_ptr<RenderSurfaceImpl> m_renderSurface; // Hierarchical bounding rect containing the layer and its descendants. // Uses target surface's space. @@ -386,13 +386,13 @@ private: FloatRect m_updateRect; // Manages animations for this layer. - scoped_ptr<CCLayerAnimationController> m_layerAnimationController; + scoped_ptr<LayerAnimationController> m_layerAnimationController; // Manages scrollbars for this layer - scoped_ptr<CCScrollbarAnimationController> m_scrollbarAnimationController; + scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; }; -void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerImpl*>::iterator end, CCLayerSorter*); +void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>::iterator end, LayerSorter*); } diff --git a/cc/layer_impl_unittest.cc b/cc/layer_impl_unittest.cc index 2a1c3a0..fbccb4b 100644 --- a/cc/layer_impl_unittest.cc +++ b/cc/layer_impl_unittest.cc @@ -50,7 +50,7 @@ namespace { EXPECT_FALSE(grandChild->layerPropertyChanged()); \ EXPECT_TRUE(root->layerSurfacePropertyChanged()) -TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) +TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly) { // // This test checks that layerPropertyChanged() has the correct behavior. @@ -59,12 +59,12 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) // The constructor on this will fake that we are on the correct thread. DebugScopedSetImplThread setImplThread; - // Create a simple CCLayerImpl tree: - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - root->addChild(CCLayerImpl::create(2)); - CCLayerImpl* child = root->children()[0]; - child->addChild(CCLayerImpl::create(3)); - CCLayerImpl* grandChild = child->children()[0]; + // Create a simple LayerImpl tree: + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + root->addChild(LayerImpl::create(2)); + LayerImpl* child = root->children()[0]; + child->addChild(LayerImpl::create(3)); + LayerImpl* grandChild = child->children()[0]; // Adding children is an internal operation and should not mark layers as changed. EXPECT_FALSE(root->layerPropertyChanged()); @@ -98,10 +98,10 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPoint(arbitraryFloatPoint)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPointZ(arbitraryNumber)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(arbitraryFilters)); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(CCLayerImpl::create(4))); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(LayerImpl::create(4))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setContentsOpaque(true)); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(CCLayerImpl::create(5))); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(LayerImpl::create(5))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryFloatPoint)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setDoubleSided(false)); // constructor initializes it to "true". diff --git a/cc/layer_iterator.cc b/cc/layer_iterator.cc index 05af12b..606992d 100644 --- a/cc/layer_iterator.cc +++ b/cc/layer_iterator.cc @@ -14,33 +14,33 @@ namespace cc { template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::BackToFront::begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { it.m_targetRenderSurfaceLayerIndex = 0; - it.m_currentLayerIndex = CCLayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; + it.m_currentLayerIndex = LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; m_highestTargetRenderSurfaceLayer = 0; } template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::BackToFront::end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { - it.m_targetRenderSurfaceLayerIndex = CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; + it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; it.m_currentLayerIndex = 0; } template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::BackToFront::next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { // If the current layer has a RS, move to its layer list. Otherwise, visit the next layer in the current RS layer list. if (it.currentLayerRepresentsContributingRenderSurface()) { - // Save our position in the childLayer list for the RenderSurface, then jump to the next RenderSurface. Save where we - // came from in the next RenderSurface so we can get back to it. + // Save our position in the childLayer list for the RenderSurfaceImpl, then jump to the next RenderSurfaceImpl. Save where we + // came from in the next RenderSurfaceImpl so we can get back to it. it.targetRenderSurface()->m_currentLayerIndexHistory = it.m_currentLayerIndex; int previousTargetRenderSurfaceLayer = it.m_targetRenderSurfaceLayerIndex; it.m_targetRenderSurfaceLayerIndex = ++m_highestTargetRenderSurfaceLayer; - it.m_currentLayerIndex = CCLayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; + it.m_currentLayerIndex = LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; it.targetRenderSurface()->m_targetRenderSurfaceLayerIndexHistory = previousTargetRenderSurfaceLayer; } else { @@ -48,10 +48,10 @@ void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerType, LayerL int targetRenderSurfaceNumChildren = it.targetRenderSurfaceChildren().size(); while (it.m_currentLayerIndex == targetRenderSurfaceNumChildren) { - // Jump back to the previous RenderSurface, and get back the position where we were in that list, and move to the next position there. + // Jump back to the previous RenderSurfaceImpl, and get back the position where we were in that list, and move to the next position there. if (!it.m_targetRenderSurfaceLayerIndex) { // End of the list - it.m_targetRenderSurfaceLayerIndex = CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; + it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; it.m_currentLayerIndex = 0; return; } @@ -64,7 +64,7 @@ void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerType, LayerL } template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::FrontToBack::begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { it.m_targetRenderSurfaceLayerIndex = 0; it.m_currentLayerIndex = it.targetRenderSurfaceChildren().size() - 1; @@ -72,14 +72,14 @@ void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerType, Layer } template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::FrontToBack::end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { - it.m_targetRenderSurfaceLayerIndex = CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; + it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; it.m_currentLayerIndex = 0; } template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::FrontToBack::next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { // Moves to the previous layer in the current RS layer list. Then we check if the // new current layer has its own RS, in which case there are things in that RS layer list that are higher, so @@ -96,7 +96,7 @@ void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerType, LayerL while (it.currentLayerRepresentsTargetRenderSurface()) { if (!it.m_targetRenderSurfaceLayerIndex) { // End of the list - it.m_targetRenderSurfaceLayerIndex = CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; + it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex; it.m_currentLayerIndex = 0; return; } @@ -107,7 +107,7 @@ void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerType, LayerL } template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> -void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) +void LayerIteratorActions::FrontToBack::goToHighestInSubtree(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it) { if (it.currentLayerRepresentsTargetRenderSurface()) return; @@ -124,26 +124,26 @@ void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<L } } -typedef std::vector<scoped_refptr<LayerChromium> > LayerChromiumList; -typedef std::vector<CCLayerImpl*> CCLayerImplList; +typedef std::vector<scoped_refptr<Layer> > LayerList; +typedef std::vector<LayerImpl*> LayerImplList; -// Declare each of the above functions for LayerChromium and CCLayerImpl classes so that they are linked. -template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, BackToFront> &); -template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, BackToFront>&); -template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, BackToFront>&); +// Declare each of the above functions for Layer and LayerImpl classes so that they are linked. +template void LayerIteratorActions::BackToFront::begin(LayerIterator<Layer, LayerList, RenderSurface, BackToFront> &); +template void LayerIteratorActions::BackToFront::end(LayerIterator<Layer, LayerList, RenderSurface, BackToFront>&); +template void LayerIteratorActions::BackToFront::next(LayerIterator<Layer, LayerList, RenderSurface, BackToFront>&); -template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, BackToFront>&); -template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, BackToFront>&); -template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, BackToFront>&); +template void LayerIteratorActions::BackToFront::begin(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>&); +template void LayerIteratorActions::BackToFront::end(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>&); +template void LayerIteratorActions::BackToFront::next(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>&); -template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::next(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::end(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::begin(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::goToHighestInSubtree(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&); -template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::next(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::end(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::begin(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&); +template void LayerIteratorActions::FrontToBack::goToHighestInSubtree(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&); } // namespace cc diff --git a/cc/layer_iterator.h b/cc/layer_iterator.h index dbfac53..e5296b5 100644 --- a/cc/layer_iterator.h +++ b/cc/layer_iterator.h @@ -11,27 +11,27 @@ namespace cc { -// These classes provide means to iterate over the RenderSurface-Layer tree. +// These classes provide means to iterate over the RenderSurfaceImpl-Layer tree. -// Example code follows, for a tree of LayerChromium/RenderSurfaceChromium objects. See below for details. +// Example code follows, for a tree of Layer/RenderSurface objects. See below for details. // -// void doStuffOnLayers(const std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList) +// void doStuffOnLayers(const std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList) // { -// typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; +// typedef LayerIterator<Layer, RenderSurface, LayerIteratorActions::FrontToBack> LayerIteratorType; // -// CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); -// for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { +// LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); +// for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { // // Only one of these will be true // if (it.representsTargetRenderSurface()) -// foo(*it); // *it is a layer representing a target RenderSurface +// foo(*it); // *it is a layer representing a target RenderSurfaceImpl // if (it.representsContributingRenderSurface()) -// bar(*it); // *it is a layer representing a RenderSurface that contributes to the layer's target RenderSurface +// bar(*it); // *it is a layer representing a RenderSurfaceImpl that contributes to the layer's target RenderSurfaceImpl // if (it.representsItself()) -// baz(*it); // *it is a layer representing itself, as it contributes to its own target RenderSurface +// baz(*it); // *it is a layer representing itself, as it contributes to its own target RenderSurfaceImpl // } // } -// A RenderSurface R may be referred to in one of two different contexts. One RenderSurface is "current" at any time, for +// A RenderSurfaceImpl R may be referred to in one of two different contexts. One RenderSurfaceImpl is "current" at any time, for // whatever operation is being performed. This current surface is referred to as a target surface. For example, when R is // being painted it would be the target surface. Once R has been painted, its contents may be included into another // surface S. While S is considered the target surface when it is being painted, R is called a contributing surface @@ -40,12 +40,12 @@ namespace cc { // The iterator's current position in the tree always points to some layer. The state of the iterator indicates the role of the // layer, and will be one of the following three states. A single layer L will appear in the iteration process in at least one, // and possibly all, of these states. -// 1. Representing the target surface: The iterator in this state, pointing at layer L, indicates that the target RenderSurface -// is now the surface owned by L. This will occur exactly once for each RenderSurface in the tree. -// 2. Representing a contributing surface: The iterator in this state, pointing at layer L, refers to the RenderSurface owned -// by L as a contributing surface, without changing the current target RenderSurface. +// 1. Representing the target surface: The iterator in this state, pointing at layer L, indicates that the target RenderSurfaceImpl +// is now the surface owned by L. This will occur exactly once for each RenderSurfaceImpl in the tree. +// 2. Representing a contributing surface: The iterator in this state, pointing at layer L, refers to the RenderSurfaceImpl owned +// by L as a contributing surface, without changing the current target RenderSurfaceImpl. // 3. Representing itself: The iterator in this state, pointing at layer L, refers to the layer itself, as a child of the -// current target RenderSurface. +// current target RenderSurfaceImpl. // // The BackToFront iterator will return a layer representing the target surface before returning layers representing themselves // as children of the current target surface. Whereas the FrontToBack ordering will iterate over children layers of a surface @@ -53,7 +53,7 @@ namespace cc { // // To use the iterators: // -// Create a stepping iterator and end iterator by calling CCLayerIterator::begin() and CCLayerIterator::end() and passing in the +// Create a stepping iterator and end iterator by calling LayerIterator::begin() and LayerIterator::end() and passing in the // list of layers owning target RenderSurfaces. Step through the tree by incrementing the stepping iterator while it is != to // the end iterator. At each step the iterator knows what the layer is representing, and you can query the iterator to decide // what actions to perform with the layer given what it represents. @@ -61,7 +61,7 @@ namespace cc { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Non-templated constants -struct CCLayerIteratorValue { +struct LayerIteratorValue { static const int InvalidTargetRenderSurfaceLayerIndex = -1; // This must be -1 since the iterator action code assumes that this value can be // reached by subtracting one from the position of the first layer in the current @@ -71,7 +71,7 @@ struct CCLayerIteratorValue { // The position of a layer iterator that is independent of its many template types. template <typename LayerType> -struct CCLayerIteratorPosition { +struct LayerIteratorPosition { bool representsTargetRenderSurface; bool representsContributingRenderSurface; bool representsItself; @@ -79,24 +79,24 @@ struct CCLayerIteratorPosition { LayerType* currentLayer; }; -// An iterator class for walking over layers in the RenderSurface-Layer tree. +// An iterator class for walking over layers in the RenderSurfaceImpl-Layer tree. template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename IteratorActionType> -class CCLayerIterator { - typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, IteratorActionType> CCLayerIteratorType; +class LayerIterator { + typedef LayerIterator<LayerType, LayerList, RenderSurfaceType, IteratorActionType> LayerIteratorType; public: - CCLayerIterator() : m_renderSurfaceLayerList(0) { } + LayerIterator() : m_renderSurfaceLayerList(0) { } - static CCLayerIteratorType begin(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, true); } - static CCLayerIteratorType end(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, false); } + static LayerIteratorType begin(const LayerList* renderSurfaceLayerList) { return LayerIteratorType(renderSurfaceLayerList, true); } + static LayerIteratorType end(const LayerList* renderSurfaceLayerList) { return LayerIteratorType(renderSurfaceLayerList, false); } - CCLayerIteratorType& operator++() { m_actions.next(*this); return *this; } - bool operator==(const CCLayerIterator& other) const + LayerIteratorType& operator++() { m_actions.next(*this); return *this; } + bool operator==(const LayerIterator& other) const { return m_targetRenderSurfaceLayerIndex == other.m_targetRenderSurfaceLayerIndex && m_currentLayerIndex == other.m_currentLayerIndex; } - bool operator!=(const CCLayerIteratorType& other) const { return !(*this == other); } + bool operator!=(const LayerIteratorType& other) const { return !(*this == other); } LayerType* operator->() const { return currentLayer(); } LayerType* operator*() const { return currentLayer(); } @@ -107,9 +107,9 @@ public: LayerType* targetRenderSurfaceLayer() const { return getRawPtr((*m_renderSurfaceLayerList)[m_targetRenderSurfaceLayerIndex]); } - operator const CCLayerIteratorPosition<LayerType>() const + operator const LayerIteratorPosition<LayerType>() const { - CCLayerIteratorPosition<LayerType> position; + LayerIteratorPosition<LayerType> position; position.representsTargetRenderSurface = representsTargetRenderSurface(); position.representsContributingRenderSurface = representsContributingRenderSurface(); position.representsItself = representsItself(); @@ -119,7 +119,7 @@ public: } private: - CCLayerIterator(const LayerList* renderSurfaceLayerList, bool start) + LayerIterator(const LayerList* renderSurfaceLayerList, bool start) : m_renderSurfaceLayerList(renderSurfaceLayerList) , m_targetRenderSurfaceLayerIndex(0) { @@ -137,13 +137,13 @@ private: m_actions.end(*this); } - inline static LayerChromium* getRawPtr(const scoped_refptr<LayerChromium>& ptr) { return ptr.get(); } - inline static CCLayerImpl* getRawPtr(CCLayerImpl* ptr) { return ptr; } + inline static Layer* getRawPtr(const scoped_refptr<Layer>& ptr) { return ptr.get(); } + inline static LayerImpl* getRawPtr(LayerImpl* ptr) { return ptr; } inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChildren()[m_currentLayerIndex]); } - inline bool currentLayerRepresentsContributingRenderSurface() const { return CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); } - inline bool currentLayerRepresentsTargetRenderSurface() const { return m_currentLayerIndex == CCLayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; } + inline bool currentLayerRepresentsContributingRenderSurface() const { return LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); } + inline bool currentLayerRepresentsTargetRenderSurface() const { return m_currentLayerIndex == LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; } inline RenderSurfaceType* targetRenderSurface() const { return targetRenderSurfaceLayer()->renderSurface(); } inline const LayerList& targetRenderSurfaceChildren() const { return targetRenderSurface()->layerList(); } @@ -155,31 +155,31 @@ private: // A position in the renderSurfaceLayerList. This points to a layer which owns the current target surface. // This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = number of surfaces). A value outside of - // this range (for example, CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex) is used to + // this range (for example, LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex) is used to // indicate a position outside the bounds of the tree. int m_targetRenderSurfaceLayerIndex; // A position in the list of layers that are children of the current target surface. When pointing to one of // these layers, this is a value from 0 to n-1 (n = number of children). Since the iterator must also stop at // the layers representing the target surface, this is done by setting the currentLayerIndex to a value of - // CCLayerIteratorValue::LayerRepresentingTargetRenderSurface. + // LayerIteratorValue::LayerRepresentingTargetRenderSurface. int m_currentLayerIndex; - friend struct CCLayerIteratorActions; + friend struct LayerIteratorActions; }; -// Orderings for iterating over the RenderSurface-Layer tree. -struct CCLayerIteratorActions { +// Orderings for iterating over the RenderSurfaceImpl-Layer tree. +struct LayerIteratorActions { // Walks layers sorted by z-order from back to front. class BackToFront { public: template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); private: int m_highestTargetRenderSurfaceLayer; @@ -189,17 +189,17 @@ struct CCLayerIteratorActions { class FrontToBack { public: template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); private: template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType> - void goToHighestInSubtree(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); + void goToHighestInSubtree(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&); }; }; diff --git a/cc/layer_iterator_unittest.cc b/cc/layer_iterator_unittest.cc index ecb80ed..39ed7bc2 100644 --- a/cc/layer_iterator_unittest.cc +++ b/cc/layer_iterator_unittest.cc @@ -21,9 +21,9 @@ using ::testing::AnyNumber; namespace { -class TestLayerChromium : public LayerChromium { +class TestLayer : public Layer { public: - static scoped_refptr<TestLayerChromium> create() { return make_scoped_refptr(new TestLayerChromium()); } + static scoped_refptr<TestLayer> create() { return make_scoped_refptr(new TestLayer()); } int m_countRepresentingTargetSurface; int m_countRepresentingContributingSurface; @@ -33,15 +33,15 @@ public: void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; } private: - TestLayerChromium() - : LayerChromium() + TestLayer() + : Layer() , m_drawsContent(true) { setBounds(IntSize(100, 100)); setPosition(IntPoint()); setAnchorPoint(IntPoint()); } - virtual ~TestLayerChromium() + virtual ~TestLayer() { } @@ -53,21 +53,21 @@ private: EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \ EXPECT_EQ(itself, layer->m_countRepresentingItself); -typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack; -typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront; +typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, LayerIteratorActions::FrontToBack> FrontToBack; +typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, LayerIteratorActions::BackToFront> BackToFront; -void resetCounts(std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList) +void resetCounts(std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList) { for (unsigned surfaceIndex = 0; surfaceIndex < renderSurfaceLayerList.size(); ++surfaceIndex) { - TestLayerChromium* renderSurfaceLayer = static_cast<TestLayerChromium*>(renderSurfaceLayerList[surfaceIndex].get()); - RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); + TestLayer* renderSurfaceLayer = static_cast<TestLayer*>(renderSurfaceLayerList[surfaceIndex].get()); + RenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); renderSurfaceLayer->m_countRepresentingTargetSurface = -1; renderSurfaceLayer->m_countRepresentingContributingSurface = -1; renderSurfaceLayer->m_countRepresentingItself = -1; for (unsigned layerIndex = 0; layerIndex < renderSurface->layerList().size(); ++layerIndex) { - TestLayerChromium* layer = static_cast<TestLayerChromium*>(renderSurface->layerList()[layerIndex].get()); + TestLayer* layer = static_cast<TestLayer*>(renderSurface->layerList()[layerIndex].get()); layer->m_countRepresentingTargetSurface = -1; layer->m_countRepresentingContributingSurface = -1; @@ -76,12 +76,12 @@ void resetCounts(std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerL } } -void iterateFrontToBack(std::vector<scoped_refptr<LayerChromium> >* renderSurfaceLayerList) +void iterateFrontToBack(std::vector<scoped_refptr<Layer> >* renderSurfaceLayerList) { resetCounts(*renderSurfaceLayerList); int count = 0; for (FrontToBack it = FrontToBack::begin(renderSurfaceLayerList); it != FrontToBack::end(renderSurfaceLayerList); ++it, ++count) { - TestLayerChromium* layer = static_cast<TestLayerChromium*>(*it); + TestLayer* layer = static_cast<TestLayer*>(*it); if (it.representsTargetRenderSurface()) layer->m_countRepresentingTargetSurface = count; if (it.representsContributingRenderSurface()) @@ -91,12 +91,12 @@ void iterateFrontToBack(std::vector<scoped_refptr<LayerChromium> >* renderSurfac } } -void iterateBackToFront(std::vector<scoped_refptr<LayerChromium> >* renderSurfaceLayerList) +void iterateBackToFront(std::vector<scoped_refptr<Layer> >* renderSurfaceLayerList) { resetCounts(*renderSurfaceLayerList); int count = 0; for (BackToFront it = BackToFront::begin(renderSurfaceLayerList); it != BackToFront::end(renderSurfaceLayerList); ++it, ++count) { - TestLayerChromium* layer = static_cast<TestLayerChromium*>(*it); + TestLayer* layer = static_cast<TestLayer*>(*it); if (it.representsTargetRenderSurface()) layer->m_countRepresentingTargetSurface = count; if (it.representsContributingRenderSurface()) @@ -106,21 +106,21 @@ void iterateBackToFront(std::vector<scoped_refptr<LayerChromium> >* renderSurfac } } -TEST(CCLayerIteratorTest, emptyTree) +TEST(LayerIteratorTest, emptyTree) { - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; iterateBackToFront(&renderSurfaceLayerList); iterateFrontToBack(&renderSurfaceLayerList); } -TEST(CCLayerIteratorTest, simpleTree) +TEST(LayerIteratorTest, simpleTree) { - scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> first = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> second = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> third = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> fourth = TestLayerChromium::create(); + scoped_refptr<TestLayer> rootLayer = TestLayer::create(); + scoped_refptr<TestLayer> first = TestLayer::create(); + scoped_refptr<TestLayer> second = TestLayer::create(); + scoped_refptr<TestLayer> third = TestLayer::create(); + scoped_refptr<TestLayer> fourth = TestLayer::create(); rootLayer->createRenderSurface(); @@ -129,8 +129,8 @@ TEST(CCLayerIteratorTest, simpleTree) rootLayer->addChild(third); rootLayer->addChild(fourth); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; + LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); iterateBackToFront(&renderSurfaceLayerList); EXPECT_COUNT(rootLayer, 0, -1, 1); @@ -148,17 +148,17 @@ TEST(CCLayerIteratorTest, simpleTree) } -TEST(CCLayerIteratorTest, complexTree) +TEST(LayerIteratorTest, complexTree) { - scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root1 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root2 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root3 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root21 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root22 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root23 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root221 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root231 = TestLayerChromium::create(); + scoped_refptr<TestLayer> rootLayer = TestLayer::create(); + scoped_refptr<TestLayer> root1 = TestLayer::create(); + scoped_refptr<TestLayer> root2 = TestLayer::create(); + scoped_refptr<TestLayer> root3 = TestLayer::create(); + scoped_refptr<TestLayer> root21 = TestLayer::create(); + scoped_refptr<TestLayer> root22 = TestLayer::create(); + scoped_refptr<TestLayer> root23 = TestLayer::create(); + scoped_refptr<TestLayer> root221 = TestLayer::create(); + scoped_refptr<TestLayer> root231 = TestLayer::create(); rootLayer->createRenderSurface(); @@ -171,8 +171,8 @@ TEST(CCLayerIteratorTest, complexTree) root22->addChild(root221); root23->addChild(root231); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; + LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); iterateBackToFront(&renderSurfaceLayerList); EXPECT_COUNT(rootLayer, 0, -1, 1); @@ -198,17 +198,17 @@ TEST(CCLayerIteratorTest, complexTree) } -TEST(CCLayerIteratorTest, complexTreeMultiSurface) +TEST(LayerIteratorTest, complexTreeMultiSurface) { - scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root1 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root2 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root3 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root21 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root22 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root23 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root221 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> root231 = TestLayerChromium::create(); + scoped_refptr<TestLayer> rootLayer = TestLayer::create(); + scoped_refptr<TestLayer> root1 = TestLayer::create(); + scoped_refptr<TestLayer> root2 = TestLayer::create(); + scoped_refptr<TestLayer> root3 = TestLayer::create(); + scoped_refptr<TestLayer> root21 = TestLayer::create(); + scoped_refptr<TestLayer> root22 = TestLayer::create(); + scoped_refptr<TestLayer> root23 = TestLayer::create(); + scoped_refptr<TestLayer> root221 = TestLayer::create(); + scoped_refptr<TestLayer> root231 = TestLayer::create(); rootLayer->createRenderSurface(); rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds())); @@ -226,8 +226,8 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) root23->setOpacity(0.5); root23->addChild(root231); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; + LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); iterateBackToFront(&renderSurfaceLayerList); EXPECT_COUNT(rootLayer, 0, -1, 1); diff --git a/cc/layer_painter.h b/cc/layer_painter.h index 14424d1..282efdc 100644 --- a/cc/layer_painter.h +++ b/cc/layer_painter.h @@ -13,9 +13,9 @@ namespace cc { class FloatRect; class IntRect; -class LayerPainterChromium { +class LayerPainter { public: - virtual ~LayerPainterChromium() { } + virtual ~LayerPainter() { } virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) = 0; }; diff --git a/cc/layer_quad.cc b/cc/layer_quad.cc index c7cc42c..2274665 100644 --- a/cc/layer_quad.cc +++ b/cc/layer_quad.cc @@ -11,7 +11,7 @@ namespace cc { -CCLayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q) +LayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q) { DCHECK(p != q); @@ -22,7 +22,7 @@ CCLayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q) scale(1.0f / tangent.length()); } -CCLayerQuad::CCLayerQuad(const FloatQuad& quad) +LayerQuad::LayerQuad(const FloatQuad& quad) { // Create edges. m_left = Edge(quad.p4(), quad.p1()); @@ -37,7 +37,7 @@ CCLayerQuad::CCLayerQuad(const FloatQuad& quad) m_bottom.scale(sign); } -CCLayerQuad::CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom) +LayerQuad::LayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom) : m_left(left) , m_top(top) , m_right(right) @@ -45,7 +45,7 @@ CCLayerQuad::CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, c { } -FloatQuad CCLayerQuad::floatQuad() const +FloatQuad LayerQuad::floatQuad() const { return FloatQuad(m_left.intersect(m_top), m_top.intersect(m_right), @@ -53,7 +53,7 @@ FloatQuad CCLayerQuad::floatQuad() const m_bottom.intersect(m_left)); } -void CCLayerQuad::toFloatArray(float flattened[12]) const +void LayerQuad::toFloatArray(float flattened[12]) const { flattened[0] = m_left.x(); flattened[1] = m_left.y(); diff --git a/cc/layer_quad.h b/cc/layer_quad.h index d468495..9f4dfcf 100644 --- a/cc/layer_quad.h +++ b/cc/layer_quad.h @@ -13,7 +13,7 @@ static const float kAntiAliasingInflateDistance = 0.5f; namespace cc { -class CCLayerQuad { +class LayerQuad { public: class Edge { public: @@ -73,8 +73,8 @@ public: float m_z; }; - CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom); - CCLayerQuad(const FloatQuad&); + LayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom); + LayerQuad(const FloatQuad&); Edge left() const { return m_left; } Edge top() const { return m_top; } diff --git a/cc/layer_quad_unittest.cc b/cc/layer_quad_unittest.cc index 6a1b8ff..c2bb24f 100644 --- a/cc/layer_quad_unittest.cc +++ b/cc/layer_quad_unittest.cc @@ -12,7 +12,7 @@ using namespace cc; namespace { -TEST(CCLayerQuadTest, FloatQuadConversion) +TEST(LayerQuadTest, FloatQuadConversion) { FloatPoint p1(-0.5, -0.5); FloatPoint p2( 0.5, -0.5); @@ -20,15 +20,15 @@ TEST(CCLayerQuadTest, FloatQuadConversion) FloatPoint p4(-0.5, 0.5); FloatQuad quadCW(p1, p2, p3, p4); - CCLayerQuad layerQuadCW(quadCW); + LayerQuad layerQuadCW(quadCW); EXPECT_TRUE(layerQuadCW.floatQuad() == quadCW); FloatQuad quadCCW(p1, p4, p3, p2); - CCLayerQuad layerQuadCCW(quadCCW); + LayerQuad layerQuadCCW(quadCCW); EXPECT_TRUE(layerQuadCCW.floatQuad() == quadCCW); } -TEST(CCLayerQuadTest, Inflate) +TEST(LayerQuadTest, Inflate) { FloatPoint p1(-0.5, -0.5); FloatPoint p2( 0.5, -0.5); @@ -36,7 +36,7 @@ TEST(CCLayerQuadTest, Inflate) FloatPoint p4(-0.5, 0.5); FloatQuad quad(p1, p2, p3, p4); - CCLayerQuad layerQuad(quad); + LayerQuad layerQuad(quad); quad.scale(2, 2); layerQuad.inflate(0.5); EXPECT_TRUE(layerQuad.floatQuad() == quad); diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc index d106442..7d546af 100644 --- a/cc/layer_sorter.cc +++ b/cc/layer_sorter.cc @@ -53,8 +53,8 @@ static bool edgeEdgeTest(const FloatPoint& a, const FloatPoint& b, const FloatPo return true; } -GraphNode::GraphNode(CCLayerImpl* cclayer) - : layer(cclayer) +GraphNode::GraphNode(LayerImpl* layerImpl) + : layer(layerImpl) , incomingEdgeWeight(0) { } @@ -63,19 +63,19 @@ GraphNode::~GraphNode() { } -CCLayerSorter::CCLayerSorter() +LayerSorter::LayerSorter() : m_zRange(0) { } -CCLayerSorter::~CCLayerSorter() +LayerSorter::~LayerSorter() { } // Checks whether layer "a" draws on top of layer "b". The weight value returned is an indication of // the maximum z-depth difference between the layers or zero if the layers are found to be intesecting // (some features are in front and some are behind). -CCLayerSorter::ABCompareResult CCLayerSorter::checkOverlap(LayerShape* a, LayerShape* b, float zThreshold, float& weight) +LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape* b, float zThreshold, float& weight) { weight = 0; @@ -154,14 +154,14 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& FloatPoint clippedQuad[8]; int numVerticesInClippedQuad; - CCMathUtil::mapClippedQuad(drawTransform, layerQuad, clippedQuad, numVerticesInClippedQuad); + MathUtil::mapClippedQuad(drawTransform, layerQuad, clippedQuad, numVerticesInClippedQuad); if (numVerticesInClippedQuad < 3) { projectedBounds = FloatRect(); return; } - projectedBounds = CCMathUtil::computeEnclosingRectOfVertices(clippedQuad, numVerticesInClippedQuad); + projectedBounds = MathUtil::computeEnclosingRectOfVertices(clippedQuad, numVerticesInClippedQuad); // NOTE: it will require very significant refactoring and overhead to deal with // generalized polygons or multiple quads per layer here. For the sake of layer @@ -178,9 +178,9 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& // Compute the normal of the layer's plane. bool clipped = false; - FloatPoint3D c1 = CCMathUtil::mapPoint(drawTransform, FloatPoint3D(0, 0, 0), clipped); - FloatPoint3D c2 = CCMathUtil::mapPoint(drawTransform, FloatPoint3D(0, 1, 0), clipped); - FloatPoint3D c3 = CCMathUtil::mapPoint(drawTransform, FloatPoint3D(1, 0, 0), clipped); + FloatPoint3D c1 = MathUtil::mapPoint(drawTransform, FloatPoint3D(0, 0, 0), clipped); + FloatPoint3D c2 = MathUtil::mapPoint(drawTransform, FloatPoint3D(0, 1, 0), clipped); + FloatPoint3D c3 = MathUtil::mapPoint(drawTransform, FloatPoint3D(1, 0, 0), clipped); // FIXME: Deal with clipping. FloatPoint3D c12 = c2 - c1; FloatPoint3D c13 = c3 - c1; @@ -212,7 +212,7 @@ float LayerShape::layerZFromProjectedPoint(const FloatPoint& p) const return n / d; } -void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::iterator last) +void LayerSorter::createGraphNodes(LayerList::iterator first, LayerList::iterator last) { DVLOG(2) << "Creating graph nodes:"; float minZ = FLT_MAX; @@ -220,7 +220,7 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera for (LayerList::const_iterator it = first; it < last; it++) { m_nodes.push_back(GraphNode(*it)); GraphNode& node = m_nodes.at(m_nodes.size() - 1); - CCRenderSurface* renderSurface = node.layer->renderSurface(); + RenderSurfaceImpl* renderSurface = node.layer->renderSurface(); if (!node.layer->drawsContent() && !renderSurface) continue; @@ -247,7 +247,7 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera m_zRange = fabsf(maxZ - minZ); } -void CCLayerSorter::createGraphEdges() +void LayerSorter::createGraphEdges() { DVLOG(2) << "Edges:"; // Fraction of the total zRange below which z differences @@ -293,7 +293,7 @@ void CCLayerSorter::createGraphEdges() // Finds and removes an edge from the list by doing a swap with the // last element of the list. -void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, std::vector<GraphEdge*>& list) +void LayerSorter::removeEdgeFromList(GraphEdge* edge, std::vector<GraphEdge*>& list) { std::vector<GraphEdge*>::iterator iter = std::find(list.begin(), list.end(), edge); DCHECK(iter != list.end()); @@ -319,7 +319,7 @@ void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, std::vector<GraphEdge*>& // of the original list of layers, since that list should already have proper z-index // ordering of layers. // -void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) +void LayerSorter::sort(LayerList::iterator first, LayerList::iterator last) { DVLOG(2) << "Sorting start ----"; createGraphNodes(first, last); diff --git a/cc/layer_sorter.h b/cc/layer_sorter.h index 587df1e..fbee7c7 100644 --- a/cc/layer_sorter.h +++ b/cc/layer_sorter.h @@ -50,10 +50,10 @@ struct LayerShape { }; struct GraphNode { - explicit GraphNode(CCLayerImpl* cclayer); + explicit GraphNode(LayerImpl* layerImpl); ~GraphNode(); - CCLayerImpl* layer; + LayerImpl* layer; LayerShape shape; std::vector<GraphEdge*> incoming; std::vector<GraphEdge*> outgoing; @@ -75,12 +75,12 @@ struct GraphEdge { -class CCLayerSorter { +class LayerSorter { public: - CCLayerSorter(); - ~CCLayerSorter(); + LayerSorter(); + ~LayerSorter(); - typedef std::vector<CCLayerImpl*> LayerList; + typedef std::vector<LayerImpl*> LayerList; void sort(LayerList::iterator first, LayerList::iterator last); @@ -106,7 +106,7 @@ private: void createGraphEdges(); void removeEdgeFromList(GraphEdge*, std::vector<GraphEdge*>&); - DISALLOW_COPY_AND_ASSIGN(CCLayerSorter); + DISALLOW_COPY_AND_ASSIGN(LayerSorter); }; } diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc index 09e4055..608105a 100644 --- a/cc/layer_sorter_unittest.cc +++ b/cc/layer_sorter_unittest.cc @@ -21,9 +21,9 @@ namespace { // meaning that layers with smaller z values (more negative) are further from the camera // and therefore must be drawn before layers with higher z values. -TEST(CCLayerSorterTest, BasicOverlap) +TEST(LayerSorterTest, BasicOverlap) { - CCLayerSorter::ABCompareResult overlapResult; + LayerSorter::ABCompareResult overlapResult; const float zThreshold = 0.1f; float weight = 0; @@ -36,29 +36,29 @@ TEST(CCLayerSorterTest, BasicOverlap) neg5Translate.translate3d(0, 0, -5); LayerShape back(2, 2, neg5Translate); - overlapResult = CCLayerSorter::checkOverlap(&front, &back, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::BBeforeA, overlapResult); + overlapResult = LayerSorter::checkOverlap(&front, &back, zThreshold, weight); + EXPECT_EQ(LayerSorter::BBeforeA, overlapResult); EXPECT_EQ(1, weight); - overlapResult = CCLayerSorter::checkOverlap(&back, &front, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult); + overlapResult = LayerSorter::checkOverlap(&back, &front, zThreshold, weight); + EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); EXPECT_EQ(1, weight); // One layer translated off to the right. No overlap should be detected. WebTransformationMatrix rightTranslate; rightTranslate.translate3d(10, 0, -5); LayerShape backRight(2, 2, rightTranslate); - overlapResult = CCLayerSorter::checkOverlap(&front, &backRight, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::None, overlapResult); + overlapResult = LayerSorter::checkOverlap(&front, &backRight, zThreshold, weight); + EXPECT_EQ(LayerSorter::None, overlapResult); // When comparing a layer with itself, z difference is always 0. - overlapResult = CCLayerSorter::checkOverlap(&front, &front, zThreshold, weight); + overlapResult = LayerSorter::checkOverlap(&front, &front, zThreshold, weight); EXPECT_EQ(0, weight); } -TEST(CCLayerSorterTest, RightAngleOverlap) +TEST(LayerSorterTest, RightAngleOverlap) { - CCLayerSorter::ABCompareResult overlapResult; + LayerSorter::ABCompareResult overlapResult; const float zThreshold = 0.1f; float weight = 0; @@ -76,13 +76,13 @@ TEST(CCLayerSorterTest, RightAngleOverlap) frontFaceMatrix.translate(-1, -1); LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); - overlapResult = CCLayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::BBeforeA, overlapResult); + overlapResult = LayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight); + EXPECT_EQ(LayerSorter::BBeforeA, overlapResult); } -TEST(CCLayerSorterTest, IntersectingLayerOverlap) +TEST(LayerSorterTest, IntersectingLayerOverlap) { - CCLayerSorter::ABCompareResult overlapResult; + LayerSorter::ABCompareResult overlapResult; const float zThreshold = 0.1f; float weight = 0; @@ -101,14 +101,14 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) throughMatrix.translateRight3d(0, 0, -4); throughMatrix.translate(-1, -1); LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); - overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); - EXPECT_NE(CCLayerSorter::None, overlapResult); + overlapResult = LayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); + EXPECT_NE(LayerSorter::None, overlapResult); EXPECT_EQ(0, weight); } -TEST(CCLayerSorterTest, LayersAtAngleOverlap) +TEST(LayerSorterTest, LayersAtAngleOverlap) { - CCLayerSorter::ABCompareResult overlapResult; + LayerSorter::ABCompareResult overlapResult; const float zThreshold = 0.1f; float weight = 0; @@ -139,17 +139,17 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) transformC.translate(-4, -10); LayerShape layerC(8, 20, transformC); - overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult); - overlapResult = CCLayerSorter::checkOverlap(&layerC, &layerB, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult); - overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::None, overlapResult); + overlapResult = LayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight); + EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); + overlapResult = LayerSorter::checkOverlap(&layerC, &layerB, zThreshold, weight); + EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); + overlapResult = LayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weight); + EXPECT_EQ(LayerSorter::None, overlapResult); } -TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) +TEST(LayerSorterTest, LayersUnderPathologicalPerspectiveTransform) { - CCLayerSorter::ABCompareResult overlapResult; + LayerSorter::ABCompareResult overlapResult; const float zThreshold = 0.1f; float weight = 0; @@ -180,14 +180,14 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // of layer B go behind the w = 0 plane. FloatQuad testQuad = FloatQuad(FloatRect(FloatPoint(-0.5, -0.5), FloatSize(1, 1))); bool clipped = false; - CCMathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); + MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); ASSERT_TRUE(clipped); - overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weight); - EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult); + overlapResult = LayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weight); + EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); } -TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) +TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) { DebugScopedSetImplThread thisScopeIsOnImplThread; @@ -195,7 +195,7 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) // existing ordering provided on input should be retained. This test covers the fix in // https://bugs.webkit.org/show_bug.cgi?id=75046. Before this fix, ordering was // accidentally reversed, causing bugs in z-index ordering on websites when - // preserves3D triggered the CCLayerSorter. + // preserves3D triggered the LayerSorter. // Input list of layers: [1, 2, 3, 4, 5]. // Expected output: [3, 4, 1, 2, 5]. @@ -203,11 +203,11 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) // - 3 and 4 do not have a 3d z difference, and therefore their relative ordering should be retained. // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5. - scoped_ptr<CCLayerImpl> layer1 = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> layer2 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> layer3 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> layer4 = CCLayerImpl::create(4); - scoped_ptr<CCLayerImpl> layer5 = CCLayerImpl::create(5); + scoped_ptr<LayerImpl> layer1 = LayerImpl::create(1); + scoped_ptr<LayerImpl> layer2 = LayerImpl::create(2); + scoped_ptr<LayerImpl> layer3 = LayerImpl::create(3); + scoped_ptr<LayerImpl> layer4 = LayerImpl::create(4); + scoped_ptr<LayerImpl> layer5 = LayerImpl::create(5); WebTransformationMatrix BehindMatrix; BehindMatrix.translate3d(0, 0, 2); @@ -239,7 +239,7 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) layer5->setDrawTransform(BehindMatrix); layer5->setDrawsContent(true); - std::vector<CCLayerImpl*> layerList; + std::vector<LayerImpl*> layerList; layerList.push_back(layer1.get()); layerList.push_back(layer2.get()); layerList.push_back(layer3.get()); @@ -253,7 +253,7 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) EXPECT_EQ(4, layerList[3]->id()); EXPECT_EQ(5, layerList[4]->id()); - CCLayerSorter layerSorter; + LayerSorter layerSorter; layerSorter.sort(layerList.begin(), layerList.end()); ASSERT_EQ(static_cast<size_t>(5), layerList.size()); diff --git a/cc/layer_texture_updater.cc b/cc/layer_texture_updater.cc index c97a986..38a1307 100644 --- a/cc/layer_texture_updater.cc +++ b/cc/layer_texture_updater.cc @@ -8,7 +8,7 @@ namespace cc { -LayerTextureUpdater::Texture::Texture(scoped_ptr<CCPrioritizedTexture> texture) +LayerTextureUpdater::Texture::Texture(scoped_ptr<PrioritizedTexture> texture) : m_texture(texture.Pass()) { } diff --git a/cc/layer_texture_updater.h b/cc/layer_texture_updater.h index 838e342..741d255 100644 --- a/cc/layer_texture_updater.h +++ b/cc/layer_texture_updater.h @@ -15,8 +15,8 @@ namespace cc { class IntRect; class IntSize; class TextureManager; -struct CCRenderingStats; -class CCTextureUpdateQueue; +struct RenderingStats; +class TextureUpdateQueue; class LayerTextureUpdater : public base::RefCounted<LayerTextureUpdater> { public: @@ -25,16 +25,16 @@ public: public: virtual ~Texture(); - CCPrioritizedTexture* texture() { return m_texture.get(); } - void swapTextureWith(scoped_ptr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); } + PrioritizedTexture* texture() { return m_texture.get(); } + void swapTextureWith(scoped_ptr<PrioritizedTexture>& texture) { m_texture.swap(texture); } // TODO(reveman): partialUpdate should be a property of this class // instead of an argument passed to update(). - virtual void update(CCTextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) = 0; + virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) = 0; protected: - explicit Texture(scoped_ptr<CCPrioritizedTexture> texture); + explicit Texture(scoped_ptr<PrioritizedTexture> texture); private: - scoped_ptr<CCPrioritizedTexture> m_texture; + scoped_ptr<PrioritizedTexture> m_texture; }; LayerTextureUpdater() { } @@ -44,7 +44,7 @@ public: SampledTexelFormatBGRA, SampledTexelFormatInvalid, }; - virtual scoped_ptr<Texture> createTexture(CCPrioritizedTextureManager*) = 0; + virtual scoped_ptr<Texture> createTexture(PrioritizedTextureManager*) = 0; // Returns the format of the texel uploaded by this interface. // This format should not be confused by texture internal format. // This format specifies the component order in the sampled texel. @@ -52,7 +52,7 @@ public: virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) = 0; // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater, // then this region should be ignored in preference for the entire layer's area. - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { } + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&) { } // Set true by the layer when it is known that the entire output is going to be opaque. virtual void setOpaque(bool) { } diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc index 63750b1..e551479 100644 --- a/cc/layer_tiling_data.cc +++ b/cc/layer_tiling_data.cc @@ -13,22 +13,22 @@ using namespace std; namespace cc { -scoped_ptr<CCLayerTilingData> CCLayerTilingData::create(const IntSize& tileSize, BorderTexelOption border) +scoped_ptr<LayerTilingData> LayerTilingData::create(const IntSize& tileSize, BorderTexelOption border) { - return make_scoped_ptr(new CCLayerTilingData(tileSize, border)); + return make_scoped_ptr(new LayerTilingData(tileSize, border)); } -CCLayerTilingData::CCLayerTilingData(const IntSize& tileSize, BorderTexelOption border) +LayerTilingData::LayerTilingData(const IntSize& tileSize, BorderTexelOption border) : m_tilingData(tileSize, IntSize(), border == HasBorderTexels) { setTileSize(tileSize); } -CCLayerTilingData::~CCLayerTilingData() +LayerTilingData::~LayerTilingData() { } -void CCLayerTilingData::setTileSize(const IntSize& size) +void LayerTilingData::setTileSize(const IntSize& size) { if (tileSize() == size) return; @@ -38,12 +38,12 @@ void CCLayerTilingData::setTileSize(const IntSize& size) m_tilingData.setMaxTextureSize(size); } -IntSize CCLayerTilingData::tileSize() const +IntSize LayerTilingData::tileSize() const { return m_tilingData.maxTextureSize(); } -void CCLayerTilingData::setBorderTexelOption(BorderTexelOption borderTexelOption) +void LayerTilingData::setBorderTexelOption(BorderTexelOption borderTexelOption) { bool borderTexels = borderTexelOption == HasBorderTexels; if (hasBorderTexels() == borderTexels) @@ -53,36 +53,36 @@ void CCLayerTilingData::setBorderTexelOption(BorderTexelOption borderTexelOption m_tilingData.setHasBorderTexels(borderTexels); } -const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& tiler) +const LayerTilingData& LayerTilingData::operator=(const LayerTilingData& tiler) { m_tilingData = tiler.m_tilingData; return *this; } -void CCLayerTilingData::addTile(scoped_ptr<Tile> tile, int i, int j) +void LayerTilingData::addTile(scoped_ptr<Tile> tile, int i, int j) { DCHECK(!tileAt(i, j)); tile->moveTo(i, j); m_tiles.add(make_pair(i, j), tile.Pass()); } -scoped_ptr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j) +scoped_ptr<LayerTilingData::Tile> LayerTilingData::takeTile(int i, int j) { return m_tiles.take_and_erase(make_pair(i, j)); } -CCLayerTilingData::Tile* CCLayerTilingData::tileAt(int i, int j) const +LayerTilingData::Tile* LayerTilingData::tileAt(int i, int j) const { return m_tiles.get(make_pair(i, j)); } -void CCLayerTilingData::reset() +void LayerTilingData::reset() { m_tiles.clear(); } -void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const +void LayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const { // An empty rect doesn't result in an empty set of tiles, so don't pass an empty rect. // FIXME: Possibly we should fill a vector of tiles instead, @@ -95,14 +95,14 @@ void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1); } -IntRect CCLayerTilingData::tileRect(const Tile* tile) const +IntRect LayerTilingData::tileRect(const Tile* tile) const { IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j()); tileRect.setSize(tileSize()); return tileRect; } -Region CCLayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const +Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const { if (contentRect.isEmpty()) return Region(); @@ -123,7 +123,7 @@ Region CCLayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) return opaqueRegion; } -void CCLayerTilingData::setBounds(const IntSize& size) +void LayerTilingData::setBounds(const IntSize& size) { m_tilingData.setTotalSize(size); if (size.isEmpty()) { @@ -143,7 +143,7 @@ void CCLayerTilingData::setBounds(const IntSize& size) m_tiles.erase(invalidTileKeys[i]); } -IntSize CCLayerTilingData::bounds() const +IntSize LayerTilingData::bounds() const { return m_tilingData.totalSize(); } diff --git a/cc/layer_tiling_data.h b/cc/layer_tiling_data.h index 2be7b4c..97c59fd 100644 --- a/cc/layer_tiling_data.h +++ b/cc/layer_tiling_data.h @@ -16,13 +16,13 @@ namespace cc { -class CCLayerTilingData { +class LayerTilingData { public: enum BorderTexelOption { HasBorderTexels, NoBorderTexels }; - ~CCLayerTilingData(); + ~LayerTilingData(); - static scoped_ptr<CCLayerTilingData> create(const IntSize& tileSize, BorderTexelOption); + static scoped_ptr<LayerTilingData> create(const IntSize& tileSize, BorderTexelOption); bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); } int numTilesX() const { return m_tilingData.numTilesX(); } @@ -39,7 +39,7 @@ public: bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); } - const CCLayerTilingData& operator=(const CCLayerTilingData&); + const LayerTilingData& operator=(const LayerTilingData&); class Tile { public: @@ -77,7 +77,7 @@ public: void reset(); protected: - CCLayerTilingData(const IntSize& tileSize, BorderTexelOption); + LayerTilingData(const IntSize& tileSize, BorderTexelOption); TileMap m_tiles; TilingData m_tilingData; diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc index f50ab4b..047e93f 100644 --- a/cc/layer_tree_host.cc +++ b/cc/layer_tree_host.cc @@ -34,9 +34,9 @@ static int numLayerTreeInstances; namespace cc { -bool CCLayerTreeHost::s_needsFilterContext = false; +bool LayerTreeHost::s_needsFilterContext = false; -CCLayerTreeSettings::CCLayerTreeSettings() +LayerTreeSettings::LayerTreeSettings() : acceleratePainting(false) , showFPSCounter(false) , showPlatformLayerTree(false) @@ -55,7 +55,7 @@ CCLayerTreeSettings::CCLayerTreeSettings() { } -CCLayerTreeSettings::~CCLayerTreeSettings() +LayerTreeSettings::~LayerTreeSettings() { } @@ -77,20 +77,20 @@ RendererCapabilities::~RendererCapabilities() { } -bool CCLayerTreeHost::anyLayerTreeHostInstanceExists() +bool LayerTreeHost::anyLayerTreeHostInstanceExists() { return numLayerTreeInstances > 0; } -scoped_ptr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCLayerTreeSettings& settings) +scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, const LayerTreeSettings& settings) { - scoped_ptr<CCLayerTreeHost> layerTreeHost(new CCLayerTreeHost(client, settings)); + scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)); if (!layerTreeHost->initialize()) - return scoped_ptr<CCLayerTreeHost>(); + return scoped_ptr<LayerTreeHost>(); return layerTreeHost.Pass(); } -CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTreeSettings& settings) +LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings) : m_animating(false) , m_needsAnimateLayers(false) , m_client(client) @@ -111,29 +111,29 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre , m_hasTransparentBackground(false) , m_partialTextureUpdateRequests(0) { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); numLayerTreeInstances++; } -bool CCLayerTreeHost::initialize() +bool LayerTreeHost::initialize() { - TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); + TRACE_EVENT0("cc", "LayerTreeHost::initialize"); - if (CCProxy::hasImplThread()) - m_proxy = CCThreadProxy::create(this); + if (Proxy::hasImplThread()) + m_proxy = ThreadProxy::create(this); else - m_proxy = CCSingleThreadProxy::create(this); + m_proxy = SingleThreadProxy::create(this); m_proxy->start(); return m_proxy->initializeContext(); } -CCLayerTreeHost::~CCLayerTreeHost() +LayerTreeHost::~LayerTreeHost() { if (m_rootLayer) m_rootLayer->setLayerTreeHost(0); - DCHECK(CCProxy::isMainThread()); - TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost"); + DCHECK(Proxy::isMainThread()); + TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); DCHECK(m_proxy.get()); m_proxy->stop(); m_proxy.reset(); @@ -143,14 +143,14 @@ CCLayerTreeHost::~CCLayerTreeHost() it->second->stop(); } -void CCLayerTreeHost::setSurfaceReady() +void LayerTreeHost::setSurfaceReady() { m_proxy->setSurfaceReady(); } -void CCLayerTreeHost::initializeRenderer() +void LayerTreeHost::initializeRenderer() { - TRACE_EVENT0("cc", "CCLayerTreeHost::initializeRenderer"); + TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer"); if (!m_proxy->initializeRenderer()) { // Uh oh, better tell the client that we can't do anything with this context. m_client->didRecreateOutputSurface(false); @@ -163,7 +163,7 @@ void CCLayerTreeHost::initializeRenderer() // Update m_settings based on partial update capability. m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); - m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool); + m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool); m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GL_RGBA); m_rendererInitialized = true; @@ -174,9 +174,9 @@ void CCLayerTreeHost::initializeRenderer() min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); } -CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() +LayerTreeHost::RecreateResult LayerTreeHost::recreateContext() { - TRACE_EVENT0("cc", "CCLayerTreeHost::recreateContext"); + TRACE_EVENT0("cc", "LayerTreeHost::recreateContext"); DCHECK(m_contextLost); bool recreated = false; @@ -198,7 +198,7 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() // FIXME: The single thread does not self-schedule context // recreation. So force another recreation attempt to happen by requesting // another commit. - if (!CCProxy::hasImplThread()) + if (!Proxy::hasImplThread()) setNeedsCommit(); return RecreateFailedButTryAgain; } @@ -209,20 +209,20 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() return RecreateFailedAndGaveUp; } -void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider) +void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); if (m_rendererInitialized) m_contentsTextureManager->clearAllMemory(resourceProvider); } -void CCLayerTreeHost::acquireLayerTextures() +void LayerTreeHost::acquireLayerTextures() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); m_proxy->acquireLayerTextures(); } -void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) +void LayerTreeHost::updateAnimations(double monotonicFrameBeginTime) { m_animating = true; m_client->animate(monotonicFrameBeginTime); @@ -232,25 +232,25 @@ void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) m_renderingStats.numAnimationFrames++; } -void CCLayerTreeHost::layout() +void LayerTreeHost::layout() { m_client->layout(); } -void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) +void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) { - DCHECK(CCProxy::isImplThread()); - TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); + DCHECK(Proxy::isImplThread()); + TRACE_EVENT0("cc", "LayerTreeHost::commitTo"); } -// This function commits the CCLayerTreeHost to an impl tree. When modifying +// This function commits the LayerTreeHost to an impl tree. When modifying // this function, keep in mind that the function *runs* on the impl thread! Any -// code that is logically a main thread operation, e.g. deletion of a LayerChromium, -// should be delayed until the CCLayerTreeHost::commitComplete, which will run +// code that is logically a main thread operation, e.g. deletion of a Layer, +// should be delayed until the LayerTreeHost::commitComplete, which will run // after the commit, but on the main thread. -void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) +void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); m_contentsTextureManager->updateBackingsInDrawingImplTree(); m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); @@ -258,7 +258,7 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->detachLayerTree(), hostImpl)); if (m_rootLayer && m_hudLayer) - hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTreeHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); + hostImpl->setHudLayer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); else hostImpl->setHudLayer(0); @@ -277,18 +277,18 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) m_commitNumber++; } -void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) +void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) { m_fontAtlas = fontAtlas.Pass(); setNeedsCommit(); } -void CCLayerTreeHost::willCommit() +void LayerTreeHost::willCommit() { m_client->willCommit(); if (m_rootLayer && m_settings.showDebugInfo()) { if (!m_hudLayer) - m_hudLayer = HeadsUpDisplayLayerChromium::create(); + m_hudLayer = HeadsUpDisplayLayer::create(); if (m_fontAtlas.get()) m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); @@ -298,37 +298,37 @@ void CCLayerTreeHost::willCommit() } } -void CCLayerTreeHost::commitComplete() +void LayerTreeHost::commitComplete() { m_deleteTextureAfterCommitList.clear(); m_client->didCommit(); } -scoped_ptr<CCGraphicsContext> CCLayerTreeHost::createContext() +scoped_ptr<GraphicsContext> LayerTreeHost::createContext() { return m_client->createOutputSurface(); } -scoped_ptr<CCInputHandler> CCLayerTreeHost::createInputHandler() +scoped_ptr<InputHandler> LayerTreeHost::createInputHandler() { return m_client->createInputHandler(); } -scoped_ptr<CCLayerTreeHostImpl> CCLayerTreeHost::createLayerTreeHostImpl(CCLayerTreeHostImplClient* client) +scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHostImplClient* client) { - return CCLayerTreeHostImpl::create(m_settings, client); + return LayerTreeHostImpl::create(m_settings, client); } -void CCLayerTreeHost::didLoseContext() +void LayerTreeHost::didLoseContext() { - TRACE_EVENT0("cc", "CCLayerTreeHost::didLoseContext"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); + DCHECK(Proxy::isMainThread()); m_contextLost = true; m_numFailedRecreateAttempts = 0; setNeedsCommit(); } -bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) +bool LayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) { m_triggerIdleUpdates = false; bool ret = m_proxy->compositeAndReadback(pixels, rect); @@ -336,60 +336,60 @@ bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) return ret; } -void CCLayerTreeHost::finishAllRendering() +void LayerTreeHost::finishAllRendering() { if (!m_rendererInitialized) return; m_proxy->finishAllRendering(); } -void CCLayerTreeHost::renderingStats(CCRenderingStats* stats) const +void LayerTreeHost::renderingStats(RenderingStats* stats) const { *stats = m_renderingStats; m_proxy->renderingStats(stats); } -const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const +const RendererCapabilities& LayerTreeHost::rendererCapabilities() const { return m_proxy->rendererCapabilities(); } -void CCLayerTreeHost::setNeedsAnimate() +void LayerTreeHost::setNeedsAnimate() { - DCHECK(CCProxy::hasImplThread()); + DCHECK(Proxy::hasImplThread()); m_proxy->setNeedsAnimate(); } -void CCLayerTreeHost::setNeedsCommit() +void LayerTreeHost::setNeedsCommit() { m_proxy->setNeedsCommit(); } -void CCLayerTreeHost::setNeedsRedraw() +void LayerTreeHost::setNeedsRedraw() { m_proxy->setNeedsRedraw(); - if (!CCThreadProxy::implThread()) + if (!ThreadProxy::implThread()) m_client->scheduleComposite(); } -bool CCLayerTreeHost::commitRequested() const +bool LayerTreeHost::commitRequested() const { return m_proxy->commitRequested(); } -void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime) +void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, double wallClockTime) { - DCHECK(CCThreadProxy::isMainThread()); + DCHECK(ThreadProxy::isMainThread()); setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime); } -void CCLayerTreeHost::didAddAnimation() +void LayerTreeHost::didAddAnimation() { m_needsAnimateLayers = true; m_proxy->didAddAnimation(); } -void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) +void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) { if (m_rootLayer == rootLayer) return; @@ -406,7 +406,7 @@ void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) setNeedsCommit(); } -void CCLayerTreeHost::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize) +void LayerTreeHost::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize) { if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize) return; @@ -417,7 +417,7 @@ void CCLayerTreeHost::setViewportSize(const IntSize& layoutViewportSize, const I setNeedsCommit(); } -void CCLayerTreeHost::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) +void LayerTreeHost::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) { if (pageScaleFactor == m_pageScaleFactor && minPageScaleFactor == m_minPageScaleFactor && maxPageScaleFactor == m_maxPageScaleFactor) return; @@ -428,7 +428,7 @@ void CCLayerTreeHost::setPageScaleFactorAndLimits(float pageScaleFactor, float m setNeedsCommit(); } -void CCLayerTreeHost::setVisible(bool visible) +void LayerTreeHost::setVisible(bool visible) { if (m_visible == visible) return; @@ -436,35 +436,35 @@ void CCLayerTreeHost::setVisible(bool visible) m_proxy->setVisible(visible); } -void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) +void LayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) { m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationSec); } -void CCLayerTreeHost::loseContext(int numTimes) +void LayerTreeHost::loseContext(int numTimes) { - TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", numTimes); + TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTimes); m_numTimesRecreateShouldFail = numTimes - 1; m_proxy->loseContext(); } -CCPrioritizedTextureManager* CCLayerTreeHost::contentsTextureManager() const +PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const { return m_contentsTextureManager.get(); } -void CCLayerTreeHost::composite() +void LayerTreeHost::composite() { - DCHECK(!CCThreadProxy::implThread()); - static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); + DCHECK(!ThreadProxy::implThread()); + static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately(); } -void CCLayerTreeHost::scheduleComposite() +void LayerTreeHost::scheduleComposite() { m_client->scheduleComposite(); } -bool CCLayerTreeHost::initializeRendererIfNeeded() +bool LayerTreeHost::initializeRendererIfNeeded() { if (!m_rendererInitialized) { initializeRenderer(); @@ -479,7 +479,7 @@ bool CCLayerTreeHost::initializeRendererIfNeeded() return true; } -void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes) +void LayerTreeHost::updateLayers(TextureUpdateQueue& queue, size_t memoryAllocationLimitBytes) { DCHECK(m_rendererInitialized); DCHECK(memoryAllocationLimitBytes); @@ -495,7 +495,7 @@ void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAll updateLayers(rootLayer(), queue); } -static void setScale(LayerChromium* layer, float deviceScaleFactor, float pageScaleFactor) +static void setScale(Layer* layer, float deviceScaleFactor, float pageScaleFactor) { if (layer->boundsContainPageScale()) layer->setContentsScale(deviceScaleFactor); @@ -503,7 +503,7 @@ static void setScale(LayerChromium* layer, float deviceScaleFactor, float pageSc layer->setContentsScale(deviceScaleFactor * pageScaleFactor); } -static LayerChromium* findFirstScrollableLayer(LayerChromium* layer) +static Layer* findFirstScrollableLayer(Layer* layer) { if (!layer) return 0; @@ -512,7 +512,7 @@ static LayerChromium* findFirstScrollableLayer(LayerChromium* layer) return layer; for (size_t i = 0; i < layer->children().size(); ++i) { - LayerChromium* found = findFirstScrollableLayer(layer->children()[i].get()); + Layer* found = findFirstScrollableLayer(layer->children()[i].get()); if (found) return found; } @@ -520,26 +520,26 @@ static LayerChromium* findFirstScrollableLayer(LayerChromium* layer) return 0; } -static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, float pageScaleFactor) +static void updateLayerScale(Layer* layer, float deviceScaleFactor, float pageScaleFactor) { setScale(layer, deviceScaleFactor, pageScaleFactor); - LayerChromium* maskLayer = layer->maskLayer(); + Layer* maskLayer = layer->maskLayer(); if (maskLayer) setScale(maskLayer, deviceScaleFactor, pageScaleFactor); - LayerChromium* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLayer()->maskLayer() : 0; + Layer* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLayer()->maskLayer() : 0; if (replicaMaskLayer) setScale(replicaMaskLayer, deviceScaleFactor, pageScaleFactor); - const std::vector<scoped_refptr<LayerChromium> >& children = layer->children(); + const std::vector<scoped_refptr<Layer> >& children = layer->children(); for (unsigned int i = 0; i < children.size(); ++i) updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor); } -void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueue& queue) +void LayerTreeHost::updateLayers(Layer* rootLayer, TextureUpdateQueue& queue) { - TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); + TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); updateLayerScale(rootLayer, m_deviceScaleFactor, m_pageScaleFactor); @@ -547,13 +547,13 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu { if (Settings::pageScalePinchZoomEnabled()) { - LayerChromium* rootScroll = findFirstScrollableLayer(rootLayer); + Layer* rootScroll = findFirstScrollableLayer(rootLayer); if (rootScroll) rootScroll->setImplTransform(m_implTransform); } - TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); + TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); + LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); } // Reset partial texture update requests. @@ -567,23 +567,23 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu updateList[i]->clearRenderSurface(); } -void CCLayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) +void LayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) { // Surfaces have a place holder for their memory since they are managed // independantly but should still be tracked and reduce other memory usage. m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()); - m_surfaceMemoryPlaceholder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); + m_surfaceMemoryPlaceholder->setRequestPriority(PriorityCalculator::renderSurfacePriority()); m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryBytes); } -void CCLayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) +void LayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) { // Use BackToFront since it's cheap and this isn't order-dependent. - typedef CCLayerIterator<LayerChromium, LayerList, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType; + typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions::BackToFront> LayerIteratorType; - CCPriorityCalculator calculator; - CCLayerIteratorType end = CCLayerIteratorType::end(&updateList); - for (CCLayerIteratorType it = CCLayerIteratorType::begin(&updateList); it != end; ++it) { + PriorityCalculator calculator; + LayerIteratorType end = LayerIteratorType::end(&updateList); + for (LayerIteratorType it = LayerIteratorType::begin(&updateList); it != end; ++it) { if (it.representsItself()) it->setTexturePriorities(calculator); else if (it.representsTargetRenderSurface()) { @@ -595,7 +595,7 @@ void CCLayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) } } -void CCLayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList, CCOverdrawMetrics& metrics) +void LayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList, OverdrawMetrics& metrics) { m_contentsTextureManager->clearPriorities(); @@ -610,7 +610,7 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList m_contentsTextureManager->prioritizeTextures(); } -size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList) +size_t LayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList) { size_t readbackBytes = 0; size_t maxBackgroundTextureBytes = 0; @@ -618,10 +618,10 @@ size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& update // Start iteration at 1 to skip the root surface as it does not have a texture cost. for (size_t i = 1; i < updateList.size(); ++i) { - LayerChromium* renderSurfaceLayer = updateList[i].get(); - RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); + Layer* renderSurfaceLayer = updateList[i].get(); + RenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GL_RGBA); + size_t bytes = Texture::memorySizeBytes(renderSurface->contentRect().size(), GL_RGBA); contentsTextureBytes += bytes; if (renderSurfaceLayer->backgroundFilters().isEmpty()) @@ -630,25 +630,25 @@ size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& update if (bytes > maxBackgroundTextureBytes) maxBackgroundTextureBytes = bytes; if (!readbackBytes) - readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GL_RGBA); + readbackBytes = Texture::memorySizeBytes(m_deviceViewportSize, GL_RGBA); } return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; } -bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdateQueue& queue) +bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, TextureUpdateQueue& queue) { // Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point // in code, we already know that at least something will be drawn into this render surface, so the // mask and replica should be painted. bool needMoreUpdates = false; - LayerChromium* maskLayer = renderSurfaceLayer->maskLayer(); + Layer* maskLayer = renderSurfaceLayer->maskLayer(); if (maskLayer) { maskLayer->update(queue, 0, m_renderingStats); needMoreUpdates |= maskLayer->needMoreUpdates(); } - LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0; + Layer* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0; if (replicaMaskLayer) { replicaMaskLayer->update(queue, 0, m_renderingStats); needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); @@ -656,20 +656,20 @@ bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLay return needMoreUpdates; } -bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, CCTextureUpdateQueue& queue) +bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, TextureUpdateQueue& queue) { // Use FrontToBack to allow for testing occlusion and performing culling during the tree walk. - typedef CCLayerIterator<LayerChromium, LayerList, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; + typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions::FrontToBack> LayerIteratorType; bool needMoreUpdates = false; bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. - CCOcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect(), recordMetricsForFrame); + OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect(), recordMetricsForFrame); occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize); prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics()); - CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); - for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { + LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); + for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { occlusionTracker.enterLayer(it); if (it.representsTargetRenderSurface()) { @@ -689,16 +689,16 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList return needMoreUpdates; } -void CCLayerTreeHost::applyScrollAndScale(const CCScrollAndScaleSet& info) +void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info) { if (!m_rootLayer) return; - LayerChromium* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); + Layer* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); IntSize rootScrollDelta; for (size_t i = 0; i < info.scrolls.size(); ++i) { - LayerChromium* layer = CCLayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), info.scrolls[i].layerId); + Layer* layer = LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), info.scrolls[i].layerId); if (!layer) continue; if (layer == rootScrollLayer) @@ -710,12 +710,12 @@ void CCLayerTreeHost::applyScrollAndScale(const CCScrollAndScaleSet& info) m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); } -void CCLayerTreeHost::setImplTransform(const WebKit::WebTransformationMatrix& transform) +void LayerTreeHost::setImplTransform(const WebKit::WebTransformationMatrix& transform) { m_implTransform = transform; } -void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) +void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) { if (m_animating) return; @@ -731,7 +731,7 @@ void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) } } -void CCLayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) +void LayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) { RateLimiterMap::iterator it = m_rateLimiters.find(context); if (it != m_rateLimiters.end()) { @@ -740,19 +740,19 @@ void CCLayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) } } -void CCLayerTreeHost::rateLimit() +void LayerTreeHost::rateLimit() { // Force a no-op command on the compositor context, so that any ratelimiting commands will wait for the compositing // context, and therefore for the SwapBuffers. m_proxy->forceSerializeOnSwapBuffers(); } -bool CCLayerTreeHost::bufferedUpdates() +bool LayerTreeHost::bufferedUpdates() { return m_settings.maxPartialTextureUpdates != numeric_limits<size_t>::max(); } -bool CCLayerTreeHost::requestPartialTextureUpdate() +bool LayerTreeHost::requestPartialTextureUpdate() { if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) return false; @@ -761,12 +761,12 @@ bool CCLayerTreeHost::requestPartialTextureUpdate() return true; } -void CCLayerTreeHost::deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture> texture) +void LayerTreeHost::deleteTextureAfterCommit(scoped_ptr<PrioritizedTexture> texture) { m_deleteTextureAfterCommitList.append(texture.Pass()); } -void CCLayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) +void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) { if (deviceScaleFactor == m_deviceScaleFactor) return; @@ -775,22 +775,22 @@ void CCLayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) setNeedsCommit(); } -void CCLayerTreeHost::animateLayers(double monotonicTime) +void LayerTreeHost::animateLayers(double monotonicTime) { if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) return; - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTime); } -bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double monotonicTime) +bool LayerTreeHost::animateLayersRecursive(Layer* current, double monotonicTime) { if (!current) return false; bool subtreeNeedsAnimateLayers = false; - CCLayerAnimationController* currentController = current->layerAnimationController(); + LayerAnimationController* currentController = current->layerAnimationController(); currentController->animate(monotonicTime, 0); // If the current controller still has an active animation, we must continue animating layers. @@ -805,14 +805,14 @@ bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono return subtreeNeedsAnimateLayers; } -void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector& events, LayerChromium* layer, double wallClockTime) +void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& events, Layer* layer, double wallClockTime) { if (!layer) return; for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { if (layer->id() == events[eventIndex].layerId) { - if (events[eventIndex].type == CCAnimationEvent::Started) + if (events[eventIndex].type == AnimationEvent::Started) layer->notifyAnimationStarted(events[eventIndex], wallClockTime); else layer->notifyAnimationFinished(wallClockTime); diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h index 1c89e26..7f3e6d6 100644 --- a/cc/layer_tree_host.h +++ b/cc/layer_tree_host.h @@ -36,19 +36,19 @@ struct hash<WebKit::WebGraphicsContext3D*> { namespace cc { -class CCFontAtlas; -class CCLayerChromium; -class CCLayerTreeHostImpl; -class CCLayerTreeHostImplClient; -class CCPrioritizedTextureManager; -class CCTextureUpdateQueue; -class HeadsUpDisplayLayerChromium; +class FontAtlas; +class Layer; +class LayerTreeHostImpl; +class LayerTreeHostImplClient; +class PrioritizedTextureManager; +class TextureUpdateQueue; +class HeadsUpDisplayLayer; class Region; -struct CCScrollAndScaleSet; +struct ScrollAndScaleSet; -struct CCLayerTreeSettings { - CCLayerTreeSettings(); - ~CCLayerTreeSettings(); +struct LayerTreeSettings { + LayerTreeSettings(); + ~LayerTreeSettings(); bool acceleratePainting; bool showFPSCounter; @@ -70,7 +70,7 @@ struct CCLayerTreeSettings { bool showDebugRects() const { return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects; } }; -// Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost +// Provides information on an Impl's rendering capabilities back to the LayerTreeHost struct RendererCapabilities { RendererCapabilities(); ~RendererCapabilities(); @@ -87,32 +87,32 @@ struct RendererCapabilities { int maxTextureSize; }; -class CCLayerTreeHost : public RateLimiterClient { +class LayerTreeHost : public RateLimiterClient { public: - static scoped_ptr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCLayerTreeSettings&); - virtual ~CCLayerTreeHost(); + static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTreeSettings&); + virtual ~LayerTreeHost(); void setSurfaceReady(); - // Returns true if any CCLayerTreeHost is alive. + // Returns true if any LayerTreeHost is alive. static bool anyLayerTreeHostInstanceExists(); static bool needsFilterContext() { return s_needsFilterContext; } static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterContext = needsFilterContext; } bool needsSharedContext() const { return needsFilterContext() || settings().acceleratePainting; } - // CCLayerTreeHost interface to CCProxy. + // LayerTreeHost interface to Proxy. void willBeginFrame() { m_client->willBeginFrame(); } void didBeginFrame() { m_client->didBeginFrame(); } void updateAnimations(double monotonicFrameBeginTime); void layout(); - void beginCommitOnImplThread(CCLayerTreeHostImpl*); - void finishCommitOnImplThread(CCLayerTreeHostImpl*); + void beginCommitOnImplThread(LayerTreeHostImpl*); + void finishCommitOnImplThread(LayerTreeHostImpl*); void willCommit(); void commitComplete(); - scoped_ptr<CCGraphicsContext> createContext(); - scoped_ptr<CCInputHandler> createInputHandler(); - virtual scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*); + scoped_ptr<GraphicsContext> createContext(); + scoped_ptr<InputHandler> createInputHandler(); + virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostImplClient*); void didLoseContext(); enum RecreateResult { RecreateSucceeded, @@ -122,13 +122,13 @@ public: RecreateResult recreateContext(); void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } - void deleteContentsTexturesOnImplThread(CCResourceProvider*); + void deleteContentsTexturesOnImplThread(ResourceProvider*); virtual void acquireLayerTextures(); // Returns false if we should abort this frame due to initialization failure. bool initializeRendererIfNeeded(); - void updateLayers(CCTextureUpdateQueue&, size_t contentsMemoryLimitBytes); + void updateLayers(TextureUpdateQueue&, size_t contentsMemoryLimitBytes); - CCLayerTreeHostClient* client() { return m_client; } + LayerTreeHostClient* client() { return m_client; } // Only used when compositing on the main thread. void composite(); @@ -143,7 +143,7 @@ public: int commitNumber() const { return m_commitNumber; } - void renderingStats(CCRenderingStats*) const; + void renderingStats(RenderingStats*) const; const RendererCapabilities& rendererCapabilities() const; @@ -156,14 +156,14 @@ public: void setNeedsRedraw(); bool commitRequested() const; - void setAnimationEvents(scoped_ptr<CCAnimationEventsVector>, double wallClockTime); + void setAnimationEvents(scoped_ptr<AnimationEventsVector>, double wallClockTime); virtual void didAddAnimation(); - LayerChromium* rootLayer() { return m_rootLayer.get(); } - const LayerChromium* rootLayer() const { return m_rootLayer.get(); } - void setRootLayer(scoped_refptr<LayerChromium>); + Layer* rootLayer() { return m_rootLayer.get(); } + const Layer* rootLayer() const { return m_rootLayer.get(); } + void setRootLayer(scoped_refptr<Layer>); - const CCLayerTreeSettings& settings() const { return m_settings; } + const LayerTreeSettings& settings() const { return m_settings; } void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize); @@ -176,14 +176,14 @@ public: void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; } - CCPrioritizedTextureManager* contentsTextureManager() const; + PrioritizedTextureManager* contentsTextureManager() const; bool visible() const { return m_visible; } void setVisible(bool); void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec); - void applyScrollAndScale(const CCScrollAndScaleSet&); + void applyScrollAndScale(const ScrollAndScaleSet&); void setImplTransform(const WebKit::WebTransformationMatrix&); void startRateLimiter(WebKit::WebGraphicsContext3D*); @@ -194,61 +194,61 @@ public: bool bufferedUpdates(); bool requestPartialTextureUpdate(); - void deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture>); + void deleteTextureAfterCommit(scoped_ptr<PrioritizedTexture>); void setDeviceScaleFactor(float); float deviceScaleFactor() const { return m_deviceScaleFactor; } - void setFontAtlas(scoped_ptr<CCFontAtlas>); + void setFontAtlas(scoped_ptr<FontAtlas>); - HeadsUpDisplayLayerChromium* hudLayer() const { return m_hudLayer.get(); } + HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } protected: - CCLayerTreeHost(CCLayerTreeHostClient*, const CCLayerTreeSettings&); + LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); bool initialize(); private: - typedef std::vector<scoped_refptr<LayerChromium> > LayerList; + typedef std::vector<scoped_refptr<Layer> > LayerList; void initializeRenderer(); - void update(LayerChromium*, CCTextureUpdateQueue&, const CCOcclusionTracker*); - bool paintLayerContents(const LayerList&, CCTextureUpdateQueue&); - bool paintMasksForRenderSurface(LayerChromium*, CCTextureUpdateQueue&); + void update(Layer*, TextureUpdateQueue&, const OcclusionTracker*); + bool paintLayerContents(const LayerList&, TextureUpdateQueue&); + bool paintMasksForRenderSurface(Layer*, TextureUpdateQueue&); - void updateLayers(LayerChromium*, CCTextureUpdateQueue&); + void updateLayers(Layer*, TextureUpdateQueue&); - void prioritizeTextures(const LayerList&, CCOverdrawMetrics&); + void prioritizeTextures(const LayerList&, OverdrawMetrics&); void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); void setPrioritiesForLayers(const LayerList&); size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); void animateLayers(double monotonicTime); - bool animateLayersRecursive(LayerChromium* current, double monotonicTime); - void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromium*, double wallClockTime); + bool animateLayersRecursive(Layer* current, double monotonicTime); + void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, double wallClockTime); bool m_animating; bool m_needsAnimateLayers; - CCLayerTreeHostClient* m_client; + LayerTreeHostClient* m_client; int m_commitNumber; - CCRenderingStats m_renderingStats; + RenderingStats m_renderingStats; - scoped_ptr<CCProxy> m_proxy; + scoped_ptr<Proxy> m_proxy; bool m_rendererInitialized; bool m_contextLost; int m_numTimesRecreateShouldFail; int m_numFailedRecreateAttempts; - scoped_refptr<LayerChromium> m_rootLayer; - scoped_refptr<HeadsUpDisplayLayerChromium> m_hudLayer; - scoped_ptr<CCFontAtlas> m_fontAtlas; + scoped_refptr<Layer> m_rootLayer; + scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; + scoped_ptr<FontAtlas> m_fontAtlas; - scoped_ptr<CCPrioritizedTextureManager> m_contentsTextureManager; - scoped_ptr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder; + scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; + scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder; - CCLayerTreeSettings m_settings; + LayerTreeSettings m_settings; IntSize m_layoutViewportSize; IntSize m_deviceViewportSize; @@ -267,13 +267,13 @@ private: SkColor m_backgroundColor; bool m_hasTransparentBackground; - typedef ScopedPtrVector<CCPrioritizedTexture> TextureList; + typedef ScopedPtrVector<PrioritizedTexture> TextureList; TextureList m_deleteTextureAfterCommitList; size_t m_partialTextureUpdateRequests; static bool s_needsFilterContext; - DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHost); + DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); }; } // namespace cc diff --git a/cc/layer_tree_host_client.h b/cc/layer_tree_host_client.h index 1c88a75..981e9ec 100644 --- a/cc/layer_tree_host_client.h +++ b/cc/layer_tree_host_client.h @@ -12,10 +12,10 @@ class WebCompositorOutputSurface; } namespace cc { -class CCInputHandler; +class InputHandler; class IntSize; -class CCLayerTreeHostClient { +class LayerTreeHostClient { public: virtual void willBeginFrame() = 0; // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit(). @@ -25,7 +25,7 @@ public: virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0; virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0; virtual void didRecreateOutputSurface(bool success) = 0; - virtual scoped_ptr<CCInputHandler> createInputHandler() = 0; + virtual scoped_ptr<InputHandler> createInputHandler() = 0; virtual void willCommit() = 0; virtual void didCommit() = 0; virtual void didCommitAndDrawFrame() = 0; @@ -35,7 +35,7 @@ public: virtual void scheduleComposite() = 0; protected: - virtual ~CCLayerTreeHostClient() { } + virtual ~LayerTreeHostClient() { } }; } diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc index 43c98ee..062eb0f 100644 --- a/cc/layer_tree_host_common.cc +++ b/cc/layer_tree_host_common.cc @@ -21,18 +21,18 @@ using WebKit::WebTransformationMatrix; namespace cc { -CCScrollAndScaleSet::CCScrollAndScaleSet() +ScrollAndScaleSet::ScrollAndScaleSet() { } -CCScrollAndScaleSet::~CCScrollAndScaleSet() +ScrollAndScaleSet::~ScrollAndScaleSet() { } -IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform) +IntRect LayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform) { // Is this layer fully contained within the target surface? - IntRect layerInSurfaceSpace = CCMathUtil::mapClippedRect(transform, layerBoundRect); + IntRect layerInSurfaceSpace = MathUtil::mapClippedRect(transform, layerBoundRect); if (targetSurfaceRect.contains(layerInSurfaceSpace)) return layerBoundRect; @@ -47,7 +47,7 @@ IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurface // axis-aligned), but is a reasonable filter on the space to consider. // Non-invertible transforms will create an empty rect here. const WebTransformationMatrix surfaceToLayer = transform.inverse(); - IntRect layerRect = enclosingIntRect(CCMathUtil::projectClippedRect(surfaceToLayer, FloatRect(minimalSurfaceRect))); + IntRect layerRect = enclosingIntRect(MathUtil::projectClippedRect(surfaceToLayer, FloatRect(minimalSurfaceRect))); layerRect.intersect(layerBoundRect); return layerRect; } @@ -126,14 +126,14 @@ static IntRect calculateVisibleContentRect(LayerType* layer) // In this case the target surface does clip layers that contribute to it. So, we // have convert the current surface's clipRect from its ancestor surface space to // the current surface space. - targetSurfaceClipRect = enclosingIntRect(CCMathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect())); + targetSurfaceClipRect = enclosingIntRect(MathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect())); targetSurfaceClipRect.intersect(layer->drawableContentRect()); } if (targetSurfaceClipRect.isEmpty()) return IntRect(); - return CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, IntRect(IntPoint(), layer->contentBounds()), layer->drawTransform()); + return LayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, IntRect(IntPoint(), layer->contentBounds()), layer->drawTransform()); } static bool isScaleOrTranslation(const WebTransformationMatrix& m) @@ -144,22 +144,22 @@ static bool isScaleOrTranslation(const WebTransformationMatrix& m) && m.m44(); } -static inline bool transformToParentIsKnown(CCLayerImpl*) +static inline bool transformToParentIsKnown(LayerImpl*) { return true; } -static inline bool transformToParentIsKnown(LayerChromium* layer) +static inline bool transformToParentIsKnown(Layer* layer) { return !layer->transformIsAnimating(); } -static inline bool transformToScreenIsKnown(CCLayerImpl*) +static inline bool transformToScreenIsKnown(LayerImpl*) { return true; } -static inline bool transformToScreenIsKnown(LayerChromium* layer) +static inline bool transformToScreenIsKnown(Layer* layer) { return !layer->screenSpaceTransformIsAnimating(); } @@ -198,7 +198,7 @@ static bool layerShouldBeSkipped(LayerType* layer) return false; } -static inline bool subtreeShouldBeSkipped(CCLayerImpl* layer) +static inline bool subtreeShouldBeSkipped(LayerImpl* layer) { // The opacity of a layer always applies to its children (either implicitly // via a render surface or explicitly if the parent preserves 3D), so the @@ -206,7 +206,7 @@ static inline bool subtreeShouldBeSkipped(CCLayerImpl* layer) return !layer->opacity(); } -static inline bool subtreeShouldBeSkipped(LayerChromium* layer) +static inline bool subtreeShouldBeSkipped(Layer* layer) { // If the opacity is being animated then the opacity on the main thread is unreliable // (since the impl thread may be using a different opacity), so it should not be trusted. @@ -226,7 +226,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig bool descendantDrawsContent = layer->descendantDrawsContent(); // - // A layer and its descendants should render onto a new RenderSurface if any of these rules hold: + // A layer and its descendants should render onto a new RenderSurfaceImpl if any of these rules hold: // // If we force it. @@ -261,7 +261,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig return false; } -WebTransformationMatrix computeScrollCompensationForThisLayer(CCLayerImpl* scrollingLayer, const WebTransformationMatrix& parentMatrix) +WebTransformationMatrix computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer, const WebTransformationMatrix& parentMatrix) { // For every layer that has non-zero scrollDelta, we have to compute a transform that can undo the // scrollDelta translation. In particular, we want this matrix to premultiply a fixed-position layer's @@ -289,14 +289,14 @@ WebTransformationMatrix computeScrollCompensationForThisLayer(CCLayerImpl* scrol return scrollCompensationForThisLayer; } -WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerChromium* currentLayer, const WebTransformationMatrix& currentParentMatrix, const WebTransformationMatrix& currentScrollCompensation) +WebTransformationMatrix computeScrollCompensationMatrixForChildren(Layer* currentLayer, const WebTransformationMatrix& currentParentMatrix, const WebTransformationMatrix& currentScrollCompensation) { - // The main thread (i.e. LayerChromium) does not need to worry about scroll compensation. + // The main thread (i.e. Layer) does not need to worry about scroll compensation. // So we can just return an identity matrix here. return WebTransformationMatrix(); } -WebTransformationMatrix computeScrollCompensationMatrixForChildren(CCLayerImpl* layer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix) +WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerImpl* layer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix) { // "Total scroll compensation" is the transform needed to cancel out all scrollDelta translations that // occurred since the nearest container layer, even if there are renderSurfaces in-between. @@ -500,7 +500,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // layerScreenSpaceTransform represents the transform between root layer's "screen space" and local content space. WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix; if (!layer->preserves3D()) - CCMathUtil::flattenTransformTo2d(layerScreenSpaceTransform); + MathUtil::flattenTransformTo2d(layerScreenSpaceTransform); layerScreenSpaceTransform.multiply(drawTransform); layer->setScreenSpaceTransform(layerScreenSpaceTransform); @@ -513,8 +513,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay FloatRect contentRect(FloatPoint(), layer->contentBounds()); - // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurface's space. - // nextHierarchyMatrix will only change if this layer uses a new RenderSurface, otherwise remains the same. + // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. + // nextHierarchyMatrix will only change if this layer uses a new RenderSurfaceImpl, otherwise remains the same. WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; WebTransformationMatrix sublayerMatrix; @@ -557,7 +557,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); // Update the aggregate hierarchy matrix to include the transform of the - // newly created RenderSurface. + // newly created RenderSurfaceImpl. nextHierarchyMatrix.multiply(renderSurface->drawTransform()); // The new renderSurface here will correctly clip the entire subtree. So, we do @@ -618,7 +618,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay } } - IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(layer->drawTransform(), contentRect)); + IntRect rectInTargetSpace = enclosingIntRect(MathUtil::mapClippedRect(layer->drawTransform(), contentRect)); if (layerClipsSubtree(layer)) { subtreeShouldBeClipped = true; @@ -631,7 +631,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // Flatten to 2D if the layer doesn't preserve 3D. if (!layer->preserves3D()) - CCMathUtil::flattenTransformTo2d(sublayerMatrix); + MathUtil::flattenTransformTo2d(sublayerMatrix); // Apply the sublayer transform at the center of the layer. sublayerMatrix.translate(0.5 * bounds.width(), 0.5 * bounds.height()); @@ -650,7 +650,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay IntRect accumulatedDrawableContentRectOfChildren; for (size_t i = 0; i < layer->children().size(); ++i) { - LayerType* child = CCLayerTreeHostCommon::getChildAsRawPtr(layer->children(), i); + LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children(), i); IntRect drawableContentRectOfChildSubtree; calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels, @@ -691,12 +691,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay if (!layer->replicaLayer() && transformToParentIsKnown(layer)) { // Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself. if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) { - IntRect surfaceClipRect = CCLayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform()); + IntRect surfaceClipRect = LayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform()); clippedContentRect.intersect(surfaceClipRect); } } - // The RenderSurface backing texture cannot exceed the maximum supported + // The RenderSurfaceImpl backing texture cannot exceed the maximum supported // texture size. clippedContentRect.setWidth(std::min(clippedContentRect.width(), maxTextureSize)); clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTextureSize)); @@ -762,30 +762,30 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPassLayer(layer); } -void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList) +void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList) { IntRect totalDrawableContentRect; WebTransformationMatrix identityMatrix; WebTransformationMatrix deviceScaleTransform; deviceScaleTransform.scale(deviceScaleFactor); - setupRootLayerAndSurfaceForRecursion<LayerChromium, std::vector<scoped_refptr<LayerChromium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); + setupRootLayerAndSurfaceForRecursion<Layer, std::vector<scoped_refptr<Layer> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); - cc::calculateDrawTransformsInternal<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, + cc::calculateDrawTransformsInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, rootLayer->renderSurface()->layerList(), 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); } -void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSorter, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList) +void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, LayerSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList) { IntRect totalDrawableContentRect; WebTransformationMatrix identityMatrix; WebTransformationMatrix deviceScaleTransform; deviceScaleTransform.scale(deviceScaleFactor); - setupRootLayerAndSurfaceForRecursion<CCLayerImpl, std::vector<CCLayerImpl*> >(rootLayer, renderSurfaceLayerList, deviceViewportSize); + setupRootLayerAndSurfaceForRecursion<LayerImpl, std::vector<LayerImpl*> >(rootLayer, renderSurfaceLayerList, deviceViewportSize); - cc::calculateDrawTransformsInternal<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, + cc::calculateDrawTransformsInternal<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); } @@ -798,7 +798,7 @@ static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformat // Transform the hit test point from screen space to the local space of the given rect. bool clipped = false; - FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), FloatPoint(screenSpacePoint), clipped); + FloatPoint hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), FloatPoint(screenSpacePoint), clipped); // If projectPoint could not project to a valid value, then we assume that this point doesn't hit this rect. if (clipped) @@ -807,9 +807,9 @@ static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformat return localSpaceRect.contains(hitTestPointInLocalSpace); } -static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, CCLayerImpl* layer) +static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, LayerImpl* layer) { - CCLayerImpl* currentLayer = layer; + LayerImpl* currentLayer = layer; // Walk up the layer tree and hit-test any renderSurfaces and any layer clipRects that are active. while (currentLayer) { @@ -818,7 +818,7 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, // Note that drawableContentRects are actually in targetSurface space, so the transform we // have to provide is the target surface's screenSpaceTransform. - CCLayerImpl* renderTarget = currentLayer->renderTarget(); + LayerImpl* renderTarget = currentLayer->renderTarget(); if (layerClipsSubtree(currentLayer) && !pointHitsRect(screenSpacePoint, renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->drawableContentRect())) return true; @@ -829,19 +829,19 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, return false; } -CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList) +LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList) { - CCLayerImpl* foundLayer = 0; + LayerImpl* foundLayer = 0; - typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; - CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); + typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; + LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); - for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { + for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { // We don't want to consider renderSurfaces for hit testing. if (!it.representsItself()) continue; - CCLayerImpl* currentLayer = (*it); + LayerImpl* currentLayer = (*it); FloatRect contentRect(FloatPoint::zero(), currentLayer->contentBounds()); if (!pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform(), contentRect)) diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h index 238dd8d..4be3ae1 100644 --- a/cc/layer_tree_host_common.h +++ b/cc/layer_tree_host_common.h @@ -14,19 +14,19 @@ namespace cc { -class CCLayerImpl; -class CCLayerSorter; -class LayerChromium; +class LayerImpl; +class LayerSorter; +class Layer; -class CCLayerTreeHostCommon { +class LayerTreeHostCommon { public: static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&); - static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList); - static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList); + static void calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList); + static void calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, LayerSorter*, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList); // Performs hit testing for a given renderSurfaceLayerList. - static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList); + static LayerImpl* findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList); template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID); @@ -34,12 +34,12 @@ public: // from the given root layer (including mask and replica layers). template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId); - static LayerChromium* getChildAsRawPtr(const std::vector<scoped_refptr<LayerChromium> >& children, size_t index) + static Layer* getChildAsRawPtr(const std::vector<scoped_refptr<Layer> >& children, size_t index) { return children[index].get(); } - static CCLayerImpl* getChildAsRawPtr(const ScopedPtrVector<CCLayerImpl>& children, size_t index) + static LayerImpl* getChildAsRawPtr(const ScopedPtrVector<LayerImpl>& children, size_t index) { return children[index]; } @@ -50,16 +50,16 @@ public: }; }; -struct CCScrollAndScaleSet { - CCScrollAndScaleSet(); - ~CCScrollAndScaleSet(); +struct ScrollAndScaleSet { + ScrollAndScaleSet(); + ~ScrollAndScaleSet(); - Vector<CCLayerTreeHostCommon::ScrollUpdateInfo> scrolls; + Vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; float pageScaleDelta; }; template<typename LayerType> -bool CCLayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, int targetSurfaceLayerID) +bool LayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, int targetSurfaceLayerID) { // A layer will either contribute its own content, or its render surface's content, to // the target surface. The layer contributes its surface's content when both the @@ -73,7 +73,7 @@ bool CCLayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, i } template<typename LayerType> -LayerType* CCLayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int layerId) +LayerType* LayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int layerId) { if (rootLayer->id() == layerId) return rootLayer; diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc index 2792b03..76857ed 100644 --- a/cc/layer_tree_host_common_unittest.cc +++ b/cc/layer_tree_host_common_unittest.cc @@ -39,41 +39,41 @@ void setLayerPropertiesForTesting(LayerType* layer, const WebTransformationMatri layer->setPreserves3D(preserves3D); } -void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) +void setLayerPropertiesForTesting(Layer* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) { - setLayerPropertiesForTesting<LayerChromium>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D); + setLayerPropertiesForTesting<Layer>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D); } -void setLayerPropertiesForTesting(CCLayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) +void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) { - setLayerPropertiesForTesting<CCLayerImpl>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D); + setLayerPropertiesForTesting<LayerImpl>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D); layer->setContentBounds(bounds); } -void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer, float deviceScaleFactor = 1) +void executeCalculateDrawTransformsAndVisibility(Layer* rootLayer, float deviceScaleFactor = 1) { WebTransformationMatrix identityMatrix; - std::vector<scoped_refptr<LayerChromium> > dummyRenderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList; int dummyMaxTextureSize = 512; IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); // We are probably not testing what is intended if the rootLayer bounds are empty. DCHECK(!rootLayer->bounds().isEmpty()); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList); } -void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer, float deviceScaleFactor = 1) +void executeCalculateDrawTransformsAndVisibility(LayerImpl* rootLayer, float deviceScaleFactor = 1) { // Note: this version skips layer sorting. WebTransformationMatrix identityMatrix; - std::vector<CCLayerImpl*> dummyRenderSurfaceLayerList; + std::vector<LayerImpl*> dummyRenderSurfaceLayerList; int dummyMaxTextureSize = 512; IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); // We are probably not testing what is intended if the rootLayer bounds are empty. DCHECK(!rootLayer->bounds().isEmpty()); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); } WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& mat) @@ -89,12 +89,12 @@ WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& return ret; } -scoped_ptr<CCLayerImpl> createTreeForFixedPositionTests() +scoped_ptr<LayerImpl> createTreeForFixedPositionTests() { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<LayerImpl> child = LayerImpl::create(2); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3); + scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4); WebTransformationMatrix IdentityMatrix; FloatPoint anchor(0, 0); @@ -112,45 +112,45 @@ scoped_ptr<CCLayerImpl> createTreeForFixedPositionTests() return root.Pass(); } -class LayerChromiumWithForcedDrawsContent : public LayerChromium { +class LayerWithForcedDrawsContent : public Layer { public: - LayerChromiumWithForcedDrawsContent() - : LayerChromium() + LayerWithForcedDrawsContent() + : Layer() { } virtual bool drawsContent() const OVERRIDE { return true; } private: - virtual ~LayerChromiumWithForcedDrawsContent() + virtual ~LayerWithForcedDrawsContent() { } }; -class MockContentLayerChromiumClient : public ContentLayerChromiumClient { +class MockContentLayerClient : public ContentLayerClient { public: - MockContentLayerChromiumClient() { } - virtual ~MockContentLayerChromiumClient() { } + MockContentLayerClient() { } + virtual ~MockContentLayerClient() { } virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) OVERRIDE { } }; -scoped_refptr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerChromiumClient* delegate) +scoped_refptr<ContentLayer> createDrawableContentLayer(ContentLayerClient* delegate) { - scoped_refptr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegate); + scoped_refptr<ContentLayer> toReturn = ContentLayer::create(delegate); toReturn->setIsDrawable(true); return toReturn; } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) +TEST(LayerTreeHostCommonTest, verifyTransformsForNoOpLayer) { // Sanity check: For layers positioned at zero, with zero size, // and with identity transforms, then the drawTransform, // screenSpaceTransform, and the hierarchy passed on to children // layers should also be identity transforms. - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild = Layer::create(); parent->addChild(child); child->addChild(grandChild); @@ -167,10 +167,10 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) +TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer) { WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> layer = LayerChromium::create(); + scoped_refptr<Layer> layer = Layer::create(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. WebTransformationMatrix arbitraryTranslation; @@ -231,12 +231,12 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) +TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) { WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild = Layer::create(); parent->addChild(child); child->addChild(grandChild); @@ -310,11 +310,11 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) +TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(child); child->addChild(grandChild); @@ -357,12 +357,12 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->screenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) +TEST(LayerTreeHostCommonTest, verifyTransformsForReplica) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> childReplica = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> childReplica = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(child); child->addChild(grandChild); child->setReplicaLayer(childReplica.get()); @@ -404,7 +404,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaScreenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) +TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) { // This test creates a more complex tree and verifies it all at once. This covers the following cases: // - layers that are described w.r.t. a render surface: should have draw transforms described w.r.t. that surface @@ -413,17 +413,17 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // - Sanity check on recursion: verify transforms of layers described w.r.t. a render surface that is described w.r.t. an ancestor render surface. // - verifying that each layer has a reference to the correct renderSurface and renderTarget values. - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface2 = LayerChromium::create(); - scoped_refptr<LayerChromium> childOfRoot = LayerChromium::create(); - scoped_refptr<LayerChromium> childOfRS1 = LayerChromium::create(); - scoped_refptr<LayerChromium> childOfRS2 = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaOfRS1 = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaOfRS2 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChildOfRoot = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<Layer> renderSurface2 = Layer::create(); + scoped_refptr<Layer> childOfRoot = Layer::create(); + scoped_refptr<Layer> childOfRS1 = Layer::create(); + scoped_refptr<Layer> childOfRS2 = Layer::create(); + scoped_refptr<Layer> replicaOfRS1 = Layer::create(); + scoped_refptr<Layer> replicaOfRS2 = Layer::create(); + scoped_refptr<Layer> grandChildOfRoot = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChildOfRS1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> grandChildOfRS2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(renderSurface1); parent->addChild(childOfRoot); renderSurface1->addChild(childOfRS1); @@ -563,16 +563,16 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForFlatteningLayer) +TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer) { // For layers that flatten their subtree, there should be an orthographic projection // (for x and y values) in the middle of the transform sequence. Note that the way the // code is currently implemented, it is not expected to use a canonical orthographic // projection. - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); WebTransformationMatrix rotationAboutYAxis; rotationAboutYAxis.rotate3d(0, 30, 0); @@ -608,7 +608,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForFlatteningLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildScreenSpaceTransform, grandChild->screenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer) +TEST(LayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer) { // A layer that is empty in one axis, but not the other, was accidentally skipping a necessary translation. // Without that translation, the coordinate space of the layer's drawTransform is incorrect. @@ -616,9 +616,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer) // Normally this isn't a problem, because the layer wouldn't be drawn anyway, but if that layer becomes a renderSurface, then // its drawTransform is implicitly inherited by the rest of the subtree, which then is positioned incorrectly as a result. - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); // The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms. const WebTransformationMatrix identityMatrix; @@ -638,11 +638,11 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer) +TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent()); const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -654,9 +654,9 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp renderSurface1->addChild(child); renderSurface1->setForceRenderSurface(true); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // The child layer's content is entirely outside the parent's clip rect, so the intermediate // render surface should not be listed here, even if it was forced to be created. Render surfaces without children or visible @@ -666,11 +666,11 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp EXPECT_EQ(1U, renderSurfaceLayerList.size()); } -TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) +TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent()); const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -681,9 +681,9 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) renderSurface1->setForceRenderSurface(true); renderSurface1->setOpacity(0); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Since the layer is transparent, renderSurface1->renderSurface() should not have gotten added anywhere. // Also, the drawable content rect should not have been extended by the children. @@ -694,11 +694,11 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) EXPECT_EQ(IntRect(), parent->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) +TEST(LayerTreeHostCommonTest, verifyForceRenderSurface) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent()); renderSurface1->setForceRenderSurface(true); const WebTransformationMatrix identityMatrix; @@ -713,9 +713,9 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) EXPECT_FALSE(parent->renderSurface()); EXPECT_FALSE(renderSurface1->renderSurface()); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // The root layer always creates a renderSurface EXPECT_TRUE(parent->renderSurface()); @@ -724,21 +724,21 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) renderSurfaceLayerList.clear(); renderSurface1->setForceRenderSurface(false); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); EXPECT_TRUE(parent->renderSurface()); EXPECT_FALSE(renderSurface1->renderSurface()); EXPECT_EQ(1U, renderSurfaceLayerList.size()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDirectContainer) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDirectContainer) { // This test checks for correct scroll compensation when the fixed-position container // is the direct parent of the fixed-position layer. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; child->setIsContainerForFixedPositionLayers(true); grandChild->setFixedToContainerLayer(true); @@ -765,7 +765,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithTransformedDirectContainer) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithTransformedDirectContainer) { // This test checks for correct scroll compensation when the fixed-position container // is the direct parent of the fixed-position layer, but that container is transformed. @@ -777,9 +777,9 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // order. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; // This scale will cause child and grandChild to be effectively 200 x 800 with respect to the renderTarget. WebTransformationMatrix nonUniformScale; @@ -814,16 +814,16 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDistantContainer) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDistantContainer) { // This test checks for correct scroll compensation when the fixed-position container // is NOT the direct parent of the fixed-position layer. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; - CCLayerImpl* greatGrandChild = grandChild->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; + LayerImpl* greatGrandChild = grandChild->children()[0]; child->setIsContainerForFixedPositionLayers(true); grandChild->setPosition(FloatPoint(8, 6)); @@ -857,17 +857,17 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDistantContainerAndTransforms) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDistantContainerAndTransforms) { // This test checks for correct scroll compensation when the fixed-position container // is NOT the direct parent of the fixed-position layer, and the hierarchy has various // transforms that have to be processed in the correct order. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; - CCLayerImpl* greatGrandChild = grandChild->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; + LayerImpl* greatGrandChild = grandChild->children()[0]; WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); @@ -916,7 +916,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithMultipleScrollDeltas) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithMultipleScrollDeltas) { // This test checks for correct scroll compensation when the fixed-position container // has multiple ancestors that have nonzero scrollDelta before reaching the space where the layer is fixed. @@ -926,10 +926,10 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // transforms that have to be processed in the correct order. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; - CCLayerImpl* greatGrandChild = grandChild->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; + LayerImpl* greatGrandChild = grandChild->children()[0]; WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); @@ -980,7 +980,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithIntermediateSurfaceAndTransforms) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithIntermediateSurfaceAndTransforms) { // This test checks for correct scroll compensation when the fixed-position container // contributes to a different renderSurface than the fixed-position layer. In this @@ -988,10 +988,10 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // scrollDelta. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; - CCLayerImpl* greatGrandChild = grandChild->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; + LayerImpl* greatGrandChild = grandChild->children()[0]; child->setIsContainerForFixedPositionLayers(true); grandChild->setPosition(FloatPoint(8, 6)); @@ -1053,7 +1053,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithMultipleIntermediateSurfaces) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithMultipleIntermediateSurfaces) { // This test checks for correct scroll compensation when the fixed-position container // contributes to a different renderSurface than the fixed-position layer, with @@ -1061,19 +1061,19 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // surfaces is accumulated properly in the final matrix transform. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; - CCLayerImpl* greatGrandChild = grandChild->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; + LayerImpl* greatGrandChild = grandChild->children()[0]; // Add one more layer to the test tree for this scenario. { WebTransformationMatrix identity; - scoped_ptr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5); + scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5); setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); greatGrandChild->addChild(fixedPositionChild.Pass()); } - CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0]; + LayerImpl* fixedPositionChild = greatGrandChild->children()[0]; // Actually set up the scenario here. child->setIsContainerForFixedPositionLayers(true); @@ -1164,7 +1164,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithContainerLayerThatHasSurface) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithContainerLayerThatHasSurface) { // This test checks for correct scroll compensation when the fixed-position container // itself has a renderSurface. In this case, the container layer should be treated @@ -1172,9 +1172,9 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // is completely irrelevant; it should not affect the scroll compensation. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; child->setIsContainerForFixedPositionLayers(true); child->setForceRenderSurface(true); @@ -1212,16 +1212,16 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatIsAlsoFixedPositionContainer) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatIsAlsoFixedPositionContainer) { // This test checks the scenario where a fixed-position layer also happens to be a // container itself for a descendant fixed position layer. In particular, the layer // should not accidentally be fixed to itself. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; child->setIsContainerForFixedPositionLayers(true); grandChild->setFixedToContainerLayer(true); @@ -1249,16 +1249,16 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatHasNoContainer) +TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatHasNoContainer) { // This test checks scroll compensation when a fixed-position layer does not find any // ancestor that is a "containerForFixedPositionLayers". In this situation, the layer should // be fixed to the viewport -- not the rootLayer, which may have transforms of its own. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); - CCLayerImpl* child = root->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; + scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); + LayerImpl* child = root->children()[0]; + LayerImpl* grandChild = child->children()[0]; WebTransformationMatrix rotationByZ; rotationByZ.rotate3d(0, 0, 90); @@ -1292,7 +1292,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) +TEST(LayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) { // The entire subtree of layers that are outside the clipRect should be culled away, // and should not affect the renderSurfaceLayerList. @@ -1309,12 +1309,12 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild = LayerChromium::create(); - scoped_refptr<LayerChromium> greatGrandChild = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild = Layer::create(); + scoped_refptr<Layer> greatGrandChild = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> leafNode1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> leafNode2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(child); child->addChild(grandChild); grandChild->addChild(greatGrandChild); @@ -1336,16 +1336,16 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) grandChild->setOpacity(0.5); greatGrandChild->setOpacity(0.4f); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); ASSERT_EQ(2U, renderSurfaceLayerList.size()); EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); } -TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) +TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) { // When a renderSurface has a clipRect, it is used to clip the contentRect // of the surface. When the renderSurface is animating its transforms, then @@ -1364,10 +1364,10 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) // in the renderSurfaceLayerList. const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> leafNode = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(child); child->addChild(grandChild); grandChild->addChild(leafNode); @@ -1381,9 +1381,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) child->setOpacity(0.4f); grandChild->setOpacity(0.4f); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Without an animation, we should cull child and grandChild from the renderSurfaceLayerList. ASSERT_EQ(1U, renderSurfaceLayerList.size()); @@ -1397,7 +1397,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) grandChild->clearRenderSurface(); renderSurfaceLayerList.clear(); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // With an animating transform, we should keep child and grandChild in the renderSurfaceLayerList. ASSERT_EQ(3U, renderSurfaceLayerList.size()); @@ -1406,7 +1406,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) +TEST(LayerTreeHostCommonTest, verifyDrawableContentRectForLayers) { // Verify that layers get the appropriate drawableContentRect when their parent masksToBounds is true. // @@ -1417,12 +1417,12 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) // const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild1 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild2 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild3 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild4 = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild1 = Layer::create(); + scoped_refptr<Layer> grandChild2 = Layer::create(); + scoped_refptr<Layer> grandChild3 = Layer::create(); + scoped_refptr<Layer> grandChild4 = Layer::create(); parent->addChild(child); child->addChild(grandChild1); @@ -1447,9 +1447,9 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) grandChild3->setOpacity(0.5); grandChild4->setOpacity(0.5); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect()); EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); @@ -1457,7 +1457,7 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); } -TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) +TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) { // Verify that renderSurfaces (and their layers) get the appropriate clipRects when their parent masksToBounds is true. // @@ -1467,16 +1467,16 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) // const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild1 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild2 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild3 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild4 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode4 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild1 = Layer::create(); + scoped_refptr<Layer> grandChild2 = Layer::create(); + scoped_refptr<Layer> grandChild3 = Layer::create(); + scoped_refptr<Layer> grandChild4 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> leafNode1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> leafNode2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> leafNode3 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> leafNode4 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(child); child->addChild(grandChild1); @@ -1512,9 +1512,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) grandChild3->setOpacity(0.5); grandChild4->setOpacity(0.5); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); ASSERT_TRUE(grandChild1->renderSurface()); ASSERT_TRUE(grandChild2->renderSurface()); @@ -1527,17 +1527,17 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); } -TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) +TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface2 = LayerChromium::create(); - scoped_refptr<LayerChromium> childOfRoot = LayerChromium::create(); - scoped_refptr<LayerChromium> childOfRS1 = LayerChromium::create(); - scoped_refptr<LayerChromium> childOfRS2 = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChildOfRoot = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<Layer> renderSurface2 = Layer::create(); + scoped_refptr<Layer> childOfRoot = Layer::create(); + scoped_refptr<Layer> childOfRS1 = Layer::create(); + scoped_refptr<Layer> childOfRS2 = Layer::create(); + scoped_refptr<Layer> grandChildOfRoot = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChildOfRS1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> grandChildOfRS2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(renderSurface1); parent->addChild(childOfRoot); renderSurface1->addChild(childOfRS1); @@ -1668,7 +1668,7 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42()); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) +TEST(LayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) { // Test the calculateVisibleRect() function works correctly for identity transforms. @@ -1678,22 +1678,22 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) // Case 1: Layer is contained within the surface. IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30)); IntRect expected = IntRect(IntPoint(10, 10), IntSize(30, 30)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerContentRect = IntRect(IntPoint(120, 120), IntSize(30, 30)); - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_TRUE(actual.isEmpty()); // Case 3: Layer is partially overlapping the surface rect. layerContentRect = IntRect(IntPoint(80, 80), IntSize(30, 30)); expected = IntRect(IntPoint(80, 80), IntSize(20, 20)); - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) +TEST(LayerTreeHostCommonTest, verifyVisibleRectForTranslations) { // Test the calculateVisibleRect() function works correctly for scaling transforms. @@ -1705,24 +1705,24 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.translate(10, 10); IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.translate(120, 120); - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_TRUE(actual.isEmpty()); // Case 3: Layer is partially overlapping the surface rect. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.translate(80, 80); expected = IntRect(IntPoint(0, 0), IntSize(20, 20)); - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) +TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) { // Test the calculateVisibleRect() function works correctly for rotations about z-axis (i.e. 2D rotations). // Remember that calculateVisibleRect() should return the visible rect in the layer's space. @@ -1736,14 +1736,14 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.translate(50, 50); layerToSurfaceTransform.rotate(45); IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.translate(-50, 0); layerToSurfaceTransform.rotate(45); - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_TRUE(actual.isEmpty()); // Case 3: The layer is rotated about its top-left corner. In surface space, the layer @@ -1754,7 +1754,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.rotate(45); expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); // Case 4: The layer is rotated about its top-left corner, and translated upwards. In @@ -1766,11 +1766,11 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.translate(0, -sqrt(2.0) * 15); layerToSurfaceTransform.rotate(45); expected = IntRect(IntPoint(15, 0), IntSize(15, 30)); // right half of layer bounds. - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) +TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) { // Test that the calculateVisibleRect() function works correctly for 3d transforms. @@ -1782,7 +1782,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.rotate3d(0, 45, 0); IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); // Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but @@ -1793,11 +1793,11 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) layerToSurfaceTransform.translate(-halfWidthOfRotatedLayer, 0); layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer expected = IntRect(IntPoint(50, 0), IntSize(50, 100)); // right half of the layer. - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) +TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) { // Test the calculateVisibleRect() function works correctly when the layer has a // perspective projection onto the target surface. @@ -1820,7 +1820,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) layerToSurfaceTransform.translate3d(0, 0, -27); IntRect expected = IntRect(IntPoint(-50, -50), IntSize(200, 200)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); // Case 2: same projection as before, except that the layer is also translated to the @@ -1833,11 +1833,11 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) // layerToSurfaceTransform.translate3d(-200, 0, 0); expected = IntRect(IntPoint(50, -50), IntSize(100, 200)); // The right half of the layer's bounding rect. - actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehindSurface) +TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehindSurface) { // There is currently no explicit concept of an orthographic projection plane in our // code (nor in the CSS spec to my knowledge). Therefore, layers that are technically @@ -1856,11 +1856,11 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe layerToSurfaceTransform.translate(-50, 0); IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) +TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) { // Test the calculateVisibleRect() function works correctly when projecting a surface // onto a layer, but the layer is partially behind the camera (not just behind the @@ -1884,17 +1884,17 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) // Sanity check that this transform does indeed cause w < 0 when applying the // transform, otherwise this code is not testing the intended scenario. bool clipped = false; - CCMathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped); + MathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped); ASSERT_TRUE(clipped); int expectedXPosition = 0; int expectedWidth = 10; - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_EQ(expectedXPosition, actual.x()); EXPECT_EQ(expectedWidth, actual.width()); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) +TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) { // To determine visibleRect in layer space, there needs to be an un-projection from // surface space to layer space. When the original transform was a perspective @@ -1914,24 +1914,24 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) // Sanity check that un-projection does indeed cause w < 0, otherwise this code is not // testing the intended scenario. bool clipped = false; - FloatRect clippedRect = CCMathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect); - CCMathUtil::projectQuad(layerToSurfaceTransform.inverse(), FloatQuad(clippedRect), clipped); + FloatRect clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect); + MathUtil::projectQuad(layerToSurfaceTransform.inverse(), FloatQuad(clippedRect), clipped); ASSERT_TRUE(clipped); // Only the corner of the layer is not visible on the surface because of being // clipped. But, the net result of rounding visible region to an axis-aligned rect is // that the entire layer should still be considered visible. IntRect expected = IntRect(IntPoint(-10, -10), IntSize(20, 20)); - IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); + IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayers) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayers) { - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(child1); root->addChild(child2); root->addChild(child3); @@ -1961,13 +1961,13 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLay EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer) { - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> grandChild1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> grandChild2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> grandChild3 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(child); child->addChild(grandChild1); child->addChild(grandChild2); @@ -2003,13 +2003,13 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersCli EXPECT_TRUE(grandChild3->drawableContentRect().isEmpty()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) { - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(renderSurface1); renderSurface1->addChild(child1); renderSurface1->addChild(child2); @@ -2047,13 +2047,13 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInU EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(renderSurface1); renderSurface1->addChild(child1); renderSurface1->addChild(child2); @@ -2094,15 +2094,15 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInC EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy) { // Check that clipping does not propagate down surfaces. - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface2 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<Layer> renderSurface2 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(renderSurface1); renderSurface1->addChild(renderSurface2); renderSurface2->addChild(child1); @@ -2153,14 +2153,14 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHi EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) { // Layers that have non-axis aligned bounds (due to transforms) have an expanded, // axis-aligned drawableContentRect and visibleContentRect. - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(renderSurface1); renderSurface1->addChild(child1); @@ -2193,14 +2193,14 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnClippedSurface) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnClippedSurface) { // Layers that have non-axis aligned bounds (due to transforms) have an expanded, // axis-aligned drawableContentRect and visibleContentRect. - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> renderSurface1 = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); root->addChild(renderSurface1); renderSurface1->addChild(child1); @@ -2232,16 +2232,16 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI) +TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI) { - MockContentLayerChromiumClient client; + MockContentLayerClient client; - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<ContentLayerChromium> renderSurface1 = createDrawableContentLayerChromium(&client); - scoped_refptr<ContentLayerChromium> renderSurface2 = createDrawableContentLayerChromium(&client); - scoped_refptr<ContentLayerChromium> child1 = createDrawableContentLayerChromium(&client); - scoped_refptr<ContentLayerChromium> child2 = createDrawableContentLayerChromium(&client); - scoped_refptr<ContentLayerChromium> child3 = createDrawableContentLayerChromium(&client); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<ContentLayer> renderSurface1 = createDrawableContentLayer(&client); + scoped_refptr<ContentLayer> renderSurface2 = createDrawableContentLayer(&client); + scoped_refptr<ContentLayer> child1 = createDrawableContentLayer(&client); + scoped_refptr<ContentLayer> child2 = createDrawableContentLayer(&client); + scoped_refptr<ContentLayer> child3 = createDrawableContentLayer(&client); root->addChild(renderSurface1); renderSurface1->addChild(renderSurface2); renderSurface2->addChild(child1); @@ -2297,22 +2297,22 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI) EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child3->visibleContentRect()); } -TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) +TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) { // Verify the behavior of back-face culling when there are no preserve-3d layers. Note // that 3d transforms still apply in this case, but they are "flattened" to each // parent layer according to current W3C spec. const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(frontFacingChild); parent->addChild(backFacingChild); @@ -2354,9 +2354,9 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_FALSE(frontFacingChild->renderSurface()); @@ -2391,22 +2391,22 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) EXPECT_EQ(frontFacingChildOfBackFacingSurface->id(), renderSurfaceLayerList[2]->renderSurface()->layerList()[0]->id()); } -TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) +TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) { // Verify the behavior of back-face culling when preserves-3d transform style is used. const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> dummyReplicaLayer1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> dummyReplicaLayer2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(frontFacingChild); parent->addChild(backFacingChild); @@ -2453,9 +2453,9 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_FALSE(frontFacingChild->renderSurface()); @@ -2483,7 +2483,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) EXPECT_EQ(frontFacingChildOfFrontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); } -TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) +TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) { // Verify that layers are appropriately culled when their back face is showing and // they are not double sided, while animations are going on. @@ -2493,12 +2493,12 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) // const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> animatingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> childOfAnimatingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> animatingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> animatingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> childOfAnimatingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> animatingChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(child); parent->addChild(animatingSurface); @@ -2533,9 +2533,9 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); EXPECT_FALSE(child->renderSurface()); EXPECT_TRUE(animatingSurface->renderSurface()); @@ -2567,17 +2567,17 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); } -TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface) +TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface) { // Verify the behavior of back-face culling for a renderSurface that is created // when it flattens its subtree, and its parent has preserves-3d. const WebTransformationMatrix identityMatrix; - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); - scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<LayerWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerWithForcedDrawsContent()); + scoped_refptr<LayerWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerWithForcedDrawsContent()); parent->addChild(frontFacingSurface); parent->addChild(backFacingSurface); @@ -2599,9 +2599,9 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_TRUE(frontFacingSurface->renderSurface()); @@ -2624,27 +2624,27 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) +TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) { // Hit testing on an empty renderSurfaceLayerList should return a null pointer. DebugScopedSetImplThread thisScopeIsOnImplThread; - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; IntPoint testPoint(0, 0); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(10, 20); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(12345); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2653,9 +2653,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); root->setDrawsContent(true); - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -2663,30 +2663,30 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) // Hit testing for a point outside the layer should return a null pointer. IntPoint testPoint(101, 101); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(-1, -1); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the root layer. testPoint = IntPoint(1, 1); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); testPoint = IntPoint(99, 99); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) +TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(12345); WebTransformationMatrix uninvertibleTransform; uninvertibleTransform.setM11(0); @@ -2702,9 +2702,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatrix, anchor, position, bounds, false); root->setDrawsContent(true); - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -2715,39 +2715,39 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) // accidentally ignored and treated like an identity, then the hit testing will // incorrectly hit the layer when it shouldn't. IntPoint testPoint(1, 1); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(10, 10); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(10, 30); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(50, 50); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(67, 48); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(99, 99); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(-1, -1); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(12345); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2756,9 +2756,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); root->setDrawsContent(true); - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -2766,31 +2766,31 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) // Hit testing for a point outside the layer should return a null pointer. IntPoint testPoint(49, 49); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it. testPoint = IntPoint(101, 101); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the root layer. testPoint = IntPoint(51, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); testPoint = IntPoint(99, 99); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(12345); WebTransformationMatrix identityMatrix; WebTransformationMatrix rotation45DegreesAboutCenter; @@ -2803,9 +2803,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, identityMatrix, anchor, position, bounds, false); root->setDrawsContent(true); - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -2814,34 +2814,34 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) // Hit testing for points outside the layer. // These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer. IntPoint testPoint(99, 99); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(1, 1); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the root layer. testPoint = IntPoint(1, 50); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); // Hit testing the corners that would overlap the unclipped layer, but are outside the clipped region. testPoint = IntPoint(50, -1); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_FALSE(resultLayer); testPoint = IntPoint(-1, 50); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_FALSE(resultLayer); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(12345); WebTransformationMatrix identityMatrix; @@ -2859,9 +2859,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false); root->setDrawsContent(true); - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -2870,26 +2870,26 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) // Hit testing for points outside the layer. // These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer. IntPoint testPoint(24, 24); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(76, 76); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the root layer. testPoint = IntPoint(26, 26); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); testPoint = IntPoint(74, 74); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) +TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) { // A layer's visibleContentRect is actually in the layer's content space. The // screenSpaceTransform converts from the layer's origin space to screen space. This @@ -2903,7 +2903,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2913,7 +2913,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents { FloatPoint position(25, 25); IntSize bounds(50, 50); - scoped_ptr<CCLayerImpl> testLayer = CCLayerImpl::create(12345); + scoped_ptr<LayerImpl> testLayer = LayerImpl::create(12345); setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); // override contentBounds @@ -2923,43 +2923,43 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents root->addChild(testLayer.Pass()); } - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25. - CCLayerImpl* testLayer = root->children()[0]; + LayerImpl* testLayer = root->children()[0]; EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); // Hit testing for a point outside the layer should return a null pointer (the root layer does not draw content, so it will not be hit tested either). IntPoint testPoint(101, 101); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(24, 24); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(76, 76); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the test layer. testPoint = IntPoint(26, 26); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); testPoint = IntPoint(74, 74); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(12345, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) { // Test that hit-testing will only work for the visible portion of a layer, and not // the entire layer bounds. Here we just test the simple axis-aligned case. @@ -2968,17 +2968,17 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); { - scoped_ptr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123); + scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123); FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. IntSize bounds(50, 50); setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); clippingLayer->setMasksToBounds(true); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456); + scoped_ptr<LayerImpl> child = LayerImpl::create(456); position = FloatPoint(-50, -50); bounds = IntSize(300, 300); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); @@ -2987,9 +2987,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) root->addChild(clippingLayer.Pass()); } - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -2999,27 +2999,27 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) // Hit testing for a point outside the layer should return a null pointer. // Despite the child layer being very large, it should be clipped to the root layer's bounds. IntPoint testPoint(24, 24); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Even though the layer exists at (101, 101), it should not be visible there since the clippingLayer would clamp it. testPoint = IntPoint(76, 76); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the child layer. testPoint = IntPoint(26, 26); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(456, resultLayer->id()); testPoint = IntPoint(74, 74); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(456, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) { // This test checks whether hit testing correctly avoids hit testing with multiple // ancestors that clip in non axis-aligned ways. To pass this test, the hit testing @@ -3033,7 +3033,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(123); + scoped_ptr<LayerImpl> root = LayerImpl::create(123); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3043,9 +3043,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) root->setMasksToBounds(true); { - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456); - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(789); - scoped_ptr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468); + scoped_ptr<LayerImpl> child = LayerImpl::create(456); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(789); + scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::create(2468); position = FloatPoint(10, 10); bounds = IntSize(80, 80); @@ -3077,9 +3077,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) root->addChild(child.Pass()); } - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. // The grandChild is expected to create a renderSurface because it masksToBounds and is not axis aligned. @@ -3091,12 +3091,12 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // (11, 89) is close to the the bottom left corner within the clip, but it is not inside the layer. IntPoint testPoint(11, 89); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Closer inwards from the bottom left will overlap the layer. testPoint = IntPoint(25, 75); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(2468, resultLayer->id()); @@ -3105,29 +3105,29 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // visibleContentRect without considering how parent may clip the layer, then hit // testing would accidentally think that the point successfully hits the layer. testPoint = IntPoint(4, 50); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // (11, 50) is inside the layer and within the clipped area. testPoint = IntPoint(11, 50); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(2468, resultLayer->id()); // Around the middle, just to the right and up, would have hit the layer except that // that area should be clipped away by the parent. testPoint = IntPoint(51, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Around the middle, just to the left and down, should successfully hit the layer. testPoint = IntPoint(49, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(2468, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) +TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) { // This test checks that hit testing code does not accidentally clip to layer // bounds for a layer that actually does not clip. @@ -3136,11 +3136,11 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); { - scoped_ptr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(123); + scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123); FloatPoint position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located. IntSize bounds(50, 50); setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); @@ -3150,7 +3150,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) // The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all. // If child is incorrectly clipped, we would not be able to hit it successfully. - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456); + scoped_ptr<LayerImpl> child = LayerImpl::create(456); position = FloatPoint(60, 60); // 70, 70 in screen space bounds = IntSize(20, 20); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); @@ -3159,9 +3159,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) root->addChild(intermediateLayer.Pass()); } - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); @@ -3170,31 +3170,31 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) // Hit testing for a point outside the layer should return a null pointer. IntPoint testPoint(69, 69); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); testPoint = IntPoint(91, 91); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); // Hit testing for a point inside should return the child layer. testPoint = IntPoint(71, 71); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(456, resultLayer->id()); testPoint = IntPoint(89, 89); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(456, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) +TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3209,9 +3209,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) // The expected stacking order is: // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers. - scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + scoped_ptr<LayerImpl> child1 = LayerImpl::create(2); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); + scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4); position = FloatPoint(10, 10); bounds = IntSize(50, 50); @@ -3235,13 +3235,13 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) root->addChild(child2.Pass()); } - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* child2 = root->children()[1]; - CCLayerImpl* grandChild1 = child1->children()[0]; + LayerImpl* child1 = root->children()[0]; + LayerImpl* child2 = root->children()[1]; + LayerImpl* grandChild1 = child1->children()[0]; - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_TRUE(child1); @@ -3256,42 +3256,42 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) // Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer. IntPoint testPoint = IntPoint(1, 1); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(1, resultLayer->id()); // At (15, 15), child1 and root are the only layers. child1 is expected to be on top. testPoint = IntPoint(15, 15); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(2, resultLayer->id()); // At (51, 20), child1 and child2 overlap. child2 is expected to be on top. testPoint = IntPoint(51, 20); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(3, resultLayer->id()); // At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top. testPoint = IntPoint(80, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(3, resultLayer->id()); // At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers. testPoint = IntPoint(51, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(3, resultLayer->id()); // At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top. testPoint = IntPoint(20, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(4, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) +TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) { // // The geometry is set up similarly to the previous case, but @@ -3299,7 +3299,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) // DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3314,9 +3314,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) // The expected stacking order is: // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers. - scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + scoped_ptr<LayerImpl> child1 = LayerImpl::create(2); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); + scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4); position = FloatPoint(10, 10); bounds = IntSize(50, 50); @@ -3343,13 +3343,13 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) root->addChild(child2.Pass()); } - CCLayerImpl* child1 = root->children()[0]; - CCLayerImpl* child2 = root->children()[1]; - CCLayerImpl* grandChild1 = child1->children()[0]; + LayerImpl* child1 = root->children()[0]; + LayerImpl* child2 = root->children()[1]; + LayerImpl* grandChild1 = child1->children()[0]; - std::vector<CCLayerImpl*> renderSurfaceLayerList; + std::vector<LayerImpl*> renderSurfaceLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); // Sanity check the scenario we just created. ASSERT_TRUE(child1); @@ -3370,60 +3370,60 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) // Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer. IntPoint testPoint = IntPoint(1, 1); - CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(1, resultLayer->id()); // At (15, 15), child1 and root are the only layers. child1 is expected to be on top. testPoint = IntPoint(15, 15); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(2, resultLayer->id()); // At (51, 20), child1 and child2 overlap. child2 is expected to be on top. testPoint = IntPoint(51, 20); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(3, resultLayer->id()); // At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top. testPoint = IntPoint(80, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(3, resultLayer->id()); // At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers. testPoint = IntPoint(51, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(3, resultLayer->id()); // At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top. testPoint = IntPoint(20, 51); - resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); EXPECT_EQ(4, resultLayer->id()); } -TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) +TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) { // Verify draw and screen space transforms of layers not in a surface. - MockContentLayerChromiumClient delegate; + MockContentLayerClient delegate; WebTransformationMatrix identityMatrix; - scoped_refptr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); - scoped_refptr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); - scoped_refptr<ContentLayerChromium> childNoScale = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> childNoScale = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); parent->addChild(child); parent->addChild(childNoScale); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; const double deviceScaleFactor = 2.5; @@ -3431,7 +3431,7 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) child->setContentsScale(deviceScaleFactor); EXPECT_EQ(childNoScale->contentsScale(), 1); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); EXPECT_EQ(1u, renderSurfaceLayerList.size()); @@ -3443,8 +3443,8 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) // Verify results of transformed parent rects FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds())); - FloatRect parentDrawRect = CCMathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds); - FloatRect parentScreenSpaceRect = CCMathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds); + FloatRect parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds); + FloatRect parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds); FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds()); expectedParentDrawRect.scale(deviceScaleFactor); @@ -3460,8 +3460,8 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) // Verify results of transformed child rects FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds())); - FloatRect childDrawRect = CCMathUtil::mapClippedRect(child->drawTransform(), childContentBounds); - FloatRect childScreenSpaceRect = CCMathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds); + FloatRect childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds); + FloatRect childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds); FloatRect expectedChildDrawRect(FloatPoint(), child->bounds()); expectedChildDrawRect.move(child->position().x(), child->position().y()); @@ -3478,32 +3478,32 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->screenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) +TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) { - MockContentLayerChromiumClient delegate; + MockContentLayerClient delegate; WebTransformationMatrix identityMatrix; - scoped_refptr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true); - scoped_refptr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); WebTransformationMatrix replicaTransform; replicaTransform.scaleNonUniform(1, -1); - scoped_refptr<ContentLayerChromium> replica = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); // This layer should end up in the same surface as child, with the same draw // and screen space transforms. - scoped_refptr<ContentLayerChromium> duplicateChildNonOwner = createDrawableContentLayerChromium(&delegate); + scoped_refptr<ContentLayer> duplicateChildNonOwner = createDrawableContentLayer(&delegate); setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true); parent->addChild(child); child->addChild(duplicateChildNonOwner); child->setReplicaLayer(replica.get()); - std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList; + std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; int dummyMaxTextureSize = 512; const double deviceScaleFactor = 1.5; @@ -3512,7 +3512,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) duplicateChildNonOwner->setContentsScale(deviceScaleFactor); replica->setContentsScale(deviceScaleFactor); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); + LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); // We should have two render surfaces. The root's render surface and child's // render surface (it needs one because it has a replica layer). @@ -3560,13 +3560,13 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaScreenSpaceTransform, child->renderSurface()->replicaScreenSpaceTransform()); } -TEST(CCLayerTreeHostCommonTest, verifySubtreeSearch) +TEST(LayerTreeHostCommonTest, verifySubtreeSearch) { - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild = LayerChromium::create(); - scoped_refptr<LayerChromium> maskLayer = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaLayer = LayerChromium::create(); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild = Layer::create(); + scoped_refptr<Layer> maskLayer = Layer::create(); + scoped_refptr<Layer> replicaLayer = Layer::create(); grandChild->setReplicaLayer(replicaLayer.get()); child->addChild(grandChild.get()); @@ -3574,12 +3574,12 @@ TEST(CCLayerTreeHostCommonTest, verifySubtreeSearch) root->addChild(child.get()); int nonexistentId = -1; - EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->id())); - EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child->id())); - EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), grandChild->id())); - EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), maskLayer->id())); - EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id())); - EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId)); + EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id())); + EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->id())); + EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), grandChild->id())); + EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), maskLayer->id())); + EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id())); + EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId)); } } // namespace diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index 29d6bd9..0a518b6 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -38,21 +38,21 @@ using WebKit::WebTransformationMatrix; namespace { -void didVisibilityChange(cc::CCLayerTreeHostImpl* id, bool visible) +void didVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) { if (visible) { - TRACE_EVENT_ASYNC_BEGIN1("webkit", "CCLayerTreeHostImpl::setVisible", id, "CCLayerTreeHostImpl", id); + TRACE_EVENT_ASYNC_BEGIN1("webkit", "LayerTreeHostImpl::setVisible", id, "LayerTreeHostImpl", id); return; } - TRACE_EVENT_ASYNC_END0("webkit", "CCLayerTreeHostImpl::setVisible", id); + TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::setVisible", id); } } // namespace namespace cc { -CCPinchZoomViewport::CCPinchZoomViewport() +PinchZoomViewport::PinchZoomViewport() : m_pageScaleFactor(1) , m_pageScaleDelta(1) , m_sentPageScaleDelta(1) @@ -61,12 +61,12 @@ CCPinchZoomViewport::CCPinchZoomViewport() { } -float CCPinchZoomViewport::totalPageScaleFactor() const +float PinchZoomViewport::totalPageScaleFactor() const { return m_pageScaleFactor * m_pageScaleDelta; } -void CCPinchZoomViewport::setPageScaleDelta(float delta) +void PinchZoomViewport::setPageScaleDelta(float delta) { // Clamp to the current min/max limits. float totalPageScaleFactor = m_pageScaleFactor * delta; @@ -81,7 +81,7 @@ void CCPinchZoomViewport::setPageScaleDelta(float delta) m_pageScaleDelta = delta; } -bool CCPinchZoomViewport::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) +bool PinchZoomViewport::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) { DCHECK(pageScaleFactor); @@ -95,7 +95,7 @@ bool CCPinchZoomViewport::setPageScaleFactorAndLimits(float pageScaleFactor, flo return true; } -FloatRect CCPinchZoomViewport::bounds() const +FloatRect PinchZoomViewport::bounds() const { FloatSize scaledViewportSize = m_layoutViewportSize; scaledViewportSize.scale(1 / totalPageScaleFactor()); @@ -106,7 +106,7 @@ FloatRect CCPinchZoomViewport::bounds() const return bounds; } -FloatSize CCPinchZoomViewport::applyScroll(FloatSize& delta) +FloatSize PinchZoomViewport::applyScroll(FloatSize& delta) { FloatSize overflow; FloatRect pinchedBounds = bounds(); @@ -140,7 +140,7 @@ FloatSize CCPinchZoomViewport::applyScroll(FloatSize& delta) return overflow; } -WebTransformationMatrix CCPinchZoomViewport::implTransform() const +WebTransformationMatrix PinchZoomViewport::implTransform() const { WebTransformationMatrix transform; transform.scale(m_pageScaleDelta); @@ -156,13 +156,13 @@ WebTransformationMatrix CCPinchZoomViewport::implTransform() const return transform; } -class CCLayerTreeHostImplTimeSourceAdapter : public CCTimeSourceClient { +class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { public: - static scoped_ptr<CCLayerTreeHostImplTimeSourceAdapter> create(CCLayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<CCDelayBasedTimeSource> timeSource) + static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> create(LayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<DelayBasedTimeSource> timeSource) { - return make_scoped_ptr(new CCLayerTreeHostImplTimeSourceAdapter(layerTreeHostImpl, timeSource)); + return make_scoped_ptr(new LayerTreeHostImplTimeSourceAdapter(layerTreeHostImpl, timeSource)); } - virtual ~CCLayerTreeHostImplTimeSourceAdapter() + virtual ~LayerTreeHostImplTimeSourceAdapter() { m_timeSource->setClient(0); m_timeSource->setActive(false); @@ -185,33 +185,33 @@ public: } private: - CCLayerTreeHostImplTimeSourceAdapter(CCLayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<CCDelayBasedTimeSource> timeSource) + LayerTreeHostImplTimeSourceAdapter(LayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<DelayBasedTimeSource> timeSource) : m_layerTreeHostImpl(layerTreeHostImpl) , m_timeSource(timeSource) { m_timeSource->setClient(this); } - CCLayerTreeHostImpl* m_layerTreeHostImpl; - scoped_refptr<CCDelayBasedTimeSource> m_timeSource; + LayerTreeHostImpl* m_layerTreeHostImpl; + scoped_refptr<DelayBasedTimeSource> m_timeSource; - DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImplTimeSourceAdapter); + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTimeSourceAdapter); }; -CCLayerTreeHostImpl::FrameData::FrameData() +LayerTreeHostImpl::FrameData::FrameData() { } -CCLayerTreeHostImpl::FrameData::~FrameData() +LayerTreeHostImpl::FrameData::~FrameData() { } -scoped_ptr<CCLayerTreeHostImpl> CCLayerTreeHostImpl::create(const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client) +scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings& settings, LayerTreeHostImplClient* client) { - return make_scoped_ptr(new CCLayerTreeHostImpl(settings, client)); + return make_scoped_ptr(new LayerTreeHostImpl(settings, client)); } -CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client) +LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTreeHostImplClient* client) : m_client(client) , m_sourceFrameNumber(-1) , m_rootScrollLayerImpl(0) @@ -223,79 +223,79 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC , m_deviceScaleFactor(1) , m_visible(true) , m_contentsTexturesPurged(false) - , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) + , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryAllocationLimit()) , m_backgroundColor(0) , m_hasTransparentBackground(false) , m_needsAnimateLayers(false) , m_pinchGestureActive(false) - , m_fpsCounter(CCFrameRateCounter::create()) - , m_debugRectHistory(CCDebugRectHistory::create()) + , m_fpsCounter(FrameRateCounter::create()) + , m_debugRectHistory(DebugRectHistory::create()) , m_numImplThreadScrolls(0) , m_numMainThreadScrolls(0) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); didVisibilityChange(this, m_visible); } -CCLayerTreeHostImpl::~CCLayerTreeHostImpl() +LayerTreeHostImpl::~LayerTreeHostImpl() { - DCHECK(CCProxy::isImplThread()); - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::~CCLayerTreeHostImpl()"); + DCHECK(Proxy::isImplThread()); + TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); if (m_rootLayerImpl) clearRenderSurfaces(); } -void CCLayerTreeHostImpl::beginCommit() +void LayerTreeHostImpl::beginCommit() { } -void CCLayerTreeHostImpl::commitComplete() +void LayerTreeHostImpl::commitComplete() { - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::commitComplete"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::commitComplete"); // Recompute max scroll position; must be after layer content bounds are // updated. updateMaxScrollPosition(); } -bool CCLayerTreeHostImpl::canDraw() +bool LayerTreeHostImpl::canDraw() { // Note: If you are changing this function or any other function that might // affect the result of canDraw, make sure to call m_client->onCanDrawStateChanged // in the proper places and update the notifyIfCanDrawChanged test. if (!m_rootLayerImpl) { - TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no root layer"); + TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no root layer"); return false; } if (deviceViewportSize().isEmpty()) { - TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw empty viewport"); + TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport"); return false; } if (!m_renderer) { - TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no renderer"); + TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer"); return false; } if (m_contentsTexturesPurged) { - TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw contents textures purged"); + TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures purged"); return false; } return true; } -CCGraphicsContext* CCLayerTreeHostImpl::context() const +GraphicsContext* LayerTreeHostImpl::context() const { return m_context.get(); } -void CCLayerTreeHostImpl::animate(double monotonicTime, double wallClockTime) +void LayerTreeHostImpl::animate(double monotonicTime, double wallClockTime) { animatePageScale(monotonicTime); animateLayers(monotonicTime, wallClockTime); animateScrollbars(monotonicTime); } -void CCLayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTime, double duration) +void LayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTime, double duration) { if (!m_rootScrollLayerImpl) return; @@ -306,7 +306,7 @@ void CCLayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, IntSize scaledContentSize = contentSize(); scaledContentSize.scale(m_pinchZoomViewport.pageScaleDelta()); - m_pageScaleAnimation = CCPageScaleAnimation::create(scrollTotal, scaleTotal, m_deviceViewportSize, scaledContentSize, startTime); + m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, scaleTotal, m_deviceViewportSize, scaledContentSize, startTime); if (anchorPoint) { IntSize windowAnchor(targetPosition); @@ -320,33 +320,33 @@ void CCLayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, m_client->setNeedsCommitOnImplThread(); } -void CCLayerTreeHostImpl::scheduleAnimation() +void LayerTreeHostImpl::scheduleAnimation() { m_client->setNeedsRedrawOnImplThread(); } -void CCLayerTreeHostImpl::trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList) +void LayerTreeHostImpl::trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList) { // For now, we use damage tracking to compute a global scissor. To do this, we must // compute all damage tracking before drawing anything, so that we know the root // damage rect. The root damage rect is then used to scissor each surface. for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; - CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); DCHECK(renderSurface); renderSurface->damageTracker()->updateDamageTrackingState(renderSurface->layerList(), renderSurfaceLayer->id(), renderSurface->surfacePropertyChangedOnlyFromDescendant(), renderSurface->contentRect(), renderSurfaceLayer->maskLayer(), renderSurfaceLayer->filters()); } } -void CCLayerTreeHostImpl::updateRootScrollLayerImplTransform() +void LayerTreeHostImpl::updateRootScrollLayerImplTransform() { if (m_rootScrollLayerImpl) { m_rootScrollLayerImpl->setImplTransform(implTransform()); } } -void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSurfaceLayerList) +void LayerTreeHostImpl::calculateRenderSurfaceLayerList(LayerList& renderSurfaceLayerList) { DCHECK(renderSurfaceLayerList.empty()); DCHECK(m_rootLayerImpl); @@ -355,61 +355,61 @@ void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSur { updateRootScrollLayerImplTransform(); - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::calcDrawEtc"); - CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, rendererCapabilities().maxTextureSize, renderSurfaceLayerList); + TRACE_EVENT0("cc", "LayerTreeHostImpl::calcDrawEtc"); + LayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, rendererCapabilities().maxTextureSize, renderSurfaceLayerList); trackDamageForAllSurfaces(m_rootLayerImpl.get(), renderSurfaceLayerList); } } -void CCLayerTreeHostImpl::FrameData::appendRenderPass(scoped_ptr<CCRenderPass> renderPass) +void LayerTreeHostImpl::FrameData::appendRenderPass(scoped_ptr<RenderPass> renderPass) { - CCRenderPass* pass = renderPass.get(); + RenderPass* pass = renderPass.get(); renderPasses.push_back(pass); renderPassesById.set(pass->id(), renderPass.Pass()); } -bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) +bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame) { DCHECK(frame.renderPasses.empty()); calculateRenderSurfaceLayerList(*frame.renderSurfaceLayerList); - TRACE_EVENT1("cc", "CCLayerTreeHostImpl::calculateRenderPasses", "renderSurfaceLayerList.size()", static_cast<long long unsigned>(frame.renderSurfaceLayerList->size())); + TRACE_EVENT1("cc", "LayerTreeHostImpl::calculateRenderPasses", "renderSurfaceLayerList.size()", static_cast<long long unsigned>(frame.renderSurfaceLayerList->size())); // Create the render passes in dependency order. for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - CCLayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceIndex]; + LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceIndex]; renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); } bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. - CCOcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->contentRect(), recordMetricsForFrame); + OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->contentRect(), recordMetricsForFrame); occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize); if (settings().showOccludingRects) occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingScreenSpaceRects); // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk. - typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; + typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; // Typically when we are missing a texture and use a checkerboard quad, we still draw the frame. However when the layer being // checkerboarded is moving due to an impl-animation, we drop the frame to avoid flashing due to the texture suddenly appearing // in the future. bool drawFrame = true; - CCLayerIteratorType end = CCLayerIteratorType::end(frame.renderSurfaceLayerList); - for (CCLayerIteratorType it = CCLayerIteratorType::begin(frame.renderSurfaceLayerList); it != end; ++it) { - CCRenderPass::Id targetRenderPassId = it.targetRenderSurfaceLayer()->renderSurface()->renderPassId(); - CCRenderPass* targetRenderPass = frame.renderPassesById.get(targetRenderPassId); + LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList); + for (LayerIteratorType it = LayerIteratorType::begin(frame.renderSurfaceLayerList); it != end; ++it) { + RenderPass::Id targetRenderPassId = it.targetRenderSurfaceLayer()->renderSurface()->renderPassId(); + RenderPass* targetRenderPass = frame.renderPassesById.get(targetRenderPassId); occlusionTracker.enterLayer(it); - CCAppendQuadsData appendQuadsData(targetRenderPass->id()); + AppendQuadsData appendQuadsData(targetRenderPass->id()); if (it.representsContributingRenderSurface()) { - CCRenderPass::Id contributingRenderPassId = it->renderSurface()->renderPassId(); - CCRenderPass* contributingRenderPass = frame.renderPassesById.get(contributingRenderPassId); + RenderPass::Id contributingRenderPassId = it->renderSurface()->renderPassId(); + RenderPass* contributingRenderPass = frame.renderPassesById.get(contributingRenderPassId); targetRenderPass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker, appendQuadsData); } else if (it.representsItself() && !it->visibleContentRect().isEmpty()) { bool hasOcclusionFromOutsideTargetSurface; @@ -420,11 +420,11 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) frame.willDrawLayers.push_back(*it); if (it->hasContributingDelegatedRenderPasses()) { - CCRenderPass::Id contributingRenderPassId = it->firstContributingRenderPassId(); + RenderPass::Id contributingRenderPassId = it->firstContributingRenderPassId(); while (frame.renderPassesById.contains(contributingRenderPassId)) { - CCRenderPass* renderPass = frame.renderPassesById.get(contributingRenderPassId); + RenderPass* renderPass = frame.renderPassesById.get(contributingRenderPassId); - CCAppendQuadsData appendQuadsData(renderPass->id()); + AppendQuadsData appendQuadsData(renderPass->id()); renderPass->appendQuadsForLayer(*it, &occlusionTracker, appendQuadsData); contributingRenderPassId = it->nextContributingRenderPassId(contributingRenderPassId); @@ -470,11 +470,11 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) return drawFrame; } -void CCLayerTreeHostImpl::animateLayersRecursive(CCLayerImpl* current, double monotonicTime, double wallClockTime, CCAnimationEventsVector* events, bool& didAnimate, bool& needsAnimateLayers) +void LayerTreeHostImpl::animateLayersRecursive(LayerImpl* current, double monotonicTime, double wallClockTime, AnimationEventsVector* events, bool& didAnimate, bool& needsAnimateLayers) { bool subtreeNeedsAnimateLayers = false; - CCLayerAnimationController* currentController = current->layerAnimationController(); + LayerAnimationController* currentController = current->layerAnimationController(); bool hadActiveAnimation = currentController->hasActiveAnimation(); currentController->animate(monotonicTime, events); @@ -498,16 +498,16 @@ void CCLayerTreeHostImpl::animateLayersRecursive(CCLayerImpl* current, double mo needsAnimateLayers = subtreeNeedsAnimateLayers; } -void CCLayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled) +void LayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled) { // Lazily create the timeSource adapter so that we can vary the interval for testing. if (!m_timeSourceClientAdapter) - m_timeSourceClientAdapter = CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval(), CCProxy::currentThread())); + m_timeSourceClientAdapter = LayerTreeHostImplTimeSourceAdapter::create(this, DelayBasedTimeSource::create(lowFrequencyAnimationInterval(), Proxy::currentThread())); m_timeSourceClientAdapter->setActive(enabled); } -IntSize CCLayerTreeHostImpl::contentSize() const +IntSize LayerTreeHostImpl::contentSize() const { // TODO(aelias): Hardcoding the first child here is weird. Think of // a cleaner way to get the contentBounds on the Impl side. @@ -516,64 +516,64 @@ IntSize CCLayerTreeHostImpl::contentSize() const return m_rootScrollLayerImpl->children()[0]->contentBounds(); } -static inline CCRenderPass* findRenderPassById(CCRenderPass::Id renderPassId, const CCLayerTreeHostImpl::FrameData& frame) +static inline RenderPass* findRenderPassById(RenderPass::Id renderPassId, const LayerTreeHostImpl::FrameData& frame) { - CCRenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId); + RenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId); DCHECK(it != frame.renderPassesById.end()); return it->second; } -static void removeRenderPassesRecursive(CCRenderPass::Id removeRenderPassId, CCLayerTreeHostImpl::FrameData& frame) +static void removeRenderPassesRecursive(RenderPass::Id removeRenderPassId, LayerTreeHostImpl::FrameData& frame) { - CCRenderPass* removeRenderPass = findRenderPassById(removeRenderPassId, frame); - CCRenderPassList& renderPasses = frame.renderPasses; - CCRenderPassList::iterator toRemove = std::find(renderPasses.begin(), renderPasses.end(), removeRenderPass); + RenderPass* removeRenderPass = findRenderPassById(removeRenderPassId, frame); + RenderPassList& renderPasses = frame.renderPasses; + RenderPassList::iterator toRemove = std::find(renderPasses.begin(), renderPasses.end(), removeRenderPass); // The pass was already removed by another quad - probably the original, and we are the replica. if (toRemove == renderPasses.end()) return; - const CCRenderPass* removedPass = *toRemove; + const RenderPass* removedPass = *toRemove; frame.renderPasses.erase(toRemove); // Now follow up for all RenderPass quads and remove their RenderPasses recursively. - const CCQuadList& quadList = removedPass->quadList(); - CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); + const QuadList& quadList = removedPass->quadList(); + QuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { - CCDrawQuad* currentQuad = (*quadListIterator); - if (currentQuad->material() != CCDrawQuad::RenderPass) + DrawQuad* currentQuad = (*quadListIterator); + if (currentQuad->material() != DrawQuad::RenderPass) continue; - CCRenderPass::Id nextRemoveRenderPassId = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); + RenderPass::Id nextRemoveRenderPassId = RenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); removeRenderPassesRecursive(nextRemoveRenderPassId, frame); } } -bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData&) const +bool LayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const RenderPassDrawQuad& quad, const FrameData&) const { return quad.contentsChangedSinceLastFrame().isEmpty() && m_renderer.haveCachedResourcesForRenderPassId(quad.renderPassId()); } -bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData& frame) const +bool LayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const RenderPassDrawQuad& quad, const FrameData& frame) const { - const CCRenderPass* renderPass = findRenderPassById(quad.renderPassId(), frame); - const CCRenderPassList& renderPasses = frame.renderPasses; - CCRenderPassList::const_iterator foundPass = std::find(renderPasses.begin(), renderPasses.end(), renderPass); + const RenderPass* renderPass = findRenderPassById(quad.renderPassId(), frame); + const RenderPassList& renderPasses = frame.renderPasses; + RenderPassList::const_iterator foundPass = std::find(renderPasses.begin(), renderPasses.end(), renderPass); bool renderPassAlreadyRemoved = foundPass == renderPasses.end(); if (renderPassAlreadyRemoved) return false; // If any quad or RenderPass draws into this RenderPass, then keep it. - const CCQuadList& quadList = (*foundPass)->quadList(); - for (CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { - CCDrawQuad* currentQuad = *quadListIterator; + const QuadList& quadList = (*foundPass)->quadList(); + for (QuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { + DrawQuad* currentQuad = *quadListIterator; - if (currentQuad->material() != CCDrawQuad::RenderPass) + if (currentQuad->material() != DrawQuad::RenderPass) return false; - const CCRenderPass* contributingPass = findRenderPassById(CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(), frame); - CCRenderPassList::const_iterator foundContributingPass = std::find(renderPasses.begin(), renderPasses.end(), contributingPass); + const RenderPass* contributingPass = findRenderPassById(RenderPassDrawQuad::materialCast(currentQuad)->renderPassId(), frame); + RenderPassList::const_iterator foundContributingPass = std::find(renderPasses.begin(), renderPasses.end(), contributingPass); if (foundContributingPass != renderPasses.end()) return false; } @@ -581,25 +581,25 @@ bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(co } // Defined for linking tests. -template void CCLayerTreeHostImpl::removeRenderPasses<CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures>(CullRenderPassesWithCachedTextures, FrameData&); -template void CCLayerTreeHostImpl::removeRenderPasses<CCLayerTreeHostImpl::CullRenderPassesWithNoQuads>(CullRenderPassesWithNoQuads, FrameData&); +template void LayerTreeHostImpl::removeRenderPasses<LayerTreeHostImpl::CullRenderPassesWithCachedTextures>(CullRenderPassesWithCachedTextures, FrameData&); +template void LayerTreeHostImpl::removeRenderPasses<LayerTreeHostImpl::CullRenderPassesWithNoQuads>(CullRenderPassesWithNoQuads, FrameData&); // static template<typename RenderPassCuller> -void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& frame) +void LayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& frame) { for (size_t it = culler.renderPassListBegin(frame.renderPasses); it != culler.renderPassListEnd(frame.renderPasses); it = culler.renderPassListNext(it)) { - const CCRenderPass* currentPass = frame.renderPasses[it]; - const CCQuadList& quadList = currentPass->quadList(); - CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); + const RenderPass* currentPass = frame.renderPasses[it]; + const QuadList& quadList = currentPass->quadList(); + QuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { - CCDrawQuad* currentQuad = *quadListIterator; + DrawQuad* currentQuad = *quadListIterator; - if (currentQuad->material() != CCDrawQuad::RenderPass) + if (currentQuad->material() != DrawQuad::RenderPass) continue; - CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); + RenderPassDrawQuad* renderPassQuad = static_cast<RenderPassDrawQuad*>(currentQuad); if (!culler.shouldRemoveRenderPass(*renderPassQuad, frame)) continue; @@ -616,9 +616,9 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& } } -bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) +bool LayerTreeHostImpl::prepareToDraw(FrameData& frame) { - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::prepareToDraw"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::prepareToDraw"); DCHECK(canDraw()); frame.renderSurfaceLayerList = &m_renderSurfaceLayerList; @@ -634,7 +634,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) return true; } -void CCLayerTreeHostImpl::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) +void LayerTreeHostImpl::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) { bool evictedResources = m_client->reduceContentsTextureMemoryOnImplThread(limitBytes); if (evictedResources) { @@ -644,7 +644,7 @@ void CCLayerTreeHostImpl::reduceContentsTextureMemoryOnImplThread(size_t limitBy } } -void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes) +void LayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes) { DCHECK(bytes); if (m_memoryAllocationLimitBytes == bytes) @@ -654,14 +654,14 @@ void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes) m_client->setNeedsCommitOnImplThread(); } -void CCLayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) +void LayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) { m_client->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds); } -void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) +void LayerTreeHostImpl::drawLayers(const FrameData& frame) { - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::drawLayers"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); DCHECK(canDraw()); DCHECK(!frame.renderPasses.empty()); @@ -691,7 +691,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) m_rootLayerImpl->resetAllChangeTrackingForSubtree(); } -void CCLayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) +void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) { for (size_t i = 0; i < frame.willDrawLayers.size(); ++i) frame.willDrawLayers[i]->didDraw(m_resourceProvider.get()); @@ -701,23 +701,23 @@ void CCLayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) m_resourceProvider->markPendingUploadsAsNonBlocking(); } -void CCLayerTreeHostImpl::finishAllRendering() +void LayerTreeHostImpl::finishAllRendering() { if (m_renderer) m_renderer->finish(); } -bool CCLayerTreeHostImpl::isContextLost() +bool LayerTreeHostImpl::isContextLost() { return m_renderer && m_renderer->isContextLost(); } -const RendererCapabilities& CCLayerTreeHostImpl::rendererCapabilities() const +const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const { return m_renderer->capabilities(); } -bool CCLayerTreeHostImpl::swapBuffers() +bool LayerTreeHostImpl::swapBuffers() { DCHECK(m_renderer); @@ -725,33 +725,33 @@ bool CCLayerTreeHostImpl::swapBuffers() return m_renderer->swapBuffers(); } -const IntSize& CCLayerTreeHostImpl::deviceViewportSize() const +const IntSize& LayerTreeHostImpl::deviceViewportSize() const { return m_deviceViewportSize; } -const CCLayerTreeSettings& CCLayerTreeHostImpl::settings() const +const LayerTreeSettings& LayerTreeHostImpl::settings() const { return m_settings; } -void CCLayerTreeHostImpl::didLoseContext() +void LayerTreeHostImpl::didLoseContext() { m_client->didLoseContextOnImplThread(); } -void CCLayerTreeHostImpl::onSwapBuffersComplete() +void LayerTreeHostImpl::onSwapBuffersComplete() { m_client->onSwapBuffersCompleteOnImplThread(); } -void CCLayerTreeHostImpl::readback(void* pixels, const IntRect& rect) +void LayerTreeHostImpl::readback(void* pixels, const IntRect& rect) { DCHECK(m_renderer); m_renderer->getFramebufferPixels(pixels, rect); } -static CCLayerImpl* findRootScrollLayer(CCLayerImpl* layer) +static LayerImpl* findRootScrollLayer(LayerImpl* layer) { if (!layer) return 0; @@ -760,7 +760,7 @@ static CCLayerImpl* findRootScrollLayer(CCLayerImpl* layer) return layer; for (size_t i = 0; i < layer->children().size(); ++i) { - CCLayerImpl* found = findRootScrollLayer(layer->children()[i]); + LayerImpl* found = findRootScrollLayer(layer->children()[i]); if (found) return found; } @@ -771,7 +771,7 @@ static CCLayerImpl* findRootScrollLayer(CCLayerImpl* layer) // Content layers can be either directly scrollable or contained in an outer // scrolling layer which applies the scroll transform. Given a content layer, // this function returns the associated scroll layer if any. -static CCLayerImpl* findScrollLayerForContentLayer(CCLayerImpl* layerImpl) +static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) { if (!layerImpl) return 0; @@ -785,21 +785,21 @@ static CCLayerImpl* findScrollLayerForContentLayer(CCLayerImpl* layerImpl) return 0; } -void CCLayerTreeHostImpl::setRootLayer(scoped_ptr<CCLayerImpl> layer) +void LayerTreeHostImpl::setRootLayer(scoped_ptr<LayerImpl> layer) { m_rootLayerImpl = layer.Pass(); m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get()); m_currentlyScrollingLayerImpl = 0; if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1) - m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtree(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree); + m_currentlyScrollingLayerImpl = LayerTreeHostCommon::findLayerInSubtree(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree); m_scrollingLayerIdFromPreviousTree = -1; m_client->onCanDrawStateChanged(canDraw()); } -scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() +scoped_ptr<LayerImpl> LayerTreeHostImpl::detachLayerTree() { // Clear all data structures that have direct references to the layer tree. m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_currentlyScrollingLayerImpl->id() : -1; @@ -809,9 +809,9 @@ scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() return m_rootLayerImpl.Pass(); } -void CCLayerTreeHostImpl::setVisible(bool visible) +void LayerTreeHostImpl::setVisible(bool visible) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); if (m_visible == visible) return; @@ -827,7 +827,7 @@ void CCLayerTreeHostImpl::setVisible(bool visible) setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); } -bool CCLayerTreeHostImpl::initializeRenderer(scoped_ptr<CCGraphicsContext> context) +bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<GraphicsContext> context) { // Since we will create a new resource provider, we cannot continue to use // the old resources (i.e. renderSurfaces and texture IDs). Clear them @@ -844,14 +844,14 @@ bool CCLayerTreeHostImpl::initializeRenderer(scoped_ptr<CCGraphicsContext> conte if (!context->bindToClient(this)) return false; - scoped_ptr<CCResourceProvider> resourceProvider = CCResourceProvider::create(context.get()); + scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(context.get()); if (!resourceProvider) return false; if (context->context3D()) - m_renderer = CCRendererGL::create(this, resourceProvider.get()); + m_renderer = GLRenderer::create(this, resourceProvider.get()); else if (context->softwareDevice()) - m_renderer = CCRendererSoftware::create(this, resourceProvider.get(), context->softwareDevice()); + m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), context->softwareDevice()); if (!m_renderer) return false; @@ -866,19 +866,19 @@ bool CCLayerTreeHostImpl::initializeRenderer(scoped_ptr<CCGraphicsContext> conte return true; } -void CCLayerTreeHostImpl::setContentsTexturesPurged() +void LayerTreeHostImpl::setContentsTexturesPurged() { m_contentsTexturesPurged = true; m_client->onCanDrawStateChanged(canDraw()); } -void CCLayerTreeHostImpl::resetContentsTexturesPurged() +void LayerTreeHostImpl::resetContentsTexturesPurged() { m_contentsTexturesPurged = false; m_client->onCanDrawStateChanged(canDraw()); } -void CCLayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize) +void LayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize) { if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize) return; @@ -896,7 +896,7 @@ void CCLayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, con m_client->onCanDrawStateChanged(canDraw()); } -static void adjustScrollsForPageScaleChange(CCLayerImpl* layerImpl, float pageScaleChange) +static void adjustScrollsForPageScaleChange(LayerImpl* layerImpl, float pageScaleChange) { if (!layerImpl) return; @@ -912,7 +912,7 @@ static void adjustScrollsForPageScaleChange(CCLayerImpl* layerImpl, float pageSc adjustScrollsForPageScaleChange(layerImpl->children()[i], pageScaleChange); } -void CCLayerTreeHostImpl::setDeviceScaleFactor(float deviceScaleFactor) +void LayerTreeHostImpl::setDeviceScaleFactor(float deviceScaleFactor) { if (deviceScaleFactor == m_deviceScaleFactor) return; @@ -921,12 +921,12 @@ void CCLayerTreeHostImpl::setDeviceScaleFactor(float deviceScaleFactor) updateMaxScrollPosition(); } -float CCLayerTreeHostImpl::pageScaleFactor() const +float LayerTreeHostImpl::pageScaleFactor() const { return m_pinchZoomViewport.pageScaleFactor(); } -void CCLayerTreeHostImpl::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) +void LayerTreeHostImpl::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) { if (!pageScaleFactor) return; @@ -944,20 +944,20 @@ void CCLayerTreeHostImpl::setPageScaleFactorAndLimits(float pageScaleFactor, flo m_pinchZoomViewport.setSentPageScaleDelta(1); } -void CCLayerTreeHostImpl::setPageScaleDelta(float delta) +void LayerTreeHostImpl::setPageScaleDelta(float delta) { m_pinchZoomViewport.setPageScaleDelta(delta); updateMaxScrollPosition(); } -void CCLayerTreeHostImpl::updateMaxScrollPosition() +void LayerTreeHostImpl::updateMaxScrollPosition() { if (!m_rootScrollLayerImpl || !m_rootScrollLayerImpl->children().size()) return; FloatSize viewBounds = m_deviceViewportSize; - if (CCLayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) { + if (LayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) { // Compensate for non-overlay scrollbars. if (clipLayer->masksToBounds()) { viewBounds = clipLayer->bounds(); @@ -987,12 +987,12 @@ void CCLayerTreeHostImpl::updateMaxScrollPosition() m_rootScrollLayerImpl->setMaxScrollPosition(maxScroll); } -void CCLayerTreeHostImpl::setNeedsRedraw() +void LayerTreeHostImpl::setNeedsRedraw() { m_client->setNeedsRedrawOnImplThread(); } -bool CCLayerTreeHostImpl::ensureRenderSurfaceLayerList() +bool LayerTreeHostImpl::ensureRenderSurfaceLayerList() { if (!m_rootLayerImpl) return false; @@ -1013,9 +1013,9 @@ bool CCLayerTreeHostImpl::ensureRenderSurfaceLayerList() return m_renderSurfaceLayerList.size(); } -CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType type) +InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(const IntPoint& viewportPoint, InputHandlerClient::ScrollInputType type) { - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::scrollBegin"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin"); DCHECK(!m_currentlyScrollingLayerImpl); clearCurrentlyScrollingLayer(); @@ -1028,10 +1028,10 @@ CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoi // First find out which layer was hit from the saved list of visible layers // in the most recent frame. - CCLayerImpl* layerImpl = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(deviceViewportPoint, m_renderSurfaceLayerList); + LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(deviceViewportPoint, m_renderSurfaceLayerList); // Walk up the hierarchy and look for a scrollable layer. - CCLayerImpl* potentiallyScrollingLayerImpl = 0; + LayerImpl* potentiallyScrollingLayerImpl = 0; for (; layerImpl; layerImpl = layerImpl->parent()) { // The content layer can also block attempts to scroll outside the main thread. if (layerImpl->tryScroll(deviceViewportPoint, type) == ScrollOnMainThread) { @@ -1039,7 +1039,7 @@ CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoi return ScrollOnMainThread; } - CCLayerImpl* scrollLayerImpl = findScrollLayerForContentLayer(layerImpl); + LayerImpl* scrollLayerImpl = findScrollLayerForContentLayer(layerImpl); if (!scrollLayerImpl) continue; @@ -1067,7 +1067,7 @@ CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoi return ScrollIgnored; } -static FloatSize scrollLayerWithViewportSpaceDelta(CCPinchZoomViewport* viewport, CCLayerImpl& layerImpl, float scaleFromViewportToScreenSpace, const FloatPoint& viewportPoint, const FloatSize& viewportDelta) +static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport, LayerImpl& layerImpl, float scaleFromViewportToScreenSpace, const FloatPoint& viewportPoint, const FloatSize& viewportDelta) { // Layers with non-invertible screen space transforms should not have passed the scroll hit // test in the first place. @@ -1084,8 +1084,8 @@ static FloatSize scrollLayerWithViewportSpaceDelta(CCPinchZoomViewport* viewport // in layer coordinates. bool startClipped, endClipped; FloatPoint screenSpaceEndPoint = screenSpacePoint + screenSpaceDelta; - FloatPoint localStartPoint = CCMathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped); - FloatPoint localEndPoint = CCMathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped); + FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped); + FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped); // In general scroll point coordinates should not get clipped. DCHECK(!startClipped); @@ -1116,7 +1116,7 @@ static FloatSize scrollLayerWithViewportSpaceDelta(CCPinchZoomViewport* viewport actualLocalContentEndPoint.scale(1 / widthScale, 1 / heightScale); // Calculate the applied scroll delta in viewport space coordinates. - FloatPoint actualScreenSpaceEndPoint = CCMathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped); + FloatPoint actualScreenSpaceEndPoint = MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped); DCHECK(!endClipped); if (endClipped) return FloatSize(); @@ -1125,26 +1125,26 @@ static FloatSize scrollLayerWithViewportSpaceDelta(CCPinchZoomViewport* viewport return actualViewportEndPoint - viewportPoint; } -static FloatSize scrollLayerWithLocalDelta(CCLayerImpl& layerImpl, const FloatSize& localDelta) +static FloatSize scrollLayerWithLocalDelta(LayerImpl& layerImpl, const FloatSize& localDelta) { FloatSize previousDelta(layerImpl.scrollDelta()); layerImpl.scrollBy(localDelta); return layerImpl.scrollDelta() - previousDelta; } -void CCLayerTreeHostImpl::scrollBy(const IntPoint& viewportPoint, const IntSize& scrollDelta) +void LayerTreeHostImpl::scrollBy(const IntPoint& viewportPoint, const IntSize& scrollDelta) { - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::scrollBy"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBy"); if (!m_currentlyScrollingLayerImpl) return; FloatSize pendingDelta(scrollDelta); - for (CCLayerImpl* layerImpl = m_currentlyScrollingLayerImpl; layerImpl; layerImpl = layerImpl->parent()) { + for (LayerImpl* layerImpl = m_currentlyScrollingLayerImpl; layerImpl; layerImpl = layerImpl->parent()) { if (!layerImpl->scrollable()) continue; - CCPinchZoomViewport* viewport = layerImpl == m_rootScrollLayerImpl ? &m_pinchZoomViewport : 0; + PinchZoomViewport* viewport = layerImpl == m_rootScrollLayerImpl ? &m_pinchZoomViewport : 0; FloatSize appliedDelta; if (m_scrollDeltaIsInViewportSpace) { float scaleFromViewportToScreenSpace = m_deviceScaleFactor; @@ -1160,7 +1160,7 @@ void CCLayerTreeHostImpl::scrollBy(const IntPoint& viewportPoint, const IntSize& // If the applied delta is within 45 degrees of the input delta, bail out to make it easier // to scroll just one layer in one direction without affecting any of its parents. float angleThreshold = 45; - if (CCMathUtil::smallestAngleBetweenVectors(appliedDelta, pendingDelta) < angleThreshold) { + if (MathUtil::smallestAngleBetweenVectors(appliedDelta, pendingDelta) < angleThreshold) { pendingDelta = FloatSize(); break; } @@ -1168,7 +1168,7 @@ void CCLayerTreeHostImpl::scrollBy(const IntPoint& viewportPoint, const IntSize& // Allow further movement only on an axis perpendicular to the direction in which the layer // moved. FloatSize perpendicularAxis(-appliedDelta.height(), appliedDelta.width()); - pendingDelta = CCMathUtil::projectVector(pendingDelta, perpendicularAxis); + pendingDelta = MathUtil::projectVector(pendingDelta, perpendicularAxis); if (flooredIntSize(pendingDelta).isZero()) break; @@ -1180,18 +1180,18 @@ void CCLayerTreeHostImpl::scrollBy(const IntPoint& viewportPoint, const IntSize& } } -void CCLayerTreeHostImpl::clearCurrentlyScrollingLayer() +void LayerTreeHostImpl::clearCurrentlyScrollingLayer() { m_currentlyScrollingLayerImpl = 0; m_scrollingLayerIdFromPreviousTree = -1; } -void CCLayerTreeHostImpl::scrollEnd() +void LayerTreeHostImpl::scrollEnd() { clearCurrentlyScrollingLayer(); } -void CCLayerTreeHostImpl::pinchGestureBegin() +void LayerTreeHostImpl::pinchGestureBegin() { m_pinchGestureActive = true; m_previousPinchAnchor = IntPoint(); @@ -1200,10 +1200,10 @@ void CCLayerTreeHostImpl::pinchGestureBegin() m_rootScrollLayerImpl->scrollbarAnimationController()->didPinchGestureBegin(); } -void CCLayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, +void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor) { - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::pinchGestureUpdate"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::pinchGestureUpdate"); if (!m_rootScrollLayerImpl) return; @@ -1238,7 +1238,7 @@ void CCLayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, m_client->setNeedsRedrawOnImplThread(); } -void CCLayerTreeHostImpl::pinchGestureEnd() +void LayerTreeHostImpl::pinchGestureEnd() { m_pinchGestureActive = false; @@ -1248,7 +1248,7 @@ void CCLayerTreeHostImpl::pinchGestureEnd() m_client->setNeedsCommitOnImplThread(); } -void CCLayerTreeHostImpl::computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo) +void LayerTreeHostImpl::computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo) { float pageScale = m_pageScaleAnimation->finalPageScale(); IntSize scrollOffset = m_pageScaleAnimation->finalScrollOffset(); @@ -1256,7 +1256,7 @@ void CCLayerTreeHostImpl::computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scroll makeScrollAndScaleSet(scrollInfo, scrollOffset, pageScale); } -void CCLayerTreeHostImpl::computePinchZoomDeltas(CCScrollAndScaleSet* scrollInfo) +void LayerTreeHostImpl::computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo) { if (!m_rootScrollLayerImpl) return; @@ -1288,12 +1288,12 @@ void CCLayerTreeHostImpl::computePinchZoomDeltas(CCScrollAndScaleSet* scrollInfo makeScrollAndScaleSet(scrollInfo, roundedIntSize(scrollEnd), m_pinchZoomViewport.minPageScaleFactor()); } -void CCLayerTreeHostImpl::makeScrollAndScaleSet(CCScrollAndScaleSet* scrollInfo, const IntSize& scrollOffset, float pageScale) +void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scrollOffset, float pageScale) { if (!m_rootScrollLayerImpl) return; - CCLayerTreeHostCommon::ScrollUpdateInfo scroll; + LayerTreeHostCommon::ScrollUpdateInfo scroll; scroll.layerId = m_rootScrollLayerImpl->id(); scroll.scrollDelta = scrollOffset - toSize(m_rootScrollLayerImpl->scrollPosition()); scrollInfo->scrolls.append(scroll); @@ -1302,14 +1302,14 @@ void CCLayerTreeHostImpl::makeScrollAndScaleSet(CCScrollAndScaleSet* scrollInfo, m_pinchZoomViewport.setSentPageScaleDelta(scrollInfo->pageScaleDelta); } -static void collectScrollDeltas(CCScrollAndScaleSet* scrollInfo, CCLayerImpl* layerImpl) +static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerImpl) { if (!layerImpl) return; if (!layerImpl->scrollDelta().isZero()) { IntSize scrollDelta = flooredIntSize(layerImpl->scrollDelta()); - CCLayerTreeHostCommon::ScrollUpdateInfo scroll; + LayerTreeHostCommon::ScrollUpdateInfo scroll; scroll.layerId = layerImpl->id(); scroll.scrollDelta = scrollDelta; scrollInfo->scrolls.append(scroll); @@ -1320,9 +1320,9 @@ static void collectScrollDeltas(CCScrollAndScaleSet* scrollInfo, CCLayerImpl* la collectScrollDeltas(scrollInfo, layerImpl->children()[i]); } -scoped_ptr<CCScrollAndScaleSet> CCLayerTreeHostImpl::processScrollDeltas() +scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::processScrollDeltas() { - scoped_ptr<CCScrollAndScaleSet> scrollInfo(new CCScrollAndScaleSet()); + scoped_ptr<ScrollAndScaleSet> scrollInfo(new ScrollAndScaleSet()); if (m_pinchGestureActive || m_pageScaleAnimation) { scrollInfo->pageScaleDelta = 1; @@ -1345,21 +1345,21 @@ scoped_ptr<CCScrollAndScaleSet> CCLayerTreeHostImpl::processScrollDeltas() return scrollInfo.Pass(); } -WebTransformationMatrix CCLayerTreeHostImpl::implTransform() const +WebTransformationMatrix LayerTreeHostImpl::implTransform() const { return m_pinchZoomViewport.implTransform(); } -void CCLayerTreeHostImpl::setFullRootLayerDamage() +void LayerTreeHostImpl::setFullRootLayerDamage() { if (m_rootLayerImpl) { - CCRenderSurface* renderSurface = m_rootLayerImpl->renderSurface(); + RenderSurfaceImpl* renderSurface = m_rootLayerImpl->renderSurface(); if (renderSurface) renderSurface->damageTracker()->forceFullDamageNextUpdate(); } } -void CCLayerTreeHostImpl::animatePageScale(double monotonicTime) +void LayerTreeHostImpl::animatePageScale(double monotonicTime) { if (!m_pageScaleAnimation || !m_rootScrollLayerImpl) return; @@ -1378,14 +1378,14 @@ void CCLayerTreeHostImpl::animatePageScale(double monotonicTime) } } -void CCLayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTime) +void LayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTime) { if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers || !m_rootLayerImpl) return; - TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEventsVector)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); bool didAnimate = false; animateLayersRecursive(m_rootLayerImpl.get(), monotonicTime, wallClockTime, events.get(), didAnimate, m_needsAnimateLayers); @@ -1399,12 +1399,12 @@ void CCLayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTi setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); } -base::TimeDelta CCLayerTreeHostImpl::lowFrequencyAnimationInterval() const +base::TimeDelta LayerTreeHostImpl::lowFrequencyAnimationInterval() const { return base::TimeDelta::FromSeconds(1); } -void CCLayerTreeHostImpl::sendDidLoseContextRecursive(CCLayerImpl* current) +void LayerTreeHostImpl::sendDidLoseContextRecursive(LayerImpl* current) { DCHECK(current); current->didLoseContext(); @@ -1416,21 +1416,21 @@ void CCLayerTreeHostImpl::sendDidLoseContextRecursive(CCLayerImpl* current) sendDidLoseContextRecursive(current->children()[i]); } -static void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl* current) +static void clearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) { DCHECK(current); for (size_t i = 0; i < current->children().size(); ++i) - clearRenderSurfacesOnCCLayerImplRecursive(current->children()[i]); + clearRenderSurfacesOnLayerImplRecursive(current->children()[i]); current->clearRenderSurface(); } -void CCLayerTreeHostImpl::clearRenderSurfaces() +void LayerTreeHostImpl::clearRenderSurfaces() { - clearRenderSurfacesOnCCLayerImplRecursive(m_rootLayerImpl.get()); + clearRenderSurfacesOnLayerImplRecursive(m_rootLayerImpl.get()); m_renderSurfaceLayerList.clear(); } -std::string CCLayerTreeHostImpl::layerTreeAsText() const +std::string LayerTreeHostImpl::layerTreeAsText() const { std::string str; if (m_rootLayerImpl) { @@ -1441,7 +1441,7 @@ std::string CCLayerTreeHostImpl::layerTreeAsText() const return str; } -void CCLayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const CCLayerImpl* layer) const +void LayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const LayerImpl* layer) const { if (layer->renderSurface()) layer->renderSurface()->dumpSurface(str, indent); @@ -1450,12 +1450,12 @@ void CCLayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const dumpRenderSurfaces(str, indent, layer->children()[i]); } -int CCLayerTreeHostImpl::sourceAnimationFrameNumber() const +int LayerTreeHostImpl::sourceAnimationFrameNumber() const { return fpsCounter()->currentFrameNumber(); } -void CCLayerTreeHostImpl::renderingStats(CCRenderingStats* stats) const +void LayerTreeHostImpl::renderingStats(RenderingStats* stats) const { stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber(); stats->droppedFrameCount = fpsCounter()->droppedFrameCount(); @@ -1463,17 +1463,17 @@ void CCLayerTreeHostImpl::renderingStats(CCRenderingStats* stats) const stats->numMainThreadScrolls = m_numMainThreadScrolls; } -void CCLayerTreeHostImpl::animateScrollbars(double monotonicTime) +void LayerTreeHostImpl::animateScrollbars(double monotonicTime) { animateScrollbarsRecursive(m_rootLayerImpl.get(), monotonicTime); } -void CCLayerTreeHostImpl::animateScrollbarsRecursive(CCLayerImpl* layer, double monotonicTime) +void LayerTreeHostImpl::animateScrollbarsRecursive(LayerImpl* layer, double monotonicTime) { if (!layer) return; - CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimationController(); + ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimationController(); if (scrollbarController && scrollbarController->animate(monotonicTime)) m_client->setNeedsRedrawOnImplThread(); diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index 7ca454b..f5928b6 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -19,20 +19,20 @@ namespace cc { -class CCCompletionEvent; -class CCDebugRectHistory; -class CCFrameRateCounter; -class CCHeadsUpDisplayLayerImpl; -class CCLayerImpl; -class CCLayerTreeHostImplTimeSourceAdapter; -class CCPageScaleAnimation; -class CCRenderPassDrawQuad; -class CCResourceProvider; +class CompletionEvent; +class DebugRectHistory; +class FrameRateCounter; +class HeadsUpDisplayLayerImpl; +class LayerImpl; +class LayerTreeHostImplTimeSourceAdapter; +class PageScaleAnimation; +class RenderPassDrawQuad; +class ResourceProvider; struct RendererCapabilities; -struct CCRenderingStats; +struct RenderingStats; -// CCLayerTreeHost->CCProxy callback interface. -class CCLayerTreeHostImplClient { +// LayerTreeHost->Proxy callback interface. +class LayerTreeHostImplClient { public: virtual void didLoseContextOnImplThread() = 0; virtual void onSwapBuffersCompleteOnImplThread() = 0; @@ -40,17 +40,17 @@ public: virtual void onCanDrawStateChanged(bool canDraw) = 0; virtual void setNeedsRedrawOnImplThread() = 0; virtual void setNeedsCommitOnImplThread() = 0; - virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) = 0; + virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, double wallClockTime) = 0; // Returns true if resources were deleted by this call. virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) = 0; }; -// CCPinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation. +// PinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation. // It tracks the layout-space dimensions of the viewport before any applied scale, and then tracks the layout-space // coordinates of the viewport respecting the pinch settings. -class CCPinchZoomViewport { +class PinchZoomViewport { public: - CCPinchZoomViewport(); + PinchZoomViewport(); float totalPageScaleFactor() const; @@ -96,18 +96,18 @@ private: FloatSize m_layoutViewportSize; }; -// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state -class CCLayerTreeHostImpl : public CCInputHandlerClient, - public CCRendererClient, +// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state +class LayerTreeHostImpl : public InputHandlerClient, + public RendererClient, public WebKit::WebCompositorOutputSurfaceClient { - typedef std::vector<CCLayerImpl*> CCLayerList; + typedef std::vector<LayerImpl*> LayerList; public: - static scoped_ptr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*); - virtual ~CCLayerTreeHostImpl(); + static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerTreeHostImplClient*); + virtual ~LayerTreeHostImpl(); - // CCInputHandlerClient implementation - virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, CCInputHandlerClient::ScrollInputType) OVERRIDE; + // InputHandlerClient implementation + virtual InputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, InputHandlerClient::ScrollInputType) OVERRIDE; virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE; virtual void scrollEnd() OVERRIDE; virtual void pinchGestureBegin() OVERRIDE; @@ -116,18 +116,18 @@ public: virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTime, double duration) OVERRIDE; virtual void scheduleAnimation() OVERRIDE; - struct FrameData : public CCRenderPassSink { + struct FrameData : public RenderPassSink { FrameData(); ~FrameData(); Vector<IntRect> occludingScreenSpaceRects; - CCRenderPassList renderPasses; - CCRenderPassIdHashMap renderPassesById; - CCLayerList* renderSurfaceLayerList; - CCLayerList willDrawLayers; + RenderPassList renderPasses; + RenderPassIdHashMap renderPassesById; + LayerList* renderSurfaceLayerList; + LayerList willDrawLayers; - // CCRenderPassSink implementation. - virtual void appendRenderPass(scoped_ptr<CCRenderPass>) OVERRIDE; + // RenderPassSink implementation. + virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE; }; // Virtual for testing. @@ -144,9 +144,9 @@ public: // Must be called if and only if prepareToDraw was called. void didDrawAllLayers(const FrameData&); - // CCRendererClient implementation + // RendererClient implementation virtual const IntSize& deviceViewportSize() const OVERRIDE; - virtual const CCLayerTreeSettings& settings() const OVERRIDE; + virtual const LayerTreeSettings& settings() const OVERRIDE; virtual void didLoseContext() OVERRIDE; virtual void onSwapBuffersComplete() OVERRIDE; virtual void setFullRootLayerDamage() OVERRIDE; @@ -157,33 +157,33 @@ public: // Implementation bool canDraw(); - CCGraphicsContext* context() const; + GraphicsContext* context() const; std::string layerTreeAsText() const; void finishAllRendering(); int sourceAnimationFrameNumber() const; - bool initializeRenderer(scoped_ptr<CCGraphicsContext>); + bool initializeRenderer(scoped_ptr<GraphicsContext>); bool isContextLost(); - CCRenderer* renderer() { return m_renderer.get(); } + Renderer* renderer() { return m_renderer.get(); } const RendererCapabilities& rendererCapabilities() const; bool swapBuffers(); void readback(void* pixels, const IntRect&); - void setRootLayer(scoped_ptr<CCLayerImpl>); - CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); } + void setRootLayer(scoped_ptr<LayerImpl>); + LayerImpl* rootLayer() { return m_rootLayerImpl.get(); } - void setHudLayer(CCHeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = layerImpl; } - CCHeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; } + void setHudLayer(HeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = layerImpl; } + HeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; } // Release ownership of the current layer tree and replace it with an empty // tree. Returns the root layer of the detached tree. - scoped_ptr<CCLayerImpl> detachLayerTree(); + scoped_ptr<LayerImpl> detachLayerTree(); - CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } + LayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } bool visible() const { return m_visible; } void setVisible(bool); @@ -206,7 +206,7 @@ public: float pageScaleFactor() const; void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor); - scoped_ptr<CCScrollAndScaleSet> processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); WebKit::WebTransformationMatrix implTransform() const; void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec); @@ -222,38 +222,38 @@ public: void setNeedsRedraw(); - void renderingStats(CCRenderingStats*) const; + void renderingStats(RenderingStats*) const; void updateRootScrollLayerImplTransform(); - CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } - CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); } - CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); } + FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } + DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); } + ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); } class CullRenderPassesWithCachedTextures { public: - bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const; + bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const; // Iterates from the root first, in order to remove the surfaces closest // to the root with cached textures, and all surfaces that draw into // them. - size_t renderPassListBegin(const CCRenderPassList& list) const { return list.size() - 1; } - size_t renderPassListEnd(const CCRenderPassList&) const { return 0 - 1; } + size_t renderPassListBegin(const RenderPassList& list) const { return list.size() - 1; } + size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } size_t renderPassListNext(size_t it) const { return it - 1; } - CullRenderPassesWithCachedTextures(CCRenderer& renderer) : m_renderer(renderer) { } + CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(renderer) { } private: - CCRenderer& m_renderer; + Renderer& m_renderer; }; class CullRenderPassesWithNoQuads { public: - bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const; + bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const; // Iterates in draw order, so that when a surface is removed, and its // target becomes empty, then its target can be removed also. - size_t renderPassListBegin(const CCRenderPassList&) const { return 0; } - size_t renderPassListEnd(const CCRenderPassList& list) const { return list.size(); } + size_t renderPassListBegin(const RenderPassList&) const { return 0; } + size_t renderPassListEnd(const RenderPassList& list) const { return list.size(); } size_t renderPassListNext(size_t it) const { return it + 1; } }; @@ -261,13 +261,13 @@ public: static void removeRenderPasses(RenderPassCuller, FrameData&); protected: - CCLayerTreeHostImpl(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*); + LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*); void animatePageScale(double monotonicTime); void animateScrollbars(double monotonicTime); // Exposed for testing. - void calculateRenderSurfaceLayerList(CCLayerList&); + void calculateRenderSurfaceLayerList(LayerList&); // Virtual for testing. virtual void animateLayers(double monotonicTime, double wallClockTime); @@ -275,45 +275,45 @@ protected: // Virtual for testing. virtual base::TimeDelta lowFrequencyAnimationInterval() const; - CCLayerTreeHostImplClient* m_client; + LayerTreeHostImplClient* m_client; int m_sourceFrameNumber; private: - void computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo); - void computePinchZoomDeltas(CCScrollAndScaleSet* scrollInfo); - void makeScrollAndScaleSet(CCScrollAndScaleSet* scrollInfo, const IntSize& scrollOffset, float pageScale); + void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); + void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); + void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scrollOffset, float pageScale); void setPageScaleDelta(float); void updateMaxScrollPosition(); - void trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList); + void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList); // Returns false if the frame should not be displayed. This function should // only be called from prepareToDraw, as didDrawAllLayers must be called // if this helper function is called. bool calculateRenderPasses(FrameData&); - void animateLayersRecursive(CCLayerImpl*, double monotonicTime, double wallClockTime, CCAnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers); + void animateLayersRecursive(LayerImpl*, double monotonicTime, double wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers); void setBackgroundTickingEnabled(bool); IntSize contentSize() const; - void sendDidLoseContextRecursive(CCLayerImpl*); + void sendDidLoseContextRecursive(LayerImpl*); void clearRenderSurfaces(); bool ensureRenderSurfaceLayerList(); void clearCurrentlyScrollingLayer(); - void animateScrollbarsRecursive(CCLayerImpl*, double monotonicTime); + void animateScrollbarsRecursive(LayerImpl*, double monotonicTime); - void dumpRenderSurfaces(std::string*, int indent, const CCLayerImpl*) const; + void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; - scoped_ptr<CCGraphicsContext> m_context; - scoped_ptr<CCResourceProvider> m_resourceProvider; - scoped_ptr<CCRenderer> m_renderer; - scoped_ptr<CCLayerImpl> m_rootLayerImpl; - CCLayerImpl* m_rootScrollLayerImpl; - CCLayerImpl* m_currentlyScrollingLayerImpl; - CCHeadsUpDisplayLayerImpl* m_hudLayerImpl; + scoped_ptr<GraphicsContext> m_context; + scoped_ptr<ResourceProvider> m_resourceProvider; + scoped_ptr<Renderer> m_renderer; + scoped_ptr<LayerImpl> m_rootLayerImpl; + LayerImpl* m_rootScrollLayerImpl; + LayerImpl* m_currentlyScrollingLayerImpl; + HeadsUpDisplayLayerImpl* m_hudLayerImpl; int m_scrollingLayerIdFromPreviousTree; bool m_scrollDeltaIsInViewportSpace; - CCLayerTreeSettings m_settings; + LayerTreeSettings m_settings; IntSize m_layoutViewportSize; IntSize m_deviceViewportSize; float m_deviceScaleFactor; @@ -329,26 +329,26 @@ private: bool m_pinchGestureActive; IntPoint m_previousPinchAnchor; - scoped_ptr<CCPageScaleAnimation> m_pageScaleAnimation; + scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; // This is used for ticking animations slowly when hidden. - scoped_ptr<CCLayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; + scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; - CCLayerSorter m_layerSorter; + LayerSorter m_layerSorter; // List of visible layers for the most recently prepared frame. Used for // rendering and input event hit testing. - CCLayerList m_renderSurfaceLayerList; + LayerList m_renderSurfaceLayerList; - CCPinchZoomViewport m_pinchZoomViewport; + PinchZoomViewport m_pinchZoomViewport; - scoped_ptr<CCFrameRateCounter> m_fpsCounter; - scoped_ptr<CCDebugRectHistory> m_debugRectHistory; + scoped_ptr<FrameRateCounter> m_fpsCounter; + scoped_ptr<DebugRectHistory> m_debugRectHistory; size_t m_numImplThreadScrolls; size_t m_numMainThreadScrolls; - DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImpl); + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); }; } // namespace cc diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 15228a7..03d5931 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -40,7 +40,7 @@ #include <public/WebVideoFrameProvider.h> using namespace cc; -using namespace CCLayerTestCommon; +using namespace LayerTestCommon; using namespace WebKit; using namespace WebKitTests; @@ -54,10 +54,10 @@ namespace { // This test is parametrized to run all tests with the // Settings::pageScalePinchZoomEnabled field enabled and disabled. -class CCLayerTreeHostImplTest : public testing::TestWithParam<bool>, - public CCLayerTreeHostImplClient { +class LayerTreeHostImplTest : public testing::TestWithParam<bool>, + public LayerTreeHostImplClient { public: - CCLayerTreeHostImplTest() + LayerTreeHostImplTest() : m_onCanDrawStateChangedCalled(false) , m_didRequestCommit(false) , m_didRequestRedraw(false) @@ -68,10 +68,10 @@ public: virtual void SetUp() { Settings::setPageScalePinchZoomEnabled(GetParam()); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + m_hostImpl = LayerTreeHostImpl::create(settings, this); m_hostImpl->initializeRenderer(createContext()); m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); } @@ -86,19 +86,19 @@ public: virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; } virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; } virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; } - virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { } + virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, double wallClockTime) OVERRIDE { } virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) OVERRIDE { return m_reduceMemoryResult; } void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } - scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<CCGraphicsContext> graphicsContext, scoped_ptr<CCLayerImpl> root) + scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root) { Settings::setPartialSwapEnabled(partialSwap); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); myHostImpl->initializeRenderer(graphicsContext.Pass()); myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); @@ -113,14 +113,14 @@ public: return myHostImpl.Pass(); } - static void expectClearedScrollDeltasRecursive(CCLayerImpl* layer) + static void expectClearedScrollDeltasRecursive(LayerImpl* layer) { ASSERT_EQ(layer->scrollDelta(), IntSize()); for (size_t i = 0; i < layer->children().size(); ++i) expectClearedScrollDeltasRecursive(layer->children()[i]); } - static void expectContains(const CCScrollAndScaleSet& scrollInfo, int id, const IntSize& scrollDelta) + static void expectContains(const ScrollAndScaleSet& scrollInfo, int id, const IntSize& scrollDelta) { int timesEncountered = 0; @@ -137,7 +137,7 @@ public: void setupScrollAndContentsLayers(const IntSize& contentSize) { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->setScrollable(true); root->setScrollPosition(IntPoint(0, 0)); root->setMaxScrollPosition(contentSize); @@ -146,7 +146,7 @@ public: root->setPosition(FloatPoint(0, 0)); root->setAnchorPoint(FloatPoint(0, 0)); - scoped_ptr<CCLayerImpl> contents = CCLayerImpl::create(2); + scoped_ptr<LayerImpl> contents = LayerImpl::create(2); contents->setDrawsContent(true); contents->setBounds(contentSize); contents->setContentBounds(contentSize); @@ -156,9 +156,9 @@ public: m_hostImpl->setRootLayer(root.Pass()); } - static scoped_ptr<CCLayerImpl> createScrollableLayer(int id, const IntSize& size) + static scoped_ptr<LayerImpl> createScrollableLayer(int id, const IntSize& size) { - scoped_ptr<CCLayerImpl> layer = CCLayerImpl::create(id); + scoped_ptr<LayerImpl> layer = LayerImpl::create(id); layer->setScrollable(true); layer->setDrawsContent(true); layer->setBounds(size); @@ -170,27 +170,27 @@ public: void initializeRendererAndDrawFrame() { m_hostImpl->initializeRenderer(createContext()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); } protected: - scoped_ptr<CCGraphicsContext> createContext() + scoped_ptr<GraphicsContext> createContext() { - return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<CCGraphicsContext>(); + return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); } DebugScopedSetImplThread m_alwaysImplThread; DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; - scoped_ptr<CCLayerTreeHostImpl> m_hostImpl; + scoped_ptr<LayerTreeHostImpl> m_hostImpl; bool m_onCanDrawStateChangedCalled; bool m_didRequestCommit; bool m_didRequestRedraw; bool m_reduceMemoryResult; - CCScopedSettings m_scopedSettings; + ScopedSettings m_scopedSettings; }; class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { @@ -198,7 +198,7 @@ public: virtual bool makeContextCurrent() { return false; } }; -TEST_P(CCLayerTreeHostImplTest, notifyIfCanDrawChanged) +TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) { // Note: It is not possible to disable the renderer once it has been set, // so we do not need to test that disabling the renderer notifies us @@ -212,7 +212,7 @@ TEST_P(CCLayerTreeHostImplTest, notifyIfCanDrawChanged) m_onCanDrawStateChangedCalled = false; // Toggle the root layer to make sure it toggles canDraw - m_hostImpl->setRootLayer(scoped_ptr<CCLayerImpl>()); + m_hostImpl->setRootLayer(scoped_ptr<LayerImpl>()); EXPECT_FALSE(m_hostImpl->canDraw()); EXPECT_TRUE(m_onCanDrawStateChangedCalled); m_onCanDrawStateChangedCalled = false; @@ -256,30 +256,30 @@ TEST_P(CCLayerTreeHostImplTest, notifyIfCanDrawChanged) m_onCanDrawStateChangedCalled = false; } -TEST_P(CCLayerTreeHostImplTest, scrollDeltaNoLayers) +TEST_P(LayerTreeHostImplTest, scrollDeltaNoLayers) { ASSERT_FALSE(m_hostImpl->rootLayer()); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); ASSERT_EQ(scrollInfo->scrolls.size(), 0u); } -TEST_P(CCLayerTreeHostImplTest, scrollDeltaTreeButNoChanges) +TEST_P(LayerTreeHostImplTest, scrollDeltaTreeButNoChanges) { { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - root->addChild(CCLayerImpl::create(2)); - root->addChild(CCLayerImpl::create(3)); - root->children()[1]->addChild(CCLayerImpl::create(4)); - root->children()[1]->addChild(CCLayerImpl::create(5)); - root->children()[1]->children()[0]->addChild(CCLayerImpl::create(6)); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + root->addChild(LayerImpl::create(2)); + root->addChild(LayerImpl::create(3)); + root->children()[1]->addChild(LayerImpl::create(4)); + root->children()[1]->addChild(LayerImpl::create(5)); + root->children()[1]->children()[0]->addChild(LayerImpl::create(6)); m_hostImpl->setRootLayer(root.Pass()); } - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); expectClearedScrollDeltasRecursive(root); - scoped_ptr<CCScrollAndScaleSet> scrollInfo; + scoped_ptr<ScrollAndScaleSet> scrollInfo; scrollInfo = m_hostImpl->processScrollDeltas(); ASSERT_EQ(scrollInfo->scrolls.size(), 0u); @@ -290,21 +290,21 @@ TEST_P(CCLayerTreeHostImplTest, scrollDeltaTreeButNoChanges) expectClearedScrollDeltasRecursive(root); } -TEST_P(CCLayerTreeHostImplTest, scrollDeltaRepeatedScrolls) +TEST_P(LayerTreeHostImplTest, scrollDeltaRepeatedScrolls) { IntPoint scrollPosition(20, 30); IntSize scrollDelta(11, -15); { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->setScrollPosition(scrollPosition); root->setScrollable(true); root->setMaxScrollPosition(IntSize(100, 100)); root->scrollBy(scrollDelta); m_hostImpl->setRootLayer(root.Pass()); } - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo; + scoped_ptr<ScrollAndScaleSet> scrollInfo; scrollInfo = m_hostImpl->processScrollDeltas(); ASSERT_EQ(scrollInfo->scrolls.size(), 1u); @@ -323,41 +323,41 @@ TEST_P(CCLayerTreeHostImplTest, scrollDeltaRepeatedScrolls) EXPECT_EQ(root->sentScrollDelta(), scrollDelta + scrollDelta2); } -TEST_P(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) +TEST_P(LayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); } -TEST_P(CCLayerTreeHostImplTest, scrollWithoutRootLayer) +TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer) { // We should not crash when trying to scroll an empty layer tree. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); } -TEST_P(CCLayerTreeHostImplTest, scrollWithoutRenderer) +TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer) { - CCLayerTreeSettings settings; - m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + LayerTreeSettings settings; + m_hostImpl = LayerTreeHostImpl::create(settings, this); // Initialization will fail here. - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>()); m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); setupScrollAndContentsLayers(IntSize(100, 100)); // We should not crash when trying to scroll after the renderer initialization fails. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); } -TEST_P(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) +TEST_P(LayerTreeHostImplTest, replaceTreeWhileScrolling) { const int scrollLayerId = 1; @@ -366,7 +366,7 @@ TEST_P(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) initializeRendererAndDrawFrame(); // We should not crash if the tree is replaced while we are scrolling. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->detachLayerTree(); setupScrollAndContentsLayers(IntSize(100, 100)); @@ -375,11 +375,11 @@ TEST_P(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) IntSize scrollDelta(0, 10); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo, scrollLayerId, scrollDelta); } -TEST_P(CCLayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) +TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); @@ -388,80 +388,80 @@ TEST_P(CCLayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) // We should be able to scroll even if the root layer loses its render surface after the most // recent render. m_hostImpl->rootLayer()->clearRenderSurface(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); } -TEST_P(CCLayerTreeHostImplTest, wheelEventHandlers) +TEST_P(LayerTreeHostImplTest, wheelEventHandlers) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); root->setHaveWheelEventHandlers(true); // With registered event handlers, wheel scrolls have to go to the main thread. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); // But gesture scrolls can still be handled. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); } -TEST_P(CCLayerTreeHostImplTest, shouldScrollOnMainThread) +TEST_P(LayerTreeHostImplTest, shouldScrollOnMainThread) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); root->setShouldScrollOnMainThread(true); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread); } -TEST_P(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic) +TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic) { setupScrollAndContentsLayers(IntSize(200, 200)); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); initializeRendererAndDrawFrame(); - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); // All scroll types inside the non-fast scrollable region should fail. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread); // All scroll types outside this region should succeed. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); } -TEST_P(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) +TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset) { setupScrollAndContentsLayers(IntSize(200, 200)); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); root->setPosition(FloatPoint(-25, 0)); initializeRendererAndDrawFrame(); // This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); m_hostImpl->scrollEnd(); // This point is still inside the non-fast region. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); } -TEST_P(CCLayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor) +TEST_P(LayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor) { setupScrollAndContentsLayers(IntSize(100, 100)); @@ -479,7 +479,7 @@ TEST_P(CCLayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor) EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(75, 75)); } -TEST_P(CCLayerTreeHostImplTest, implPinchZoom) +TEST_P(LayerTreeHostImplTest, implPinchZoom) { // This test is specific to the page-scale based pinch zoom. if (!Settings::pageScalePinchZoomEnabled()) @@ -489,7 +489,7 @@ TEST_P(CCLayerTreeHostImplTest, implPinchZoom) m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); + LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); DCHECK(scrollLayer); const float minPageScale = 1, maxPageScale = 4; @@ -508,7 +508,7 @@ TEST_P(CCLayerTreeHostImplTest, implPinchZoom) EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(50, 50)); @@ -527,22 +527,22 @@ TEST_P(CCLayerTreeHostImplTest, implPinchZoom) m_hostImpl->pinchGestureEnd(); IntSize scrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), scrollDelta); } } -TEST_P(CCLayerTreeHostImplTest, pinchGesture) +TEST_P(LayerTreeHostImplTest, pinchGesture) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); + LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); DCHECK(scrollLayer); const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; @@ -562,7 +562,7 @@ TEST_P(CCLayerTreeHostImplTest, pinchGesture) EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); } @@ -577,7 +577,7 @@ TEST_P(CCLayerTreeHostImplTest, pinchGesture) m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50)); m_hostImpl->pinchGestureEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, maxPageScale); } @@ -593,7 +593,7 @@ TEST_P(CCLayerTreeHostImplTest, pinchGesture) m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0)); m_hostImpl->pinchGestureEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); if (!Settings::pageScalePinchZoomEnabled()) { @@ -617,19 +617,19 @@ TEST_P(CCLayerTreeHostImplTest, pinchGesture) m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(20, 20)); m_hostImpl->pinchGestureEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); expectContains(*scrollInfo, scrollLayer->id(), IntSize(-10, -10)); } } -TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) +TEST_P(LayerTreeHostImplTest, pageScaleAnimation) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); + LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); DCHECK(scrollLayer); const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; @@ -652,7 +652,7 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) m_hostImpl->animate(endTime, endTime); EXPECT_TRUE(m_didRequestCommit); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, 2); expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); } @@ -668,20 +668,20 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); // Pushed to (0,0) via clamping against contents layer size. expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); } } -TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming) +TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); + LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); DCHECK(scrollLayer); const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; @@ -697,7 +697,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin // Because we are pinch zooming in, we shouldn't get any scroll or page // scale deltas. - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); EXPECT_EQ(scrollInfo->pageScaleDelta, 1); EXPECT_EQ(scrollInfo->scrolls.size(), 0u); @@ -722,7 +722,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin // Since we are pinch zooming out, we should get an update to zoom all // the way out to the minimum page scale. - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); if (!Settings::pageScalePinchZoomEnabled()) { EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); expectContains(*scrollInfo, scrollLayer->id(), IntSize(0, 0)); @@ -744,13 +744,13 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin } } -TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPageScale) +TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPageScale) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); initializeRendererAndDrawFrame(); - CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); + LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); DCHECK(scrollLayer); const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; @@ -768,7 +768,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa // We should immediately get the final zoom and scroll values for the // animation. m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); if (!Settings::pageScalePinchZoomEnabled()) { EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); @@ -780,7 +780,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa // Scrolling during the animation is ignored. const IntSize scrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); @@ -792,16 +792,16 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); } -class DidDrawCheckLayer : public CCTiledLayerImpl { +class DidDrawCheckLayer : public TiledLayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new DidDrawCheckLayer(id)); } + static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(id)); } - virtual void didDraw(CCResourceProvider*) OVERRIDE + virtual void didDraw(ResourceProvider*) OVERRIDE { m_didDrawCalled = true; } - virtual void willDraw(CCResourceProvider*) OVERRIDE + virtual void willDraw(ResourceProvider*) OVERRIDE { m_willDrawCalled = true; } @@ -817,7 +817,7 @@ public: protected: explicit DidDrawCheckLayer(int id) - : CCTiledLayerImpl(id) + : TiledLayerImpl(id) , m_didDrawCalled(false) , m_willDrawCalled(false) { @@ -828,7 +828,7 @@ protected: setSkipsDraw(false); setVisibleContentRect(IntRect(0, 0, 10, 10)); - scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); + scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::HasBorderTexels); tiler->setBounds(contentBounds()); setTilingData(*tiler.get()); } @@ -838,7 +838,7 @@ private: bool m_willDrawCalled; }; -TEST_P(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) +TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) { // The root layer is always drawn, so run this test on a child layer that // will be masked out by the root layer's bounds. @@ -853,7 +853,7 @@ TEST_P(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) layer->setBounds(IntSize(10, 10)); layer->setContentBounds(IntSize(10, 10)); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_FALSE(layer->willDrawCalled()); EXPECT_FALSE(layer->didDrawCalled()); @@ -883,7 +883,7 @@ TEST_P(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_FALSE(layer->visibleContentRect().isEmpty()); } -TEST_P(CCLayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) +TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) { IntSize bigSize(1000, 1000); m_hostImpl->setViewportSize(bigSize, bigSize); @@ -901,7 +901,7 @@ TEST_P(CCLayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) topLayer->setContentBounds(bigSize); topLayer->setContentsOpaque(true); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_FALSE(occludedLayer->willDrawCalled()); EXPECT_FALSE(occludedLayer->didDrawCalled()); @@ -918,7 +918,7 @@ TEST_P(CCLayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) EXPECT_TRUE(topLayer->didDrawCalled()); } -TEST_P(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) +TEST_P(LayerTreeHostImplTest, didDrawCalledOnAllLayers) { m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); @@ -936,7 +936,7 @@ TEST_P(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) EXPECT_FALSE(layer1->didDrawCalled()); EXPECT_FALSE(layer2->didDrawCalled()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -951,21 +951,21 @@ TEST_P(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) class MissingTextureAnimatingLayer : public DidDrawCheckLayer { public: - static scoped_ptr<CCLayerImpl> create(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) + static scoped_ptr<LayerImpl> create(int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) { - return scoped_ptr<CCLayerImpl>(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating, resourceProvider)); + return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating, resourceProvider)); } private: - explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) + explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) : DidDrawCheckLayer(id) { - scoped_ptr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels); + scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels); tilingData->setBounds(bounds()); setTilingData(*tilingData.get()); setSkipsDraw(skipsDraw); if (!tileMissing) { - CCResourceProvider::ResourceId resource = resourceProvider->createResource(CCRenderer::ContentPool, IntSize(), GL_RGBA, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId resource = resourceProvider->createResource(Renderer::ContentPool, IntSize(), GL_RGBA, ResourceProvider::TextureUsageAny); pushTileProperties(0, 0, resource, IntRect()); } if (animating) @@ -973,14 +973,14 @@ private: } }; -TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) +TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) { // When the texture is not missing, we draw as usual. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); root->addChild(MissingTextureAnimatingLayer::create(2, false, false, true, m_hostImpl->resourceProvider())); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); @@ -1014,26 +1014,26 @@ TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) m_hostImpl->didDrawAllLayers(frame); } -TEST_P(CCLayerTreeHostImplTest, scrollRootIgnored) +TEST_P(LayerTreeHostImplTest, scrollRootIgnored) { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->setScrollable(false); m_hostImpl->setRootLayer(root.Pass()); initializeRendererAndDrawFrame(); // Scroll event is ignored because layer is not scrollable. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); EXPECT_FALSE(m_didRequestRedraw); EXPECT_FALSE(m_didRequestCommit); } -TEST_P(CCLayerTreeHostImplTest, scrollNonCompositedRoot) +TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) { // Test the configuration where a non-composited root layer is embedded in a // scrollable outer layer. IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> contentLayer = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(1); contentLayer->setUseLCDText(true); contentLayer->setDrawsContent(true); contentLayer->setPosition(FloatPoint(0, 0)); @@ -1041,7 +1041,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonCompositedRoot) contentLayer->setBounds(surfaceSize); contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize.height() * 2)); - scoped_ptr<CCLayerImpl> scrollLayer = CCLayerImpl::create(2); + scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2); scrollLayer->setScrollable(true); scrollLayer->setMaxScrollPosition(surfaceSize); scrollLayer->setBounds(surfaceSize); @@ -1054,17 +1054,17 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonCompositedRoot) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); } -TEST_P(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) +TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); root->addChild(createScrollableLayer(2, surfaceSize)); @@ -1072,33 +1072,33 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); } -TEST_P(CCLayerTreeHostImplTest, scrollMissesChild) +TEST_P(LayerTreeHostImplTest, scrollMissesChild) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->addChild(createScrollableLayer(2, surfaceSize)); m_hostImpl->setRootLayer(root.Pass()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); // Scroll event is ignored because the input coordinate is outside the layer boundaries. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(15, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(15, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); EXPECT_FALSE(m_didRequestRedraw); EXPECT_FALSE(m_didRequestCommit); } -TEST_P(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) +TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); WebTransformationMatrix matrix; @@ -1112,19 +1112,19 @@ TEST_P(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) // Scroll event is ignored because the scrollable layer is not facing the viewer and there is // nothing scrollable behind it. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); EXPECT_FALSE(m_didRequestRedraw); EXPECT_FALSE(m_didRequestCommit); } -TEST_P(CCLayerTreeHostImplTest, scrollBlockedByContentLayer) +TEST_P(LayerTreeHostImplTest, scrollBlockedByContentLayer) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> contentLayer = createScrollableLayer(1, surfaceSize); + scoped_ptr<LayerImpl> contentLayer = createScrollableLayer(1, surfaceSize); contentLayer->setShouldScrollOnMainThread(true); contentLayer->setScrollable(false); - scoped_ptr<CCLayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize); + scoped_ptr<LayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize); scrollLayer->addChild(contentLayer.Pass()); m_hostImpl->setRootLayer(scrollLayer.Pass()); @@ -1132,14 +1132,14 @@ TEST_P(CCLayerTreeHostImplTest, scrollBlockedByContentLayer) initializeRendererAndDrawFrame(); // Scrolling fails because the content layer is asking to be scrolled on the main thread. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); } -TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) +TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); m_hostImpl->setRootLayer(root.Pass()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1147,7 +1147,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); @@ -1158,7 +1158,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) // The scale should apply to the scroll delta. expectedScrollDelta.scale(pageScale); } - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScrollDelta); // The scroll range should also have been updated. @@ -1168,11 +1168,11 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), WebTransformationMatrix()); } -TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) +TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); m_hostImpl->setRootLayer(root.Pass()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); @@ -1181,7 +1181,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); @@ -1192,7 +1192,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) m_hostImpl->updateRootScrollLayerImplTransform(); // The scroll delta is not scaled because the main thread did not scale. - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScrollDelta); // The scroll range should also have been updated. @@ -1204,7 +1204,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), expectedScale); } -TEST_P(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) +TEST_P(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) { IntSize surfaceSize(10, 10); float defaultPageScale = 1; @@ -1216,12 +1216,12 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) // Create a normal scrollable root layer and another scrollable child layer. setupScrollAndContentsLayers(surfaceSize); - CCLayerImpl* root = m_hostImpl->rootLayer(); - CCLayerImpl* child = root->children()[0]; + LayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* child = root->children()[0]; - scoped_ptr<CCLayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize); + scoped_ptr<LayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize); child->addChild(scrollableChild.Pass()); - CCLayerImpl* grandChild = child->children()[0]; + LayerImpl* grandChild = child->children()[0]; // Set new page scale on impl thread by pinching. m_hostImpl->pinchGestureBegin(); @@ -1236,7 +1236,7 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) // Make sure all the layers are drawn with the page scale delta applied, i.e., the page scale // delta on the root layer is applied hierarchically. - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -1249,10 +1249,10 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) EXPECT_EQ(grandChild->drawTransform().m22(), newPageScale); } -TEST_P(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) +TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); // Also mark the root scrollable so it becomes the root scroll layer. @@ -1263,12 +1263,12 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); - CCLayerImpl* child = m_hostImpl->rootLayer()->children()[0]; + LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(child->maxScrollPosition()); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); @@ -1281,7 +1281,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) // The scale should apply to the scroll delta. expectedScrollDelta.scale(pageScale); } - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); // The scroll range should not have changed. @@ -1292,18 +1292,18 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) EXPECT_EQ(child->implTransform(), WebTransformationMatrix()); } -TEST_P(CCLayerTreeHostImplTest, scrollChildBeyondLimit) +TEST_P(LayerTreeHostImplTest, scrollChildBeyondLimit) { // Scroll a child layer beyond its maximum scroll range and make sure the // parent layer is scrolled on the axis on which the child was unable to // scroll. IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); - scoped_ptr<CCLayerImpl> grandChild = createScrollableLayer(3, surfaceSize); + scoped_ptr<LayerImpl> grandChild = createScrollableLayer(3, surfaceSize); grandChild->setScrollPosition(IntPoint(0, 5)); - scoped_ptr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); + scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); child->setScrollPosition(IntPoint(3, 0)); child->addChild(grandChild.Pass()); @@ -1313,15 +1313,15 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildBeyondLimit) initializeRendererAndDrawFrame(); { IntSize scrollDelta(-8, -7); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); // The grand child should have scrolled up to its limit. - CCLayerImpl* child = m_hostImpl->rootLayer()->children()[0]; - CCLayerImpl* grandChild = child->children()[0]; + LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; + LayerImpl* grandChild = child->children()[0]; expectContains(*scrollInfo.get(), grandChild->id(), IntSize(0, -5)); // The child should have only scrolled on the other axis. @@ -1329,13 +1329,13 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildBeyondLimit) } } -TEST_P(CCLayerTreeHostImplTest, scrollEventBubbling) +TEST_P(LayerTreeHostImplTest, scrollEventBubbling) { // When we try to scroll a non-scrollable child layer, the scroll delta // should be applied to one of its ancestors if possible. IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); - scoped_ptr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); + scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); + scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); child->setScrollable(false); root->addChild(child.Pass()); @@ -1345,11 +1345,11 @@ TEST_P(CCLayerTreeHostImplTest, scrollEventBubbling) initializeRendererAndDrawFrame(); { IntSize scrollDelta(0, 4); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); // Only the root should have scrolled. ASSERT_EQ(scrollInfo->scrolls.size(), 1u); @@ -1357,7 +1357,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollEventBubbling) } } -TEST_P(CCLayerTreeHostImplTest, scrollBeforeRedraw) +TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw) { IntSize surfaceSize(10, 10); m_hostImpl->setRootLayer(createScrollableLayer(1, surfaceSize)); @@ -1369,10 +1369,10 @@ TEST_P(CCLayerTreeHostImplTest, scrollBeforeRedraw) m_hostImpl->setRootLayer(createScrollableLayer(2, surfaceSize)); // Scrolling should still work even though we did not draw yet. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); } -TEST_P(CCLayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) +TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) { setupScrollAndContentsLayers(IntSize(100, 100)); @@ -1387,18 +1387,18 @@ TEST_P(CCLayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) // Scroll to the right in screen coordinates with a gesture. IntSize gestureScrollDelta(10, 0); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); m_hostImpl->scrollEnd(); // The layer should have scrolled down in its local coordinates. - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), IntSize(0, gestureScrollDelta.width())); // Reset and scroll down with the wheel. m_hostImpl->rootLayer()->setScrollDelta(FloatSize()); IntSize wheelScrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), wheelScrollDelta); m_hostImpl->scrollEnd(); @@ -1407,14 +1407,14 @@ TEST_P(CCLayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScrollDelta); } -TEST_P(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) +TEST_P(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) { setupScrollAndContentsLayers(IntSize(100, 100)); int childLayerId = 3; float childLayerAngle = -20; // Create a child layer that is rotated to a non-axis-aligned angle. - scoped_ptr<CCLayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->rootLayer()->contentBounds()); + scoped_ptr<LayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->rootLayer()->contentBounds()); WebTransformationMatrix rotateTransform; rotateTransform.translate(-50, -50); rotateTransform.rotate(childLayerAngle); @@ -1432,14 +1432,14 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) { // Scroll down in screen coordinates with a gesture. IntSize gestureScrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); m_hostImpl->scrollEnd(); // The child layer should have scrolled down in its local coordinates an amount proportional to // the angle between it and the input scroll delta. IntSize expectedScrollDelta(0, gestureScrollDelta.height() * cosf(deg2rad(childLayerAngle))); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), childLayerId, expectedScrollDelta); // The root layer should not have scrolled, because the input delta was close to the layer's @@ -1451,14 +1451,14 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) // Now reset and scroll the same amount horizontally. m_hostImpl->rootLayer()->children()[1]->setScrollDelta(FloatSize()); IntSize gestureScrollDelta(10, 0); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); m_hostImpl->scrollEnd(); // The child layer should have scrolled down in its local coordinates an amount proportional to // the angle between it and the input scroll delta. IntSize expectedScrollDelta(0, -gestureScrollDelta.width() * sinf(deg2rad(childLayerAngle))); - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), childLayerId, expectedScrollDelta); // The root layer should have scrolled more, since the input scroll delta was mostly @@ -1468,7 +1468,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) } } -TEST_P(CCLayerTreeHostImplTest, scrollScaledLayer) +TEST_P(LayerTreeHostImplTest, scrollScaledLayer) { setupScrollAndContentsLayers(IntSize(100, 100)); @@ -1484,18 +1484,18 @@ TEST_P(CCLayerTreeHostImplTest, scrollScaledLayer) // Scroll down in screen coordinates with a gesture. IntSize scrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); // The layer should have scrolled down in its local coordinates, but half he amount. - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), IntSize(0, scrollDelta.height() / scale)); // Reset and scroll down with the wheel. m_hostImpl->rootLayer()->setScrollDelta(FloatSize()); IntSize wheelScrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), wheelScrollDelta); m_hostImpl->scrollEnd(); @@ -1526,11 +1526,11 @@ private: bool m_blend; }; -class BlendStateCheckLayer : public CCLayerImpl { +class BlendStateCheckLayer : public LayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id, CCResourceProvider* resourceProvider) { return scoped_ptr<CCLayerImpl>(new BlendStateCheckLayer(id, resourceProvider)); } + static scoped_ptr<LayerImpl> create(int id, ResourceProvider* resourceProvider) { return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(id, resourceProvider)); } - virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) OVERRIDE + virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) OVERRIDE { m_quadsAppended = true; @@ -1540,12 +1540,12 @@ public: else opaqueRect = m_opaqueContentRect; - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); - scoped_ptr<CCTileDrawQuad> testBlendingDrawQuad = CCTileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + scoped_ptr<TileDrawQuad> testBlendingDrawQuad = TileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false); testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect); EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending()); EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); - quadSink.append(testBlendingDrawQuad.PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(testBlendingDrawQuad.PassAs<DrawQuad>(), appendQuadsData); } void setExpectation(bool blend, bool hasRenderSurface) @@ -1562,14 +1562,14 @@ public: void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect; } private: - explicit BlendStateCheckLayer(int id, CCResourceProvider* resourceProvider) - : CCLayerImpl(id) + explicit BlendStateCheckLayer(int id, ResourceProvider* resourceProvider) + : LayerImpl(id) , m_blend(false) , m_hasRenderSurface(false) , m_quadsAppended(false) , m_quadRect(5, 5, 5, 5) , m_quadVisibleRect(5, 5, 5, 5) - , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool, IntSize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny)) + , m_resourceId(resourceProvider->createResource(Renderer::ContentPool, IntSize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny)) { setAnchorPoint(FloatPoint(0, 0)); setBounds(IntSize(10, 10)); @@ -1583,26 +1583,26 @@ private: IntRect m_quadRect; IntRect m_opaqueContentRect; IntRect m_quadVisibleRect; - CCResourceProvider::ResourceId m_resourceId; + ResourceProvider::ResourceId m_resourceId; }; -TEST_P(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) +TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setContentBounds(root->bounds()); root->setDrawsContent(false); m_hostImpl->setRootLayer(root.Pass()); } - CCLayerImpl* root = m_hostImpl->rootLayer(); + LayerImpl* root = m_hostImpl->rootLayer(); root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0]); layer1->setPosition(FloatPoint(2, 2)); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; // Opaque layer, drawn without blending. layer1->setContentsOpaque(true); @@ -1778,7 +1778,7 @@ TEST_P(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) } -TEST_P(CCLayerTreeHostImplTest, viewportCovered) +TEST_P(LayerTreeHostImplTest, viewportCovered) { m_hostImpl->initializeRenderer(createContext()); m_hostImpl->setBackgroundColor(SK_ColorGRAY); @@ -1800,13 +1800,13 @@ TEST_P(CCLayerTreeHostImplTest, viewportCovered) root->setQuadRect(IntRect(IntPoint(), layerRect.size())); root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); ASSERT_EQ(1u, frame.renderPasses.size()); size_t numGutterQuads = 0; for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i) - numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0; + numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0; EXPECT_EQ(0u, numGutterQuads); EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size()); @@ -1823,14 +1823,14 @@ TEST_P(CCLayerTreeHostImplTest, viewportCovered) root->setQuadRect(IntRect(IntPoint(), layerRect.size())); root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); ASSERT_EQ(1u, frame.renderPasses.size()); m_hostImpl->didDrawAllLayers(frame); size_t numGutterQuads = 0; for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i) - numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0; + numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0; EXPECT_EQ(1u, numGutterQuads); EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size()); @@ -1847,13 +1847,13 @@ TEST_P(CCLayerTreeHostImplTest, viewportCovered) root->setQuadRect(IntRect(IntPoint(), layerRect.size())); root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); ASSERT_EQ(1u, frame.renderPasses.size()); size_t numGutterQuads = 0; for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i) - numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0; + numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0; EXPECT_EQ(4u, numGutterQuads); EXPECT_EQ(5u, frame.renderPasses[0]->quadList().size()); @@ -1879,30 +1879,30 @@ private: bool m_reshapeCalled; }; -class FakeDrawableCCLayerImpl: public CCLayerImpl { +class FakeDrawableLayerImpl: public LayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new FakeDrawableCCLayerImpl(id)); } + static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(id)); } protected: - explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } + explicit FakeDrawableLayerImpl(int id) : LayerImpl(id) { } }; // Only reshape when we know we are going to draw. Otherwise, the reshape // can leave the window at the wrong size if we never draw and the proper // viewport size is never set. -TEST_P(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) +TEST_P(LayerTreeHostImplTest, reshapeNotCalledUntilDraw) { - scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<CCGraphicsContext>(); - ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D()); - m_hostImpl->initializeRenderer(ccContext.Pass()); + scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<GraphicsContext>(); + ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->context3D()); + m_hostImpl->initializeRenderer(outputSurface.Pass()); - scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setDrawsContent(true); m_hostImpl->setRootLayer(root.Pass()); EXPECT_FALSE(reshapeTracker->reshapeCalled()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); EXPECT_TRUE(reshapeTracker->reshapeCalled()); @@ -1932,21 +1932,21 @@ private: // Make sure damage tracking propagates all the way to the graphics context, // where it should request to swap only the subBuffer that is damaged. -TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) +TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) { - scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<CCGraphicsContext>(); - PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(ccContext->context3D()); + scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<GraphicsContext>(); + PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(outputSurface->context3D()); - // This test creates its own CCLayerTreeHostImpl, so + // This test creates its own LayerTreeHostImpl, so // that we can force partial swap enabled. - CCLayerTreeSettings settings; + LayerTreeSettings settings; Settings::setPartialSwapEnabled(true); - scoped_ptr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this); - layerTreeHostImpl->initializeRenderer(ccContext.Pass()); + scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(settings, this); + layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); - scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = FakeDrawableCCLayerImpl::create(2); + scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); + scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); child->setPosition(FloatPoint(12, 13)); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(14, 15)); @@ -1959,7 +1959,7 @@ TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) root->addChild(child.Pass()); layerTreeHostImpl->setRootLayer(root.Pass()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; // First frame, the entire screen should get swapped. EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame)); @@ -2006,10 +2006,10 @@ TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); } -TEST_P(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) +TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) { - scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = FakeDrawableCCLayerImpl::create(2); + scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); + scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(10, 10)); child->setContentBounds(IntSize(10, 10)); @@ -2023,7 +2023,7 @@ TEST_P(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) m_hostImpl->setRootLayer(root.Pass()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); @@ -2033,23 +2033,23 @@ TEST_P(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) } // namespace -class FakeLayerWithQuads : public CCLayerImpl { +class FakeLayerWithQuads : public LayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new FakeLayerWithQuads(id)); } + static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(id)); } - virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) OVERRIDE + virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) OVERRIDE { - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); SkColor gray = SkColorSetRGB(100, 100, 100); IntRect quadRect(IntPoint(0, 0), contentBounds()); - scoped_ptr<CCSolidColorDrawQuad> myQuad = CCSolidColorDrawQuad::create(sharedQuadState, quadRect, gray); - quadSink.append(myQuad.PassAs<CCDrawQuad>(), appendQuadsData); + scoped_ptr<SolidColorDrawQuad> myQuad = SolidColorDrawQuad::create(sharedQuadState, quadRect, gray); + quadSink.append(myQuad.PassAs<DrawQuad>(), appendQuadsData); } private: FakeLayerWithQuads(int id) - : CCLayerImpl(id) + : LayerImpl(id) { } }; @@ -2146,9 +2146,9 @@ public: } }; -TEST_P(CCLayerTreeHostImplTest, noPartialSwap) +TEST_P(LayerTreeHostImplTest, noPartialSwap) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>(); MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); @@ -2156,28 +2156,28 @@ TEST_P(CCLayerTreeHostImplTest, noPartialSwap) harness.mustSetScissor(0, 0, 10, 10); // Run test case - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), FakeLayerWithQuads::create(1)); + scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), FakeLayerWithQuads::create(1)); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); Mock::VerifyAndClearExpectations(&mockContext); } -TEST_P(CCLayerTreeHostImplTest, partialSwap) +TEST_P(LayerTreeHostImplTest, partialSwap) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>(); MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.Pass(), FakeLayerWithQuads::create(1)); + scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.Pass(), FakeLayerWithQuads::create(1)); // The first frame is not a partially-swapped one. harness.mustSetScissor(0, 0, 10, 10); harness.mustDrawSolidQuad(); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2191,7 +2191,7 @@ TEST_P(CCLayerTreeHostImplTest, partialSwap) harness.mustSetScissor(0, 7, 2, 3); harness.mustDrawSolidQuad(); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2221,14 +2221,14 @@ public: } }; -static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, CCLayerTreeHostImplClient* client) +static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client) { Settings::setPartialSwapEnabled(partialSwap); - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, client); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); @@ -2250,9 +2250,9 @@ static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C Layers 1, 2 have render surfaces */ - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> grandChild = FakeLayerWithQuads::create(3); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<LayerImpl> child = LayerImpl::create(2); + scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(3); IntRect rootRect(0, 0, 100, 100); IntRect childRect(10, 10, 50, 50); @@ -2289,12 +2289,12 @@ static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C return myHostImpl.Pass(); } -TEST_P(CCLayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) +TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) { - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Just for consistency, the most interesting stuff already happened @@ -2305,17 +2305,17 @@ TEST_P(CCLayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) ASSERT_EQ(2U, frame.renderPasses.size()); ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size()); ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); - EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); } } -TEST_P(CCLayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) +TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) { - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Just for consistency, the most interesting stuff already happened @@ -2326,15 +2326,15 @@ TEST_P(CCLayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) ASSERT_EQ(2U, frame.renderPasses.size()); ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size()); ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); - EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); } } // Make sure that context lost notifications are propagated through the tree. -class ContextLostNotificationCheckLayer : public CCLayerImpl { +class ContextLostNotificationCheckLayer : public LayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new ContextLostNotificationCheckLayer(id)); } + static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new ContextLostNotificationCheckLayer(id)); } virtual void didLoseContext() OVERRIDE { @@ -2345,7 +2345,7 @@ public: private: explicit ContextLostNotificationCheckLayer(int id) - : CCLayerImpl(id) + : LayerImpl(id) , m_didLoseContextCalled(false) { } @@ -2353,7 +2353,7 @@ private: bool m_didLoseContextCalled; }; -TEST_P(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) +TEST_P(LayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) { m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(1)); ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); @@ -2375,13 +2375,13 @@ TEST_P(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayer EXPECT_TRUE(layer2->didLoseContextCalled()); } -TEST_P(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) +TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost) { - CCLayerTreeSettings settings; - m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + LayerTreeSettings settings; + m_hostImpl = LayerTreeHostImpl::create(settings, this); // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>()); m_hostImpl->finishAllRendering(); } @@ -2399,10 +2399,10 @@ private: unsigned m_succeedCount; }; -TEST_P(CCLayerTreeHostImplTest, contextLostDuringInitialize) +TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize) { - CCLayerTreeSettings settings; - m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + LayerTreeSettings settings; + m_hostImpl = LayerTreeHostImpl::create(settings, this); // Initialize into a known successful state. EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); @@ -2419,14 +2419,14 @@ TEST_P(CCLayerTreeHostImplTest, contextLostDuringInitialize) for (unsigned i = 0; i < kMakeCurrentSuccessesNeededForSuccessfulInitialization; ++i) { // The context will get lost during initialization, we shouldn't crash. We // should also be in a consistent state. - EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<CCGraphicsContext>())); + EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<GraphicsContext>())); EXPECT_EQ(0, m_hostImpl->context()); EXPECT_EQ(0, m_hostImpl->renderer()); EXPECT_EQ(0, m_hostImpl->resourceProvider()); EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); } - EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<CCGraphicsContext>())); + EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<GraphicsContext>())); EXPECT_TRUE(m_hostImpl->context()); EXPECT_TRUE(m_hostImpl->renderer()); EXPECT_TRUE(m_hostImpl->resourceProvider()); @@ -2607,21 +2607,21 @@ class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet } }; -class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { +class FakeScrollbarLayerImpl : public ScrollbarLayerImpl { public: static scoped_ptr<FakeScrollbarLayerImpl> create(int id) { return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); } - void createResources(CCResourceProvider* provider) + void createResources(ResourceProvider* provider) { DCHECK(provider); int pool = 0; IntSize size(10, 10); GLenum format = GL_RGBA; - CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureUsageAny; - setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometryNonEmpty::create())); + ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsageAny; + setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometryNonEmpty::create())); setBackTrackResourceId(provider->createResource(pool, size, format, hint)); setForeTrackResourceId(provider->createResource(pool, size, format, hint)); @@ -2630,54 +2630,54 @@ public: protected: explicit FakeScrollbarLayerImpl(int id) - : CCScrollbarLayerImpl(id) + : ScrollbarLayerImpl(id) { } }; -static inline scoped_ptr<CCRenderPass> createRenderPassWithResource(CCResourceProvider* provider) +static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvider* provider) { - CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntSize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId resourceId = provider->createResource(0, IntSize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); - scoped_ptr<CCRenderPass> pass = CCRenderPass::create(CCRenderPass::Id(1, 1), IntRect(0, 0, 1, 1), WebTransformationMatrix()); - scoped_ptr<CCSharedQuadState> sharedState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); - scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedState.get(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false); + scoped_ptr<RenderPass> pass = RenderPass::create(RenderPass::Id(1, 1), IntRect(0, 0, 1, 1), WebTransformationMatrix()); + scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); + scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedState.get(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false); - static_cast<CCTestRenderPass*>(pass.get())->appendSharedQuadState(sharedState.Pass()); - static_cast<CCTestRenderPass*>(pass.get())->appendQuad(quad.PassAs<CCDrawQuad>()); + static_cast<TestRenderPass*>(pass.get())->appendSharedQuadState(sharedState.Pass()); + static_cast<TestRenderPass*>(pass.get())->appendQuad(quad.PassAs<DrawQuad>()); return pass.Pass(); } -TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) +TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) { int layerId = 1; - scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(layerId++)); + scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(layerId++)); rootLayer->setBounds(IntSize(10, 10)); rootLayer->setAnchorPoint(FloatPoint(0, 0)); - scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(layerId++); + scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++); tileLayer->setBounds(IntSize(10, 10)); tileLayer->setAnchorPoint(FloatPoint(0, 0)); tileLayer->setContentBounds(IntSize(10, 10)); tileLayer->setDrawsContent(true); tileLayer->setSkipsDraw(false); - scoped_ptr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels)); + scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels)); tilingData->setBounds(IntSize(10, 10)); tileLayer->setTilingData(*tilingData); tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); - rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); - scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(layerId++); + scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId++); textureLayer->setBounds(IntSize(10, 10)); textureLayer->setAnchorPoint(FloatPoint(0, 0)); textureLayer->setContentBounds(IntSize(10, 10)); textureLayer->setDrawsContent(true); textureLayer->setTextureId(1); - rootLayer->addChild(textureLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); - scoped_ptr<CCTiledLayerImpl> maskLayer = CCTiledLayerImpl::create(layerId++); + scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++); maskLayer->setBounds(IntSize(10, 10)); maskLayer->setAnchorPoint(FloatPoint(0, 0)); maskLayer->setContentBounds(IntSize(10, 10)); @@ -2686,53 +2686,53 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) maskLayer->setTilingData(*tilingData); maskLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); - scoped_ptr<CCTextureLayerImpl> textureLayerWithMask = CCTextureLayerImpl::create(layerId++); + scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(layerId++); textureLayerWithMask->setBounds(IntSize(10, 10)); textureLayerWithMask->setAnchorPoint(FloatPoint(0, 0)); textureLayerWithMask->setContentBounds(IntSize(10, 10)); textureLayerWithMask->setDrawsContent(true); textureLayerWithMask->setTextureId(1); - textureLayerWithMask->setMaskLayer(maskLayer.PassAs<CCLayerImpl>()); - rootLayer->addChild(textureLayerWithMask.PassAs<CCLayerImpl>()); + textureLayerWithMask->setMaskLayer(maskLayer.PassAs<LayerImpl>()); + rootLayer->addChild(textureLayerWithMask.PassAs<LayerImpl>()); FakeVideoFrame videoFrame; FakeVideoFrameProvider provider; provider.setFrame(&videoFrame); - scoped_ptr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(layerId++, &provider); + scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(layerId++, &provider); videoLayer->setBounds(IntSize(10, 10)); videoLayer->setAnchorPoint(FloatPoint(0, 0)); videoLayer->setContentBounds(IntSize(10, 10)); videoLayer->setDrawsContent(true); videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(videoLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); FakeVideoFrame hwVideoFrame; FakeVideoFrameProvider hwProvider; hwProvider.setFrame(&hwVideoFrame); - scoped_ptr<CCVideoLayerImpl> hwVideoLayer = CCVideoLayerImpl::create(layerId++, &hwProvider); + scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(layerId++, &hwProvider); hwVideoLayer->setBounds(IntSize(10, 10)); hwVideoLayer->setAnchorPoint(FloatPoint(0, 0)); hwVideoLayer->setContentBounds(IntSize(10, 10)); hwVideoLayer->setDrawsContent(true); hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(hwVideoLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>()); - scoped_ptr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(layerId++); + scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(layerId++); ioSurfaceLayer->setBounds(IntSize(10, 10)); ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); ioSurfaceLayer->setContentBounds(IntSize(10, 10)); ioSurfaceLayer->setDrawsContent(true); ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(ioSurfaceLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); - scoped_ptr<CCHeadsUpDisplayLayerImpl> hudLayer = CCHeadsUpDisplayLayerImpl::create(layerId++); + scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(layerId++); hudLayer->setBounds(IntSize(10, 10)); hudLayer->setAnchorPoint(FloatPoint(0, 0)); hudLayer->setContentBounds(IntSize(10, 10)); hudLayer->setDrawsContent(true); hudLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(hudLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(hudLayer.PassAs<LayerImpl>()); scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(layerId++)); scrollbarLayer->setBounds(IntSize(10, 10)); @@ -2740,27 +2740,27 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) scrollbarLayer->setDrawsContent(true); scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); scrollbarLayer->createResources(m_hostImpl->resourceProvider()); - rootLayer->addChild(scrollbarLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(scrollbarLayer.PassAs<LayerImpl>()); - scoped_ptr<CCDelegatedRendererLayerImpl> delegatedRendererLayer(CCDelegatedRendererLayerImpl::create(layerId++)); + scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(layerId++)); delegatedRendererLayer->setBounds(IntSize(10, 10)); delegatedRendererLayer->setContentBounds(IntSize(10, 10)); delegatedRendererLayer->setDrawsContent(true); delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get()); - ScopedPtrVector<CCRenderPass> passList; + ScopedPtrVector<RenderPass> passList; passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider())); delegatedRendererLayer->setRenderPasses(passList); EXPECT_TRUE(passList.isEmpty()); - rootLayer->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>()); // Use a context that supports IOSurfaces - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>()); hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture()); m_hostImpl->setRootLayer(rootLayer.Pass()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -2770,7 +2770,7 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface, // that will warn if any resource from the previous context gets used. - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>()); // Create dummy resources so that looking up an old resource will get an // invalid texture id mapping. @@ -2836,58 +2836,58 @@ private: unsigned m_numTextures; }; -TEST_P(CCLayerTreeHostImplTest, layersFreeTextures) +TEST_P(LayerTreeHostImplTest, layersFreeTextures) { - scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(1)); + scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(1)); rootLayer->setBounds(IntSize(10, 10)); rootLayer->setAnchorPoint(FloatPoint(0, 0)); - scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(2); + scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2); tileLayer->setBounds(IntSize(10, 10)); tileLayer->setAnchorPoint(FloatPoint(0, 0)); tileLayer->setContentBounds(IntSize(10, 10)); tileLayer->setDrawsContent(true); tileLayer->setSkipsDraw(false); - scoped_ptr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels)); + scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels)); tilingData->setBounds(IntSize(10, 10)); tileLayer->setTilingData(*tilingData); tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); - rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); - scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(3); + scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3); textureLayer->setBounds(IntSize(10, 10)); textureLayer->setAnchorPoint(FloatPoint(0, 0)); textureLayer->setContentBounds(IntSize(10, 10)); textureLayer->setDrawsContent(true); textureLayer->setTextureId(1); - rootLayer->addChild(textureLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); FakeVideoFrameProvider provider; - scoped_ptr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(4, &provider); + scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(4, &provider); videoLayer->setBounds(IntSize(10, 10)); videoLayer->setAnchorPoint(FloatPoint(0, 0)); videoLayer->setContentBounds(IntSize(10, 10)); videoLayer->setDrawsContent(true); videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(videoLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); - scoped_ptr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(5); + scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(5); ioSurfaceLayer->setBounds(IntSize(10, 10)); ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); ioSurfaceLayer->setContentBounds(IntSize(10, 10)); ioSurfaceLayer->setDrawsContent(true); ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(ioSurfaceLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); - // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of). - scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D))); - TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D()); - m_hostImpl->initializeRenderer(ccContext.Pass()); + // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of). + scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D))); + TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(outputSurface->context3D()); + m_hostImpl->initializeRenderer(outputSurface.Pass()); m_hostImpl->setRootLayer(rootLayer.Pass()); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -2896,7 +2896,7 @@ TEST_P(CCLayerTreeHostImplTest, layersFreeTextures) EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); // Kill the layer tree. - m_hostImpl->setRootLayer(CCLayerImpl::create(100)); + m_hostImpl->setRootLayer(LayerImpl::create(100)); // There should be no textures left in use after. EXPECT_EQ(0u, trackingWebGraphicsContext->numTextures()); } @@ -2907,13 +2907,13 @@ public: MOCK_METHOD4(drawElements, void(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset)); }; -TEST_P(CCLayerTreeHostImplTest, hasTransparentBackground) +TEST_P(LayerTreeHostImplTest, hasTransparentBackground) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<GraphicsContext>(); MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D()); // Run test case - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), CCLayerImpl::create(1)); + scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), LayerImpl::create(1)); myHostImpl->setBackgroundColor(SK_ColorWHITE); // Verify one quad is drawn when transparent background set is not set. @@ -2922,7 +2922,7 @@ TEST_P(CCLayerTreeHostImplTest, hasTransparentBackground) .Times(1); EXPECT_CALL(*mockContext, drawElements(_, _, _, _)) .Times(1); - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2936,10 +2936,10 @@ TEST_P(CCLayerTreeHostImplTest, hasTransparentBackground) Mock::VerifyAndClearExpectations(&mockContext); } -static void addDrawingLayerTo(CCLayerImpl* parent, int id, const IntRect& layerRect, CCLayerImpl** result) +static void addDrawingLayerTo(LayerImpl* parent, int id, const IntRect& layerRect, LayerImpl** result) { - scoped_ptr<CCLayerImpl> layer = FakeLayerWithQuads::create(id); - CCLayerImpl* layerPtr = layer.get(); + scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(id); + LayerImpl* layerPtr = layer.get(); layerPtr->setAnchorPoint(FloatPoint(0, 0)); layerPtr->setPosition(FloatPoint(layerRect.location())); layerPtr->setBounds(layerRect.size()); @@ -2951,14 +2951,14 @@ static void addDrawingLayerTo(CCLayerImpl* parent, int id, const IntRect& layerR *result = layerPtr; } -static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) +static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, LayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPtr, LayerImpl*& childPtr, const IntSize& rootSize) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); layerTreeHostImpl->initializeRenderer(context.Pass()); layerTreeHostImpl->setViewportSize(rootSize, rootSize); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -2981,30 +2981,30 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(5, 5, rootSize.width() - 25, rootSize.height() - 25), &childPtr); } -class CCRendererGLWithReleaseTextures : public CCRendererGL { +class GLRendererWithReleaseTextures : public GLRenderer { public: - using CCRendererGL::releaseRenderPassTextures; + using GLRenderer::releaseRenderPassTextures; }; -TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) +TEST_P(LayerTreeHostImplTest, textureCachingWithClipping) { Settings::setPartialSwapEnabled(true); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); - CCLayerImpl* rootPtr; - CCLayerImpl* surfaceLayerPtr; + LayerImpl* rootPtr; + LayerImpl* surfaceLayerPtr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); IntSize rootSize(100, 100); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3034,7 +3034,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) surfaceLayerPtr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes, each with one quad @@ -3052,8 +3052,8 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) // Verify that the render surface texture is *not* clipped. EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), frame.renderPasses[0]->outputRect()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); EXPECT_FALSE(quad->contentsChangedSinceLastFrame().isEmpty()); myHostImpl->drawLayers(frame); @@ -3070,7 +3070,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) // Since the layers were clipped, even though the render surface size // was not changed, the texture should not be saved. { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes, each with one quad @@ -3083,13 +3083,13 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) } } -TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) +TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) { Settings::setPartialSwapEnabled(false); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); // Layers are structure as follows: // @@ -3105,18 +3105,18 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) // L20 occludes L10 (external) // L21 occludes L20 (internal) - CCLayerImpl* rootPtr; - CCLayerImpl* layerS1Ptr; - CCLayerImpl* layerS2Ptr; + LayerImpl* rootPtr; + LayerImpl* layerS1Ptr; + LayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); IntSize rootSize(1000, 1000); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3140,7 +3140,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) // Initial draw - must receive all quads { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 3 render passes. @@ -3162,7 +3162,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) transform.translate(150, 150); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 2 render passes. @@ -3185,7 +3185,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) transform.translate(-15, -15); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 1 render pass - for the root. @@ -3199,13 +3199,13 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) } -TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) +TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) { Settings::setPartialSwapEnabled(false); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); // Layers are structure as follows: // @@ -3218,18 +3218,18 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) // +-- S2 +- L20 (owning, drawing) // - CCLayerImpl* rootPtr; - CCLayerImpl* layerS1Ptr; - CCLayerImpl* layerS2Ptr; + LayerImpl* rootPtr; + LayerImpl* layerS1Ptr; + LayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); IntSize rootSize(1000, 1000); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3255,7 +3255,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) // Initial draw - must receive all quads { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 3 render passes. @@ -3279,7 +3279,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) transform.translate(100, 100); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 2 render passes. @@ -3302,7 +3302,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) transform.translate(-15, -15); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 1 render pass - for the root. @@ -3315,13 +3315,13 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) } } -TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) +TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) { Settings::setPartialSwapEnabled(false); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); // Layers are structured as follows: // @@ -3332,18 +3332,18 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) // +-- S2 +- L20 (owning, drawing) // - CCLayerImpl* rootPtr; - CCLayerImpl* layerS1Ptr; - CCLayerImpl* layerS2Ptr; + LayerImpl* rootPtr; + LayerImpl* layerS1Ptr; + LayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); IntSize rootSize(1000, 1000); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3365,7 +3365,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) // Initial draw - must receive all quads { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 3 render passes. @@ -3387,7 +3387,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) transform.translate(300, 0); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 2 render passes. @@ -3404,29 +3404,29 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) } } -TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) +TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) { Settings::setPartialSwapEnabled(false); - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); // Layers are structured as follows: // // R +-- S1 +- L10 (rotated, drawing) // +- L11 (occupies half surface) - CCLayerImpl* rootPtr; - CCLayerImpl* layerS1Ptr; + LayerImpl* rootPtr; + LayerImpl* layerS1Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); IntSize rootSize(1000, 1000); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3449,7 +3449,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) // Initial draw - must receive all quads { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 2 render passes. @@ -3465,7 +3465,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) // Change opacity and draw. Verify we used cached texture. layerS1Ptr->setOpacity(0.2f); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // One render pass must be gone due to cached texture. @@ -3478,13 +3478,13 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) } } -TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) +TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) { Settings::setPartialSwapEnabled(true); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); // Layers are structure as follows: // @@ -3500,18 +3500,18 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) // L20 occludes L10 (external) // L21 occludes L20 (internal) - CCLayerImpl* rootPtr; - CCLayerImpl* layerS1Ptr; - CCLayerImpl* layerS2Ptr; + LayerImpl* rootPtr; + LayerImpl* layerS1Ptr; + LayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); IntSize rootSize(1000, 1000); myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3535,7 +3535,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) // Initial draw - must receive all quads { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 3 render passes. @@ -3557,7 +3557,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) transform.translate(150, 150); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive 2 render passes. @@ -3580,7 +3580,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) transform.translate(-15, -15); layerS2Ptr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Root render pass only. @@ -3591,13 +3591,13 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) } } -TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) +TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) { Settings::setPartialSwapEnabled(false); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); /* Layers are created as follows: @@ -3617,15 +3617,15 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) Layers 1, 2 have render surfaces */ - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(3); + scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::create(2); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3); IntRect rootRect(0, 0, 100, 100); IntRect childRect(10, 10, 50, 50); IntRect grandChildRect(5, 5, 150, 150); - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); myHostImpl->initializeRenderer(context.Pass()); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3644,7 +3644,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) child->setSkipsDraw(false); // child layer has 10x10 tiles. - scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::HasBorderTexels); + scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(10, 10), LayerTilingData::HasBorderTexels); tiler->setBounds(child->contentBounds()); child->setTilingData(*tiler.get()); @@ -3654,18 +3654,18 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) grandChild->setContentBounds(grandChild->bounds()); grandChild->setDrawsContent(true); - CCTiledLayerImpl* childPtr = child.get(); - CCRenderPass::Id childPassId(childPtr->id(), 0); + TiledLayerImpl* childPtr = child.get(); + RenderPass::Id childPassId(childPtr->id(), 0); child->addChild(grandChild.Pass()); - root->addChild(child.PassAs<CCLayerImpl>()); + root->addChild(child.PassAs<LayerImpl>()); myHostImpl->setRootLayer(root.Pass()); myHostImpl->setViewportSize(rootRect.size(), rootRect.size()); EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -3675,7 +3675,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -3688,7 +3688,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) childPtr->setUpdateRect(IntRect(10, 10, 10, 10)); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -3698,23 +3698,23 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); } -TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) +TEST_P(LayerTreeHostImplTest, surfaceTextureCaching) { Settings::setPartialSwapEnabled(true); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); - CCLayerImpl* rootPtr; - CCLayerImpl* intermediateLayerPtr; - CCLayerImpl* surfaceLayerPtr; - CCLayerImpl* childPtr; + LayerImpl* rootPtr; + LayerImpl* intermediateLayerPtr; + LayerImpl* surfaceLayerPtr; + LayerImpl* childPtr; setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, IntSize(100, 100)); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes, each with one quad @@ -3722,9 +3722,9 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_FALSE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3733,16 +3733,16 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) // Draw without any change { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive one render pass, as the other one should be culled ASSERT_EQ(1U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3752,16 +3752,16 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) // Change opacity and draw surfaceLayerPtr->setOpacity(0.6f); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive one render pass, as the other one should be culled ASSERT_EQ(1U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3771,18 +3771,18 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) // Change less benign property and draw - should have contents changed flag surfaceLayerPtr->setStackingOrderChanged(true); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes, each with one quad ASSERT_EQ(2U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); + EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_FALSE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3791,12 +3791,12 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) // Change opacity again, and evict the cached surface texture. surfaceLayerPtr->setOpacity(0.5f); - static_cast<CCRendererGLWithReleaseTextures*>(myHostImpl->renderer())->releaseRenderPassTextures(); + static_cast<GLRendererWithReleaseTextures*>(myHostImpl->renderer())->releaseRenderPassTextures(); // Change opacity and draw surfaceLayerPtr->setOpacity(0.6f); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes @@ -3807,9 +3807,9 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); // Was our surface evicted? @@ -3821,16 +3821,16 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) // Draw without any change, to make sure the state is clear { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive one render pass, as the other one should be culled ASSERT_EQ(1U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3842,16 +3842,16 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) transform.setM11(1.0001); intermediateLayerPtr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive one render pass, as the other one should be culled. ASSERT_EQ(1U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3859,23 +3859,23 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) } } -TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) +TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) { Settings::setPartialSwapEnabled(false); - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.minimumOcclusionTrackingSize = IntSize(); - scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); - CCLayerImpl* rootPtr; - CCLayerImpl* intermediateLayerPtr; - CCLayerImpl* surfaceLayerPtr; - CCLayerImpl* childPtr; + LayerImpl* rootPtr; + LayerImpl* intermediateLayerPtr; + LayerImpl* surfaceLayerPtr; + LayerImpl* childPtr; setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, IntSize(100, 100)); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes, each with one quad @@ -3883,9 +3883,9 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_FALSE(targetPass->damageRect().isEmpty()); EXPECT_FALSE(frame.renderPasses[0]->damageRect().isEmpty()); @@ -3900,7 +3900,7 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) // Draw without any change { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Even though there was no change, we set the damage to entire viewport. @@ -3918,16 +3918,16 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) // Change opacity and draw surfaceLayerPtr->setOpacity(0.6f); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive one render pass, as the other one should be culled ASSERT_EQ(1U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3937,18 +3937,18 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) // Change less benign property and draw - should have contents changed flag surfaceLayerPtr->setStackingOrderChanged(true); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes, each with one quad ASSERT_EQ(2U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); + EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_FALSE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -3957,12 +3957,12 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) // Change opacity again, and evict the cached surface texture. surfaceLayerPtr->setOpacity(0.5f); - static_cast<CCRendererGLWithReleaseTextures*>(myHostImpl->renderer())->releaseRenderPassTextures(); + static_cast<GLRendererWithReleaseTextures*>(myHostImpl->renderer())->releaseRenderPassTextures(); // Change opacity and draw surfaceLayerPtr->setOpacity(0.6f); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive two render passes @@ -3973,9 +3973,9 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); // Was our surface evicted? @@ -3987,7 +3987,7 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) // Draw without any change, to make sure the state is clear { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Even though there was no change, we set the damage to entire viewport. @@ -4005,16 +4005,16 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) transform.setM11(1.0001); intermediateLayerPtr->setTransform(transform); { - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); // Must receive one render pass, as the other one should be culled. ASSERT_EQ(1U, frame.renderPasses.size()); EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); - EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); - CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); - CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]); + RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); EXPECT_TRUE(targetPass->damageRect().isEmpty()); myHostImpl->drawLayers(frame); @@ -4022,7 +4022,7 @@ TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) } } -TEST_P(CCLayerTreeHostImplTest, releaseContentsTextureShouldTriggerCommit) +TEST_P(LayerTreeHostImplTest, releaseContentsTextureShouldTriggerCommit) { setReduceMemoryResult(false); @@ -4050,56 +4050,56 @@ TEST_P(CCLayerTreeHostImplTest, releaseContentsTextureShouldTriggerCommit) EXPECT_FALSE(m_didRequestCommit); } -struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { - ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> renderPassCache; - scoped_ptr<CCSharedQuadState> sharedQuadState; +struct RenderPassRemovalTestData : public LayerTreeHostImpl::FrameData { + ScopedPtrHashMap<RenderPass::Id, RenderPass> renderPassCache; + scoped_ptr<SharedQuadState> sharedQuadState; }; -class CCTestRenderer : public CCRendererGL, public CCRendererClient { +class TestRenderer : public GLRenderer, public RendererClient { public: - static scoped_ptr<CCTestRenderer> create(CCResourceProvider* resourceProvider) + static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider) { - scoped_ptr<CCTestRenderer> renderer(new CCTestRenderer(resourceProvider)); + scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider)); if (!renderer->initialize()) - return scoped_ptr<CCTestRenderer>(); + return scoped_ptr<TestRenderer>(); return renderer.Pass(); } void clearCachedTextures() { m_textures.clear(); } - void setHaveCachedResourcesForRenderPassId(CCRenderPass::Id id) { m_textures.insert(id); } + void setHaveCachedResourcesForRenderPassId(RenderPass::Id id) { m_textures.insert(id); } - virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id id) const OVERRIDE { return m_textures.count(id); } + virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id id) const OVERRIDE { return m_textures.count(id); } - // CCRendererClient implementation. + // RendererClient implementation. virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewportSize; } - virtual const CCLayerTreeSettings& settings() const OVERRIDE { return m_settings; } + virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; } virtual void didLoseContext() OVERRIDE { } virtual void onSwapBuffersComplete() OVERRIDE { } virtual void setFullRootLayerDamage() OVERRIDE { } virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE { } protected: - CCTestRenderer(CCResourceProvider* resourceProvider) : CCRendererGL(this, resourceProvider) { } + TestRenderer(ResourceProvider* resourceProvider) : GLRenderer(this, resourceProvider) { } private: - CCLayerTreeSettings m_settings; + LayerTreeSettings m_settings; IntSize m_viewportSize; - base::hash_set<CCRenderPass::Id> m_textures; + base::hash_set<RenderPass::Id> m_textures; }; -static void configureRenderPassTestData(const char* testScript, RenderPassRemovalTestData& testData, CCTestRenderer* renderer) +static void configureRenderPassTestData(const char* testScript, RenderPassRemovalTestData& testData, TestRenderer* renderer) { renderer->clearCachedTextures(); // One shared state for all quads - we don't need the correct details - testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); + testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); const char* currentChar = testScript; // Pre-create root pass - CCRenderPass::Id rootRenderPassId = CCRenderPass::Id(testScript[0], testScript[1]); - testData.renderPassCache.add(rootRenderPassId, CCRenderPass::create(rootRenderPassId, IntRect(), WebTransformationMatrix())); + RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1]); + testData.renderPassCache.add(rootRenderPassId, RenderPass::create(rootRenderPassId, IntRect(), WebTransformationMatrix())); while (*currentChar) { int layerId = *currentChar; currentChar++; @@ -4107,21 +4107,21 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova int index = *currentChar; currentChar++; - CCRenderPass::Id renderPassId = CCRenderPass::Id(layerId, index); + RenderPass::Id renderPassId = RenderPass::Id(layerId, index); bool isReplica = false; if (!testData.renderPassCache.contains(renderPassId)) isReplica = true; - scoped_ptr<CCRenderPass> renderPass = testData.renderPassCache.take(renderPassId); + scoped_ptr<RenderPass> renderPass = testData.renderPassCache.take(renderPassId); // Cycle through quad data and create all quads while (*currentChar && *currentChar != '\n') { if (*currentChar == 's') { // Solid color draw quad - scoped_ptr<CCSolidColorDrawQuad> quad = CCSolidColorDrawQuad::create(testData.sharedQuadState.get(), IntRect(0, 0, 10, 10), SK_ColorWHITE); + scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::create(testData.sharedQuadState.get(), IntRect(0, 0, 10, 10), SK_ColorWHITE); - static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.PassAs<CCDrawQuad>()); + static_cast<TestRenderPass*>(renderPass.get())->appendQuad(quad.PassAs<DrawQuad>()); currentChar++; } else if ((*currentChar >= 'A') && (*currentChar <= 'Z')) { // RenderPass draw quad @@ -4130,7 +4130,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova ASSERT_TRUE(currentChar); int index = *currentChar; currentChar++; - CCRenderPass::Id newRenderPassId = CCRenderPass::Id(layerId, index); + RenderPass::Id newRenderPassId = RenderPass::Id(layerId, index); ASSERT_NE(rootRenderPassId, newRenderPassId); bool hasTexture = false; bool contentsChanged = true; @@ -4156,13 +4156,13 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova if (hasTexture) renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId); - testData.renderPassCache.add(newRenderPassId, CCTestRenderPass::create(newRenderPassId, IntRect(), WebTransformationMatrix())); + testData.renderPassCache.add(newRenderPassId, TestRenderPass::create(newRenderPassId, IntRect(), WebTransformationMatrix())); } IntRect quadRect = IntRect(0, 0, 1, 1); IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect(); - scoped_ptr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, 1, contentsChangedRect, 1, 1, 0, 0); - static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.PassAs<CCDrawQuad>()); + scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, 1, contentsChangedRect, 1, 1, 0, 0); + static_cast<TestRenderPass*>(renderPass.get())->appendQuad(quad.PassAs<DrawQuad>()); } } testData.renderPasses.insert(testData.renderPasses.begin(), renderPass.get()); @@ -4175,25 +4175,25 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buffer) { char* pos = buffer; - for (CCRenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) { - const CCRenderPass* currentPass = *it; + for (RenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) { + const RenderPass* currentPass = *it; *pos = currentPass->id().layerId; pos++; *pos = currentPass->id().index; pos++; - CCQuadList::const_iterator quadListIterator = currentPass->quadList().begin(); + QuadList::const_iterator quadListIterator = currentPass->quadList().begin(); while (quadListIterator != currentPass->quadList().end()) { - CCDrawQuad* currentQuad = *quadListIterator; + DrawQuad* currentQuad = *quadListIterator; switch (currentQuad->material()) { - case CCDrawQuad::SolidColor: + case DrawQuad::SolidColor: *pos = 's'; pos++; break; - case CCDrawQuad::RenderPass: - *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId().layerId; + case DrawQuad::RenderPass: + *pos = RenderPassDrawQuad::materialCast(currentQuad)->renderPassId().layerId; pos++; - *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId().index; + *pos = RenderPassDrawQuad::materialCast(currentQuad)->renderPassId().index; pos++; break; default: @@ -4210,7 +4210,7 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf *pos = '\0'; } -// Each CCRenderPassList is represented by a string which describes the configuration. +// Each RenderPassList is represented by a string which describes the configuration. // The syntax of the string is as follows: // // RsssssX[c]ssYsssZ[t]ssW[ct] @@ -4358,26 +4358,26 @@ static void verifyRenderPassTestData(TestCase& testCase, RenderPassRemovalTestDa EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << testCase.name; } -TEST_P(CCLayerTreeHostImplTest, testRemoveRenderPasses) +TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses) { - scoped_ptr<CCGraphicsContext> context(createContext()); + scoped_ptr<GraphicsContext> context(createContext()); ASSERT_TRUE(context->context3D()); - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); - scoped_ptr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get())); + scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get())); int testCaseIndex = 0; while (removeRenderPassesCases[testCaseIndex].name) { RenderPassRemovalTestData testData; configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initScript, testData, renderer.get()); - CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures(*renderer), testData); + LayerTreeHostImpl::removeRenderPasses(LayerTreeHostImpl::CullRenderPassesWithCachedTextures(*renderer), testData); verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testData); testCaseIndex++; } } -INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, - CCLayerTreeHostImplTest, +INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, + LayerTreeHostImplTest, ::testing::Values(false, true)); } // namespace diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 02a79c2..fa01275 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -32,12 +32,12 @@ using namespace WebKitTests; namespace { -class CCLayerTreeHostTest : public CCThreadedTest { }; +class LayerTreeHostTest : public ThreadedTest { }; // Shortlived layerTreeHosts shouldn't die. -class CCLayerTreeHostTestShortlived1 : public CCLayerTreeHostTest { +class LayerTreeHostTestShortlived1 : public LayerTreeHostTest { public: - CCLayerTreeHostTestShortlived1() { } + LayerTreeHostTestShortlived1() { } virtual void beginTest() OVERRIDE { @@ -54,9 +54,9 @@ public: }; // Shortlived layerTreeHosts shouldn't die with a commit in flight. -class CCLayerTreeHostTestShortlived2 : public CCLayerTreeHostTest { +class LayerTreeHostTestShortlived2 : public LayerTreeHostTest { public: - CCLayerTreeHostTestShortlived2() { } + LayerTreeHostTestShortlived2() { } virtual void beginTest() OVERRIDE { @@ -74,12 +74,12 @@ public: } }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived2) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestShortlived2) // Shortlived layerTreeHosts shouldn't die with a redraw in flight. -class CCLayerTreeHostTestShortlived3 : public CCLayerTreeHostTest { +class LayerTreeHostTestShortlived3 : public LayerTreeHostTest { public: - CCLayerTreeHostTestShortlived3() { } + LayerTreeHostTestShortlived3() { } virtual void beginTest() OVERRIDE { @@ -97,12 +97,12 @@ public: } }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived3) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestShortlived3) // Test interleaving of redraws and commits -class CCLayerTreeHostTestCommitingWithContinuousRedraw : public CCLayerTreeHostTest { +class LayerTreeHostTestCommitingWithContinuousRedraw : public LayerTreeHostTest { public: - CCLayerTreeHostTestCommitingWithContinuousRedraw() + LayerTreeHostTestCommitingWithContinuousRedraw() : m_numCompleteCommits(0) , m_numDraws(0) { @@ -113,14 +113,14 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { m_numCompleteCommits++; if (m_numCompleteCommits == 2) endTest(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl*) OVERRIDE { if (m_numDraws == 1) postSetNeedsCommitToMainThread(); @@ -137,16 +137,16 @@ private: int m_numDraws; }; -TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw, runMultiThread) +TEST_F(LayerTreeHostTestCommitingWithContinuousRedraw, runMultiThread) { runTest(true); } // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 // draw with frame 0. -class CCLayerTreeHostTestSetNeedsCommit1 : public CCLayerTreeHostTest { +class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetNeedsCommit1() + LayerTreeHostTestSetNeedsCommit1() : m_numCommits(0) , m_numDraws(0) { @@ -158,14 +158,14 @@ public: postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_numDraws++; if (!impl->sourceFrameNumber()) endTest(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { m_numCommits++; } @@ -181,16 +181,16 @@ private: int m_numDraws; }; -TEST_F(CCLayerTreeHostTestSetNeedsCommit1, DISABLED_runMultiThread) +TEST_F(LayerTreeHostTestSetNeedsCommit1, DISABLED_runMultiThread) { runTest(true); } // A setNeedsCommit should lead to 1 commit. Issuing a second commit after that // first committed frame draws should lead to another commit. -class CCLayerTreeHostTestSetNeedsCommit2 : public CCLayerTreeHostTest { +class LayerTreeHostTestSetNeedsCommit2 : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetNeedsCommit2() + LayerTreeHostTestSetNeedsCommit2() : m_numCommits(0) , m_numDraws(0) { @@ -201,7 +201,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { if (!impl->sourceFrameNumber()) postSetNeedsCommitToMainThread(); @@ -209,7 +209,7 @@ public: endTest(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { m_numCommits++; } @@ -227,9 +227,9 @@ private: #if OS(WINDOWS) // http://webkit.org/b/74623 -TEST_F(CCLayerTreeHostTestSetNeedsCommit2, FLAKY_runMultiThread) +TEST_F(LayerTreeHostTestSetNeedsCommit2, FLAKY_runMultiThread) #else -TEST_F(CCLayerTreeHostTestSetNeedsCommit2, runMultiThread) +TEST_F(LayerTreeHostTestSetNeedsCommit2, runMultiThread) #endif { runTest(true); @@ -237,9 +237,9 @@ TEST_F(CCLayerTreeHostTestSetNeedsCommit2, runMultiThread) // 1 setNeedsRedraw after the first commit has completed should lead to 1 // additional draw. -class CCLayerTreeHostTestSetNeedsRedraw : public CCLayerTreeHostTest { +class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetNeedsRedraw() + LayerTreeHostTestSetNeedsRedraw() : m_numCommits(0) , m_numDraws(0) { @@ -250,7 +250,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { EXPECT_EQ(0, impl->sourceFrameNumber()); if (!m_numDraws) @@ -260,7 +260,7 @@ public: m_numDraws++; } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { EXPECT_EQ(0, m_numDraws); m_numCommits++; @@ -277,15 +277,15 @@ private: int m_numDraws; }; -TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread) +TEST_F(LayerTreeHostTestSetNeedsRedraw, runMultiThread) { runTest(true); } // If the layerTreeHost says it can't draw, then we should not try to draw. -class CCLayerTreeHostTestCanDrawBlocksDrawing : public CCLayerTreeHostTest { +class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest { public: - CCLayerTreeHostTestCanDrawBlocksDrawing() + LayerTreeHostTestCanDrawBlocksDrawing() : m_numCommits(0) { } @@ -295,14 +295,14 @@ public: postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { // Only the initial draw should bring us here. EXPECT_TRUE(impl->canDraw()); EXPECT_EQ(0, impl->sourceFrameNumber()); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { if (m_numCommits >= 1) { // After the first commit, we should not be able to draw. @@ -334,12 +334,12 @@ private: int m_numCommits; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCanDrawBlocksDrawing) // beginLayerWrite should prevent draws from executing until a commit occurs -class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTest { +class LayerTreeHostTestWriteLayersRedraw : public LayerTreeHostTest { public: - CCLayerTreeHostTestWriteLayersRedraw() + LayerTreeHostTestWriteLayersRedraw() : m_numCommits(0) , m_numDraws(0) { @@ -352,13 +352,13 @@ public: postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_numDraws++; EXPECT_EQ(m_numDraws, m_numCommits); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { m_numCommits++; endTest(); @@ -374,7 +374,7 @@ private: int m_numDraws; }; -TEST_F(CCLayerTreeHostTestWriteLayersRedraw, runMultiThread) +TEST_F(LayerTreeHostTestWriteLayersRedraw, runMultiThread) { runTest(true); } @@ -384,9 +384,9 @@ TEST_F(CCLayerTreeHostTestWriteLayersRedraw, runMultiThread) // scheduled redraws. This behavior is critical for reliably surviving tab // switching. There are no failure conditions to this test, it just passes // by not timing out. -class CCLayerTreeHostTestWriteLayersAfterVisible : public CCLayerTreeHostTest { +class LayerTreeHostTestWriteLayersAfterVisible : public LayerTreeHostTest { public: - CCLayerTreeHostTestWriteLayersAfterVisible() + LayerTreeHostTestWriteLayersAfterVisible() : m_numCommits(0) { } @@ -396,7 +396,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { m_numCommits++; if (m_numCommits == 2) @@ -417,15 +417,15 @@ private: int m_numCommits; }; -TEST_F(CCLayerTreeHostTestWriteLayersAfterVisible, runMultiThread) +TEST_F(LayerTreeHostTestWriteLayersAfterVisible, runMultiThread) { runTest(true); } // A compositeAndReadback while invisible should force a normal commit without assertion. -class CCLayerTreeHostTestCompositeAndReadbackWhileInvisible : public CCLayerTreeHostTest { +class LayerTreeHostTestCompositeAndReadbackWhileInvisible : public LayerTreeHostTest { public: - CCLayerTreeHostTestCompositeAndReadbackWhileInvisible() + LayerTreeHostTestCompositeAndReadbackWhileInvisible() : m_numCommits(0) { } @@ -456,14 +456,14 @@ private: int m_numCommits; }; -TEST_F(CCLayerTreeHostTestCompositeAndReadbackWhileInvisible, runMultiThread) +TEST_F(LayerTreeHostTestCompositeAndReadbackWhileInvisible, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestAbortFrameWhenInvisible : public CCLayerTreeHostTest { +class LayerTreeHostTestAbortFrameWhenInvisible : public LayerTreeHostTest { public: - CCLayerTreeHostTestAbortFrameWhenInvisible() + LayerTreeHostTestAbortFrameWhenInvisible() { } @@ -490,15 +490,15 @@ public: private: }; -TEST_F(CCLayerTreeHostTestAbortFrameWhenInvisible, runMultiThread) +TEST_F(LayerTreeHostTestAbortFrameWhenInvisible, runMultiThread) { runTest(true); } // Makes sure that setNedsAnimate does not cause the commitRequested() state to be set. -class CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested : public CCLayerTreeHostTest { +class LayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested() + LayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested() : m_numCommits(0) { } @@ -546,7 +546,7 @@ private: int m_numCommits; }; -TEST_F(CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested, runMultiThread) +TEST_F(LayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested, runMultiThread) { runTest(true); } @@ -558,9 +558,9 @@ TEST_F(CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested, runMultiTh // animate gets called yet-again, indicating that the proxy is correctly // handling the case where setNeedsAnimate() is called inside the begin frame // flow. -class CCLayerTreeHostTestSetNeedsAnimateInsideAnimationCallback : public CCLayerTreeHostTest { +class LayerTreeHostTestSetNeedsAnimateInsideAnimationCallback : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetNeedsAnimateInsideAnimationCallback() + LayerTreeHostTestSetNeedsAnimateInsideAnimationCallback() : m_numAnimates(0) { } @@ -588,16 +588,16 @@ private: int m_numAnimates; }; -TEST_F(CCLayerTreeHostTestSetNeedsAnimateInsideAnimationCallback, runMultiThread) +TEST_F(LayerTreeHostTestSetNeedsAnimateInsideAnimationCallback, runMultiThread) { runTest(true); } -// Add a layer animation and confirm that CCLayerTreeHostImpl::animateLayers does get +// Add a layer animation and confirm that LayerTreeHostImpl::animateLayers does get // called and continues to get called. -class CCLayerTreeHostTestAddAnimation : public CCLayerTreeHostTest { +class LayerTreeHostTestAddAnimation : public LayerTreeHostTest { public: - CCLayerTreeHostTestAddAnimation() + LayerTreeHostTestAddAnimation() : m_numAnimates(0) , m_receivedAnimationStartedNotification(false) , m_startTime(0) @@ -610,7 +610,7 @@ public: postAddInstantAnimationToMainThread(); } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE + virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { if (!m_numAnimates) { // The animation had zero duration so layerTreeHostImpl should no @@ -644,16 +644,16 @@ private: double m_firstMonotonicTime; }; -TEST_F(CCLayerTreeHostTestAddAnimation, runMultiThread) +TEST_F(LayerTreeHostTestAddAnimation, runMultiThread) { runTest(true); } // Add a layer animation to a layer, but continually fail to draw. Confirm that after // a while, we do eventually force a draw. -class CCLayerTreeHostTestCheckerboardDoesNotStarveDraws : public CCLayerTreeHostTest { +class LayerTreeHostTestCheckerboardDoesNotStarveDraws : public LayerTreeHostTest { public: - CCLayerTreeHostTestCheckerboardDoesNotStarveDraws() + LayerTreeHostTestCheckerboardDoesNotStarveDraws() : m_startedAnimating(false) { } @@ -667,18 +667,18 @@ public: { } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE + virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { m_startedAnimating = true; } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl*) OVERRIDE { if (m_startedAnimating) endTest(); } - virtual bool prepareToDrawOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual bool prepareToDrawOnThread(LayerTreeHostImpl*) OVERRIDE { return false; } @@ -688,15 +688,15 @@ private: }; // Starvation can only be an issue with the MT compositor. -TEST_F(CCLayerTreeHostTestCheckerboardDoesNotStarveDraws, runMultiThread) +TEST_F(LayerTreeHostTestCheckerboardDoesNotStarveDraws, runMultiThread) { runTest(true); } // Ensures that animations continue to be ticked when we are backgrounded. -class CCLayerTreeHostTestTickAnimationWhileBackgrounded : public CCLayerTreeHostTest { +class LayerTreeHostTestTickAnimationWhileBackgrounded : public LayerTreeHostTest { public: - CCLayerTreeHostTestTickAnimationWhileBackgrounded() + LayerTreeHostTestTickAnimationWhileBackgrounded() : m_numAnimates(0) { } @@ -709,7 +709,7 @@ public: // Use willAnimateLayers to set visible false before the animation runs and // causes a commit, so we block the second visible animate in single-thread // mode. - virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE + virtual void willAnimateLayers(LayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { if (m_numAnimates < 2) { if (!m_numAnimates) { @@ -730,12 +730,12 @@ private: int m_numAnimates; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTickAnimationWhileBackgrounded) // Ensures that animations continue to be ticked when we are backgrounded. -class CCLayerTreeHostTestAddAnimationWithTimingFunction : public CCLayerTreeHostTest { +class LayerTreeHostTestAddAnimationWithTimingFunction : public LayerTreeHostTest { public: - CCLayerTreeHostTestAddAnimationWithTimingFunction() + LayerTreeHostTestAddAnimationWithTimingFunction() { } @@ -744,12 +744,12 @@ public: postAddAnimationToMainThread(); } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE + virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { - const CCActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity); + const ActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, ActiveAnimation::Opacity); if (!animation) return; - const CCFloatAnimationCurve* curve = animation->curve()->toFloatAnimationCurve(); + const FloatAnimationCurve* curve = animation->curve()->toFloatAnimationCurve(); float startOpacity = curve->getValue(0); float endOpacity = curve->getValue(curve->duration()); float linearlyInterpolatedOpacity = 0.25 * endOpacity + 0.75 * startOpacity; @@ -768,12 +768,12 @@ public: private: }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestAddAnimationWithTimingFunction) // Ensures that when opacity is being animated, this value does not cause the subtree to be skipped. -class CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public CCLayerTreeHostTest { +class LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public LayerTreeHostTest { public: - CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity() + LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity() { } @@ -785,7 +785,7 @@ public: postAddAnimationToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { // If the subtree was skipped when preparing to draw, the layer's draw opacity // will not have been updated. It should be set to 0 due to the animation. @@ -801,18 +801,18 @@ public: #if OS(WINDOWS) // http://webkit.org/b/74623 -TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, FLAKY_runMultiThread) +TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, FLAKY_runMultiThread) #else -TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) +TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) #endif { runTest(true); } // Ensures that main thread animations have their start times synchronized with impl thread animations. -class CCLayerTreeHostTestSynchronizeAnimationStartTimes : public CCLayerTreeHostTest { +class LayerTreeHostTestSynchronizeAnimationStartTimes : public LayerTreeHostTest { public: - CCLayerTreeHostTestSynchronizeAnimationStartTimes() + LayerTreeHostTestSynchronizeAnimationStartTimes() : m_layerTreeHostImpl(0) { } @@ -822,8 +822,8 @@ public: postAddAnimationToMainThread(); } - // This is guaranteed to be called before CCLayerTreeHostImpl::animateLayers. - virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE + // This is guaranteed to be called before LayerTreeHostImpl::animateLayers. + virtual void willAnimateLayers(LayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { m_layerTreeHostImpl = layerTreeHostImpl; } @@ -832,10 +832,10 @@ public: { EXPECT_TRUE(m_layerTreeHostImpl); - CCLayerAnimationController* controllerImpl = m_layerTreeHostImpl->rootLayer()->layerAnimationController(); - CCLayerAnimationController* controller = m_layerTreeHost->rootLayer()->layerAnimationController(); - CCActiveAnimation* animationImpl = controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity); - CCActiveAnimation* animation = controller->getActiveAnimation(0, CCActiveAnimation::Opacity); + LayerAnimationController* controllerImpl = m_layerTreeHostImpl->rootLayer()->layerAnimationController(); + LayerAnimationController* controller = m_layerTreeHost->rootLayer()->layerAnimationController(); + ActiveAnimation* animationImpl = controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity); + ActiveAnimation* animation = controller->getActiveAnimation(0, ActiveAnimation::Opacity); EXPECT_EQ(animationImpl->startTime(), animation->startTime()); @@ -847,15 +847,15 @@ public: } private: - CCLayerTreeHostImpl* m_layerTreeHostImpl; + LayerTreeHostImpl* m_layerTreeHostImpl; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSynchronizeAnimationStartTimes) // Ensures that main thread animations have their start times synchronized with impl thread animations. -class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTest { +class LayerTreeHostTestAnimationFinishedEvents : public LayerTreeHostTest { public: - CCLayerTreeHostTestAnimationFinishedEvents() + LayerTreeHostTestAnimationFinishedEvents() { } @@ -876,11 +876,11 @@ public: private: }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAnimationFinishedEvents) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestAnimationFinishedEvents) -class CCLayerTreeHostTestScrollSimple : public CCLayerTreeHostTest { +class LayerTreeHostTestScrollSimple : public LayerTreeHostTest { public: - CCLayerTreeHostTestScrollSimple() + LayerTreeHostTestScrollSimple() : m_initialScroll(IntPoint(10, 20)) , m_secondScroll(IntPoint(40, 5)) , m_scrollAmount(2, -1) @@ -897,7 +897,7 @@ public: virtual void layout() OVERRIDE { - LayerChromium* root = m_layerTreeHost->rootLayer(); + Layer* root = m_layerTreeHost->rootLayer(); if (!m_layerTreeHost->commitNumber()) EXPECT_EQ(root->scrollPosition(), m_initialScroll); else { @@ -908,9 +908,9 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CCLayerImpl* root = impl->rootLayer(); + LayerImpl* root = impl->rootLayer(); EXPECT_EQ(root->scrollDelta(), IntSize()); root->setScrollable(true); @@ -946,14 +946,14 @@ private: int m_scrolls; }; -TEST_F(CCLayerTreeHostTestScrollSimple, runMultiThread) +TEST_F(LayerTreeHostTestScrollSimple, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestScrollMultipleRedraw : public CCLayerTreeHostTest { +class LayerTreeHostTestScrollMultipleRedraw : public LayerTreeHostTest { public: - CCLayerTreeHostTestScrollMultipleRedraw() + LayerTreeHostTestScrollMultipleRedraw() : m_initialScroll(IntPoint(40, 10)) , m_scrollAmount(-3, 17) , m_scrolls(0) @@ -967,9 +967,9 @@ public: postSetNeedsCommitToMainThread(); } - virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void beginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE { - LayerChromium* root = m_layerTreeHost->rootLayer(); + Layer* root = m_layerTreeHost->rootLayer(); if (!m_layerTreeHost->commitNumber()) EXPECT_EQ(root->scrollPosition(), m_initialScroll); else if (m_layerTreeHost->commitNumber() == 1) @@ -978,9 +978,9 @@ public: EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CCLayerImpl* root = impl->rootLayer(); + LayerImpl* root = impl->rootLayer(); root->setScrollable(true); root->setMaxScrollPosition(IntSize(100, 100)); @@ -1026,16 +1026,16 @@ private: int m_scrolls; }; -TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, runMultiThread) +TEST_F(LayerTreeHostTestScrollMultipleRedraw, runMultiThread) { runTest(true); } // This test verifies that properties on the layer tree host are commited to the impl side. -class CCLayerTreeHostTestCommit : public CCLayerTreeHostTest { +class LayerTreeHostTestCommit : public LayerTreeHostTest { public: - CCLayerTreeHostTestCommit() { } + LayerTreeHostTestCommit() { } virtual void beginTest() OVERRIDE { @@ -1046,7 +1046,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize()); EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor()); @@ -1058,17 +1058,17 @@ public: virtual void afterTest() OVERRIDE { } }; -TEST_F(CCLayerTreeHostTestCommit, runTest) +TEST_F(LayerTreeHostTestCommit, runTest) { runTest(true); } -// Verifies that startPageScaleAnimation events propagate correctly from CCLayerTreeHost to -// CCLayerTreeHostImpl in the MT compositor. -class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest { +// Verifies that startPageScaleAnimation events propagate correctly from LayerTreeHost to +// LayerTreeHostImpl in the MT compositor. +class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { public: - CCLayerTreeHostTestStartPageScaleAnimation() + LayerTreeHostTestStartPageScaleAnimation() : m_animationRequested(false) { } @@ -1085,7 +1085,7 @@ public: layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { impl->rootLayer()->setScrollable(true); impl->rootLayer()->setScrollPosition(IntPoint()); @@ -1093,7 +1093,7 @@ public: // We request animation only once. if (!m_animationRequested) { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTestStartPageScaleAnimation::requestStartPageScaleAnimation)); + m_mainThreadProxy->postTask(createThreadTask(this, &LayerTreeHostTestStartPageScaleAnimation::requestStartPageScaleAnimation)); m_animationRequested = true; } } @@ -1105,7 +1105,7 @@ public: m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { impl->processScrollDeltas(); // We get one commit before the first draw, and the animation doesn't happen until the second draw. @@ -1124,15 +1124,15 @@ private: bool m_animationRequested; }; -TEST_F(CCLayerTreeHostTestStartPageScaleAnimation, runTest) +TEST_F(LayerTreeHostTestStartPageScaleAnimation, runTest) { runTest(true); } -class CCLayerTreeHostTestSetVisible : public CCLayerTreeHostTest { +class LayerTreeHostTestSetVisible : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetVisible() + LayerTreeHostTestSetVisible() : m_numDraws(0) { } @@ -1144,7 +1144,7 @@ public: postSetVisibleToMainThread(true); // Triggers the redraw. } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { EXPECT_TRUE(impl->visible()); ++m_numDraws; @@ -1160,14 +1160,14 @@ private: int m_numDraws; }; -TEST_F(CCLayerTreeHostTestSetVisible, runMultiThread) +TEST_F(LayerTreeHostTestSetVisible, runMultiThread) { runTest(true); } -class TestOpacityChangeLayerDelegate : public ContentLayerChromiumClient { +class TestOpacityChangeLayerDelegate : public ContentLayerClient { public: - TestOpacityChangeLayerDelegate(CCLayerTreeHostTest* test) + TestOpacityChangeLayerDelegate(LayerTreeHostTest* test) : m_test(test) { } @@ -1179,32 +1179,32 @@ public: } private: - CCLayerTreeHostTest* m_test; + LayerTreeHostTest* m_test; }; -class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium { +class ContentLayerWithUpdateTracking : public ContentLayer { public: - static scoped_refptr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return make_scoped_refptr(new ContentLayerChromiumWithUpdateTracking(client)); } + static scoped_refptr<ContentLayerWithUpdateTracking> create(ContentLayerClient* client) { return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); } int paintContentsCount() { return m_paintContentsCount; } void resetPaintContentsCount() { m_paintContentsCount = 0; } - virtual void update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) OVERRIDE + virtual void update(TextureUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats) OVERRIDE { - ContentLayerChromium::update(queue, occlusion, stats); + ContentLayer::update(queue, occlusion, stats); m_paintContentsCount++; } private: - explicit ContentLayerChromiumWithUpdateTracking(ContentLayerChromiumClient* client) - : ContentLayerChromium(client) + explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) + : ContentLayer(client) , m_paintContentsCount(0) { setAnchorPoint(FloatPoint(0, 0)); setBounds(IntSize(10, 10)); setIsDrawable(true); } - virtual ~ContentLayerChromiumWithUpdateTracking() + virtual ~ContentLayerWithUpdateTracking() { } @@ -1212,11 +1212,11 @@ private: }; // Layer opacity change during paint should not prevent compositor resources from being updated during commit. -class CCLayerTreeHostTestOpacityChange : public CCLayerTreeHostTest { +class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { public: - CCLayerTreeHostTestOpacityChange() + LayerTreeHostTestOpacityChange() : m_testOpacityChangeDelegate(this) - , m_updateCheckLayer(ContentLayerChromiumWithUpdateTracking::create(&m_testOpacityChangeDelegate)) + , m_updateCheckLayer(ContentLayerWithUpdateTracking::create(&m_testOpacityChangeDelegate)) { } @@ -1228,7 +1228,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { endTest(); } @@ -1238,21 +1238,21 @@ public: // update() should have been called once. EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount()); - // clear m_updateCheckLayer so CCLayerTreeHost dies. + // clear m_updateCheckLayer so LayerTreeHost dies. m_updateCheckLayer = NULL; } private: TestOpacityChangeLayerDelegate m_testOpacityChangeDelegate; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer; + scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; }; -TEST_F(CCLayerTreeHostTestOpacityChange, runMultiThread) +TEST_F(LayerTreeHostTestOpacityChange, runMultiThread) { runTest(true); } -class MockContentLayerChromiumClient : public ContentLayerChromiumClient { +class MockContentLayerClient : public ContentLayerClient { public: bool drawsContent() const { return true; } MOCK_CONST_METHOD0(preserves3D, bool()); @@ -1260,24 +1260,24 @@ public: void notifySyncRequired() { } }; -class NoScaleContentLayerChromium : public ContentLayerChromium { +class NoScaleContentLayer : public ContentLayer { public: - static scoped_refptr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return make_scoped_refptr(new NoScaleContentLayerChromium(client)); } + static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client) { return make_scoped_refptr(new NoScaleContentLayer(client)); } virtual bool needsContentsScale() const OVERRIDE { return false; } private: - explicit NoScaleContentLayerChromium(ContentLayerChromiumClient* client) - : ContentLayerChromium(client) { } - virtual ~NoScaleContentLayerChromium() { } + explicit NoScaleContentLayer(ContentLayerClient* client) + : ContentLayer(client) { } + virtual ~NoScaleContentLayer() { } }; -class CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public CCLayerTreeHostTest { +class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public LayerTreeHostTest { public: - CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() - : m_rootLayer(NoScaleContentLayerChromium::create(&m_client)) - , m_childLayer(ContentLayerChromium::create(&m_client)) + LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() + : m_rootLayer(NoScaleContentLayer::create(&m_client)) + , m_childLayer(ContentLayer::create(&m_client)) { } @@ -1302,7 +1302,7 @@ public: m_layerTreeHost->setRootLayer(m_rootLayer); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { // Get access to protected methods. MockLayerTreeHostImpl* mockImpl = static_cast<MockLayerTreeHostImpl*>(impl); @@ -1319,15 +1319,15 @@ public: EXPECT_EQ(IntSize(40, 40), impl->layoutViewportSize()); EXPECT_EQ(IntSize(60, 60), impl->deviceViewportSize()); - CCLayerImpl* root = impl->rootLayer(); - CCLayerImpl* child = impl->rootLayer()->children()[0]; + LayerImpl* root = impl->rootLayer(); + LayerImpl* child = impl->rootLayer()->children()[0]; // Positions remain in layout pixels. EXPECT_EQ(IntPoint(0, 0), root->position()); EXPECT_EQ(IntPoint(2, 2), child->position()); // Compute all the layer transforms for the frame. - MockLayerTreeHostImpl::CCLayerList renderSurfaceLayerList; + MockLayerTreeHostImpl::LayerList renderSurfaceLayerList; mockImpl->calculateRenderSurfaceLayerList(renderSurfaceLayerList); // Both layers should be drawing into the root render surface. @@ -1371,22 +1371,22 @@ public: } private: - MockContentLayerChromiumClient m_client; - scoped_refptr<NoScaleContentLayerChromium> m_rootLayer; - scoped_refptr<ContentLayerChromium> m_childLayer; + MockContentLayerClient m_client; + scoped_refptr<NoScaleContentLayer> m_rootLayer; + scoped_refptr<ContentLayer> m_childLayer; }; // Test is flaky - http://crbug.com/148490 -TEST_F(CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, DISABLED_runMultiThread) +TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, DISABLED_runMultiThread) { runTest(true); } // Verify atomicity of commits and reuse of textures. -class CCLayerTreeHostTestAtomicCommit : public CCLayerTreeHostTest { +class LayerTreeHostTestAtomicCommit : public LayerTreeHostTest { public: - CCLayerTreeHostTestAtomicCommit() - : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_client)) + LayerTreeHostTestAtomicCommit() + : m_layer(ContentLayerWithUpdateTracking::create(&m_client)) { // Make sure partial texture updates are turned off. m_settings.maxPartialTextureUpdates = 0; @@ -1401,7 +1401,7 @@ public: postSetNeedsRedrawToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1435,7 +1435,7 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1460,16 +1460,16 @@ public: } private: - MockContentLayerChromiumClient m_client; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_layer; + MockContentLayerClient m_client; + scoped_refptr<ContentLayerWithUpdateTracking> m_layer; }; -TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) +TEST_F(LayerTreeHostTestAtomicCommit, runMultiThread) { runTest(true); } -static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { layer->removeAllChildren(); if (parent) @@ -1481,11 +1481,11 @@ static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* pa layer->setContentsOpaque(opaque); } -class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest { +class LayerTreeHostTestAtomicCommitWithPartialUpdate : public LayerTreeHostTest { public: - CCLayerTreeHostTestAtomicCommitWithPartialUpdate() - : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client)) - , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_client)) + LayerTreeHostTestAtomicCommitWithPartialUpdate() + : m_parent(ContentLayerWithUpdateTracking::create(&m_client)) + , m_child(ContentLayerWithUpdateTracking::create(&m_client)) , m_numCommits(0) { // Allow one partial texture update. @@ -1505,7 +1505,7 @@ public: postSetNeedsRedrawToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1557,7 +1557,7 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1607,25 +1607,25 @@ public: } private: - MockContentLayerChromiumClient m_client; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_parent; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_child; + MockContentLayerClient m_client; + scoped_refptr<ContentLayerWithUpdateTracking> m_parent; + scoped_refptr<ContentLayerWithUpdateTracking> m_child; int m_numCommits; }; -TEST_F(CCLayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread) +TEST_F(LayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread) { runTest(true); } -class TestLayerChromium : public LayerChromium { +class TestLayer : public Layer { public: - static scoped_refptr<TestLayerChromium> create() { return make_scoped_refptr(new TestLayerChromium()); } + static scoped_refptr<TestLayer> create() { return make_scoped_refptr(new TestLayer()); } - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker* occlusion, CCRenderingStats&) OVERRIDE + virtual void update(TextureUpdateQueue&, const OcclusionTracker* occlusion, RenderingStats&) OVERRIDE { - // Gain access to internals of the CCOcclusionTracker. - const TestCCOcclusionTracker* testOcclusion = static_cast<const TestCCOcclusionTracker*>(occlusion); + // Gain access to internals of the OcclusionTracker. + const TestOcclusionTracker* testOcclusion = static_cast<const TestOcclusionTracker*>(occlusion); m_occludedScreenSpace = testOcclusion ? testOcclusion->occlusionInScreenSpace() : Region(); } @@ -1635,29 +1635,29 @@ public: void clearOccludedScreenSpace() { m_occludedScreenSpace = Region(); } private: - TestLayerChromium() : LayerChromium() { } - virtual ~TestLayerChromium() { } + TestLayer() : Layer() { } + virtual ~TestLayer() { } Region m_occludedScreenSpace; }; -static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque); layer->clearOccludedScreenSpace(); } -class CCLayerTreeHostTestLayerOcclusion : public CCLayerTreeHostTest { +class LayerTreeHostTestLayerOcclusion : public LayerTreeHostTest { public: - CCLayerTreeHostTestLayerOcclusion() { } + LayerTreeHostTestLayerOcclusion() { } virtual void beginTest() OVERRIDE { - scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> child = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> child2 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> grandChild = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> mask = TestLayerChromium::create(); + scoped_refptr<TestLayer> rootLayer = TestLayer::create(); + scoped_refptr<TestLayer> child = TestLayer::create(); + scoped_refptr<TestLayer> child2 = TestLayer::create(); + scoped_refptr<TestLayer> grandChild = TestLayer::create(); + scoped_refptr<TestLayer> mask = TestLayer::create(); WebTransformationMatrix identityMatrix; WebTransformationMatrix childTransform; @@ -1667,7 +1667,7 @@ public: child->setMasksToBounds(true); - // See CCLayerTreeHostCommonTest.layerAddsSelfToOccludedRegionWithRotatedSurface for a nice visual of these layers and how they end up + // See LayerTreeHostCommonTest.layerAddsSelfToOccludedRegionWithRotatedSurface for a nice visual of these layers and how they end up // positioned on the screen. // The child layer is rotated and the grandChild is opaque, but clipped to the child and rootLayer @@ -1678,7 +1678,7 @@ public: m_layerTreeHost->setRootLayer(rootLayer); m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds()); ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); - CCTextureUpdateQueue queue; + TextureUpdateQueue queue; m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); @@ -1848,19 +1848,19 @@ public: } }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusion) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLayerOcclusion) -class CCLayerTreeHostTestLayerOcclusionWithFilters : public CCLayerTreeHostTest { +class LayerTreeHostTestLayerOcclusionWithFilters : public LayerTreeHostTest { public: - CCLayerTreeHostTestLayerOcclusionWithFilters() { } + LayerTreeHostTestLayerOcclusionWithFilters() { } virtual void beginTest() OVERRIDE { - scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> child = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> child2 = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> grandChild = TestLayerChromium::create(); - scoped_refptr<TestLayerChromium> mask = TestLayerChromium::create(); + scoped_refptr<TestLayer> rootLayer = TestLayer::create(); + scoped_refptr<TestLayer> child = TestLayer::create(); + scoped_refptr<TestLayer> child2 = TestLayer::create(); + scoped_refptr<TestLayer> grandChild = TestLayer::create(); + scoped_refptr<TestLayer> mask = TestLayer::create(); WebTransformationMatrix identityMatrix; WebTransformationMatrix childTransform; @@ -1886,7 +1886,7 @@ public: m_layerTreeHost->setRootLayer(rootLayer); m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds()); ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); - CCTextureUpdateQueue queue; + TextureUpdateQueue queue; m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); @@ -1930,7 +1930,7 @@ public: m_layerTreeHost->setRootLayer(0); m_layerTreeHost.reset(); - CCLayerTreeHost::setNeedsFilterContext(false); + LayerTreeHost::setNeedsFilterContext(false); endTest(); } @@ -1939,43 +1939,43 @@ public: } }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusionWithFilters) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLayerOcclusionWithFilters) -class CCLayerTreeHostTestManySurfaces : public CCLayerTreeHostTest { +class LayerTreeHostTestManySurfaces : public LayerTreeHostTest { public: - CCLayerTreeHostTestManySurfaces() { } + LayerTreeHostTestManySurfaces() { } virtual void beginTest() OVERRIDE { // We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion. Region occluded; const WebTransformationMatrix identityMatrix; - std::vector<scoped_refptr<TestLayerChromium> > layers; - std::vector<scoped_refptr<TestLayerChromium> > children; + std::vector<scoped_refptr<TestLayer> > layers; + std::vector<scoped_refptr<TestLayer> > children; int numSurfaces = 20; - scoped_refptr<TestLayerChromium> replica = TestLayerChromium::create(); + scoped_refptr<TestLayer> replica = TestLayer::create(); for (int i = 0; i < numSurfaces; ++i) { - layers.push_back(TestLayerChromium::create()); + layers.push_back(TestLayer::create()); if (!i) { setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); layers.back()->createRenderSurface(); } else { setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true); layers.back()->setMasksToBounds(true); - layers.back()->setReplicaLayer(replica.get()); // Make it have a RenderSurface + layers.back()->setReplicaLayer(replica.get()); // Make it have a RenderSurfaceImpl } } for (int i = 1; i < numSurfaces; ++i) { - children.push_back(TestLayerChromium::create()); + children.push_back(TestLayer::create()); setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); } m_layerTreeHost->setRootLayer(layers[0].get()); m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds()); ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); - CCTextureUpdateQueue queue; + TextureUpdateQueue queue; m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); @@ -1998,12 +1998,12 @@ public: } }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestManySurfaces) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestManySurfaces) // A loseContext(1) should lead to a didRecreateOutputSurface(true) -class CCLayerTreeHostTestSetSingleLostContext : public CCLayerTreeHostTest { +class LayerTreeHostTestSetSingleLostContext : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetSingleLostContext() + LayerTreeHostTestSetSingleLostContext() { } @@ -2028,16 +2028,16 @@ public: } }; -TEST_F(CCLayerTreeHostTestSetSingleLostContext, runMultiThread) +TEST_F(LayerTreeHostTestSetSingleLostContext, runMultiThread) { runTest(true); } // A loseContext(10) should lead to a didRecreateOutputSurface(false), and // a finishAllRendering() should not hang. -class CCLayerTreeHostTestSetRepeatedLostContext : public CCLayerTreeHostTest { +class LayerTreeHostTestSetRepeatedLostContext : public LayerTreeHostTest { public: - CCLayerTreeHostTestSetRepeatedLostContext() + LayerTreeHostTestSetRepeatedLostContext() { } @@ -2063,14 +2063,14 @@ public: } }; -TEST_F(CCLayerTreeHostTestSetRepeatedLostContext, runMultiThread) +TEST_F(LayerTreeHostTestSetRepeatedLostContext, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestFractionalScroll : public CCLayerTreeHostTest { +class LayerTreeHostTestFractionalScroll : public LayerTreeHostTest { public: - CCLayerTreeHostTestFractionalScroll() + LayerTreeHostTestFractionalScroll() : m_scrollAmount(1.75, 0) { } @@ -2081,9 +2081,9 @@ public: postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CCLayerImpl* root = impl->rootLayer(); + LayerImpl* root = impl->rootLayer(); root->setMaxScrollPosition(IntSize(100, 100)); // Check that a fractional scroll delta is correctly accumulated over multiple commits. @@ -2116,14 +2116,14 @@ private: FloatSize m_scrollAmount; }; -TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread) +TEST_F(LayerTreeHostTestFractionalScroll, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestFinishAllRendering : public CCLayerTreeHostTest { +class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { public: - CCLayerTreeHostTestFinishAllRendering() + LayerTreeHostTestFinishAllRendering() : m_once(false) , m_drawCount(0) { @@ -2153,7 +2153,7 @@ public: endTest(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { base::AutoLock lock(m_lock); ++m_drawCount; @@ -2169,13 +2169,13 @@ private: int m_drawCount; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestFinishAllRendering) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFinishAllRendering) // Layers added to tree with existing active animations should have the animation // correctly recognized. -class CCLayerTreeHostTestLayerAddedWithAnimation : public CCLayerTreeHostTest { +class LayerTreeHostTestLayerAddedWithAnimation : public LayerTreeHostTest { public: - CCLayerTreeHostTestLayerAddedWithAnimation() + LayerTreeHostTestLayerAddedWithAnimation() : m_addedAnimation(false) { } @@ -2184,12 +2184,12 @@ public: { EXPECT_FALSE(m_addedAnimation); - scoped_refptr<LayerChromium> layer = LayerChromium::create(); + scoped_refptr<Layer> layer = Layer::create(); 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)); + // Any valid AnimationCurve will do here. + scoped_ptr<AnimationCurve> curve(EaseTimingFunction::create()); + scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.Pass(), 1, 1, ActiveAnimation::Opacity)); layer->layerAnimationController()->addAnimation(animation.Pass()); // We add the animation *before* attaching the layer to the tree. @@ -2210,11 +2210,11 @@ private: bool m_addedAnimation; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerAddedWithAnimation) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLayerAddedWithAnimation) -class CCLayerTreeHostTestScrollChildLayer : public CCLayerTreeHostTest, public WebLayerScrollClient { +class LayerTreeHostTestScrollChildLayer : public LayerTreeHostTest, public WebLayerScrollClient { public: - CCLayerTreeHostTestScrollChildLayer(float deviceScaleFactor) + LayerTreeHostTestScrollChildLayer(float deviceScaleFactor) : m_deviceScaleFactor(deviceScaleFactor) , m_initialScroll(IntPoint(10, 20)) , m_secondScroll(IntPoint(40, 5)) @@ -2232,7 +2232,7 @@ public: m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); - m_rootScrollLayer = ContentLayerChromium::create(&m_mockDelegate); + m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); m_rootScrollLayer->setBounds(IntSize(110, 110)); m_rootScrollLayer->setPosition(FloatPoint(0, 0)); @@ -2243,7 +2243,7 @@ public: m_rootScrollLayer->setMaxScrollPosition(IntSize(100, 100)); m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer); - m_childLayer = ContentLayerChromium::create(&m_mockDelegate); + m_childLayer = ContentLayer::create(&m_mockDelegate); m_childLayer->setLayerScrollClient(this); m_childLayer->setBounds(IntSize(110, 110)); @@ -2294,11 +2294,11 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CCLayerImpl* root = impl->rootLayer(); - CCLayerImpl* rootScrollLayer = root->children()[0]; - CCLayerImpl* childLayer = rootScrollLayer->children()[0]; + LayerImpl* root = impl->rootLayer(); + LayerImpl* rootScrollLayer = root->children()[0]; + LayerImpl* childLayer = rootScrollLayer->children()[0]; EXPECT_EQ(root->scrollDelta(), IntSize()); EXPECT_EQ(rootScrollLayer->scrollDelta(), IntSize()); @@ -2310,7 +2310,7 @@ public: switch (impl->sourceFrameNumber()) { case 0: // Gesture scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); impl->scrollBy(IntPoint(), m_scrollAmount); impl->scrollEnd(); @@ -2320,7 +2320,7 @@ public: break; case 1: // Wheel scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); impl->scrollBy(IntPoint(), m_scrollAmount); impl->scrollEnd(); @@ -2349,34 +2349,34 @@ private: int m_rootScrolls; IntPoint m_finalScrollPosition; - MockContentLayerChromiumClient m_mockDelegate; - scoped_refptr<LayerChromium> m_rootScrollLayer; - scoped_refptr<LayerChromium> m_childLayer; + MockContentLayerClient m_mockDelegate; + scoped_refptr<Layer> m_rootScrollLayer; + scoped_refptr<Layer> m_childLayer; }; -class CCLayerTreeHostTestScrollChildLayerNormalDpi : public CCLayerTreeHostTestScrollChildLayer { +class LayerTreeHostTestScrollChildLayerNormalDpi : public LayerTreeHostTestScrollChildLayer { public: - CCLayerTreeHostTestScrollChildLayerNormalDpi() : CCLayerTreeHostTestScrollChildLayer(1) { } + LayerTreeHostTestScrollChildLayerNormalDpi() : LayerTreeHostTestScrollChildLayer(1) { } }; -TEST_F(CCLayerTreeHostTestScrollChildLayerNormalDpi, runMultiThread) +TEST_F(LayerTreeHostTestScrollChildLayerNormalDpi, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestScrollChildLayerHighDpi : public CCLayerTreeHostTestScrollChildLayer { +class LayerTreeHostTestScrollChildLayerHighDpi : public LayerTreeHostTestScrollChildLayer { public: - CCLayerTreeHostTestScrollChildLayerHighDpi() : CCLayerTreeHostTestScrollChildLayer(2) { } + LayerTreeHostTestScrollChildLayerHighDpi() : LayerTreeHostTestScrollChildLayer(2) { } }; -TEST_F(CCLayerTreeHostTestScrollChildLayerHighDpi, runMultiThread) +TEST_F(LayerTreeHostTestScrollChildLayerHighDpi, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestScrollRootScrollLayer : public CCLayerTreeHostTest { +class LayerTreeHostTestScrollRootScrollLayer : public LayerTreeHostTest { public: - CCLayerTreeHostTestScrollRootScrollLayer(float deviceScaleFactor) + LayerTreeHostTestScrollRootScrollLayer(float deviceScaleFactor) : m_deviceScaleFactor(deviceScaleFactor) , m_initialScroll(IntPoint(10, 20)) , m_secondScroll(IntPoint(40, 5)) @@ -2394,7 +2394,7 @@ public: m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); - m_rootScrollLayer = ContentLayerChromium::create(&m_mockDelegate); + m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); m_rootScrollLayer->setBounds(IntSize(110, 110)); m_rootScrollLayer->setPosition(FloatPoint(0, 0)); @@ -2435,10 +2435,10 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CCLayerImpl* root = impl->rootLayer(); - CCLayerImpl* rootScrollLayer = root->children()[0]; + LayerImpl* root = impl->rootLayer(); + LayerImpl* rootScrollLayer = root->children()[0]; EXPECT_EQ(root->scrollDelta(), IntSize()); EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootScrollLayer->contentBounds().width()); @@ -2447,7 +2447,7 @@ public: switch (impl->sourceFrameNumber()) { case 0: // Gesture scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); impl->scrollBy(IntPoint(), m_scrollAmount); impl->scrollEnd(); @@ -2457,7 +2457,7 @@ public: break; case 1: // Wheel scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); impl->scrollBy(IntPoint(), m_scrollAmount); impl->scrollEnd(); @@ -2484,37 +2484,37 @@ private: IntSize m_scrollAmount; int m_rootScrolls; - MockContentLayerChromiumClient m_mockDelegate; - scoped_refptr<LayerChromium> m_rootScrollLayer; + MockContentLayerClient m_mockDelegate; + scoped_refptr<Layer> m_rootScrollLayer; }; -class CCLayerTreeHostTestScrollRootScrollLayerNormalDpi : public CCLayerTreeHostTestScrollRootScrollLayer { +class LayerTreeHostTestScrollRootScrollLayerNormalDpi : public LayerTreeHostTestScrollRootScrollLayer { public: - CCLayerTreeHostTestScrollRootScrollLayerNormalDpi() : CCLayerTreeHostTestScrollRootScrollLayer(1) { } + LayerTreeHostTestScrollRootScrollLayerNormalDpi() : LayerTreeHostTestScrollRootScrollLayer(1) { } }; -TEST_F(CCLayerTreeHostTestScrollRootScrollLayerNormalDpi, runMultiThread) +TEST_F(LayerTreeHostTestScrollRootScrollLayerNormalDpi, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestScrollRootScrollLayerHighDpi : public CCLayerTreeHostTestScrollRootScrollLayer { +class LayerTreeHostTestScrollRootScrollLayerHighDpi : public LayerTreeHostTestScrollRootScrollLayer { public: - CCLayerTreeHostTestScrollRootScrollLayerHighDpi() : CCLayerTreeHostTestScrollRootScrollLayer(2) { } + LayerTreeHostTestScrollRootScrollLayerHighDpi() : LayerTreeHostTestScrollRootScrollLayer(2) { } }; -TEST_F(CCLayerTreeHostTestScrollRootScrollLayerHighDpi, runMultiThread) +TEST_F(LayerTreeHostTestScrollRootScrollLayerHighDpi, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestCompositeAndReadbackCleanup : public CCLayerTreeHostTest { +class LayerTreeHostTestCompositeAndReadbackCleanup : public LayerTreeHostTest { public: - CCLayerTreeHostTestCompositeAndReadbackCleanup() { } + LayerTreeHostTestCompositeAndReadbackCleanup() { } virtual void beginTest() OVERRIDE { - LayerChromium* rootLayer = m_layerTreeHost->rootLayer(); + Layer* rootLayer = m_layerTreeHost->rootLayer(); scoped_array<char> pixels(new char[4]); m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1)); @@ -2528,16 +2528,16 @@ public: } }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCompositeAndReadbackCleanup) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackCleanup) -class CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit : public CCLayerTreeHostTest { +class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit : public LayerTreeHostTest { public: - CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit() - : m_rootLayer(ContentLayerChromiumWithUpdateTracking::create(&m_mockDelegate)) - , m_surfaceLayer1(ContentLayerChromiumWithUpdateTracking::create(&m_mockDelegate)) - , m_replicaLayer1(ContentLayerChromiumWithUpdateTracking::create(&m_mockDelegate)) - , m_surfaceLayer2(ContentLayerChromiumWithUpdateTracking::create(&m_mockDelegate)) - , m_replicaLayer2(ContentLayerChromiumWithUpdateTracking::create(&m_mockDelegate)) + LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit() + : m_rootLayer(ContentLayerWithUpdateTracking::create(&m_mockDelegate)) + , m_surfaceLayer1(ContentLayerWithUpdateTracking::create(&m_mockDelegate)) + , m_replicaLayer1(ContentLayerWithUpdateTracking::create(&m_mockDelegate)) + , m_surfaceLayer2(ContentLayerWithUpdateTracking::create(&m_mockDelegate)) + , m_replicaLayer2(ContentLayerWithUpdateTracking::create(&m_mockDelegate)) { } @@ -2561,11 +2561,11 @@ public: m_layerTreeHost->setRootLayer(m_rootLayer); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* hostImpl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* hostImpl) OVERRIDE { - CCRenderer* renderer = hostImpl->renderer(); - CCRenderPass::Id surface1RenderPassId = hostImpl->rootLayer()->children()[0]->renderSurface()->renderPassId(); - CCRenderPass::Id surface2RenderPassId = hostImpl->rootLayer()->children()[0]->children()[0]->renderSurface()->renderPassId(); + Renderer* renderer = hostImpl->renderer(); + RenderPass::Id surface1RenderPassId = hostImpl->rootLayer()->children()[0]->renderSurface()->renderPassId(); + RenderPass::Id surface2RenderPassId = hostImpl->rootLayer()->children()[0]->children()[0]->renderSurface()->renderPassId(); switch (hostImpl->sourceFrameNumber()) { case 0: @@ -2591,7 +2591,7 @@ public: EXPECT_EQ(2, m_surfaceLayer1->paintContentsCount()); EXPECT_EQ(2, m_surfaceLayer2->paintContentsCount()); - // Clear layer references so CCLayerTreeHost dies. + // Clear layer references so LayerTreeHost dies. m_rootLayer = NULL; m_surfaceLayer1 = NULL; m_replicaLayer1 = NULL; @@ -2600,47 +2600,47 @@ public: } private: - MockContentLayerChromiumClient m_mockDelegate; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_rootLayer; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer2; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer2; + MockContentLayerClient m_mockDelegate; + scoped_refptr<ContentLayerWithUpdateTracking> m_rootLayer; + scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer1; + scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer1; + scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer2; + scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer2; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit) -class EvictionTestLayer : public LayerChromium { +class EvictionTestLayer : public Layer { public: static scoped_refptr<EvictionTestLayer> create() { return make_scoped_refptr(new EvictionTestLayer()); } - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; virtual bool drawsContent() const OVERRIDE { return true; } - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; - virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; - virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; + virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; + virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; bool haveBackingTexture() const { return m_texture.get() ? m_texture->haveBackingTexture() : false; } private: - EvictionTestLayer() : LayerChromium() { } + EvictionTestLayer() : Layer() { } virtual ~EvictionTestLayer() { } void createTextureIfNeeded() { if (m_texture.get()) return; - m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextureManager()); + m_texture = PrioritizedTexture::create(layerTreeHost()->contentsTextureManager()); m_texture->setDimensions(IntSize(10, 10), GL_RGBA); m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); } - scoped_ptr<CCPrioritizedTexture> m_texture; + scoped_ptr<PrioritizedTexture> m_texture; SkBitmap m_bitmap; }; -class EvictionTestLayerImpl : public CCLayerImpl { +class EvictionTestLayerImpl : public LayerImpl { public: static scoped_ptr<EvictionTestLayerImpl> create(int id) { @@ -2648,7 +2648,7 @@ public: } virtual ~EvictionTestLayerImpl() { } - virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData&) OVERRIDE + virtual void appendQuads(QuadSink& quadSink, AppendQuadsData&) OVERRIDE { ASSERT_TRUE(m_hasTexture); ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources()); @@ -2658,21 +2658,21 @@ public: private: explicit EvictionTestLayerImpl(int id) - : CCLayerImpl(id) + : LayerImpl(id) , m_hasTexture(false) { } bool m_hasTexture; }; -void EvictionTestLayer::setTexturePriorities(const CCPriorityCalculator&) +void EvictionTestLayer::setTexturePriorities(const PriorityCalculator&) { createTextureIfNeeded(); if (!m_texture.get()) return; - m_texture->setRequestPriority(CCPriorityCalculator::uiPriority(true)); + m_texture->setRequestPriority(PriorityCalculator::uiPriority(true)); } -void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker*, CCRenderingStats&) +void EvictionTestLayer::update(TextureUpdateQueue& queue, const OcclusionTracker*, RenderingStats&) { createTextureIfNeeded(); if (!m_texture.get()) @@ -2684,22 +2684,22 @@ void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTra queue.appendFullUpload(upload); } -scoped_ptr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl() +scoped_ptr<LayerImpl> EvictionTestLayer::createLayerImpl() { - return EvictionTestLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return EvictionTestLayerImpl::create(m_layerId).PassAs<LayerImpl>(); } -void EvictionTestLayer::pushPropertiesTo(CCLayerImpl* layerImpl) +void EvictionTestLayer::pushPropertiesTo(LayerImpl* layerImpl) { - LayerChromium::pushPropertiesTo(layerImpl); + Layer::pushPropertiesTo(layerImpl); EvictionTestLayerImpl* testLayerImpl = static_cast<EvictionTestLayerImpl*>(layerImpl); testLayerImpl->setHasTexture(m_texture->haveBackingTexture()); } -class CCLayerTreeHostTestEvictTextures : public CCLayerTreeHostTest { +class LayerTreeHostTestEvictTextures : public LayerTreeHostTest { public: - CCLayerTreeHostTestEvictTextures() + LayerTreeHostTestEvictTextures() : m_layer(EvictionTestLayer::create()) , m_implForEvictTextures(0) , m_numCommits(0) @@ -2717,7 +2717,7 @@ public: class EvictTexturesTask : public WebKit::WebThread::Task { public: - EvictTexturesTask(CCLayerTreeHostTestEvictTextures* test) : m_test(test) { } + EvictTexturesTask(LayerTreeHostTestEvictTextures* test) : m_test(test) { } virtual ~EvictTexturesTask() { } virtual void run() OVERRIDE { @@ -2726,7 +2726,7 @@ public: } private: - CCLayerTreeHostTestEvictTextures* m_test; + LayerTreeHostTestEvictTextures* m_test; }; void postEvictTextures() @@ -2786,7 +2786,7 @@ public: } } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_implForEvictTextures = impl; } @@ -2824,20 +2824,20 @@ public: } private: - MockContentLayerChromiumClient m_client; + MockContentLayerClient m_client; scoped_refptr<EvictionTestLayer> m_layer; - CCLayerTreeHostImpl* m_implForEvictTextures; + LayerTreeHostImpl* m_implForEvictTextures; int m_numCommits; }; -TEST_F(CCLayerTreeHostTestEvictTextures, runMultiThread) +TEST_F(LayerTreeHostTestEvictTextures, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestLostContextAfterEvictTextures : public CCLayerTreeHostTest { +class LayerTreeHostTestLostContextAfterEvictTextures : public LayerTreeHostTest { public: - CCLayerTreeHostTestLostContextAfterEvictTextures() + LayerTreeHostTestLostContextAfterEvictTextures() : m_layer(EvictionTestLayer::create()) , m_implForEvictTextures(0) , m_numCommits(0) @@ -2855,7 +2855,7 @@ public: class EvictTexturesTask : public WebKit::WebThread::Task { public: - EvictTexturesTask(CCLayerTreeHostTestLostContextAfterEvictTextures* test) : m_test(test) { } + EvictTexturesTask(LayerTreeHostTestLostContextAfterEvictTextures* test) : m_test(test) { } virtual ~EvictTexturesTask() { } virtual void run() OVERRIDE { @@ -2863,7 +2863,7 @@ public: } private: - CCLayerTreeHostTestLostContextAfterEvictTextures* m_test; + LayerTreeHostTestLostContextAfterEvictTextures* m_test; }; void postEvictTextures() @@ -2904,7 +2904,7 @@ public: } } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_implForEvictTextures = impl; } @@ -2920,13 +2920,13 @@ public: } private: - MockContentLayerChromiumClient m_client; + MockContentLayerClient m_client; scoped_refptr<EvictionTestLayer> m_layer; - CCLayerTreeHostImpl* m_implForEvictTextures; + LayerTreeHostImpl* m_implForEvictTextures; int m_numCommits; }; -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLostContextAfterEvictTextures) +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLostContextAfterEvictTextures) class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public WebKit::CompositorFakeWebGraphicsContext3D { public: @@ -2964,14 +2964,14 @@ private: bool m_isContextLost; }; -class CCLayerTreeHostTestLostContextWhileUpdatingResources : public CCLayerTreeHostTest { +class LayerTreeHostTestLostContextWhileUpdatingResources : public LayerTreeHostTest { public: - CCLayerTreeHostTestLostContextWhileUpdatingResources() - : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client)) + LayerTreeHostTestLostContextWhileUpdatingResources() + : m_parent(ContentLayerWithUpdateTracking::create(&m_client)) , m_numChildren(50) { for (int i = 0; i < m_numChildren; i++) - m_children.push_back(ContentLayerChromiumWithUpdateTracking::create(&m_client)); + m_children.push_back(ContentLayerWithUpdateTracking::create(&m_client)); } virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface() @@ -2992,7 +2992,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) { endTest(); } @@ -3009,20 +3009,20 @@ public: } private: - MockContentLayerChromiumClient m_client; - scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_parent; + MockContentLayerClient m_client; + scoped_refptr<ContentLayerWithUpdateTracking> m_parent; int m_numChildren; - std::vector<scoped_refptr<ContentLayerChromiumWithUpdateTracking> > m_children; + std::vector<scoped_refptr<ContentLayerWithUpdateTracking> > m_children; }; -TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread) +TEST_F(LayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestContinuousCommit : public CCLayerTreeHostTest { +class LayerTreeHostTestContinuousCommit : public LayerTreeHostTest { public: - CCLayerTreeHostTestContinuousCommit() + LayerTreeHostTestContinuousCommit() : m_numCommitComplete(0) , m_numDrawLayers(0) { @@ -3041,13 +3041,13 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { if (m_numDrawLayers == 1) m_numCommitComplete++; } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_numDrawLayers++; if (m_numDrawLayers == 2) @@ -3065,14 +3065,14 @@ private: int m_numDrawLayers; }; -TEST_F(CCLayerTreeHostTestContinuousCommit, runMultiThread) +TEST_F(LayerTreeHostTestContinuousCommit, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestContinuousInvalidate : public CCLayerTreeHostTest { +class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { public: - CCLayerTreeHostTestContinuousInvalidate() + LayerTreeHostTestContinuousInvalidate() : m_numCommitComplete(0) , m_numDrawLayers(0) { @@ -3083,7 +3083,7 @@ public: m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); - m_contentLayer = ContentLayerChromium::create(&m_mockDelegate); + m_contentLayer = ContentLayer::create(&m_mockDelegate); m_contentLayer->setBounds(IntSize(10, 10)); m_contentLayer->setPosition(FloatPoint(0, 0)); m_contentLayer->setAnchorPoint(FloatPoint(0, 0)); @@ -3098,13 +3098,13 @@ public: m_contentLayer->setNeedsDisplay(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { if (m_numDrawLayers == 1) m_numCommitComplete++; } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_numDrawLayers++; if (m_numDrawLayers == 2) @@ -3116,25 +3116,25 @@ public: // Check that we didn't commit twice between first and second draw. EXPECT_EQ(1, m_numCommitComplete); - // Clear layer references so CCLayerTreeHost dies. + // Clear layer references so LayerTreeHost dies. m_contentLayer = NULL; } private: - MockContentLayerChromiumClient m_mockDelegate; - scoped_refptr<LayerChromium> m_contentLayer; + MockContentLayerClient m_mockDelegate; + scoped_refptr<Layer> m_contentLayer; int m_numCommitComplete; int m_numDrawLayers; }; -TEST_F(CCLayerTreeHostTestContinuousInvalidate, runMultiThread) +TEST_F(LayerTreeHostTestContinuousInvalidate, runMultiThread) { runTest(true); } -class CCLayerTreeHostTestContinuousAnimate : public CCLayerTreeHostTest { +class LayerTreeHostTestContinuousAnimate : public LayerTreeHostTest { public: - CCLayerTreeHostTestContinuousAnimate() + LayerTreeHostTestContinuousAnimate() : m_numCommitComplete(0) , m_numDrawLayers(0) { @@ -3158,13 +3158,13 @@ public: m_layerTreeHost->rootLayer()->setNeedsDisplay(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { if (m_numDrawLayers == 1) m_numCommitComplete++; } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { m_numDrawLayers++; if (m_numDrawLayers == 2) @@ -3182,7 +3182,7 @@ private: int m_numDrawLayers; }; -TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) +TEST_F(LayerTreeHostTestContinuousAnimate, runMultiThread) { runTest(true); } diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc index 49b1cfb..d880da0 100644 --- a/cc/layer_unittest.cc +++ b/cc/layer_unittest.cc @@ -36,10 +36,10 @@ using ::testing::AnyNumber; namespace { -class MockCCLayerTreeHost : public CCLayerTreeHost { +class MockLayerImplTreeHost : public LayerTreeHost { public: - MockCCLayerTreeHost() - : CCLayerTreeHost(&m_fakeClient, CCLayerTreeSettings()) + MockLayerImplTreeHost() + : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) { initialize(); } @@ -47,18 +47,18 @@ public: MOCK_METHOD0(setNeedsCommit, void()); private: - FakeCCLayerTreeHostClient m_fakeClient; + FakeLayerImplTreeHostClient m_fakeClient; }; -class MockLayerPainterChromium : public LayerPainterChromium { +class MockLayerPainter : public LayerPainter { public: virtual void paint(SkCanvas*, const IntRect&, FloatRect&) OVERRIDE { } }; -class LayerChromiumTest : public testing::Test { +class LayerTest : public testing::Test { public: - LayerChromiumTest() + LayerTest() : m_compositorInitializer(0) { } @@ -66,7 +66,7 @@ public: protected: virtual void SetUp() { - m_layerTreeHost = scoped_ptr<MockCCLayerTreeHost>(new MockCCLayerTreeHost); + m_layerTreeHost = scoped_ptr<MockLayerImplTreeHost>(new MockLayerImplTreeHost); } virtual void TearDown() @@ -110,13 +110,13 @@ protected: void createSimpleTestTree() { - m_parent = LayerChromium::create(); - m_child1 = LayerChromium::create(); - m_child2 = LayerChromium::create(); - m_child3 = LayerChromium::create(); - m_grandChild1 = LayerChromium::create(); - m_grandChild2 = LayerChromium::create(); - m_grandChild3 = LayerChromium::create(); + m_parent = Layer::create(); + m_child1 = Layer::create(); + m_child2 = Layer::create(); + m_child3 = Layer::create(); + m_grandChild1 = Layer::create(); + m_grandChild2 = Layer::create(); + m_grandChild3 = Layer::create(); EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); m_layerTreeHost->setRootLayer(m_parent); @@ -133,24 +133,24 @@ protected: verifyTestTreeInitialState(); } - scoped_ptr<MockCCLayerTreeHost> m_layerTreeHost; - scoped_refptr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3; + scoped_ptr<MockLayerImplTreeHost> m_layerTreeHost; + scoped_refptr<Layer> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3; WebCompositorInitializer m_compositorInitializer; }; -TEST_F(LayerChromiumTest, basicCreateAndDestroy) +TEST_F(LayerTest, basicCreateAndDestroy) { - scoped_refptr<LayerChromium> testLayer = LayerChromium::create(); + scoped_refptr<Layer> testLayer = Layer::create(); ASSERT_TRUE(testLayer); EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(0); testLayer->setLayerTreeHost(m_layerTreeHost.get()); } -TEST_F(LayerChromiumTest, addAndRemoveChild) +TEST_F(LayerTest, addAndRemoveChild) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); // Upon creation, layers should not have children or parent. ASSERT_EQ(static_cast<size_t>(0), parent->children().size()); @@ -168,13 +168,13 @@ TEST_F(LayerChromiumTest, addAndRemoveChild) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(AtLeast(1), child->removeFromParent()); } -TEST_F(LayerChromiumTest, insertChild) +TEST_F(LayerTest, insertChild) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child1 = LayerChromium::create(); - scoped_refptr<LayerChromium> child2 = LayerChromium::create(); - scoped_refptr<LayerChromium> child3 = LayerChromium::create(); - scoped_refptr<LayerChromium> child4 = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child1 = Layer::create(); + scoped_refptr<Layer> child2 = Layer::create(); + scoped_refptr<Layer> child3 = Layer::create(); + scoped_refptr<Layer> child4 = Layer::create(); parent->setLayerTreeHost(m_layerTreeHost.get()); @@ -214,11 +214,11 @@ TEST_F(LayerChromiumTest, insertChild) EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); } -TEST_F(LayerChromiumTest, insertChildPastEndOfList) +TEST_F(LayerTest, insertChildPastEndOfList) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child1 = LayerChromium::create(); - scoped_refptr<LayerChromium> child2 = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child1 = Layer::create(); + scoped_refptr<Layer> child2 = Layer::create(); ASSERT_EQ(static_cast<size_t>(0), parent->children().size()); @@ -236,11 +236,11 @@ TEST_F(LayerChromiumTest, insertChildPastEndOfList) EXPECT_EQ(child2, parent->children()[1]); } -TEST_F(LayerChromiumTest, insertSameChildTwice) +TEST_F(LayerTest, insertSameChildTwice) { - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child1 = LayerChromium::create(); - scoped_refptr<LayerChromium> child2 = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child1 = Layer::create(); + scoped_refptr<Layer> child2 = Layer::create(); parent->setLayerTreeHost(m_layerTreeHost.get()); @@ -264,10 +264,10 @@ TEST_F(LayerChromiumTest, insertSameChildTwice) EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); } -TEST_F(LayerChromiumTest, replaceChildWithNewChild) +TEST_F(LayerTest, replaceChildWithNewChild) { createSimpleTestTree(); - scoped_refptr<LayerChromium> child4 = LayerChromium::create(); + scoped_refptr<Layer> child4 = Layer::create(); EXPECT_FALSE(child4->parent()); @@ -282,13 +282,13 @@ TEST_F(LayerChromiumTest, replaceChildWithNewChild) EXPECT_FALSE(m_child2->parent()); } -TEST_F(LayerChromiumTest, replaceChildWithNewChildThatHasOtherParent) +TEST_F(LayerTest, replaceChildWithNewChildThatHasOtherParent) { createSimpleTestTree(); // create another simple tree with testLayer and child4. - scoped_refptr<LayerChromium> testLayer = LayerChromium::create(); - scoped_refptr<LayerChromium> child4 = LayerChromium::create(); + scoped_refptr<Layer> testLayer = Layer::create(); + scoped_refptr<Layer> child4 = Layer::create(); testLayer->addChild(child4); ASSERT_EQ(static_cast<size_t>(1), testLayer->children().size()); EXPECT_EQ(child4, testLayer->children()[0]); @@ -308,7 +308,7 @@ TEST_F(LayerChromiumTest, replaceChildWithNewChildThatHasOtherParent) EXPECT_FALSE(m_child2->parent()); } -TEST_F(LayerChromiumTest, replaceChildWithSameChild) +TEST_F(LayerTest, replaceChildWithSameChild) { createSimpleTestTree(); @@ -318,7 +318,7 @@ TEST_F(LayerChromiumTest, replaceChildWithSameChild) verifyTestTreeInitialState(); } -TEST_F(LayerChromiumTest, removeAllChildren) +TEST_F(LayerTest, removeAllChildren) { createSimpleTestTree(); @@ -330,15 +330,15 @@ TEST_F(LayerChromiumTest, removeAllChildren) EXPECT_FALSE(m_child3->parent()); } -TEST_F(LayerChromiumTest, setChildren) +TEST_F(LayerTest, setChildren) { - scoped_refptr<LayerChromium> oldParent = LayerChromium::create(); - scoped_refptr<LayerChromium> newParent = LayerChromium::create(); + scoped_refptr<Layer> oldParent = Layer::create(); + scoped_refptr<Layer> newParent = Layer::create(); - scoped_refptr<LayerChromium> child1 = LayerChromium::create(); - scoped_refptr<LayerChromium> child2 = LayerChromium::create(); + scoped_refptr<Layer> child1 = Layer::create(); + scoped_refptr<Layer> child2 = Layer::create(); - std::vector<scoped_refptr<LayerChromium> > newChildren; + std::vector<scoped_refptr<Layer> > newChildren; newChildren.push_back(child1); newChildren.push_back(child2); @@ -359,14 +359,14 @@ TEST_F(LayerChromiumTest, setChildren) EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); } -TEST_F(LayerChromiumTest, getRootLayerAfterTreeManipulations) +TEST_F(LayerTest, getRootLayerAfterTreeManipulations) { createSimpleTestTree(); // For this test we don't care about setNeedsCommit calls. EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); - scoped_refptr<LayerChromium> child4 = LayerChromium::create(); + scoped_refptr<Layer> child4 = Layer::create(); EXPECT_EQ(m_parent.get(), m_parent->rootLayer()); EXPECT_EQ(m_parent.get(), m_child1->rootLayer()); @@ -413,13 +413,13 @@ TEST_F(LayerChromiumTest, getRootLayerAfterTreeManipulations) EXPECT_EQ(m_grandChild3.get(), m_grandChild3->rootLayer()); } -TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) +TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior) { // The semantics for setNeedsDisplay which are tested here: // 1. sets needsDisplay flag appropriately. // 2. indirectly calls setNeedsCommit, exactly once for each call to setNeedsDisplay. - scoped_refptr<LayerChromium> testLayer = LayerChromium::create(); + scoped_refptr<Layer> testLayer = Layer::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); IntSize testBounds = IntSize(501, 508); @@ -434,7 +434,7 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) // This is just initialization, but setNeedsCommit behavior is verified anyway to avoid warnings. EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds)); - testLayer = LayerChromium::create(); + testLayer = Layer::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXPECT_FALSE(testLayer->needsDisplay()); @@ -452,27 +452,27 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNeedsDisplayRect(dirty2)); EXPECT_TRUE(testLayer->needsDisplay()); - // Case 4: LayerChromium should accept dirty rects that go beyond its bounds. - testLayer = LayerChromium::create(); + // Case 4: Layer should accept dirty rects that go beyond its bounds. + testLayer = Layer::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNeedsDisplayRect(outOfBoundsDirtyRect)); EXPECT_TRUE(testLayer->needsDisplay()); // Case 5: setNeedsDisplay() without the dirty rect arg. - testLayer = LayerChromium::create(); + testLayer = Layer::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNeedsDisplay()); EXPECT_TRUE(testLayer->needsDisplay()); } -TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) +TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior) { - scoped_refptr<LayerChromium> testLayer = LayerChromium::create(); + scoped_refptr<Layer> testLayer = Layer::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); - scoped_refptr<LayerChromium> dummyLayer = LayerChromium::create(); // just a dummy layer for this test case. + scoped_refptr<Layer> dummyLayer = Layer::create(); // just a dummy layer for this test case. // sanity check of initial test condition EXPECT_FALSE(testLayer->needsDisplay()); @@ -518,33 +518,33 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_TRUE(testLayer->needsDisplay()); } -TEST_F(LayerChromiumTest, verifyPushPropertiesAccumulatesUpdateRect) +TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) { DebugScopedSetImplThread setImplThread; - scoped_refptr<LayerChromium> testLayer = LayerChromium::create(); - scoped_ptr<CCLayerImpl> implLayer = CCLayerImpl::create(1); + scoped_refptr<Layer> testLayer = Layer::create(); + scoped_ptr<LayerImpl> implLayer = LayerImpl::create(1); testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLayer->updateRect()); - // The CCLayerImpl's updateRect should be accumulated here, since we did not do anything to clear it. + // The LayerImpl's updateRect should be accumulated here, since we did not do anything to clear it. testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(15, 15)), implLayer->updateRect()); - // If we do clear the CCLayerImpl side, then the next updateRect should be fresh without accumulation. + // If we do clear the LayerImpl side, then the next updateRect should be fresh without accumulation. implLayer->resetAllChangeTrackingForSubtree(); testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)), implLayer->updateRect()); } -class LayerChromiumWithContentScaling : public LayerChromium { +class LayerWithContentScaling : public Layer { public: - explicit LayerChromiumWithContentScaling() - : LayerChromium() + explicit LayerWithContentScaling() + : Layer() { } @@ -556,7 +556,7 @@ public: virtual void setNeedsDisplayRect(const FloatRect& dirtyRect) OVERRIDE { m_lastNeedsDisplayRect = dirtyRect; - LayerChromium::setNeedsDisplayRect(dirtyRect); + Layer::setNeedsDisplayRect(dirtyRect); } void resetNeedsDisplay() @@ -567,16 +567,16 @@ public: const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } private: - virtual ~LayerChromiumWithContentScaling() + virtual ~LayerWithContentScaling() { } FloatRect m_lastNeedsDisplayRect; }; -TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay) +TEST_F(LayerTest, checkContentsScaleChangeTriggersNeedsDisplay) { - scoped_refptr<LayerChromiumWithContentScaling> testLayer = make_scoped_refptr(new LayerChromiumWithContentScaling()); + scoped_refptr<LayerWithContentScaling> testLayer = make_scoped_refptr(new LayerWithContentScaling()); testLayer->setLayerTreeHost(m_layerTreeHost.get()); IntSize testBounds = IntSize(320, 240); @@ -590,26 +590,26 @@ TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240), testLayer->lastNeedsDisplayRect()); } -class FakeCCLayerTreeHost : public CCLayerTreeHost { +class FakeLayerImplTreeHost : public LayerTreeHost { public: - static scoped_ptr<FakeCCLayerTreeHost> create() + static scoped_ptr<FakeLayerImplTreeHost> create() { - scoped_ptr<FakeCCLayerTreeHost> host(new FakeCCLayerTreeHost); + scoped_ptr<FakeLayerImplTreeHost> host(new FakeLayerImplTreeHost); // The initialize call will fail, since our client doesn't provide a valid GraphicsContext3D, but it doesn't matter in the tests that use this fake so ignore the return value. host->initialize(); return host.Pass(); } private: - FakeCCLayerTreeHost() - : CCLayerTreeHost(&m_client, CCLayerTreeSettings()) + FakeLayerImplTreeHost() + : LayerTreeHost(&m_client, LayerTreeSettings()) { } - FakeCCLayerTreeHostClient m_client; + FakeLayerImplTreeHostClient m_client; }; -void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost* host) +void assertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { EXPECT_EQ(host, layer->layerTreeHost()); @@ -624,14 +624,14 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost* } -TEST(LayerChromiumLayerTreeHostTest, enteringTree) +TEST(LayerLayerTreeHostTest, enteringTree) { WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> mask = LayerChromium::create(); - scoped_refptr<LayerChromium> replica = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaMask = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> mask = Layer::create(); + scoped_refptr<Layer> replica = Layer::create(); + scoped_refptr<Layer> replicaMask = Layer::create(); // Set up a detached tree of layers. The host pointer should be nil for these layers. parent->addChild(child); @@ -641,7 +641,7 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree) assertLayerTreeHostMatchesForSubtree(parent.get(), 0); - scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create()); // Setting the root layer should set the host pointer for all layers in the tree. layerTreeHost->setRootLayer(parent.get()); @@ -653,27 +653,27 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree) assertLayerTreeHostMatchesForSubtree(parent.get(), 0); } -TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) +TEST(LayerLayerTreeHostTest, addingLayerSubtree) { WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); + scoped_refptr<Layer> parent = Layer::create(); + scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create()); layerTreeHost->setRootLayer(parent.get()); EXPECT_EQ(parent->layerTreeHost(), layerTreeHost.get()); // Adding a subtree to a layer already associated with a host should set the host pointer on all layers in that subtree. - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> grandChild = LayerChromium::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> grandChild = Layer::create(); child->addChild(grandChild); // Masks, replicas, and replica masks should pick up the new host too. - scoped_refptr<LayerChromium> childMask = LayerChromium::create(); + scoped_refptr<Layer> childMask = Layer::create(); child->setMaskLayer(childMask.get()); - scoped_refptr<LayerChromium> childReplica = LayerChromium::create(); + scoped_refptr<Layer> childReplica = Layer::create(); child->setReplicaLayer(childReplica.get()); - scoped_refptr<LayerChromium> childReplicaMask = LayerChromium::create(); + scoped_refptr<Layer> childReplicaMask = Layer::create(); childReplica->setMaskLayer(childReplicaMask.get()); parent->addChild(child); @@ -682,14 +682,14 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) layerTreeHost->setRootLayer(0); } -TEST(LayerChromiumLayerTreeHostTest, changeHost) +TEST(LayerLayerTreeHostTest, changeHost) { WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); - scoped_refptr<LayerChromium> mask = LayerChromium::create(); - scoped_refptr<LayerChromium> replica = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaMask = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); + scoped_refptr<Layer> mask = Layer::create(); + scoped_refptr<Layer> replica = Layer::create(); + scoped_refptr<Layer> replicaMask = Layer::create(); // Same setup as the previous test. parent->addChild(child); @@ -697,14 +697,14 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost) child->setReplicaLayer(replica.get()); replica->setMaskLayer(mask.get()); - scoped_ptr<FakeCCLayerTreeHost> firstLayerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> firstLayerTreeHost(FakeLayerImplTreeHost::create()); firstLayerTreeHost->setRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), firstLayerTreeHost.get()); // Now re-root the tree to a new host (simulating what we do on a context lost event). // This should update the host pointers for all layers in the tree. - scoped_ptr<FakeCCLayerTreeHost> secondLayerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> secondLayerTreeHost(FakeLayerImplTreeHost::create()); secondLayerTreeHost->setRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), secondLayerTreeHost.get()); @@ -712,27 +712,27 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost) secondLayerTreeHost->setRootLayer(0); } -TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) +TEST(LayerLayerTreeHostTest, changeHostInSubtree) { WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> firstParent = LayerChromium::create(); - scoped_refptr<LayerChromium> firstChild = LayerChromium::create(); - scoped_refptr<LayerChromium> secondParent = LayerChromium::create(); - scoped_refptr<LayerChromium> secondChild = LayerChromium::create(); - scoped_refptr<LayerChromium> secondGrandChild = LayerChromium::create(); + scoped_refptr<Layer> firstParent = Layer::create(); + scoped_refptr<Layer> firstChild = Layer::create(); + scoped_refptr<Layer> secondParent = Layer::create(); + scoped_refptr<Layer> secondChild = Layer::create(); + scoped_refptr<Layer> secondGrandChild = Layer::create(); // First put all children under the first parent and set the first host. firstParent->addChild(firstChild); secondChild->addChild(secondGrandChild); firstParent->addChild(secondChild); - scoped_ptr<FakeCCLayerTreeHost> firstLayerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> firstLayerTreeHost(FakeLayerImplTreeHost::create()); firstLayerTreeHost->setRootLayer(firstParent.get()); assertLayerTreeHostMatchesForSubtree(firstParent.get(), firstLayerTreeHost.get()); // Now reparent the subtree starting at secondChild to a layer in a different tree. - scoped_ptr<FakeCCLayerTreeHost> secondLayerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> secondLayerTreeHost(FakeLayerImplTreeHost::create()); secondLayerTreeHost->setRootLayer(secondParent.get()); secondParent->addChild(secondChild); @@ -746,23 +746,23 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) secondLayerTreeHost->setRootLayer(0); } -TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) +TEST(LayerLayerTreeHostTest, replaceMaskAndReplicaLayer) { WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> parent = LayerChromium::create(); - scoped_refptr<LayerChromium> mask = LayerChromium::create(); - scoped_refptr<LayerChromium> replica = LayerChromium::create(); - scoped_refptr<LayerChromium> maskChild = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaChild = LayerChromium::create(); - scoped_refptr<LayerChromium> maskReplacement = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaReplacement = LayerChromium::create(); + scoped_refptr<Layer> parent = Layer::create(); + scoped_refptr<Layer> mask = Layer::create(); + scoped_refptr<Layer> replica = Layer::create(); + scoped_refptr<Layer> maskChild = Layer::create(); + scoped_refptr<Layer> replicaChild = Layer::create(); + scoped_refptr<Layer> maskReplacement = Layer::create(); + scoped_refptr<Layer> replicaReplacement = Layer::create(); parent->setMaskLayer(mask.get()); parent->setReplicaLayer(replica.get()); mask->addChild(maskChild); replica->addChild(replicaChild); - scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create()); layerTreeHost->setRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), layerTreeHost.get()); @@ -781,43 +781,43 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) layerTreeHost->setRootLayer(0); } -TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer) +TEST(LayerLayerTreeHostTest, destroyHostWithNonNullRootLayer) { WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> root = LayerChromium::create(); - scoped_refptr<LayerChromium> child = LayerChromium::create(); + scoped_refptr<Layer> root = Layer::create(); + scoped_refptr<Layer> child = Layer::create(); root->addChild(child); - scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create()); layerTreeHost->setRootLayer(root); } -static bool addTestAnimation(LayerChromium* layer) +static bool addTestAnimation(Layer* 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)); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); + curve->addKeyframe(FloatKeyframe::create(0, 0.3f, scoped_ptr<TimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(1, 0.7f, scoped_ptr<TimingFunction>())); + scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<AnimationCurve>(), 0, 0, ActiveAnimation::Opacity)); return layer->addAnimation(animation.Pass()); } -TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) +TEST(LayerLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) { // Currently, WebCore assumes that animations will be started immediately / very soon // if a composited layer's addAnimation() returns true. However, without a layerTreeHost, // layers cannot actually animate yet. So, to prevent violating this WebCore assumption, // the animation should not be accepted if the layer doesn't already have a layerTreeHost. - CCScopedSettings scopedSettings; + ScopedSettings scopedSettings; Settings::setAcceleratedAnimationEnabled(true); WebCompositorInitializer compositorInitializer(0); - scoped_refptr<LayerChromium> layer = LayerChromium::create(); + scoped_refptr<Layer> layer = Layer::create(); // Case 1: without a layerTreeHost, the animation should not be accepted. EXPECT_FALSE(addTestAnimation(layer.get())); - scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); + scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create()); layerTreeHost->setRootLayer(layer.get()); layer->setLayerTreeHost(layerTreeHost.get()); assertLayerTreeHostMatchesForSubtree(layer.get(), layerTreeHost.get()); @@ -826,19 +826,19 @@ TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) EXPECT_TRUE(addTestAnimation(layer.get())); } -class MockLayerChromium : public LayerChromium { +class MockLayer : public Layer { public: bool needsDisplay() const { return m_needsDisplay; } private: - virtual ~MockLayerChromium() + virtual ~MockLayer() { } }; -TEST(LayerChromiumTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds) +TEST(LayerTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds) { - scoped_refptr<MockLayerChromium> layer(new MockLayerChromium); + scoped_refptr<MockLayer> layer(new MockLayer); EXPECT_FALSE(layer->needsDisplay()); layer->setBounds(IntSize(0, 10)); EXPECT_FALSE(layer->needsDisplay()); diff --git a/cc/math_util.cc b/cc/math_util.cc index 417e0c9..d738437 100644 --- a/cc/math_util.cc +++ b/cc/math_util.cc @@ -95,12 +95,12 @@ static inline void addVertexToClippedQuad(const FloatPoint& newVertex, FloatPoin numVerticesInClippedQuad++; } -IntRect CCMathUtil::mapClippedRect(const WebTransformationMatrix& transform, const IntRect& srcRect) +IntRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const IntRect& srcRect) { return enclosingIntRect(mapClippedRect(transform, FloatRect(srcRect))); } -FloatRect CCMathUtil::mapClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect) +FloatRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect) { if (transform.isIdentityOrTranslation()) { FloatRect mappedRect(srcRect); @@ -118,7 +118,7 @@ FloatRect CCMathUtil::mapClippedRect(const WebTransformationMatrix& transform, c return computeEnclosingClippedRect(h1, h2, h3, h4); } -FloatRect CCMathUtil::projectClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect) +FloatRect MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect) { // Perform the projection, but retain the result in homogeneous coordinates. FloatQuad q = FloatQuad(FloatRect(srcRect)); @@ -130,7 +130,7 @@ FloatRect CCMathUtil::projectClippedRect(const WebTransformationMatrix& transfor return computeEnclosingClippedRect(h1, h2, h3, h4); } -void CCMathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad) +void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad) { HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, srcQuad.p1()); HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, srcQuad.p2()); @@ -168,7 +168,7 @@ void CCMathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const DCHECK(numVerticesInClippedQuad <= 8); } -FloatRect CCMathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices) +FloatRect MathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices) { if (numVertices < 2) return FloatRect(); @@ -184,7 +184,7 @@ FloatRect CCMathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin)); } -FloatRect CCMathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4) +FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4) { // This function performs clipping as necessary and computes the enclosing 2d // FloatRect of the vertices. Doing these two steps simultaneously allows us to avoid @@ -234,7 +234,7 @@ FloatRect CCMathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin)); } -FloatQuad CCMathUtil::mapQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped) +FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped) { if (transform.isIdentityOrTranslation()) { FloatQuad mappedQuad(q); @@ -254,7 +254,7 @@ FloatQuad CCMathUtil::mapQuad(const WebTransformationMatrix& transform, const Fl return FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d()); } -FloatPoint CCMathUtil::mapPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped) +FloatPoint MathUtil::mapPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped) { HomogeneousCoordinate h = mapHomogeneousPoint(transform, p); @@ -277,7 +277,7 @@ FloatPoint CCMathUtil::mapPoint(const WebTransformationMatrix& transform, const return h.cartesianPoint2d(); } -FloatPoint3D CCMathUtil::mapPoint(const WebTransformationMatrix& transform, const FloatPoint3D& p, bool& clipped) +FloatPoint3D MathUtil::mapPoint(const WebTransformationMatrix& transform, const FloatPoint3D& p, bool& clipped) { HomogeneousCoordinate h = mapHomogeneousPoint(transform, p); @@ -300,7 +300,7 @@ FloatPoint3D CCMathUtil::mapPoint(const WebTransformationMatrix& transform, cons return h.cartesianPoint3d(); } -FloatQuad CCMathUtil::projectQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped) +FloatQuad MathUtil::projectQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped) { FloatQuad projectedQuad; bool clippedPoint; @@ -316,7 +316,7 @@ FloatQuad CCMathUtil::projectQuad(const WebTransformationMatrix& transform, cons return projectedQuad; } -FloatPoint CCMathUtil::projectPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped) +FloatPoint MathUtil::projectPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped) { HomogeneousCoordinate h = projectHomogeneousPoint(transform, p); @@ -340,7 +340,7 @@ FloatPoint CCMathUtil::projectPoint(const WebTransformationMatrix& transform, co return h.cartesianPoint2d(); } -void CCMathUtil::flattenTransformTo2d(WebTransformationMatrix& transform) +void MathUtil::flattenTransformTo2d(WebTransformationMatrix& transform) { // Set both the 3rd row and 3rd column to (0, 0, 1, 0). // @@ -361,7 +361,7 @@ void CCMathUtil::flattenTransformTo2d(WebTransformationMatrix& transform) transform.setM43(0); } -float CCMathUtil::smallestAngleBetweenVectors(const FloatSize& v1, const FloatSize& v2) +float MathUtil::smallestAngleBetweenVectors(const FloatSize& v1, const FloatSize& v2) { float dotProduct = (v1.width() * v2.width() + v1.height() * v2.height()) / (v1.diagonalLength() * v2.diagonalLength()); // Clamp to compensate for rounding errors. @@ -369,7 +369,7 @@ float CCMathUtil::smallestAngleBetweenVectors(const FloatSize& v1, const FloatSi return rad2deg(acosf(dotProduct)); } -FloatSize CCMathUtil::projectVector(const FloatSize& source, const FloatSize& destination) +FloatSize MathUtil::projectVector(const FloatSize& source, const FloatSize& destination) { float sourceDotDestination = source.width() * destination.width() + source.height() * destination.height(); float projectedLength = sourceDotDestination / destination.diagonalLengthSquared(); diff --git a/cc/math_util.h b/cc/math_util.h index f0a36ab..da3ba08 100644 --- a/cc/math_util.h +++ b/cc/math_util.h @@ -38,7 +38,7 @@ struct HomogeneousCoordinate { if (w == 1) return FloatPoint(x, y); - // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case. + // For now, because this code is used privately only by MathUtil, it should never be called when w == 0, and we do not yet need to handle that case. DCHECK(w); double invW = 1.0 / w; return FloatPoint(x * invW, y * invW); @@ -49,7 +49,7 @@ struct HomogeneousCoordinate { if (w == 1) return FloatPoint3D(x, y, z); - // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case. + // For now, because this code is used privately only by MathUtil, it should never be called when w == 0, and we do not yet need to handle that case. DCHECK(w); double invW = 1.0 / w; return FloatPoint3D(x * invW, y * invW, z * invW); @@ -61,7 +61,7 @@ struct HomogeneousCoordinate { double w; }; -class CCMathUtil { +class MathUtil { public: // Background: WebTransformationMatrix code in WebCore does not do the right thing in diff --git a/cc/math_util_unittest.cc b/cc/math_util_unittest.cc index b246923..d13de1a 100644 --- a/cc/math_util_unittest.cc +++ b/cc/math_util_unittest.cc @@ -17,7 +17,7 @@ using WebKit::WebTransformationMatrix; namespace { -TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) +TEST(MathUtilTest, verifyBackfaceVisibilityBasicCases) { WebTransformationMatrix transform; @@ -38,7 +38,7 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) EXPECT_FALSE(transform.isBackFaceVisible()); } -TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) +TEST(MathUtilTest, verifyBackfaceVisibilityForPerspective) { WebTransformationMatrix layerSpaceToProjectionPlane; @@ -81,7 +81,7 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible()); } -TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) +TEST(MathUtilTest, verifyProjectionOfPerpendicularPlane) { // In this case, the m33() element of the transform becomes zero, which could cause a // divide-by-zero when projecting points/quads. @@ -91,14 +91,14 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) transform.setM33(0); FloatRect rect = FloatRect(0, 0, 1, 1); - FloatRect projectedRect = CCMathUtil::projectClippedRect(transform, rect); + FloatRect projectedRect = MathUtil::projectClippedRect(transform, rect); EXPECT_EQ(0, projectedRect.x()); EXPECT_EQ(0, projectedRect.y()); EXPECT_TRUE(projectedRect.isEmpty()); } -TEST(CCMathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) +TEST(MathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) { HomogeneousCoordinate h1(-100, -100, 0, 1); HomogeneousCoordinate h2(-10, -10, 0, 1); @@ -109,12 +109,12 @@ TEST(CCMathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) // However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing // clipped rect will be computed incorrectly. - FloatRect result = CCMathUtil::computeEnclosingClippedRect(h1, h2, h3, h4); + FloatRect result = MathUtil::computeEnclosingClippedRect(h1, h2, h3, h4); EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); } -TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) +TEST(MathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) { FloatPoint vertices[3]; int numVertices = 3; @@ -127,54 +127,54 @@ TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) // if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing // clipped rect will be computed incorrectly. - FloatRect result = CCMathUtil::computeEnclosingRectOfVertices(vertices, numVertices); + FloatRect result = MathUtil::computeEnclosingRectOfVertices(vertices, numVertices); EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); } -TEST(CCMathUtilTest, smallestAngleBetweenVectors) +TEST(MathUtilTest, smallestAngleBetweenVectors) { FloatSize x(1, 0); FloatSize y(0, 1); FloatSize testVector(0.5, 0.5); // Orthogonal vectors are at an angle of 90 degress. - EXPECT_EQ(90, CCMathUtil::smallestAngleBetweenVectors(x, y)); + EXPECT_EQ(90, MathUtil::smallestAngleBetweenVectors(x, y)); // A vector makes a zero angle with itself. - EXPECT_EQ(0, CCMathUtil::smallestAngleBetweenVectors(x, x)); - EXPECT_EQ(0, CCMathUtil::smallestAngleBetweenVectors(y, y)); - EXPECT_EQ(0, CCMathUtil::smallestAngleBetweenVectors(testVector, testVector)); + EXPECT_EQ(0, MathUtil::smallestAngleBetweenVectors(x, x)); + EXPECT_EQ(0, MathUtil::smallestAngleBetweenVectors(y, y)); + EXPECT_EQ(0, MathUtil::smallestAngleBetweenVectors(testVector, testVector)); // Parallel but reversed vectors are at 180 degrees. - EXPECT_FLOAT_EQ(180, CCMathUtil::smallestAngleBetweenVectors(x, -x)); - EXPECT_FLOAT_EQ(180, CCMathUtil::smallestAngleBetweenVectors(y, -y)); - EXPECT_FLOAT_EQ(180, CCMathUtil::smallestAngleBetweenVectors(testVector, -testVector)); + EXPECT_FLOAT_EQ(180, MathUtil::smallestAngleBetweenVectors(x, -x)); + EXPECT_FLOAT_EQ(180, MathUtil::smallestAngleBetweenVectors(y, -y)); + EXPECT_FLOAT_EQ(180, MathUtil::smallestAngleBetweenVectors(testVector, -testVector)); // The test vector is at a known angle. - EXPECT_FLOAT_EQ(45, floor(CCMathUtil::smallestAngleBetweenVectors(testVector, x))); - EXPECT_FLOAT_EQ(45, floor(CCMathUtil::smallestAngleBetweenVectors(testVector, y))); + EXPECT_FLOAT_EQ(45, floor(MathUtil::smallestAngleBetweenVectors(testVector, x))); + EXPECT_FLOAT_EQ(45, floor(MathUtil::smallestAngleBetweenVectors(testVector, y))); } -TEST(CCMathUtilTest, vectorProjection) +TEST(MathUtilTest, vectorProjection) { FloatSize x(1, 0); FloatSize y(0, 1); FloatSize testVector(0.3f, 0.7f); // Orthogonal vectors project to a zero vector. - EXPECT_EQ(FloatSize(0, 0), CCMathUtil::projectVector(x, y)); - EXPECT_EQ(FloatSize(0, 0), CCMathUtil::projectVector(y, x)); + EXPECT_EQ(FloatSize(0, 0), MathUtil::projectVector(x, y)); + EXPECT_EQ(FloatSize(0, 0), MathUtil::projectVector(y, x)); // Projecting a vector onto the orthonormal basis gives the corresponding component of the // vector. - EXPECT_EQ(FloatSize(testVector.width(), 0), CCMathUtil::projectVector(testVector, x)); - EXPECT_EQ(FloatSize(0, testVector.height()), CCMathUtil::projectVector(testVector, y)); + EXPECT_EQ(FloatSize(testVector.width(), 0), MathUtil::projectVector(testVector, x)); + EXPECT_EQ(FloatSize(0, testVector.height()), MathUtil::projectVector(testVector, y)); // Finally check than an arbitrary vector projected to another one gives a vector parallel to // the second vector. FloatSize targetVector(0.5, 0.2f); - FloatSize projectedVector = CCMathUtil::projectVector(testVector, targetVector); + FloatSize projectedVector = MathUtil::projectVector(testVector, targetVector); EXPECT_EQ(projectedVector.width() / targetVector.width(), projectedVector.height() / targetVector.height()); } diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc index 7d5640d..c148da5 100644 --- a/cc/occlusion_tracker.cc +++ b/cc/occlusion_tracker.cc @@ -18,15 +18,15 @@ using WebKit::WebTransformationMatrix; namespace cc { template<typename LayerType, typename RenderSurfaceType> -CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame) +OcclusionTrackerBase<LayerType, RenderSurfaceType>::OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame) : m_rootTargetRect(rootTargetRect) - , m_overdrawMetrics(CCOverdrawMetrics::create(recordMetricsForFrame)) + , m_overdrawMetrics(OverdrawMetrics::create(recordMetricsForFrame)) , m_occludingScreenSpaceRects(0) { } template<typename LayerType, typename RenderSurfaceType> -void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::enterLayer(const CCLayerIteratorPosition<LayerType>& layerIterator) +void OcclusionTrackerBase<LayerType, RenderSurfaceType>::enterLayer(const LayerIteratorPosition<LayerType>& layerIterator) { LayerType* renderTarget = layerIterator.targetRenderSurfaceLayer; @@ -37,7 +37,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::enterLayer(const CCLa } template<typename LayerType, typename RenderSurfaceType> -void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveLayer(const CCLayerIteratorPosition<LayerType>& layerIterator) +void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveLayer(const LayerIteratorPosition<LayerType>& layerIterator) { LayerType* renderTarget = layerIterator.targetRenderSurfaceLayer; @@ -48,7 +48,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveLayer(const CCLa } template<typename LayerType, typename RenderSurfaceType> -void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::enterRenderTarget(const LayerType* newTarget) +void OcclusionTrackerBase<LayerType, RenderSurfaceType>::enterRenderTarget(const LayerType* newTarget) { if (!m_stack.isEmpty() && m_stack.last().target == newTarget) return; @@ -59,8 +59,8 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::enterRenderTarget(con m_stack.append(StackObject(newTarget)); - // We copy the screen occlusion into the new RenderSurface subtree, but we never copy in the - // target occlusion, since we are looking at a new RenderSurface target. + // We copy the screen occlusion into the new RenderSurfaceImpl subtree, but we never copy in the + // target occlusion, since we are looking at a new RenderSurfaceImpl target. // If we are entering a subtree that is going to move pixels around, then the occlusion we've computed // so far won't apply to the pixels we're drawing here in the same way. We discard the occlusion thus @@ -74,25 +74,25 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::enterRenderTarget(con } } -static inline bool layerOpacityKnown(const LayerChromium* layer) { return !layer->drawOpacityIsAnimating(); } -static inline bool layerOpacityKnown(const CCLayerImpl*) { return true; } -static inline bool layerTransformsToTargetKnown(const LayerChromium* layer) { return !layer->drawTransformIsAnimating(); } -static inline bool layerTransformsToTargetKnown(const CCLayerImpl*) { return true; } -static inline bool layerTransformsToScreenKnown(const LayerChromium* layer) { return !layer->screenSpaceTransformIsAnimating(); } -static inline bool layerTransformsToScreenKnown(const CCLayerImpl*) { return true; } +static inline bool layerOpacityKnown(const Layer* layer) { return !layer->drawOpacityIsAnimating(); } +static inline bool layerOpacityKnown(const LayerImpl*) { return true; } +static inline bool layerTransformsToTargetKnown(const Layer* layer) { return !layer->drawTransformIsAnimating(); } +static inline bool layerTransformsToTargetKnown(const LayerImpl*) { return true; } +static inline bool layerTransformsToScreenKnown(const Layer* layer) { return !layer->screenSpaceTransformIsAnimating(); } +static inline bool layerTransformsToScreenKnown(const LayerImpl*) { return true; } -static inline bool surfaceOpacityKnown(const RenderSurfaceChromium* surface) { return !surface->drawOpacityIsAnimating(); } -static inline bool surfaceOpacityKnown(const CCRenderSurface*) { return true; } -static inline bool surfaceTransformsToTargetKnown(const RenderSurfaceChromium* surface) { return !surface->targetSurfaceTransformsAreAnimating(); } -static inline bool surfaceTransformsToTargetKnown(const CCRenderSurface*) { return true; } -static inline bool surfaceTransformsToScreenKnown(const RenderSurfaceChromium* surface) { return !surface->screenSpaceTransformsAreAnimating(); } -static inline bool surfaceTransformsToScreenKnown(const CCRenderSurface*) { return true; } +static inline bool surfaceOpacityKnown(const RenderSurface* surface) { return !surface->drawOpacityIsAnimating(); } +static inline bool surfaceOpacityKnown(const RenderSurfaceImpl*) { return true; } +static inline bool surfaceTransformsToTargetKnown(const RenderSurface* surface) { return !surface->targetSurfaceTransformsAreAnimating(); } +static inline bool surfaceTransformsToTargetKnown(const RenderSurfaceImpl*) { return true; } +static inline bool surfaceTransformsToScreenKnown(const RenderSurface* surface) { return !surface->screenSpaceTransformsAreAnimating(); } +static inline bool surfaceTransformsToScreenKnown(const RenderSurfaceImpl*) { return true; } -static inline bool layerIsInUnsorted3dRenderingContext(const LayerChromium* layer) { return layer->parent() && layer->parent()->preserves3D(); } -static inline bool layerIsInUnsorted3dRenderingContext(const CCLayerImpl*) { return false; } +static inline bool layerIsInUnsorted3dRenderingContext(const Layer* layer) { return layer->parent() && layer->parent()->preserves3D(); } +static inline bool layerIsInUnsorted3dRenderingContext(const LayerImpl*) { return false; } template<typename LayerType, typename RenderSurfaceType> -void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::finishedRenderTarget(const LayerType* finishedTarget) +void OcclusionTrackerBase<LayerType, RenderSurfaceType>::finishedRenderTarget(const LayerType* finishedTarget) { // Make sure we know about the target surface. enterRenderTarget(finishedTarget); @@ -118,7 +118,7 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa // apply |transform| to each rect within |region| in order to transform the entire Region. bool clipped; - FloatQuad transformedBoundsQuad = CCMathUtil::mapQuad(transform, FloatQuad(region.bounds()), clipped); + FloatQuad transformedBoundsQuad = MathUtil::mapQuad(transform, FloatQuad(region.bounds()), clipped); // FIXME: Find a rect interior to each transformed quad. if (clipped || !transformedBoundsQuad.isRectilinear()) return Region(); @@ -128,7 +128,7 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa Vector<WebCore::IntRect> rects = region.rects(); for (size_t i = 0; i < rects.size(); ++i) { // We've already checked for clipping in the mapQuad call above, these calls should not clip anything further. - IntRect transformedRect = enclosedIntRect(CCMathUtil::mapClippedRect(transform, FloatRect(rects[i]))); + IntRect transformedRect = enclosedIntRect(MathUtil::mapClippedRect(transform, FloatRect(rects[i]))); if (!surface->clipRect().isEmpty()) transformedRect.intersect(surface->clipRect()); transformedRegion.unite(transformedRect); @@ -180,7 +180,7 @@ static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const IntR if (surfaceRect.isEmpty()) return; - IntRect boundsInTarget = enclosingIntRect(CCMathUtil::mapClippedRect(surfaceTransform, FloatRect(surfaceRect))); + IntRect boundsInTarget = enclosingIntRect(MathUtil::mapClippedRect(surfaceTransform, FloatRect(surfaceRect))); if (!contributingLayer->renderSurface()->clipRect().isEmpty()) boundsInTarget.intersect(contributingLayer->renderSurface()->clipRect()); @@ -191,22 +191,22 @@ static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const IntR boundsInTarget.move(-outsetLeft, -outsetTop); boundsInTarget.expand(outsetLeft + outsetRight, outsetTop + outsetBottom); - IntRect boundsInScreen = enclosingIntRect(CCMathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), FloatRect(boundsInTarget))); + IntRect boundsInScreen = enclosingIntRect(MathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), FloatRect(boundsInTarget))); IntRect filterOutsetsInTarget(-outsetLeft, -outsetTop, outsetLeft + outsetRight, outsetTop + outsetBottom); - IntRect filterOutsetsInScreen = enclosingIntRect(CCMathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), FloatRect(filterOutsetsInTarget))); + IntRect filterOutsetsInScreen = enclosingIntRect(MathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), FloatRect(filterOutsetsInTarget))); reduceOcclusion(boundsInTarget, filterOutsetsInTarget, occlusionInTarget); reduceOcclusion(boundsInScreen, filterOutsetsInScreen, occlusionInScreen); } template<typename LayerType, typename RenderSurfaceType> -void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(const LayerType* newTarget) +void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(const LayerType* newTarget) { int lastIndex = m_stack.size() - 1; bool surfaceWillBeAtTopAfterPop = m_stack.size() > 1 && m_stack[lastIndex - 1].target == newTarget; - // We merge the screen occlusion from the current RenderSurface subtree out to its parent target RenderSurface. + // We merge the screen occlusion from the current RenderSurfaceImpl subtree out to its parent target RenderSurfaceImpl. // The target occlusion can be merged out as well but needs to be transformed to the new target. const LayerType* oldTarget = m_stack[lastIndex].target; @@ -248,7 +248,7 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye DCHECK(layer->visibleContentRect().contains(opaqueContents.bounds())); bool clipped; - FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped); + FloatQuad visibleTransformedQuad = MathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped); // FIXME: Find a rect interior to each transformed quad. if (clipped || !visibleTransformedQuad.isRectilinear()) return; @@ -256,7 +256,7 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye Vector<WebCore::IntRect> contentRects = opaqueContents.rects(); for (size_t i = 0; i < contentRects.size(); ++i) { // We've already checked for clipping in the mapQuad call above, these calls should not clip anything further. - IntRect transformedRect = enclosedIntRect(CCMathUtil::mapClippedRect(transform, FloatRect(contentRects[i]))); + IntRect transformedRect = enclosedIntRect(MathUtil::mapClippedRect(transform, FloatRect(contentRects[i]))); transformedRect.intersect(clipRectInTarget); if (transformedRect.width() >= minimumTrackingSize.width() || transformedRect.height() >= minimumTrackingSize.height()) { if (occludingScreenSpaceRects) @@ -267,7 +267,7 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye } template<typename LayerType, typename RenderSurfaceType> -void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer(const LayerType* layer) +void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer(const LayerType* layer) { DCHECK(!m_stack.isEmpty()); DCHECK(layer->renderTarget() == m_stack.last().target); @@ -294,7 +294,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLay if (layerTransformsToScreenKnown(layer)) { WebTransformationMatrix targetToScreenTransform = m_stack.last().target->renderSurface()->screenSpaceTransform(); bool clipped; - FloatQuad clipQuadInScreen = CCMathUtil::mapQuad(targetToScreenTransform, FloatQuad(FloatRect(clipRectInTarget)), clipped); + FloatQuad clipQuadInScreen = MathUtil::mapQuad(targetToScreenTransform, FloatQuad(FloatRect(clipRectInTarget)), clipped); // FIXME: Find a rect interior to the transformed clip quad. if (clipped || !clipQuadInScreen.isRectilinear()) return; @@ -305,14 +305,14 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLay static inline bool testContentRectOccluded(const IntRect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const IntRect& clipRectInTarget, const Region& occlusion) { - FloatRect transformedRect = CCMathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect)); + FloatRect transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect)); // Take the enclosingIntRect, as we want to include partial pixels in the test. IntRect targetRect = intersection(enclosingIntRect(transformedRect), clipRectInTarget); return targetRect.isEmpty() || occlusion.contains(targetRect); } template<typename LayerType, typename RenderSurfaceType> -bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const +bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { if (hasOcclusionFromOutsideTargetSurface) *hasOcclusionFromOutsideTargetSurface = false; @@ -352,15 +352,15 @@ static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, c return contentRect; // Take the enclosingIntRect at each step, as we want to contain any unoccluded partial pixels in the resulting IntRect. - FloatRect transformedRect = CCMathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect)); + FloatRect transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect)); IntRect shrunkRect = rectSubtractRegion(intersection(enclosingIntRect(transformedRect), clipRectInTarget), occlusion); - IntRect unoccludedRect = enclosingIntRect(CCMathUtil::projectClippedRect(contentSpaceTransform.inverse(), FloatRect(shrunkRect))); + IntRect unoccludedRect = enclosingIntRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), FloatRect(shrunkRect))); // The rect back in content space is a bounding box and may extend outside of the original contentRect, so clamp it to the contentRectBounds. return intersection(unoccludedRect, contentRect); } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const +IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { DCHECK(!m_stack.isEmpty()); if (m_stack.isEmpty()) @@ -388,7 +388,7 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const +IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { DCHECK(!m_stack.isEmpty()); // The layer is a contributing renderTarget so it should have a surface. @@ -443,7 +443,7 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(const LayerType* layer) const +IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(const LayerType* layer) const { // FIXME: we could remove this helper function, but unit tests currently override this // function, and they need to be verified/adjusted before this can be removed. @@ -451,29 +451,29 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTar } // Declare the possible functions here for the linker. -template CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); -template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::enterLayer(const CCLayerIteratorPosition<LayerChromium>&); -template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::leaveLayer(const CCLayerIteratorPosition<LayerChromium>&); -template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::enterRenderTarget(const LayerChromium* newTarget); -template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::finishedRenderTarget(const LayerChromium* finishedTarget); -template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::leaveToRenderTarget(const LayerChromium* newTarget); -template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::markOccludedBehindLayer(const LayerChromium*); -template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const LayerChromium*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::layerClipRectInTarget(const LayerChromium*) const; - -template CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); -template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::enterLayer(const CCLayerIteratorPosition<CCLayerImpl>&); -template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::leaveLayer(const CCLayerIteratorPosition<CCLayerImpl>&); -template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::enterRenderTarget(const CCLayerImpl* newTarget); -template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::finishedRenderTarget(const CCLayerImpl* finishedTarget); -template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::leaveToRenderTarget(const CCLayerImpl* newTarget); -template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::markOccludedBehindLayer(const CCLayerImpl*); -template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCLayerImpl*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::layerClipRectInTarget(const CCLayerImpl*) const; +template OcclusionTrackerBase<Layer, RenderSurface>::OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); +template void OcclusionTrackerBase<Layer, RenderSurface>::enterLayer(const LayerIteratorPosition<Layer>&); +template void OcclusionTrackerBase<Layer, RenderSurface>::leaveLayer(const LayerIteratorPosition<Layer>&); +template void OcclusionTrackerBase<Layer, RenderSurface>::enterRenderTarget(const Layer* newTarget); +template void OcclusionTrackerBase<Layer, RenderSurface>::finishedRenderTarget(const Layer* finishedTarget); +template void OcclusionTrackerBase<Layer, RenderSurface>::leaveToRenderTarget(const Layer* newTarget); +template void OcclusionTrackerBase<Layer, RenderSurface>::markOccludedBehindLayer(const Layer*); +template bool OcclusionTrackerBase<Layer, RenderSurface>::occluded(const Layer*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect OcclusionTrackerBase<Layer, RenderSurface>::unoccludedContentRect(const Layer*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect OcclusionTrackerBase<Layer, RenderSurface>::unoccludedContributingSurfaceContentRect(const Layer*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect OcclusionTrackerBase<Layer, RenderSurface>::layerClipRectInTarget(const Layer*) const; + +template OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); +template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::enterLayer(const LayerIteratorPosition<LayerImpl>&); +template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::leaveLayer(const LayerIteratorPosition<LayerImpl>&); +template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::enterRenderTarget(const LayerImpl* newTarget); +template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::finishedRenderTarget(const LayerImpl* finishedTarget); +template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::leaveToRenderTarget(const LayerImpl* newTarget); +template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::markOccludedBehindLayer(const LayerImpl*); +template bool OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::occluded(const LayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unoccludedContentRect(const LayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unoccludedContributingSurfaceContentRect(const LayerImpl*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::layerClipRectInTarget(const LayerImpl*) const; } // namespace cc diff --git a/cc/occlusion_tracker.h b/cc/occlusion_tracker.h index affd9c5..811c9cb 100644 --- a/cc/occlusion_tracker.h +++ b/cc/occlusion_tracker.h @@ -11,26 +11,26 @@ #include "Region.h" namespace cc { -class CCOverdrawMetrics; -class CCLayerImpl; -class CCRenderSurface; -class LayerChromium; -class RenderSurfaceChromium; +class OverdrawMetrics; +class LayerImpl; +class RenderSurfaceImpl; +class Layer; +class RenderSurface; // This class is used to track occlusion of layers while traversing them in a front-to-back order. As each layer is visited, one of the // methods in this class is called to notify it about the current target surface. // Then, occlusion in the content space of the current layer may be queried, via methods such as occluded() and unoccludedContentRect(). -// If the current layer owns a RenderSurface, then occlusion on that RenderSurface may also be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). +// If the current layer owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). // Finally, once finished with the layer, occlusion behind the layer should be marked by calling markOccludedBehindLayer(). template<typename LayerType, typename RenderSurfaceType> -class CCOcclusionTrackerBase { +class OcclusionTrackerBase { public: - CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); + OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); - // Called at the beginning of each step in the CCLayerIterator's front-to-back traversal. - void enterLayer(const CCLayerIteratorPosition<LayerType>&); - // Called at the end of each step in the CCLayerIterator's front-to-back traversal. - void leaveLayer(const CCLayerIteratorPosition<LayerType>&); + // Called at the beginning of each step in the LayerIterator's front-to-back traversal. + void enterLayer(const LayerIteratorPosition<LayerType>&); + // Called at the end of each step in the LayerIterator's front-to-back traversal. + void leaveLayer(const LayerIteratorPosition<LayerType>&); // Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface. bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; @@ -42,7 +42,7 @@ public: IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Report operations for recording overdraw metrics. - CCOverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); } + OverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); } // Gives the region of the screen that is not occluded by something opaque. Region computeVisibleRegionInScreen() const { return subtract(Region(m_rootTargetRect), m_stack.last().occlusionInScreen); } @@ -61,7 +61,7 @@ protected: Region occlusionInTarget; }; - // The stack holds occluded regions for subtrees in the RenderSurface-Layer tree, so that when we leave a subtree we may + // The stack holds occluded regions for subtrees in the RenderSurfaceImpl-Layer tree, so that when we leave a subtree we may // apply a mask to it, but not to the parts outside the subtree. // - The first time we see a new subtree under a target, we add that target to the top of the stack. This can happen as a layer representing itself, or as a target surface. // - When we visit a target surface, we apply its mask to its subtree, which is at the top of the stack. @@ -89,17 +89,17 @@ private: void markOccludedBehindLayer(const LayerType*); IntRect m_rootTargetRect; - scoped_ptr<CCOverdrawMetrics> m_overdrawMetrics; + scoped_ptr<OverdrawMetrics> m_overdrawMetrics; IntSize m_minimumTrackingSize; // This is used for visualizing the occlusion tracking process. Vector<IntRect>* m_occludingScreenSpaceRects; - DISALLOW_COPY_AND_ASSIGN(CCOcclusionTrackerBase); + DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); }; -typedef CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium> CCOcclusionTracker; -typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl; +typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; +typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; } #endif // CCOcclusionTracker_h diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc index a662d3d..b4558aa 100644 --- a/cc/occlusion_tracker_unittest.cc +++ b/cc/occlusion_tracker_unittest.cc @@ -29,10 +29,10 @@ using namespace WebKitTests; namespace { -class TestContentLayerChromium : public LayerChromium { +class TestContentLayer : public Layer { public: - TestContentLayerChromium() - : LayerChromium() + TestContentLayer() + : Layer() , m_overrideOpaqueContentsRect(false) { } @@ -42,7 +42,7 @@ public: { if (m_overrideOpaqueContentsRect) return intersection(m_opaqueContentsRect, visibleContentRect()); - return LayerChromium::visibleContentOpaqueRegion(); + return Layer::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) { @@ -51,7 +51,7 @@ public: } private: - virtual ~TestContentLayerChromium() + virtual ~TestContentLayer() { } @@ -59,10 +59,10 @@ private: IntRect m_opaqueContentsRect; }; -class TestContentLayerImpl : public CCLayerImpl { +class TestContentLayerImpl : public LayerImpl { public: TestContentLayerImpl(int id) - : CCLayerImpl(id) + : LayerImpl(id) , m_overrideOpaqueContentsRect(false) { setDrawsContent(true); @@ -72,7 +72,7 @@ public: { if (m_overrideOpaqueContentsRect) return intersection(m_opaqueContentsRect, visibleContentRect()); - return CCLayerImpl::visibleContentOpaqueRegion(); + return LayerImpl::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) { @@ -86,10 +86,10 @@ private: }; template<typename LayerType, typename RenderSurfaceType> -class TestCCOcclusionTrackerWithClip : public TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType> { +class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> { public: - TestCCOcclusionTrackerWithClip(IntRect viewportRect, bool recordMetricsForFrame = false) - : TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, recordMetricsForFrame) + TestOcclusionTrackerWithClip(IntRect viewportRect, bool recordMetricsForFrame = false) + : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, recordMetricsForFrame) , m_overrideLayerClipRect(false) { } @@ -98,25 +98,25 @@ public: void useDefaultLayerClipRect() { m_overrideLayerClipRect = false; } protected: - virtual IntRect layerClipRectInTarget(const LayerType* layer) const { return m_overrideLayerClipRect ? m_layerClipRect : CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(layer); } + virtual IntRect layerClipRectInTarget(const LayerType* layer) const { return m_overrideLayerClipRect ? m_layerClipRect : OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(layer); } private: bool m_overrideLayerClipRect; IntRect m_layerClipRect; }; -struct CCOcclusionTrackerTestMainThreadTypes { - typedef LayerChromium LayerType; - typedef RenderSurfaceChromium RenderSurfaceType; - typedef TestContentLayerChromium ContentLayerType; - typedef scoped_refptr<LayerChromium> LayerPtrType; +struct OcclusionTrackerTestMainThreadTypes { + typedef Layer LayerType; + typedef RenderSurface RenderSurfaceType; + typedef TestContentLayer ContentLayerType; + typedef scoped_refptr<Layer> LayerPtrType; typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; - typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator; - typedef CCOcclusionTracker OcclusionTrackerType; + typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, LayerIteratorActions::FrontToBack> LayerIterator; + typedef OcclusionTracker OcclusionTrackerType; static LayerPtrType createLayer() { - return LayerChromium::create(); + return Layer::create(); } static ContentLayerPtrType createContentLayer() { return make_scoped_refptr(new ContentLayerType()); } @@ -136,18 +136,18 @@ struct CCOcclusionTrackerTestMainThreadTypes { } }; -struct CCOcclusionTrackerTestImplThreadTypes { - typedef CCLayerImpl LayerType; - typedef CCRenderSurface RenderSurfaceType; +struct OcclusionTrackerTestImplThreadTypes { + typedef LayerImpl LayerType; + typedef RenderSurfaceImpl RenderSurfaceType; typedef TestContentLayerImpl ContentLayerType; - typedef scoped_ptr<CCLayerImpl> LayerPtrType; + typedef scoped_ptr<LayerImpl> LayerPtrType; typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; - typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> LayerIterator; - typedef CCOcclusionTrackerImpl OcclusionTrackerType; + typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIterator; + typedef OcclusionTrackerImpl OcclusionTrackerType; - static LayerPtrType createLayer() { return CCLayerImpl::create(nextCCLayerImplId++); } - static ContentLayerPtrType createContentLayer() { return make_scoped_ptr(new ContentLayerType(nextCCLayerImplId++)); } - static int nextCCLayerImplId; + static LayerPtrType createLayer() { return LayerImpl::create(nextLayerImplId++); } + static ContentLayerPtrType createContentLayer() { return make_scoped_ptr(new ContentLayerType(nextLayerImplId++)); } + static int nextLayerImplId; static LayerPtrType passLayerPtr(LayerPtrType& layer) { @@ -165,12 +165,12 @@ struct CCOcclusionTrackerTestImplThreadTypes { } }; -int CCOcclusionTrackerTestImplThreadTypes::nextCCLayerImplId = 1; +int OcclusionTrackerTestImplThreadTypes::nextLayerImplId = 1; template<typename Types> -class CCOcclusionTrackerTest : public testing::Test { +class OcclusionTrackerTest : public testing::Test { protected: - CCOcclusionTrackerTest(bool opaqueLayers) + OcclusionTrackerTest(bool opaqueLayers) : m_opaqueLayers(opaqueLayers) { } @@ -179,11 +179,11 @@ protected: virtual void TearDown() { Types::destroyLayer(m_root); - m_renderSurfaceLayerListChromium.clear(); + m_renderSurfaceLayerList.clear(); m_renderSurfaceLayerListImpl.clear(); m_replicaLayers.clear(); m_maskLayers.clear(); - CCLayerTreeHost::setNeedsFilterContext(false); + LayerTreeHost::setNeedsFilterContext(false); } typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) @@ -266,25 +266,25 @@ protected: { DCHECK(root == m_root.get()); int dummyMaxTextureSize = 512; - CCLayerSorter layerSorter; + LayerSorter layerSorter; DCHECK(!root->renderSurface()); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); + LayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerListImpl); } - void calcDrawEtc(TestContentLayerChromium* root) + void calcDrawEtc(TestContentLayer* root) { DCHECK(root == m_root.get()); int dummyMaxTextureSize = 512; DCHECK(!root->renderSurface()); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, dummyMaxTextureSize, m_renderSurfaceLayerListChromium); + LayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, dummyMaxTextureSize, m_renderSurfaceLayerList); - m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerListChromium); + m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerList); } void enterLayer(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion) @@ -350,36 +350,36 @@ private: layer->setBounds(bounds); } - void setProperties(LayerChromium* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(Layer* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); } - void setProperties(CCLayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(LayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); layer->setContentBounds(layer->bounds()); } - void setReplica(LayerChromium* owningLayer, scoped_refptr<LayerChromium> layer) + void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) { owningLayer->setReplicaLayer(layer.get()); m_replicaLayers.push_back(layer); } - void setReplica(CCLayerImpl* owningLayer, scoped_ptr<CCLayerImpl> layer) + void setReplica(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) { owningLayer->setReplicaLayer(layer.Pass()); } - void setMask(LayerChromium* owningLayer, scoped_refptr<LayerChromium> layer) + void setMask(Layer* owningLayer, scoped_refptr<Layer> layer) { owningLayer->setMaskLayer(layer.get()); m_maskLayers.push_back(layer); } - void setMask(CCLayerImpl* owningLayer, scoped_ptr<CCLayerImpl> layer) + void setMask(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) { owningLayer->setMaskLayer(layer.Pass()); } @@ -387,44 +387,44 @@ private: bool m_opaqueLayers; // These hold ownership of the layers for the duration of the test. typename Types::LayerPtrType m_root; - std::vector<scoped_refptr<LayerChromium> > m_renderSurfaceLayerListChromium; - std::vector<CCLayerImpl*> m_renderSurfaceLayerListImpl; + std::vector<scoped_refptr<Layer> > m_renderSurfaceLayerList; + std::vector<LayerImpl*> m_renderSurfaceLayerListImpl; typename Types::LayerIterator m_layerIteratorBegin; typename Types::LayerIterator m_layerIterator; typename Types::LayerType* m_lastLayerVisited; - std::vector<scoped_refptr<LayerChromium> > m_replicaLayers; - std::vector<scoped_refptr<LayerChromium> > m_maskLayers; + std::vector<scoped_refptr<Layer> > m_replicaLayers; + std::vector<scoped_refptr<Layer> > m_maskLayers; }; #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ - class ClassName##MainThreadOpaqueLayers : public ClassName<CCOcclusionTrackerTestMainThreadTypes> { \ + class ClassName##MainThreadOpaqueLayers : public ClassName<OcclusionTrackerTestMainThreadTypes> { \ public: \ - ClassName##MainThreadOpaqueLayers() : ClassName<CCOcclusionTrackerTestMainThreadTypes>(true) { } \ + ClassName##MainThreadOpaqueLayers() : ClassName<OcclusionTrackerTestMainThreadTypes>(true) { } \ }; \ TEST_F(ClassName##MainThreadOpaqueLayers, runTest) { runMyTest(); } #define RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ - class ClassName##MainThreadOpaquePaints : public ClassName<CCOcclusionTrackerTestMainThreadTypes> { \ + class ClassName##MainThreadOpaquePaints : public ClassName<OcclusionTrackerTestMainThreadTypes> { \ public: \ - ClassName##MainThreadOpaquePaints() : ClassName<CCOcclusionTrackerTestMainThreadTypes>(false) { } \ + ClassName##MainThreadOpaquePaints() : ClassName<OcclusionTrackerTestMainThreadTypes>(false) { } \ }; \ TEST_F(ClassName##MainThreadOpaquePaints, runTest) { runMyTest(); } #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ - class ClassName##ImplThreadOpaqueLayers : public ClassName<CCOcclusionTrackerTestImplThreadTypes> { \ + class ClassName##ImplThreadOpaqueLayers : public ClassName<OcclusionTrackerTestImplThreadTypes> { \ DebugScopedSetImplThread impl; \ public: \ - ClassName##ImplThreadOpaqueLayers() : ClassName<CCOcclusionTrackerTestImplThreadTypes>(true) { } \ + ClassName##ImplThreadOpaqueLayers() : ClassName<OcclusionTrackerTestImplThreadTypes>(true) { } \ }; \ TEST_F(ClassName##ImplThreadOpaqueLayers, runTest) { runMyTest(); } #define RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) \ - class ClassName##ImplThreadOpaquePaints : public ClassName<CCOcclusionTrackerTestImplThreadTypes> { \ + class ClassName##ImplThreadOpaquePaints : public ClassName<OcclusionTrackerTestImplThreadTypes> { \ DebugScopedSetImplThread impl; \ public: \ - ClassName##ImplThreadOpaquePaints() : ClassName<CCOcclusionTrackerTestImplThreadTypes>(false) { } \ + ClassName##ImplThreadOpaquePaints() : ClassName<OcclusionTrackerTestImplThreadTypes>(false) { } \ }; \ TEST_F(ClassName##ImplThreadOpaquePaints, runTest) { runMyTest(); } -#define ALL_CCOCCLUSIONTRACKER_TEST(ClassName) \ +#define ALL_OCCLUSIONTRACKER_TEST(ClassName) \ RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ @@ -441,9 +441,9 @@ private: RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) template<class Types> -class CCOcclusionTrackerTestIdentityTransforms : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { @@ -451,7 +451,7 @@ protected: typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(layer, occlusion); @@ -488,12 +488,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestIdentityTransforms); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); template<class Types> -class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestRotatedChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix layerTransform; @@ -505,7 +505,7 @@ protected: typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(layer, occlusion); @@ -542,12 +542,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestRotatedChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); template<class Types> -class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestTranslatedChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix layerTransform; @@ -557,7 +557,7 @@ protected: typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(layer, occlusion); @@ -606,12 +606,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTranslatedChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); template<class Types> -class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix childTransform; @@ -626,7 +626,7 @@ protected: typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(layer, occlusion); @@ -687,12 +687,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestChildInRotatedChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestChildInRotatedChild); template<class Types> -class CCOcclusionTrackerTestVisitTargetTwoTimes : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix childTransform; @@ -705,12 +705,12 @@ protected: typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500)); child->setMasksToBounds(true); typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); - // |child2| makes |parent|'s surface get considered by CCOcclusionTracker first, instead of |child|'s. This exercises different code in + // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in // leaveToTargetRenderSurface, as the target surface has already been seen. typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(-10, -10, 1000, 1000)); this->visitLayer(child2, occlusion); @@ -800,12 +800,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestVisitTargetTwoTimes); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestVisitTargetTwoTimes); template<class Types> -class CCOcclusionTrackerTestSurfaceRotatedOffAxis : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceRotatedOffAxis : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceRotatedOffAxis(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceRotatedOffAxis(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix childTransform; @@ -822,10 +822,10 @@ protected: typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); + IntRect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); @@ -867,12 +867,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceRotatedOffAxis); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); template<class Types> -class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix childTransform; @@ -888,7 +888,7 @@ protected: typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(layer2, occlusion); @@ -957,12 +957,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithTwoOpaqueChildren); template<class Types> -class CCOcclusionTrackerTestOverlappingSurfaceSiblings : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix childTransform; @@ -978,7 +978,7 @@ protected: typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); this->visitLayer(layer2, occlusion); @@ -1068,12 +1068,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestOverlappingSurfaceSiblings); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblings); template<class Types> -class CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix child1Transform; @@ -1094,7 +1094,7 @@ protected: typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(-30, -30, 1000, 1000)); this->visitLayer(layer2, occlusion); @@ -1177,12 +1177,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms); template<class Types> -class CCOcclusionTrackerTestFilters : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestFilters(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix layerTransform; @@ -1210,7 +1210,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // Opacity layer won't contribute to occlusion. @@ -1262,12 +1262,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestFilters); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); template<class Types> -class CCOcclusionTrackerTestReplicaDoesOcclude : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); @@ -1275,7 +1275,7 @@ protected: this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize()); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface, occlusion); @@ -1294,12 +1294,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaDoesOcclude); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); template<class Types> -class CCOcclusionTrackerTestReplicaWithClipping : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 170)); @@ -1308,7 +1308,7 @@ protected: this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize()); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface, occlusion); @@ -1327,12 +1327,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); template<class Types> -class CCOcclusionTrackerTestReplicaWithMask : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); @@ -1341,7 +1341,7 @@ protected: this->createMaskLayer(replica, IntSize(10, 10)); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface, occlusion); @@ -1360,19 +1360,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithMask); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); template<class Types> -class CCOcclusionTrackerTestLayerClipRectOutsideChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(200, 100, 100, 100)); this->enterLayer(layer, occlusion); @@ -1405,19 +1405,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOutsideChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); template<class Types> -class CCOcclusionTrackerTestViewportRectOutsideChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); @@ -1450,19 +1450,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOutsideChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); template<class Types> -class CCOcclusionTrackerTestLayerClipRectOverChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(100, 100, 100, 100)); this->enterLayer(layer, occlusion); @@ -1490,19 +1490,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOverChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); template<class Types> -class CCOcclusionTrackerTestViewportRectOverChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); @@ -1530,19 +1530,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOverChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); template<class Types> -class CCOcclusionTrackerTestLayerClipRectPartlyOverChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(50, 50, 200, 200)); this->enterLayer(layer, occlusion); @@ -1574,19 +1574,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectPartlyOverChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); template<class Types> -class CCOcclusionTrackerTestViewportRectPartlyOverChild : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); @@ -1618,19 +1618,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectPartlyOverChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); template<class Types> -class CCOcclusionTrackerTestLayerClipRectOverNothing : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(500, 500, 100, 100)); this->enterLayer(layer, occlusion); @@ -1662,19 +1662,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOverNothing); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); template<class Types> -class CCOcclusionTrackerTestViewportRectOverNothing : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); @@ -1706,19 +1706,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOverNothing); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); template<class Types> -class CCOcclusionTrackerTestLayerClipRectForLayerOffOrigin : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); // This layer is translated when drawn into its target. So if the clip rect given from the target surface @@ -1731,19 +1731,19 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectForLayerOffOrigin); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); template<class Types> -class CCOcclusionTrackerTestOpaqueContentsRegionEmpty : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); @@ -1768,12 +1768,12 @@ protected: } }; -MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionEmpty); +MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); template<class Types> -class CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -1781,7 +1781,7 @@ protected: this->calcDrawEtc(parent); { - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); this->resetLayerIterator(); @@ -1797,7 +1797,7 @@ protected: } { - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); this->resetLayerIterator(); @@ -1813,7 +1813,7 @@ protected: } { - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); this->resetLayerIterator(); @@ -1830,12 +1830,12 @@ protected: } }; -MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty); +MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); template<class Types> -class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTest3dTransform(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix transform; @@ -1846,7 +1846,7 @@ protected: typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets resized. @@ -1854,12 +1854,12 @@ protected: } }; -MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTest3dTransform); +MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTest3dTransform); template<class Types> -class CCOcclusionTrackerTestUnsorted3dLayers : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestUnsorted3dLayers : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestUnsorted3dLayers(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestUnsorted3dLayers(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { // Currently, the main thread layer iterator does not iterate over 3d items in @@ -1881,7 +1881,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(child2, occlusion); EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); @@ -1893,12 +1893,12 @@ protected: }; // This test will have different layer ordering on the impl thread; the test will only work on the main thread. -MAIN_THREAD_TEST(CCOcclusionTrackerTestUnsorted3dLayers); +MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); template<class Types> -class CCOcclusionTrackerTestPerspectiveTransform : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix transform; @@ -1914,7 +1914,7 @@ protected: layer->setPreserves3D(true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); @@ -1922,12 +1922,12 @@ protected: }; // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl thread. -IMPL_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransform); +IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); template<class Types> -class CCOcclusionTrackerTestPerspectiveTransformBehindCamera : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { // This test is based on the platform/chromium/compositing/3d-corners.html layout test. @@ -1946,7 +1946,7 @@ protected: layer->setPreserves3D(true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); // The bottom 11 pixel rows of this layer remain visible inside the container, after translation to the target surface. When translated back, @@ -1956,12 +1956,12 @@ protected: }; // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl thread. -IMPL_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransformBehindCamera); +IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); template<class Types> -class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix transform; @@ -1976,7 +1976,7 @@ protected: layer->setPreserves3D(true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); // The |layer| is entirely behind the camera and should not occlude. this->visitLayer(layer, occlusion); @@ -1987,12 +1987,12 @@ protected: }; // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl thread. -IMPL_THREAD_TEST(CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude); +IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); template<class Types> -class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix transform; @@ -2008,7 +2008,7 @@ protected: layer->setPreserves3D(true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. // Ensure that those pixels don't occlude things outside the clipRect. @@ -2022,12 +2022,12 @@ protected: }; // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl thread. -IMPL_THREAD_TEST(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect); +IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); template<class Types> -class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -2046,7 +2046,7 @@ protected: EXPECT_FALSE(surface->drawOpacityIsAnimating()); EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); @@ -2075,12 +2075,12 @@ protected: } }; -MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity1OnMainThread); +MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); template<class Types> -class CCOcclusionTrackerTestAnimationOpacity0OnMainThread : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -2099,7 +2099,7 @@ protected: EXPECT_FALSE(surface->drawOpacityIsAnimating()); EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); @@ -2128,12 +2128,12 @@ protected: } }; -MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity0OnMainThread); +MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); template<class Types> -class CCOcclusionTrackerTestAnimationTranslateOnMainThread : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -2158,7 +2158,7 @@ protected: EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface2, occlusion); this->enterContributingSurface(surface2, occlusion); @@ -2221,12 +2221,12 @@ protected: } }; -MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationTranslateOnMainThread); +MAIN_THREAD_TEST(OcclusionTrackerTestAnimationTranslateOnMainThread); template<class Types> -class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix surfaceTransform; @@ -2241,7 +2241,7 @@ protected: surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface2, occlusion); this->visitContributingSurface(surface2, occlusion); @@ -2265,12 +2265,12 @@ protected: } }; -MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent); +MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent); template<class Types> -class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -2279,7 +2279,7 @@ protected: surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); @@ -2291,12 +2291,12 @@ protected: } }; -MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping); +MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping); template<class Types> -class CCOcclusionTrackerTestReplicaOccluded : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); @@ -2305,7 +2305,7 @@ protected: typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // |topmost| occludes the replica, but not the surface itself. @@ -2330,12 +2330,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaOccluded); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); template<class Types> -class CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); @@ -2344,7 +2344,7 @@ protected: typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // |topmost| occludes the surface, but not the entire surface's replica. @@ -2370,12 +2370,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); template<class Types> -class CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); @@ -2385,7 +2385,7 @@ protected: typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // These occlude the surface and replica differently, so we can test each one. @@ -2412,12 +2412,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently); template<class Types> -class CCOcclusionTrackerTestSurfaceChildOfSurface : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { // This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect. @@ -2428,7 +2428,7 @@ protected: typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000)); // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); @@ -2471,12 +2471,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); template<class Types> -class CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { // This test verifies that the top-most surface is considered occluded outside of its target's clipRect and outside the viewport rect. @@ -2487,7 +2487,7 @@ protected: { // Make a viewport rect that is larger than the root layer. - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->visitLayer(surface, occlusion); @@ -2499,7 +2499,7 @@ protected: this->resetLayerIterator(); { // Make a viewport rect that is smaller than the root layer. - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); this->visitLayer(surface, occlusion); @@ -2511,12 +2511,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewport); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport); template<class Types> -class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { // This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect. @@ -2528,7 +2528,7 @@ protected: typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // |topmost| occludes everything partially so we know occlusion is happening at all. @@ -2563,12 +2563,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfClippingSurface); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfClippingSurface); template<class Types> -class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix scaleByHalf; @@ -2597,7 +2597,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will @@ -2689,12 +2689,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter); template<class Types> -class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix scaleByHalf; @@ -2720,7 +2720,7 @@ protected: this->calcDrawEtc(root); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(occludingLayerAbove, occlusion); @@ -2752,12 +2752,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice); template<class Types> -class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { // Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order. @@ -2785,7 +2785,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will @@ -2878,12 +2878,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip); template<class Types> -class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix scaleByHalf; @@ -2905,7 +2905,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); // The surface has a background blur, so it blurs non-opaque pixels below it. @@ -2928,12 +2928,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter); template<class Types> -class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix scaleByHalf; @@ -2955,7 +2955,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(aboveReplicaLayer, occlusion); @@ -2977,12 +2977,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded); template<class Types> -class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { WebTransformationMatrix scaleByHalf; @@ -3010,7 +3010,7 @@ protected: this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(besideReplicaLayer, occlusion); @@ -3050,12 +3050,12 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded); template<class Types> -class CCOcclusionTrackerTestMinimumTrackingSize : public CCOcclusionTrackerTest<Types> { +class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Types> { protected: - CCOcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : CCOcclusionTrackerTest<Types>(opaqueLayers) {} + OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} void runMyTest() { IntSize trackingSize(100, 100); @@ -3066,7 +3066,7 @@ protected: typename Types::LayerType* small = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); this->calcDrawEtc(parent); - TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); occlusion.setMinimumTrackingSize(trackingSize); @@ -3088,6 +3088,6 @@ protected: } }; -ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); } // namespace diff --git a/cc/overdraw_metrics.cc b/cc/overdraw_metrics.cc index 765d245..04ba2d5 100644 --- a/cc/overdraw_metrics.cc +++ b/cc/overdraw_metrics.cc @@ -19,7 +19,7 @@ using WebKit::WebTransformationMatrix; namespace cc { -CCOverdrawMetrics::CCOverdrawMetrics(bool recordMetricsForFrame) +OverdrawMetrics::OverdrawMetrics(bool recordMetricsForFrame) : m_recordMetricsForFrame(recordMetricsForFrame) , m_pixelsPainted(0) , m_pixelsUploadedOpaque(0) @@ -55,11 +55,11 @@ static inline float areaOfMappedQuad(const WebTransformationMatrix& transform, c { FloatPoint clippedQuad[8]; int numVerticesInClippedQuad = 0; - CCMathUtil::mapClippedQuad(transform, quad, clippedQuad, numVerticesInClippedQuad); + MathUtil::mapClippedQuad(transform, quad, clippedQuad, numVerticesInClippedQuad); return polygonArea(clippedQuad, numVerticesInClippedQuad); } -void CCOverdrawMetrics::didPaint(const IntRect& paintedRect) +void OverdrawMetrics::didPaint(const IntRect& paintedRect) { if (!m_recordMetricsForFrame) return; @@ -67,13 +67,13 @@ void CCOverdrawMetrics::didPaint(const IntRect& paintedRect) m_pixelsPainted += static_cast<float>(paintedRect.width()) * paintedRect.height(); } -void CCOverdrawMetrics::didCullTileForUpload() +void OverdrawMetrics::didCullTileForUpload() { if (m_recordMetricsForFrame) ++m_tilesCulledForUpload; } -void CCOverdrawMetrics::didUpload(const WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect) +void OverdrawMetrics::didUpload(const WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect) { if (!m_recordMetricsForFrame) return; @@ -85,7 +85,7 @@ void CCOverdrawMetrics::didUpload(const WebTransformationMatrix& transformToTarg m_pixelsUploadedTranslucent += uploadArea - uploadOpaqueArea; } -void CCOverdrawMetrics::didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes) +void OverdrawMetrics::didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes) { if (!m_recordMetricsForFrame) return; @@ -93,7 +93,7 @@ void CCOverdrawMetrics::didUseContentsTextureMemoryBytes(size_t contentsTextureU m_contentsTextureUseBytes += contentsTextureUseBytes; } -void CCOverdrawMetrics::didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes) +void OverdrawMetrics::didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes) { if (!m_recordMetricsForFrame) return; @@ -101,7 +101,7 @@ void CCOverdrawMetrics::didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfa m_renderSurfaceTextureUseBytes += renderSurfaceUseBytes; } -void CCOverdrawMetrics::didCullForDrawing(const WebTransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect) +void OverdrawMetrics::didCullForDrawing(const WebTransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect) { if (!m_recordMetricsForFrame) return; @@ -112,7 +112,7 @@ void CCOverdrawMetrics::didCullForDrawing(const WebTransformationMatrix& transfo m_pixelsCulledForDrawing += beforeCullArea - afterCullArea; } -void CCOverdrawMetrics::didDraw(const WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect) +void OverdrawMetrics::didDraw(const WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect) { if (!m_recordMetricsForFrame) return; @@ -124,20 +124,20 @@ void CCOverdrawMetrics::didDraw(const WebTransformationMatrix& transformToTarget m_pixelsDrawnTranslucent += afterCullArea - afterCullOpaqueArea; } -void CCOverdrawMetrics::recordMetrics(const CCLayerTreeHost* layerTreeHost) const +void OverdrawMetrics::recordMetrics(const LayerTreeHost* layerTreeHost) const { if (m_recordMetricsForFrame) - recordMetricsInternal<CCLayerTreeHost>(UpdateAndCommit, layerTreeHost); + recordMetricsInternal<LayerTreeHost>(UpdateAndCommit, layerTreeHost); } -void CCOverdrawMetrics::recordMetrics(const CCLayerTreeHostImpl* layerTreeHost) const +void OverdrawMetrics::recordMetrics(const LayerTreeHostImpl* layerTreeHost) const { if (m_recordMetricsForFrame) - recordMetricsInternal<CCLayerTreeHostImpl>(DrawingToScreen, layerTreeHost); + recordMetricsInternal<LayerTreeHostImpl>(DrawingToScreen, layerTreeHost); } template<typename LayerTreeHostType> -void CCOverdrawMetrics::recordMetricsInternal(MetricsType metricsType, const LayerTreeHostType* layerTreeHost) const +void OverdrawMetrics::recordMetricsInternal(MetricsType metricsType, const LayerTreeHostType* layerTreeHost) const { // This gives approximately 10x the percentage of pixels to fill the viewport once. float normalization = 1000.f / (layerTreeHost->deviceViewportSize().width() * layerTreeHost->deviceViewportSize().height()); @@ -153,7 +153,7 @@ void CCOverdrawMetrics::recordMetricsInternal(MetricsType metricsType, const Lay HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountCulled_Draw", static_cast<int>(normalization * m_pixelsCulledForDrawing), 100, 1000000, 50); TRACE_COUNTER_ID1("cc", "DrawPixelsCulled", layerTreeHost, m_pixelsCulledForDrawing); - TRACE_EVENT2("cc", "CCOverdrawMetrics", "PixelsDrawnOpaque", m_pixelsDrawnOpaque, "PixelsDrawnTranslucent", m_pixelsDrawnTranslucent); + TRACE_EVENT2("cc", "OverdrawMetrics", "PixelsDrawnOpaque", m_pixelsDrawnOpaque, "PixelsDrawnTranslucent", m_pixelsDrawnTranslucent); break; } case UpdateAndCommit: { @@ -168,15 +168,15 @@ void CCOverdrawMetrics::recordMetricsInternal(MetricsType metricsType, const Lay { TRACE_COUNTER_ID1("cc", "UploadTilesCulled", layerTreeHost, m_tilesCulledForUpload); - TRACE_EVENT2("cc", "CCOverdrawMetrics", "PixelsUploadedOpaque", m_pixelsUploadedOpaque, "PixelsUploadedTranslucent", m_pixelsUploadedTranslucent); + TRACE_EVENT2("cc", "OverdrawMetrics", "PixelsUploadedOpaque", m_pixelsUploadedOpaque, "PixelsUploadedTranslucent", m_pixelsUploadedTranslucent); } { // This must be in a different scope than the TRACE_EVENT2 above. - TRACE_EVENT1("cc", "CCOverdrawPaintMetrics", "PixelsPainted", m_pixelsPainted); + TRACE_EVENT1("cc", "OverdrawPaintMetrics", "PixelsPainted", m_pixelsPainted); } { // This must be in a different scope than the TRACE_EVENTs above. - TRACE_EVENT2("cc", "CCOverdrawPaintMetrics", "ContentsTextureBytes", m_contentsTextureUseBytes, "RenderSurfaceTextureBytes", m_renderSurfaceTextureUseBytes); + TRACE_EVENT2("cc", "OverdrawPaintMetrics", "ContentsTextureBytes", m_contentsTextureUseBytes, "RenderSurfaceTextureBytes", m_renderSurfaceTextureUseBytes); } break; } diff --git a/cc/overdraw_metrics.h b/cc/overdraw_metrics.h index bbeba8b..eb5f5db 100644 --- a/cc/overdraw_metrics.h +++ b/cc/overdraw_metrics.h @@ -13,13 +13,13 @@ class WebTransformationMatrix; namespace cc { class IntRect; -class CCLayerTreeHost; -class CCLayerTreeHostImpl; +class LayerTreeHost; +class LayerTreeHostImpl; // FIXME: compute overdraw metrics only occasionally, not every frame. -class CCOverdrawMetrics { +class OverdrawMetrics { public: - static scoped_ptr<CCOverdrawMetrics> create(bool recordMetricsForFrame) { return make_scoped_ptr(new CCOverdrawMetrics(recordMetricsForFrame)); } + static scoped_ptr<OverdrawMetrics> create(bool recordMetricsForFrame) { return make_scoped_ptr(new OverdrawMetrics(recordMetricsForFrame)); } // These methods are used for saving metrics during update/commit. @@ -31,7 +31,7 @@ public: void didUpload(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect); // Record contents texture(s) behind present using the given number of bytes. void didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes); - // Record RenderSurface texture(s) being present using the given number of bytes. + // Record RenderSurfaceImpl texture(s) being present using the given number of bytes. void didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes); // These methods are used for saving metrics during draw. @@ -41,8 +41,8 @@ public: // Record pixels that were drawn to screen. void didDraw(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect); - void recordMetrics(const CCLayerTreeHost*) const; - void recordMetrics(const CCLayerTreeHostImpl*) const; + void recordMetrics(const LayerTreeHost*) const; + void recordMetrics(const LayerTreeHostImpl*) const; // Accessors for tests. float pixelsDrawnOpaque() const { return m_pixelsDrawnOpaque; } @@ -59,7 +59,7 @@ private: DrawingToScreen }; - explicit CCOverdrawMetrics(bool recordMetricsForFrame); + explicit OverdrawMetrics(bool recordMetricsForFrame); template<typename LayerTreeHostType> void recordMetricsInternal(MetricsType, const LayerTreeHostType*) const; @@ -79,7 +79,7 @@ private: int m_tilesCulledForUpload; // Count the number of bytes in contents textures. unsigned long long m_contentsTextureUseBytes; - // Count the number of bytes in RenderSurface textures. + // Count the number of bytes in RenderSurfaceImpl textures. unsigned long long m_renderSurfaceTextureUseBytes; // These values are used for saving metrics during draw. diff --git a/cc/page_scale_animation.cc b/cc/page_scale_animation.cc index 7a7ebfe..9c6b8e7 100644 --- a/cc/page_scale_animation.cc +++ b/cc/page_scale_animation.cc @@ -13,12 +13,12 @@ namespace cc { -scoped_ptr<CCPageScaleAnimation> CCPageScaleAnimation::create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) +scoped_ptr<PageScaleAnimation> PageScaleAnimation::create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) { - return make_scoped_ptr(new CCPageScaleAnimation(scrollStart, pageScaleStart, windowSize, contentSize, startTime)); + return make_scoped_ptr(new PageScaleAnimation(scrollStart, pageScaleStart, windowSize, contentSize, startTime)); } -CCPageScaleAnimation::CCPageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) +PageScaleAnimation::PageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) : m_scrollStart(scrollStart) , m_pageScaleStart(pageScaleStart) , m_windowSize(windowSize) @@ -31,7 +31,7 @@ CCPageScaleAnimation::CCPageScaleAnimation(const IntSize& scrollStart, float pag { } -void CCPageScaleAnimation::zoomTo(const IntSize& finalScroll, float finalPageScale, double duration) +void PageScaleAnimation::zoomTo(const IntSize& finalScroll, float finalPageScale, double duration) { if (m_pageScaleStart != finalPageScale) { // For uniform-looking zooming, infer the anchor (point that remains in @@ -66,7 +66,7 @@ void CCPageScaleAnimation::zoomTo(const IntSize& finalScroll, float finalPageSca } } -void CCPageScaleAnimation::zoomWithAnchor(const IntSize& anchor, float finalPageScale, double duration) +void PageScaleAnimation::zoomWithAnchor(const IntSize& anchor, float finalPageScale, double duration) { m_scrollEnd = m_scrollStart + anchor; m_scrollEnd.scale(finalPageScale / m_pageScaleStart); @@ -84,22 +84,22 @@ void CCPageScaleAnimation::zoomWithAnchor(const IntSize& anchor, float finalPage m_anchorMode = true; } -IntSize CCPageScaleAnimation::scrollOffsetAtTime(double time) const +IntSize PageScaleAnimation::scrollOffsetAtTime(double time) const { return scrollOffsetAtRatio(progressRatioForTime(time)); } -float CCPageScaleAnimation::pageScaleAtTime(double time) const +float PageScaleAnimation::pageScaleAtTime(double time) const { return pageScaleAtRatio(progressRatioForTime(time)); } -bool CCPageScaleAnimation::isAnimationCompleteAtTime(double time) const +bool PageScaleAnimation::isAnimationCompleteAtTime(double time) const { return time >= endTime(); } -float CCPageScaleAnimation::progressRatioForTime(double time) const +float PageScaleAnimation::progressRatioForTime(double time) const { if (isAnimationCompleteAtTime(time)) return 1; @@ -107,7 +107,7 @@ float CCPageScaleAnimation::progressRatioForTime(double time) const return (time - m_startTime) / m_duration; } -IntSize CCPageScaleAnimation::scrollOffsetAtRatio(float ratio) const +IntSize PageScaleAnimation::scrollOffsetAtRatio(float ratio) const { if (ratio <= 0) return m_scrollStart; @@ -137,7 +137,7 @@ IntSize CCPageScaleAnimation::scrollOffsetAtRatio(float ratio) const return currentScrollOffset; } -float CCPageScaleAnimation::pageScaleAtRatio(float ratio) const +float PageScaleAnimation::pageScaleAtRatio(float ratio) const { if (ratio <= 0) return m_pageScaleStart; diff --git a/cc/page_scale_animation.h b/cc/page_scale_animation.h index a3634f3..1a4193b 100644 --- a/cc/page_scale_animation.h +++ b/cc/page_scale_animation.h @@ -14,12 +14,12 @@ namespace cc { // double-tap zoom. Initialize it with starting and ending scroll/page scale // positions and an animation length time, then call ...AtTime() at every frame // to obtain the current interpolated position. -class CCPageScaleAnimation { +class PageScaleAnimation { public: // Construct with the starting page scale and scroll offset (which is in // pageScaleStart space). The window size is the user-viewable area // in pixels. - static scoped_ptr<CCPageScaleAnimation> create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime); + static scoped_ptr<PageScaleAnimation> create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime); // The following methods initialize the animation. Call one of them // immediately after construction to set the final scroll and page scale. @@ -48,7 +48,7 @@ public: float finalPageScale() const { return m_pageScaleEnd; } protected: - CCPageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime); + PageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime); private: float progressRatioForTime(double time) const; diff --git a/cc/prioritized_texture.cc b/cc/prioritized_texture.cc index bfda4de..91638b2 100644 --- a/cc/prioritized_texture.cc +++ b/cc/prioritized_texture.cc @@ -15,11 +15,11 @@ using namespace std; namespace cc { -CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, IntSize size, GLenum format) +PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, IntSize size, GLenum format) : m_size(size) , m_format(format) , m_bytes(0) - , m_priority(CCPriorityCalculator::lowestPriority()) + , m_priority(PriorityCalculator::lowestPriority()) , m_isAbovePriorityCutoff(false) , m_isSelfManaged(false) , m_backing(0) @@ -28,18 +28,18 @@ CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, // m_manager is set in registerTexture() so validity can be checked. DCHECK(format || size.isEmpty()); if (format) - m_bytes = CCTexture::memorySizeBytes(size, format); + m_bytes = Texture::memorySizeBytes(size, format); if (manager) manager->registerTexture(this); } -CCPrioritizedTexture::~CCPrioritizedTexture() +PrioritizedTexture::~PrioritizedTexture() { if (m_manager) m_manager->unregisterTexture(this); } -void CCPrioritizedTexture::setTextureManager(CCPrioritizedTextureManager* manager) +void PrioritizedTexture::setTextureManager(PrioritizedTextureManager* manager) { if (m_manager == manager) return; @@ -49,46 +49,46 @@ void CCPrioritizedTexture::setTextureManager(CCPrioritizedTextureManager* manage manager->registerTexture(this); } -void CCPrioritizedTexture::setDimensions(IntSize size, GLenum format) +void PrioritizedTexture::setDimensions(IntSize size, GLenum format) { if (m_format != format || m_size != size) { m_isAbovePriorityCutoff = false; m_format = format; m_size = size; - m_bytes = CCTexture::memorySizeBytes(size, format); + m_bytes = Texture::memorySizeBytes(size, format); DCHECK(m_manager || !m_backing); if (m_manager) m_manager->returnBackingTexture(this); } } -bool CCPrioritizedTexture::requestLate() +bool PrioritizedTexture::requestLate() { if (!m_manager) return false; return m_manager->requestLate(this); } -bool CCPrioritizedTexture::backingResourceWasEvicted() const +bool PrioritizedTexture::backingResourceWasEvicted() const { return m_backing ? m_backing->resourceHasBeenDeleted() : false; } -void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourceProvider) +void PrioritizedTexture::acquireBackingTexture(ResourceProvider* resourceProvider) { DCHECK(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); } -CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const +ResourceProvider::ResourceId PrioritizedTexture::resourceId() const { if (m_backing) return m_backing->id(); return 0; } -void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider, +void PrioritizedTexture::upload(ResourceProvider* resourceProvider, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset) { @@ -99,7 +99,7 @@ void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider, resourceProvider->upload(resourceId(), image, imageRect, sourceRect, destOffset); } -void CCPrioritizedTexture::link(Backing* backing) +void PrioritizedTexture::link(Backing* backing) { DCHECK(backing); DCHECK(!backing->m_owner); @@ -109,7 +109,7 @@ void CCPrioritizedTexture::link(Backing* backing) m_backing->m_owner = this; } -void CCPrioritizedTexture::unlink() +void PrioritizedTexture::unlink() { DCHECK(m_backing); DCHECK(m_backing->m_owner == this); @@ -118,17 +118,17 @@ void CCPrioritizedTexture::unlink() m_backing = 0; } -void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) +void PrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) { setDimensions(IntSize(), GL_RGBA); setIsSelfManaged(true); m_bytes = bytes; } -CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resourceProvider, IntSize size, GLenum format) - : CCTexture(id, size, format) +PrioritizedTexture::Backing::Backing(unsigned id, ResourceProvider* resourceProvider, IntSize size, GLenum format) + : Texture(id, size, format) , m_owner(0) - , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) + , m_priorityAtLastPriorityUpdate(PriorityCalculator::lowestPriority()) , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) , m_inDrawingImplTree(false) , m_resourceHasBeenDeleted(false) @@ -138,15 +138,15 @@ CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource { } -CCPrioritizedTexture::Backing::~Backing() +PrioritizedTexture::Backing::~Backing() { DCHECK(!m_owner); DCHECK(m_resourceHasBeenDeleted); } -void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceProvider) +void PrioritizedTexture::Backing::deleteResource(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(!m_resourceHasBeenDeleted); #ifndef NDEBUG DCHECK(resourceProvider == m_resourceProvider); @@ -157,36 +157,36 @@ void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceP m_resourceHasBeenDeleted = true; } -bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const +bool PrioritizedTexture::Backing::resourceHasBeenDeleted() const { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); return m_resourceHasBeenDeleted; } -bool CCPrioritizedTexture::Backing::canBeRecycled() const +bool PrioritizedTexture::Backing::canBeRecycled() const { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree; } -void CCPrioritizedTexture::Backing::updatePriority() +void PrioritizedTexture::Backing::updatePriority() { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); if (m_owner) { m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityCutoff(); } else { - m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); + m_priorityAtLastPriorityUpdate = PriorityCalculator::lowestPriority(); m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; } } -void CCPrioritizedTexture::Backing::updateInDrawingImplTree() +void PrioritizedTexture::Backing::updateInDrawingImplTree() { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); m_inDrawingImplTree = !!owner(); if (!m_inDrawingImplTree) - DCHECK(m_priorityAtLastPriorityUpdate == CCPriorityCalculator::lowestPriority()); + DCHECK(m_priorityAtLastPriorityUpdate == PriorityCalculator::lowestPriority()); } } // namespace cc diff --git a/cc/prioritized_texture.h b/cc/prioritized_texture.h index aff026e..0750490 100644 --- a/cc/prioritized_texture.h +++ b/cc/prioritized_texture.h @@ -17,24 +17,24 @@ namespace cc { -class CCPrioritizedTextureManager; +class PrioritizedTextureManager; -class CCPrioritizedTexture { +class PrioritizedTexture { public: - static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GLenum format) + static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager, IntSize size, GLenum format) { - return make_scoped_ptr(new CCPrioritizedTexture(manager, size, format)); + return make_scoped_ptr(new PrioritizedTexture(manager, size, format)); } - static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager) + static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager) { - return make_scoped_ptr(new CCPrioritizedTexture(manager, IntSize(), 0)); + return make_scoped_ptr(new PrioritizedTexture(manager, IntSize(), 0)); } - ~CCPrioritizedTexture(); + ~PrioritizedTexture(); // Texture properties. Changing these causes the backing texture to be lost. // Setting these to the same value is a no-op. - void setTextureManager(CCPrioritizedTextureManager*); - CCPrioritizedTextureManager* textureManager() { return m_manager; } + void setTextureManager(PrioritizedTextureManager*); + PrioritizedTextureManager* textureManager() { return m_manager; } void setDimensions(IntSize, GLenum format); GLenum format() const { return m_format; } IntSize size() const { return m_size; } @@ -44,7 +44,7 @@ public: void setRequestPriority(int priority) { m_priority = priority; } int requestPriority() const { return m_priority; } - // After CCPrioritizedTexture::prioritizeTextures() is called, this returns + // After PrioritizedTexture::prioritizeTextures() is called, this returns // if the the request succeeded and this texture can be acquired for use. bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; } @@ -58,7 +58,7 @@ public: // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire // a backing texture for use. Call this whenever the texture is actually needed. - void acquireBackingTexture(CCResourceProvider*); + void acquireBackingTexture(ResourceProvider*); // FIXME: Request late is really a hack for when we are totally out of memory // (all textures are visible) but we can still squeeze into the limit @@ -70,9 +70,9 @@ public: bool requestLate(); // Uploads pixels into the backing resource. This functions will aquire the backing if needed. - void upload(CCResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset); + void upload(ResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset); - CCResourceProvider::ResourceId resourceId() const; + ResourceProvider::ResourceId resourceId() const; // Self-managed textures are accounted for when prioritizing other textures, // but they are not allocated/recycled/deleted, so this needs to be done @@ -83,28 +83,28 @@ public: void setToSelfManagedMemoryPlaceholder(size_t bytes); private: - friend class CCPrioritizedTextureManager; - friend class CCPrioritizedTextureTest; + friend class PrioritizedTextureManager; + friend class PrioritizedTextureTest; - class Backing : public CCTexture { + class Backing : public Texture { public: - Backing(unsigned id, CCResourceProvider*, IntSize, GLenum format); + Backing(unsigned id, ResourceProvider*, IntSize, GLenum format); ~Backing(); void updatePriority(); void updateInDrawingImplTree(); - CCPrioritizedTexture* owner() { return m_owner; } + PrioritizedTexture* owner() { return m_owner; } bool canBeRecycled() const; int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLastPriorityUpdate; } bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAbovePriorityCutoffAtLastPriorityUpdate; } bool inDrawingImplTree() const { return m_inDrawingImplTree; } - void deleteResource(CCResourceProvider*); + void deleteResource(ResourceProvider*); bool resourceHasBeenDeleted() const; private: - friend class CCPrioritizedTexture; - CCPrioritizedTexture* m_owner; + friend class PrioritizedTexture; + PrioritizedTexture* m_owner; int m_priorityAtLastPriorityUpdate; bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; @@ -113,17 +113,17 @@ private: bool m_resourceHasBeenDeleted; #ifndef NDEBUG - CCResourceProvider* m_resourceProvider; + ResourceProvider* m_resourceProvider; #endif DISALLOW_COPY_AND_ASSIGN(Backing); }; - CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GLenum format); + PrioritizedTexture(PrioritizedTextureManager*, IntSize, GLenum format); bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; } - void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; } + void setManagerInternal(PrioritizedTextureManager* manager) { m_manager = manager; } Backing* backing() const { return m_backing; } void link(Backing*); @@ -138,9 +138,9 @@ private: bool m_isSelfManaged; Backing* m_backing; - CCPrioritizedTextureManager* m_manager; + PrioritizedTextureManager* m_manager; - DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTexture); + DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); }; } // namespace cc diff --git a/cc/prioritized_texture_manager.cc b/cc/prioritized_texture_manager.cc index d766380..1726b80 100644 --- a/cc/prioritized_texture_manager.cc +++ b/cc/prioritized_texture_manager.cc @@ -17,7 +17,7 @@ using namespace std; namespace cc { -CCPrioritizedTextureManager::CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int, int pool) +PrioritizedTextureManager::PrioritizedTextureManager(size_t maxMemoryLimitBytes, int, int pool) : m_maxMemoryLimitBytes(maxMemoryLimitBytes) , m_memoryUseBytes(0) , m_memoryAboveCutoffBytes(0) @@ -27,7 +27,7 @@ CCPrioritizedTextureManager::CCPrioritizedTextureManager(size_t maxMemoryLimitBy { } -CCPrioritizedTextureManager::~CCPrioritizedTextureManager() +PrioritizedTextureManager::~PrioritizedTextureManager() { while (m_textures.size() > 0) unregisterTexture(*m_textures.begin()); @@ -39,10 +39,10 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() DCHECK(m_backings.empty()); } -void CCPrioritizedTextureManager::prioritizeTextures() +void PrioritizedTextureManager::prioritizeTextures() { - TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "PrioritizedTextureManager::prioritizeTextures"); + DCHECK(Proxy::isMainThread()); // Sorting textures in this function could be replaced by a slightly // modified O(n) quick-select to partition textures rather than @@ -57,10 +57,10 @@ void CCPrioritizedTextureManager::prioritizeTextures() std::sort(sortedTextures.begin(), sortedTextures.end(), compareTextures); m_memoryAvailableBytes = m_maxMemoryLimitBytes; - m_priorityCutoff = CCPriorityCalculator::lowestPriority(); + m_priorityCutoff = PriorityCalculator::lowestPriority(); size_t memoryBytes = 0; for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) { - if ((*it)->requestPriority() == CCPriorityCalculator::lowestPriority()) + if ((*it)->requestPriority() == PriorityCalculator::lowestPriority()) break; if ((*it)->isSelfManaged()) { @@ -88,7 +88,7 @@ void CCPrioritizedTextureManager::prioritizeTextures() // being partially allowed randomly. m_memoryAboveCutoffBytes = 0; for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) { - bool isAbovePriorityCutoff = CCPriorityCalculator::priorityIsHigher((*it)->requestPriority(), m_priorityCutoff); + bool isAbovePriorityCutoff = PriorityCalculator::priorityIsHigher((*it)->requestPriority(), m_priorityCutoff); (*it)->setAbovePriorityCutoff(isAbovePriorityCutoff); if (isAbovePriorityCutoff && !(*it)->isSelfManaged()) m_memoryAboveCutoffBytes += (*it)->bytes(); @@ -99,10 +99,10 @@ void CCPrioritizedTextureManager::prioritizeTextures() DCHECK(memoryAboveCutoffBytes() <= maxMemoryLimitBytes()); } -void CCPrioritizedTextureManager::pushTexturePrioritiesToBackings() +void PrioritizedTextureManager::pushTexturePrioritiesToBackings() { - TRACE_EVENT0("cc", "CCPrioritizedTextureManager::pushTexturePrioritiesToBackings"); - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + TRACE_EVENT0("cc", "PrioritizedTextureManager::pushTexturePrioritiesToBackings"); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); assertInvariants(); for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) @@ -111,51 +111,51 @@ void CCPrioritizedTextureManager::pushTexturePrioritiesToBackings() assertInvariants(); } -void CCPrioritizedTextureManager::updateBackingsInDrawingImplTree() +void PrioritizedTextureManager::updateBackingsInDrawingImplTree() { - TRACE_EVENT0("cc", "CCPrioritizedTextureManager::updateBackingsInDrawingImplTree"); - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + TRACE_EVENT0("cc", "PrioritizedTextureManager::updateBackingsInDrawingImplTree"); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); assertInvariants(); for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - CCPrioritizedTexture::Backing* backing = (*it); + PrioritizedTexture::Backing* backing = (*it); backing->updateInDrawingImplTree(); } sortBackings(); assertInvariants(); } -void CCPrioritizedTextureManager::sortBackings() +void PrioritizedTextureManager::sortBackings() { - TRACE_EVENT0("cc", "CCPrioritizedTextureManager::sortBackings"); - DCHECK(CCProxy::isImplThread()); + TRACE_EVENT0("cc", "PrioritizedTextureManager::sortBackings"); + DCHECK(Proxy::isImplThread()); // Put backings in eviction/recycling order. m_backings.sort(compareBackings); m_backingsTailNotSorted = false; } -void CCPrioritizedTextureManager::clearPriorities() +void PrioritizedTextureManager::clearPriorities() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { // FIXME: We should remove this and just set all priorities to - // CCPriorityCalculator::lowestPriority() once we have priorities + // PriorityCalculator::lowestPriority() once we have priorities // for all textures (we can't currently calculate distances for // off-screen textures). - (*it)->setRequestPriority(CCPriorityCalculator::lingeringPriority((*it)->requestPriority())); + (*it)->setRequestPriority(PriorityCalculator::lingeringPriority((*it)->requestPriority())); } } -bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) +bool PrioritizedTextureManager::requestLate(PrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); // This is already above cutoff, so don't double count it's memory below. if (texture->isAbovePriorityCutoff()) return true; - if (CCPriorityCalculator::priorityIsLower(texture->requestPriority(), m_priorityCutoff)) + if (PriorityCalculator::priorityIsLower(texture->requestPriority(), m_priorityCutoff)) return false; size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->bytes(); @@ -167,16 +167,16 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) return true; } -void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, CCResourceProvider* resourceProvider) +void PrioritizedTextureManager::acquireBackingTextureIfNeeded(PrioritizedTexture* texture, ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); DCHECK(!texture->isSelfManaged()); DCHECK(texture->isAbovePriorityCutoff()); if (texture->backing() || !texture->isAbovePriorityCutoff()) return; // Find a backing below, by either recycling or allocating. - CCPrioritizedTexture::Backing* backing = 0; + PrioritizedTexture::Backing* backing = 0; // First try to recycle for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { @@ -207,16 +207,16 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex backing->updatePriority(); } -bool CCPrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy evictionPolicy, CCResourceProvider* resourceProvider) +bool PrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy evictionPolicy, ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); if (memoryUseBytes() <= limitBytes) return false; // Destroy backings until we are below the limit, // or until all backings remaining are above the cutoff. while (memoryUseBytes() > limitBytes && m_backings.size() > 0) { - CCPrioritizedTexture::Backing* backing = m_backings.front(); + PrioritizedTexture::Backing* backing = m_backings.front(); if (evictionPolicy == RespectManagerPriorityCutoff) if (backing->wasAbovePriorityCutoffAtLastPriorityUpdate()) break; @@ -225,9 +225,9 @@ bool CCPrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, return true; } -void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider) +void PrioritizedTextureManager::reduceMemory(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); evictBackingsToReduceMemory(m_memoryAvailableBytes, RespectManagerPriorityCutoff, resourceProvider); DCHECK(memoryUseBytes() <= maxMemoryLimitBytes()); @@ -257,16 +257,16 @@ void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvi deleteUnlinkedEvictedBackings(); } -void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider) +void PrioritizedTextureManager::clearAllMemory(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); DCHECK(resourceProvider); evictBackingsToReduceMemory(0, DoNotRespectManagerPriorityCutoff, resourceProvider); } -bool CCPrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider* resourceProvider) +bool PrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(resourceProvider); // If we are in the process of uploading a new frame then the backings at the very end of // the list are not sorted by priority. Sort them before doing the eviction. @@ -275,29 +275,29 @@ bool CCPrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, CC return evictBackingsToReduceMemory(limitBytes, DoNotRespectManagerPriorityCutoff, resourceProvider); } -void CCPrioritizedTextureManager::getEvictedBackings(BackingList& evictedBackings) +void PrioritizedTextureManager::getEvictedBackings(BackingList& evictedBackings) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); evictedBackings.clear(); evictedBackings.insert(evictedBackings.begin(), m_evictedBackings.begin(), m_evictedBackings.end()); } -void CCPrioritizedTextureManager::unlinkEvictedBackings(const BackingList& evictedBackings) +void PrioritizedTextureManager::unlinkEvictedBackings(const BackingList& evictedBackings) { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); for (BackingList::const_iterator it = evictedBackings.begin(); it != evictedBackings.end(); ++it) { - CCPrioritizedTexture::Backing* backing = (*it); + PrioritizedTexture::Backing* backing = (*it); if (backing->owner()) backing->owner()->unlink(); } } -void CCPrioritizedTextureManager::deleteUnlinkedEvictedBackings() +void PrioritizedTextureManager::deleteUnlinkedEvictedBackings() { - DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); + DCHECK(Proxy::isMainThread() || (Proxy::isImplThread() && Proxy::isMainThreadBlocked())); BackingList newEvictedBackings; for (BackingList::const_iterator it = m_evictedBackings.begin(); it != m_evictedBackings.end(); ++it) { - CCPrioritizedTexture::Backing* backing = (*it); + PrioritizedTexture::Backing* backing = (*it); if (backing->owner()) newEvictedBackings.push_back(backing); else @@ -306,7 +306,7 @@ void CCPrioritizedTextureManager::deleteUnlinkedEvictedBackings() m_evictedBackings.swap(newEvictedBackings); } -bool CCPrioritizedTextureManager::linkedEvictedBackingsExist() const +bool PrioritizedTextureManager::linkedEvictedBackingsExist() const { for (BackingList::const_iterator it = m_evictedBackings.begin(); it != m_evictedBackings.end(); ++it) { if ((*it)->owner()) @@ -315,9 +315,9 @@ bool CCPrioritizedTextureManager::linkedEvictedBackingsExist() const return false; } -void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) +void PrioritizedTextureManager::registerTexture(PrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); DCHECK(texture); DCHECK(!texture->textureManager()); DCHECK(!texture->backing()); @@ -328,9 +328,9 @@ void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) } -void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* texture) +void PrioritizedTextureManager::unregisterTexture(PrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); + DCHECK(Proxy::isMainThread() || (Proxy::isImplThread() && Proxy::isMainThreadBlocked())); DCHECK(texture); DCHECK(ContainsKey(m_textures, texture)); @@ -340,29 +340,29 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur texture->setAbovePriorityCutoff(false); } -void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture) +void PrioritizedTextureManager::returnBackingTexture(PrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); + DCHECK(Proxy::isMainThread() || (Proxy::isImplThread() && Proxy::isMainThreadBlocked())); if (texture->backing()) texture->unlink(); } -CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GLenum format, CCResourceProvider* resourceProvider) +PrioritizedTexture::Backing* PrioritizedTextureManager::createBacking(IntSize size, GLenum format, ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); DCHECK(resourceProvider); - CCResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, CCResourceProvider::TextureUsageAny); - CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, resourceProvider, size, format); + ResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, ResourceProvider::TextureUsageAny); + PrioritizedTexture::Backing* backing = new PrioritizedTexture::Backing(resourceId, resourceProvider, size, format); m_memoryUseBytes += backing->bytes(); return backing; } -void CCPrioritizedTextureManager::evictFirstBackingResource(CCResourceProvider* resourceProvider) +void PrioritizedTextureManager::evictFirstBackingResource(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(resourceProvider); DCHECK(!m_backings.empty()); - CCPrioritizedTexture::Backing* backing = m_backings.front(); + PrioritizedTexture::Backing* backing = m_backings.front(); // Note that we create a backing and its resource at the same time, but we // delete the backing structure and its resource in two steps. This is because @@ -374,10 +374,10 @@ void CCPrioritizedTextureManager::evictFirstBackingResource(CCResourceProvider* m_evictedBackings.push_back(backing); } -void CCPrioritizedTextureManager::assertInvariants() +void PrioritizedTextureManager::assertInvariants() { #ifndef NDEBUG - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); // If we hit any of these asserts, there is a bug in this class. To see // where the bug is, call this function at the beginning and end of @@ -391,8 +391,8 @@ void CCPrioritizedTextureManager::assertInvariants() } } for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { - CCPrioritizedTexture* texture = (*it); - CCPrioritizedTexture::Backing* backing = texture->backing(); + PrioritizedTexture* texture = (*it); + PrioritizedTexture::Backing* backing = texture->backing(); if (backing) { if (backing->resourceHasBeenDeleted()) { DCHECK(std::find(m_backings.begin(), m_backings.end(), backing) == m_backings.end()); @@ -409,9 +409,9 @@ void CCPrioritizedTextureManager::assertInvariants() // backings that can't be evicted in the backing texture list (otherwise // reduceMemory will not find all textures available for eviction/recycling). bool reachedUnrecyclable = false; - CCPrioritizedTexture::Backing* previous_backing = NULL; + PrioritizedTexture::Backing* previous_backing = NULL; for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - CCPrioritizedTexture::Backing* backing = *it; + PrioritizedTexture::Backing* backing = *it; if (previous_backing && (!m_backingsTailNotSorted || !backing->wasAbovePriorityCutoffAtLastPriorityUpdate())) DCHECK(compareBackings(previous_backing, backing)); if (!backing->canBeRecycled()) diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h index 64b3abe..fa083cd 100644 --- a/cc/prioritized_texture_manager.h +++ b/cc/prioritized_texture_manager.h @@ -20,8 +20,8 @@ #if defined(COMPILER_GCC) namespace BASE_HASH_NAMESPACE { template<> -struct hash<cc::CCPrioritizedTexture*> { - size_t operator()(cc::CCPrioritizedTexture* ptr) const { +struct hash<cc::PrioritizedTexture*> { + size_t operator()(cc::PrioritizedTexture* ptr) const { return hash<size_t>()(reinterpret_cast<size_t>(ptr)); } }; @@ -30,21 +30,21 @@ struct hash<cc::CCPrioritizedTexture*> { namespace cc { -class CCPriorityCalculator; +class PriorityCalculator; -class CCPrioritizedTextureManager { +class PrioritizedTextureManager { public: - static scoped_ptr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool) + static scoped_ptr<PrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool) { - return make_scoped_ptr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool)); + return make_scoped_ptr(new PrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool)); } - scoped_ptr<CCPrioritizedTexture> createTexture(IntSize size, GLenum format) + scoped_ptr<PrioritizedTexture> createTexture(IntSize size, GLenum format) { - return make_scoped_ptr(new CCPrioritizedTexture(this, size, format)); + return make_scoped_ptr(new PrioritizedTexture(this, size, format)); } - ~CCPrioritizedTextureManager(); + ~PrioritizedTextureManager(); - typedef std::list<CCPrioritizedTexture::Backing*> BackingList; + typedef std::list<PrioritizedTexture::Backing*> BackingList; // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the // old texture manager and is just to give us a default memory allocation before @@ -70,7 +70,7 @@ public: // Delete contents textures' backing resources until they use only bytesLimit bytes. This may // be called on the impl thread while the main thread is running. Returns true if resources are // indeed evicted as a result of this call. - bool reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider*); + bool reduceMemoryOnImplThread(size_t limitBytes, ResourceProvider*); // Returns true if there exist any textures that are linked to backings that have had their // resources evicted. Only when we commit a tree that has no textures linked to evicted backings // may we allow drawing. @@ -82,16 +82,16 @@ public: // before updating layers. void unlinkEvictedBackings(const BackingList& evictedBackings); - bool requestLate(CCPrioritizedTexture*); + bool requestLate(PrioritizedTexture*); - void reduceMemory(CCResourceProvider*); - void clearAllMemory(CCResourceProvider*); + void reduceMemory(ResourceProvider*); + void clearAllMemory(ResourceProvider*); - void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*); + void acquireBackingTextureIfNeeded(PrioritizedTexture*, ResourceProvider*); - void registerTexture(CCPrioritizedTexture*); - void unregisterTexture(CCPrioritizedTexture*); - void returnBackingTexture(CCPrioritizedTexture*); + void registerTexture(PrioritizedTexture*); + void unregisterTexture(PrioritizedTexture*); + void returnBackingTexture(PrioritizedTexture*); // Update all backings' priorities from their owning texture. void pushTexturePrioritiesToBackings(); @@ -100,7 +100,7 @@ public: void updateBackingsInDrawingImplTree(); private: - friend class CCPrioritizedTextureTest; + friend class PrioritizedTextureTest; enum EvictionPriorityPolicy { RespectManagerPriorityCutoff, @@ -108,14 +108,14 @@ private: }; // Compare textures. Highest priority first. - static inline bool compareTextures(CCPrioritizedTexture* a, CCPrioritizedTexture* b) + static inline bool compareTextures(PrioritizedTexture* a, PrioritizedTexture* b) { if (a->requestPriority() == b->requestPriority()) return a < b; - return CCPriorityCalculator::priorityIsHigher(a->requestPriority(), b->requestPriority()); + return PriorityCalculator::priorityIsHigher(a->requestPriority(), b->requestPriority()); } // Compare backings. Lowest priority first. - static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b) + static inline bool compareBackings(PrioritizedTexture::Backing* a, PrioritizedTexture::Backing* b) { // Make textures that can be recycled appear first if (a->canBeRecycled() != b->canBeRecycled()) @@ -126,18 +126,18 @@ private: // Then sort by priority (note that backings that no longer have owners will // always have the lowest priority) if (a->requestPriorityAtLastPriorityUpdate() != b->requestPriorityAtLastPriorityUpdate()) - return CCPriorityCalculator::priorityIsLower(a->requestPriorityAtLastPriorityUpdate(), b->requestPriorityAtLastPriorityUpdate()); + return PriorityCalculator::priorityIsLower(a->requestPriorityAtLastPriorityUpdate(), b->requestPriorityAtLastPriorityUpdate()); // Finally sort by being in the impl tree versus being completely unreferenced if (a->inDrawingImplTree() != b->inDrawingImplTree()) return (a->inDrawingImplTree() < b->inDrawingImplTree()); return a < b; } - CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); + PrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); - bool evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*); - CCPrioritizedTexture::Backing* createBacking(IntSize, GLenum format, CCResourceProvider*); - void evictFirstBackingResource(CCResourceProvider*); + bool evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, ResourceProvider*); + PrioritizedTexture::Backing* createBacking(IntSize, GLenum format, ResourceProvider*); + void evictFirstBackingResource(ResourceProvider*); void deleteUnlinkedEvictedBackings(); void sortBackings(); @@ -150,8 +150,8 @@ private: size_t m_memoryAvailableBytes; int m_pool; - typedef base::hash_set<CCPrioritizedTexture*> TextureSet; - typedef Vector<CCPrioritizedTexture*> TextureVector; + typedef base::hash_set<PrioritizedTexture*> TextureSet; + typedef Vector<PrioritizedTexture*> TextureVector; TextureSet m_textures; // This list is always sorted in eviction order, with the exception the @@ -163,7 +163,7 @@ private: TextureVector m_tempTextureVector; - DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTextureManager); + DISALLOW_COPY_AND_ASSIGN(PrioritizedTextureManager); }; } // namespace cc diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc index 10372ea..ae8e63f 100644 --- a/cc/prioritized_texture_unittest.cc +++ b/cc/prioritized_texture_unittest.cc @@ -19,19 +19,19 @@ using namespace WebKitTests; namespace cc { -class CCPrioritizedTextureTest : public testing::Test { +class PrioritizedTextureTest : public testing::Test { public: - CCPrioritizedTextureTest() + PrioritizedTextureTest() : m_textureSize(256, 256) , m_textureFormat(GL_RGBA) , m_compositorInitializer(0) - , m_context(WebKit::createFakeCCGraphicsContext()) + , m_context(WebKit::createFakeGraphicsContext()) { DebugScopedSetImplThread implThread; - m_resourceProvider = CCResourceProvider::create(m_context.get()); + m_resourceProvider = ResourceProvider::create(m_context.get()); } - virtual ~CCPrioritizedTextureTest() + virtual ~PrioritizedTextureTest() { DebugScopedSetImplThread implThread; m_resourceProvider.reset(); @@ -39,15 +39,15 @@ public: size_t texturesMemorySize(size_t textureCount) { - return CCTexture::memorySizeBytes(m_textureSize, m_textureFormat) * textureCount; + return Texture::memorySizeBytes(m_textureSize, m_textureFormat) * textureCount; } - scoped_ptr<CCPrioritizedTextureManager> createManager(size_t maxTextures) + scoped_ptr<PrioritizedTextureManager> createManager(size_t maxTextures) { - return CCPrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024, 0); + return PrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024, 0); } - bool validateTexture(scoped_ptr<CCPrioritizedTexture>& texture, bool requestLate) + bool validateTexture(scoped_ptr<PrioritizedTexture>& texture, bool requestLate) { textureManagerAssertInvariants(texture->textureManager()); if (requestLate) @@ -60,24 +60,24 @@ public: return success; } - void prioritizeTexturesAndBackings(CCPrioritizedTextureManager* textureManager) + void prioritizeTexturesAndBackings(PrioritizedTextureManager* textureManager) { textureManager->prioritizeTextures(); textureManagerUpdateBackingsPriorities(textureManager); } - void textureManagerUpdateBackingsPriorities(CCPrioritizedTextureManager* textureManager) + void textureManagerUpdateBackingsPriorities(PrioritizedTextureManager* textureManager) { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->pushTexturePrioritiesToBackings(); } - CCResourceProvider* resourceProvider() + ResourceProvider* resourceProvider() { return m_resourceProvider.get(); } - void textureManagerAssertInvariants(CCPrioritizedTextureManager* textureManager) + void textureManagerAssertInvariants(PrioritizedTextureManager* textureManager) { #ifndef NDEBUG DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; @@ -85,7 +85,7 @@ public: #endif } - bool textureBackingIsAbovePriorityCutoff(CCPrioritizedTexture* texture) + bool textureBackingIsAbovePriorityCutoff(PrioritizedTexture* texture) { return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate(); } @@ -94,21 +94,21 @@ protected: const IntSize m_textureSize; const GLenum m_textureFormat; WebCompositorInitializer m_compositorInitializer; - scoped_ptr<CCGraphicsContext> m_context; - scoped_ptr<CCResourceProvider> m_resourceProvider; + scoped_ptr<GraphicsContext> m_context; + scoped_ptr<ResourceProvider> m_resourceProvider; }; } namespace { -TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) +TEST_F(PrioritizedTextureTest, requestTextureExceedingMaxLimit) { const size_t maxTextures = 8; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); // Create textures for double our memory limit. - scoped_ptr<CCPrioritizedTexture> textures[maxTextures*2]; + scoped_ptr<PrioritizedTexture> textures[maxTextures*2]; for (size_t i = 0; i < maxTextures*2; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -142,11 +142,11 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) +TEST_F(PrioritizedTextureTest, changeMemoryLimits) { const size_t maxTextures = 8; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -196,13 +196,13 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) +TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures) { const size_t maxTextures = 4; const size_t numTextures = 4; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - scoped_ptr<CCPrioritizedTexture> textures[numTextures]; - scoped_ptr<CCPrioritizedTexture> moreTextures[numTextures]; + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTexture> textures[numTextures]; + scoped_ptr<PrioritizedTexture> moreTextures[numTextures]; for (size_t i = 0; i < numTextures; ++i) { textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -256,11 +256,11 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) +TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual) { const size_t maxTextures = 16; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -296,10 +296,10 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) +TEST_F(PrioritizedTextureTest, textureManagerDestroyedFirst) { - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(1); - scoped_ptr<CCPrioritizedTexture> texture = textureManager->createTexture(m_textureSize, m_textureFormat); + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(1); + scoped_ptr<PrioritizedTexture> texture = textureManager->createTexture(m_textureSize, m_textureFormat); // Texture is initially invalid, but it will become available. EXPECT_FALSE(texture->haveBackingTexture()); @@ -321,11 +321,11 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_FALSE(texture->haveBackingTexture()); } -TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) +TEST_F(PrioritizedTextureTest, textureMovedToNewManager) { - scoped_ptr<CCPrioritizedTextureManager> textureManagerOne = createManager(1); - scoped_ptr<CCPrioritizedTextureManager> textureManagerTwo = createManager(1); - scoped_ptr<CCPrioritizedTexture> texture = textureManagerOne->createTexture(m_textureSize, m_textureFormat); + scoped_ptr<PrioritizedTextureManager> textureManagerOne = createManager(1); + scoped_ptr<PrioritizedTextureManager> textureManagerTwo = createManager(1); + scoped_ptr<PrioritizedTexture> texture = textureManagerOne->createTexture(m_textureSize, m_textureFormat); // Texture is initially invalid, but it will become available. EXPECT_FALSE(texture->haveBackingTexture()); @@ -360,18 +360,18 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) textureManagerTwo->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSurface) +TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSurface) { const size_t maxTextures = 8; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); // Half of the memory is taken by surfaces (with high priority place-holder) - scoped_ptr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); - renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); + renderSurfacePlaceHolder->setRequestPriority(PriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -406,18 +406,18 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate) +TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate) { const size_t maxTextures = 8; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); // Half of the memory is taken by surfaces (with high priority place-holder) - scoped_ptr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); - renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); + renderSurfacePlaceHolder->setRequestPriority(PriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -443,27 +443,27 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvailable) +TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvailable) { const size_t maxTextures = 8; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); // Half of the memory is taken by surfaces (with high priority place-holder) - scoped_ptr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); - renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); + renderSurfacePlaceHolder->setRequestPriority(PriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); // Set 6 visible textures in the root surface, and 2 in a child surface. for (size_t i = 0; i < 6; ++i) - textures[i]->setRequestPriority(CCPriorityCalculator::visiblePriority(true)); + textures[i]->setRequestPriority(PriorityCalculator::visiblePriority(true)); for (size_t i = 6; i < 8; ++i) - textures[i]->setRequestPriority(CCPriorityCalculator::visiblePriority(false)); + textures[i]->setRequestPriority(PriorityCalculator::visiblePriority(false)); prioritizeTexturesAndBackings(textureManager.get()); @@ -483,14 +483,14 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, requestLateBackingsSorting) +TEST_F(PrioritizedTextureTest, requestLateBackingsSorting) { const size_t maxTextures = 8; - scoped_ptr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); // Create textures to fill our memory limit. - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -531,15 +531,15 @@ TEST_F(CCPrioritizedTextureTest, requestLateBackingsSorting) textureManager->clearAllMemory(resourceProvider()); } -TEST_F(CCPrioritizedTextureTest, clearUploadsToEvictedResources) +TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources) { const size_t maxTextures = 4; - scoped_ptr<CCPrioritizedTextureManager> textureManager = + scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures); textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); // Create textures to fill our memory limit. - scoped_ptr<CCPrioritizedTexture> textures[maxTextures]; + scoped_ptr<PrioritizedTexture> textures[maxTextures]; for (size_t i = 0; i < maxTextures; ++i) textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); @@ -551,7 +551,7 @@ TEST_F(CCPrioritizedTextureTest, clearUploadsToEvictedResources) for (unsigned i = 0; i < maxTextures; ++i) EXPECT_TRUE(validateTexture(textures[i], false)); - CCTextureUpdateQueue queue; + TextureUpdateQueue queue; DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; for (size_t i = 0; i < maxTextures; ++i) { const ResourceUpdate upload = ResourceUpdate::Create( diff --git a/cc/priority_calculator.cc b/cc/priority_calculator.cc index 055520c..c77e42d 100644 --- a/cc/priority_calculator.cc +++ b/cc/priority_calculator.cc @@ -29,25 +29,25 @@ static const int lingeringBasePriority = 2000000; static const int lingeringLimitPriority = 2900000; // static -int CCPriorityCalculator::uiPriority(bool drawsToRootSurface) +int PriorityCalculator::uiPriority(bool drawsToRootSurface) { return drawsToRootSurface ? uiDrawsToRootSurfacePriority : uiDoesNotDrawToRootSurfacePriority; } // static -int CCPriorityCalculator::visiblePriority(bool drawsToRootSurface) +int PriorityCalculator::visiblePriority(bool drawsToRootSurface) { return drawsToRootSurface ? visibleDrawsToRootSurfacePriority : visibleDoesNotDrawToRootSurfacePriority; } // static -int CCPriorityCalculator::renderSurfacePriority() +int PriorityCalculator::renderSurfacePriority() { return renderSurfacesPriority; } // static -int CCPriorityCalculator::lingeringPriority(int previousPriority) +int PriorityCalculator::lingeringPriority(int previousPriority) { // FIXME: We should remove this once we have priorities for all // textures (we can't currently calculate distances for @@ -67,7 +67,7 @@ int manhattanDistance(const IntRect& a, const IntRect& b) } // static -int CCPriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface) +int PriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface) { int distance = manhattanDistance(visibleRect, textureRect); if (!distance) @@ -76,7 +76,7 @@ int CCPriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const } // static -int CCPriorityCalculator::smallAnimatedLayerMinPriority() +int PriorityCalculator::smallAnimatedLayerMinPriority() { return smallAnimatedLayerPriority; } diff --git a/cc/priority_calculator.h b/cc/priority_calculator.h index 2d0f5ba..c1f5f0c 100644 --- a/cc/priority_calculator.h +++ b/cc/priority_calculator.h @@ -10,7 +10,7 @@ namespace cc { -class CCPriorityCalculator { +class PriorityCalculator { public: static int uiPriority(bool drawsToRootSurface); static int visiblePriority(bool drawsToRootSurface); diff --git a/cc/proxy.cc b/cc/proxy.cc index e9f0d09..390d0a6 100644 --- a/cc/proxy.cc +++ b/cc/proxy.cc @@ -16,36 +16,36 @@ bool implThreadIsOverridden = false; bool s_isMainThreadBlocked = false; base::PlatformThreadId threadIDOverridenToBeImplThread; #endif -CCThread* s_mainThread = 0; -CCThread* s_implThread = 0; +Thread* s_mainThread = 0; +Thread* s_implThread = 0; } -void CCProxy::setMainThread(CCThread* thread) +void Proxy::setMainThread(Thread* thread) { s_mainThread = thread; } -CCThread* CCProxy::mainThread() +Thread* Proxy::mainThread() { return s_mainThread; } -bool CCProxy::hasImplThread() +bool Proxy::hasImplThread() { return s_implThread; } -void CCProxy::setImplThread(CCThread* thread) +void Proxy::setImplThread(Thread* thread) { s_implThread = thread; } -CCThread* CCProxy::implThread() +Thread* Proxy::implThread() { return s_implThread; } -CCThread* CCProxy::currentThread() +Thread* Proxy::currentThread() { base::PlatformThreadId currentThreadIdentifier = base::PlatformThread::CurrentId(); if (s_mainThread && s_mainThread->threadID() == currentThreadIdentifier) @@ -55,7 +55,7 @@ CCThread* CCProxy::currentThread() return 0; } -bool CCProxy::isMainThread() +bool Proxy::isMainThread() { #ifndef NDEBUG DCHECK(s_mainThread); @@ -67,7 +67,7 @@ bool CCProxy::isMainThread() #endif } -bool CCProxy::isImplThread() +bool Proxy::isImplThread() { #ifndef NDEBUG base::PlatformThreadId implThreadID = s_implThread ? s_implThread->threadID() : 0; @@ -80,7 +80,7 @@ bool CCProxy::isImplThread() } #ifndef NDEBUG -void CCProxy::setCurrentThreadIsImplThread(bool isImplThread) +void Proxy::setCurrentThreadIsImplThread(bool isImplThread) { implThreadIsOverridden = isImplThread; if (isImplThread) @@ -88,7 +88,7 @@ void CCProxy::setCurrentThreadIsImplThread(bool isImplThread) } #endif -bool CCProxy::isMainThreadBlocked() +bool Proxy::isMainThreadBlocked() { #ifndef NDEBUG return s_isMainThreadBlocked; @@ -98,18 +98,18 @@ bool CCProxy::isMainThreadBlocked() } #ifndef NDEBUG -void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) +void Proxy::setMainThreadBlocked(bool isMainThreadBlocked) { s_isMainThreadBlocked = isMainThreadBlocked; } #endif -CCProxy::CCProxy() +Proxy::Proxy() { DCHECK(isMainThread()); } -CCProxy::~CCProxy() +Proxy::~Proxy() { DCHECK(isMainThread()); } @@ -11,27 +11,27 @@ namespace cc { -class CCThread; +class Thread; class IntRect; class IntSize; -struct CCRenderingStats; +struct RenderingStats; struct RendererCapabilities; // Abstract class responsible for proxying commands from the main-thread side of // the compositor over to the compositor implementation. -class CCProxy { +class Proxy { public: - static void setMainThread(CCThread*); - static CCThread* mainThread(); + static void setMainThread(Thread*); + static Thread* mainThread(); static bool hasImplThread(); - static void setImplThread(CCThread*); - static CCThread* implThread(); + static void setImplThread(Thread*); + static Thread* implThread(); // Returns 0 if the current thread is neither the main thread nor the impl thread. - static CCThread* currentThread(); + static Thread* currentThread(); - virtual ~CCProxy(); + virtual ~Proxy(); virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0; @@ -57,7 +57,7 @@ public: // reinitialized. virtual bool recreateContext() = 0; - virtual void renderingStats(CCRenderingStats*) = 0; + virtual void renderingStats(RenderingStats*) = 0; virtual const RendererCapabilities& rendererCapabilities() const = 0; @@ -97,12 +97,12 @@ public: #endif protected: - CCProxy(); + Proxy(); friend class DebugScopedSetImplThread; friend class DebugScopedSetMainThreadBlocked; private: - DISALLOW_COPY_AND_ASSIGN(CCProxy); + DISALLOW_COPY_AND_ASSIGN(Proxy); }; class DebugScopedSetMainThreadBlocked { @@ -110,15 +110,15 @@ public: DebugScopedSetMainThreadBlocked() { #ifndef NDEBUG - DCHECK(!CCProxy::isMainThreadBlocked()); - CCProxy::setMainThreadBlocked(true); + DCHECK(!Proxy::isMainThreadBlocked()); + Proxy::setMainThreadBlocked(true); #endif } ~DebugScopedSetMainThreadBlocked() { #ifndef NDEBUG - DCHECK(CCProxy::isMainThreadBlocked()); - CCProxy::setMainThreadBlocked(false); + DCHECK(Proxy::isMainThreadBlocked()); + Proxy::setMainThreadBlocked(false); #endif } }; diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc index 6733b31..bc921c5 100644 --- a/cc/quad_culler.cc +++ b/cc/quad_culler.cc @@ -26,7 +26,7 @@ static const int debugTileBorderColorRed = 160; static const int debugTileBorderColorGreen = 100; static const int debugTileBorderColorBlue = 0; -CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCSharedQuadStateList& sharedQuadStateList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) +QuadCuller::QuadCuller(QuadList& quadList, SharedQuadStateList& sharedQuadStateList, LayerImpl* layer, const OcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) : m_quadList(quadList) , m_sharedQuadStateList(sharedQuadStateList) , m_currentSharedQuadState(0) @@ -37,7 +37,7 @@ CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCSharedQuadStateList& sharedQu { } -CCSharedQuadState* CCQuadCuller::useSharedQuadState(scoped_ptr<CCSharedQuadState> sharedQuadState) +SharedQuadState* QuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> sharedQuadState) { sharedQuadState->id = m_sharedQuadStateList.size(); @@ -47,7 +47,7 @@ CCSharedQuadState* CCQuadCuller::useSharedQuadState(scoped_ptr<CCSharedQuadState return m_currentSharedQuadState; } -static inline bool appendQuadInternal(scoped_ptr<CCDrawQuad> drawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads) +static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const IntRect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads) { bool keepQuad = !culledRect.isEmpty(); if (keepQuad) @@ -59,7 +59,7 @@ static inline bool appendQuadInternal(scoped_ptr<CCDrawQuad> drawQuad, const Int if (keepQuad) { if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quadVisibleRect() != drawQuad->quadRect()) { SkColor borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); - quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadState(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth).PassAs<CCDrawQuad>()); + quadList.append(DebugBorderDrawQuad::create(drawQuad->sharedQuadState(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth).PassAs<DrawQuad>()); } // Pass the quad after we're done using it. @@ -68,7 +68,7 @@ static inline bool appendQuadInternal(scoped_ptr<CCDrawQuad> drawQuad, const Int return keepQuad; } -bool CCQuadCuller::append(scoped_ptr<CCDrawQuad> drawQuad, CCAppendQuadsData& appendQuadsData) +bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQuadsData) { DCHECK(drawQuad->sharedQuadState() == m_currentSharedQuadState); DCHECK(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); diff --git a/cc/quad_culler.h b/cc/quad_culler.h index b3927cc..df23ec6 100644 --- a/cc/quad_culler.h +++ b/cc/quad_culler.h @@ -9,26 +9,26 @@ #include "CCRenderPass.h" namespace cc { -class CCLayerImpl; -class CCRenderSurface; +class LayerImpl; +class RenderSurfaceImpl; template<typename LayerType, typename SurfaceType> -class CCOcclusionTrackerBase; +class OcclusionTrackerBase; -class CCQuadCuller : public CCQuadSink { +class QuadCuller : public QuadSink { public: - CCQuadCuller(CCQuadList&, CCSharedQuadStateList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); - virtual ~CCQuadCuller() { } + QuadCuller(QuadList&, SharedQuadStateList&, LayerImpl*, const OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>*, bool showCullingWithDebugBorderQuads, bool forSurface); + virtual ~QuadCuller() { } - // CCQuadSink implementation. - virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState>) OVERRIDE; - virtual bool append(scoped_ptr<CCDrawQuad>, CCAppendQuadsData&) OVERRIDE; + // QuadSink implementation. + virtual SharedQuadState* useSharedQuadState(scoped_ptr<SharedQuadState>) OVERRIDE; + virtual bool append(scoped_ptr<DrawQuad>, AppendQuadsData&) OVERRIDE; private: - CCQuadList& m_quadList; - CCSharedQuadStateList& m_sharedQuadStateList; - CCSharedQuadState* m_currentSharedQuadState; - CCLayerImpl* m_layer; - const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker; + QuadList& m_quadList; + SharedQuadStateList& m_sharedQuadStateList; + SharedQuadState* m_currentSharedQuadState; + LayerImpl* m_layer; + const OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>* m_occlusionTracker; bool m_showCullingWithDebugBorderQuads; bool m_forSurface; }; diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc index dd1b460..38d88f2 100644 --- a/cc/quad_culler_unittest.cc +++ b/cc/quad_culler_unittest.cc @@ -23,27 +23,27 @@ using WebKit::WebTransformationMatrix; namespace { -class TestCCOcclusionTrackerImpl : public CCOcclusionTrackerImpl { +class TestOcclusionTrackerImpl : public OcclusionTrackerImpl { public: - TestCCOcclusionTrackerImpl(const IntRect& scissorRectInScreen, bool recordMetricsForFrame = true) - : CCOcclusionTrackerImpl(scissorRectInScreen, recordMetricsForFrame) + TestOcclusionTrackerImpl(const IntRect& scissorRectInScreen, bool recordMetricsForFrame = true) + : OcclusionTrackerImpl(scissorRectInScreen, recordMetricsForFrame) , m_scissorRectInScreen(scissorRectInScreen) { } protected: - virtual IntRect layerScissorRectInTargetSurface(const CCLayerImpl* layer) const { return m_scissorRectInScreen; } + virtual IntRect layerScissorRectInTargetSurface(const LayerImpl* layer) const { return m_scissorRectInScreen; } private: IntRect m_scissorRectInScreen; }; -typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; +typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; -static scoped_ptr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<CCLayerImpl*>& surfaceLayerList) +static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList) { - scoped_ptr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); - scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); + scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1); + scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::NoBorderTexels); tiler->setBounds(layerRect.size()); layer->setTilingData(*tiler); layer->setSkipsDraw(false); @@ -55,14 +55,14 @@ static scoped_ptr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We layer->setBounds(layerRect.size()); layer->setContentBounds(layerRect.size()); - CCResourceProvider::ResourceId resourceId = 1; + ResourceProvider::ResourceId resourceId = 1; for (int i = 0; i < tiler->numTilesX(); ++i) for (int j = 0; j < tiler->numTilesY(); ++j) { IntRect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : intersection(tiler->tileBounds(i, j), layerOpaqueRect); layer->pushTileProperties(i, j, resourceId++, tileOpaqueRect); } - IntRect rectInTarget = CCMathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect()); + IntRect rectInTarget = MathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect()); if (!parent) { layer->createRenderSurface(); surfaceLayerList.push_back(layer.get()); @@ -70,18 +70,18 @@ static scoped_ptr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We } else { layer->setRenderTarget(parent->renderTarget()); parent->renderSurface()->layerList().push_back(layer.get()); - rectInTarget.unite(CCMathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect())); + rectInTarget.unite(MathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect())); } layer->setDrawableContentRect(rectInTarget); return layer.Pass(); } -static void appendQuads(CCQuadList& quadList, CCSharedQuadStateList& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) +static void appendQuads(QuadList& quadList, SharedQuadStateList& sharedStateList, TiledLayerImpl* layer, LayerIteratorType& it, OcclusionTrackerImpl& occlusionTracker) { occlusionTracker.enterLayer(it); - CCQuadCuller quadCuller(quadList, sharedStateList, layer, &occlusionTracker, false, false); - CCAppendQuadsData data; + QuadCuller quadCuller(quadList, sharedStateList, layer, &occlusionTracker, false, false); + AppendQuadsData data; layer->appendQuads(quadCuller, data); occlusionTracker.leaveLayer(it); ++it; @@ -89,23 +89,23 @@ static void appendQuads(CCQuadList& quadList, CCSharedQuadStateList& sharedState #define DECLARE_AND_INITIALIZE_TEST_QUADS \ DebugScopedSetImplThread impl; \ - CCQuadList quadList; \ - CCSharedQuadStateList sharedStateList; \ - std::vector<CCLayerImpl*> renderSurfaceLayerList; \ + QuadList quadList; \ + SharedQuadStateList sharedStateList; \ + std::vector<LayerImpl*> renderSurfaceLayerList; \ WebTransformationMatrix childTransform; \ IntSize rootSize = IntSize(300, 300); \ IntRect rootRect = IntRect(IntPoint(), rootSize); \ IntSize childSize = IntSize(200, 200); \ IntRect childRect = IntRect(IntPoint(), childSize); -TEST(CCQuadCullerTest, verifyNoCulling) +TEST(QuadCullerTest, verifyNoCulling) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -115,14 +115,14 @@ TEST(CCQuadCullerTest, verifyNoCulling) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); } -TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) +TEST(QuadCullerTest, verifyCullChildLinesUpTopLeft) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -132,14 +132,14 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 40000, 1); } -TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) +TEST(QuadCullerTest, verifyCullWhenChildOpacityNotOne) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -149,14 +149,14 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); } -TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) +TEST(QuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -166,16 +166,16 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); } -TEST(CCQuadCullerTest, verifyCullCenterTileOnly) +TEST(QuadCullerTest, verifyCullCenterTileOnly) { DECLARE_AND_INITIALIZE_TEST_QUADS childTransform.translate(50, 50); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -201,7 +201,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 30000, 1); } -TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) +TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize1) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -215,10 +215,10 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) rootRect = childRect = IntRect(0, 0, 100, 100); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -229,7 +229,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); } -TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) +TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize2) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -243,10 +243,10 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) rootRect = childRect = IntRect(0, 0, 100, 100); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -257,16 +257,16 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); } -TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) +TEST(QuadCullerTest, verifyCullChildLinesUpBottomRight) { DECLARE_AND_INITIALIZE_TEST_QUADS childTransform.translate(100, 100); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -276,17 +276,17 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 40000, 1); } -TEST(CCQuadCullerTest, verifyCullSubRegion) +TEST(QuadCullerTest, verifyCullSubRegion) { DECLARE_AND_INITIALIZE_TEST_QUADS childTransform.translate(50, 50); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -296,17 +296,17 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 10000, 1); } -TEST(CCQuadCullerTest, verifyCullSubRegion2) +TEST(QuadCullerTest, verifyCullSubRegion2) { DECLARE_AND_INITIALIZE_TEST_QUADS childTransform.translate(50, 10); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -316,17 +316,17 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 15000, 1); } -TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) +TEST(QuadCullerTest, verifyCullSubRegionCheckOvercull) { DECLARE_AND_INITIALIZE_TEST_QUADS childTransform.translate(50, 49); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -336,17 +336,17 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 10000, 1); } -TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) +TEST(QuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) { DECLARE_AND_INITIALIZE_TEST_QUADS // Use a small rotation so as to not disturb the geometry significantly. childTransform.rotate(1); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -361,7 +361,7 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) // tile parent layer is rotated by 1 degree. Of the four tiles the child would // normally occlude, three will move (slightly) out from under the child layer, and // one moves further under the child. Only this last tile should be culled. -TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) +TEST(QuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -369,10 +369,10 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) WebTransformationMatrix parentTransform; parentTransform.rotate(1); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -382,14 +382,14 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 29400, 1); } -TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) +TEST(QuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -399,14 +399,14 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 120000, 1); } -TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) +TEST(QuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -416,14 +416,14 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 120000, 1); } -TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) +TEST(QuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -433,14 +433,14 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 90000, 1); } -TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) +TEST(QuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); @@ -450,14 +450,14 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 130000, 1); } -TEST(CCQuadCullerTest, verifyWithoutMetrics) +TEST(QuadCullerTest, verifyWithoutMetrics) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); - TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); - CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + TestOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); + LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); diff --git a/cc/quad_sink.h b/cc/quad_sink.h index 06d31b0..e925756 100644 --- a/cc/quad_sink.h +++ b/cc/quad_sink.h @@ -9,21 +9,21 @@ namespace cc { -class CCDrawQuad; +class DrawQuad; -struct CCAppendQuadsData; -struct CCSharedQuadState; +struct AppendQuadsData; +struct SharedQuadState; -class CCQuadSink { +class QuadSink { public: - virtual ~CCQuadSink() { } + virtual ~QuadSink() { } // Call this to add a SharedQuadState before appending quads that refer to it. Returns a pointer // to the given SharedQuadState for convenience, that can be set on the quads to append. - virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState>) = 0; + virtual SharedQuadState* useSharedQuadState(scoped_ptr<SharedQuadState>) = 0; // Returns true if the quad is added to the list, and false if the quad is entirely culled. - virtual bool append(scoped_ptr<CCDrawQuad> passDrawQuad, CCAppendQuadsData&) = 0; + virtual bool append(scoped_ptr<DrawQuad> passDrawQuad, AppendQuadsData&) = 0; }; } diff --git a/cc/rate_limiter.cc b/cc/rate_limiter.cc index 2fd4994..53c7aef 100644 --- a/cc/rate_limiter.cc +++ b/cc/rate_limiter.cc @@ -13,7 +13,7 @@ namespace cc { -class RateLimiter::Task : public CCThread::Task { +class RateLimiter::Task : public Thread::Task { public: static PassOwnPtr<Task> create(RateLimiter* rateLimiter) { @@ -23,7 +23,7 @@ public: private: explicit Task(RateLimiter* rateLimiter) - : CCThread::Task(this) + : Thread::Task(this) , m_rateLimiter(rateLimiter) { } @@ -60,7 +60,7 @@ void RateLimiter::start() TRACE_EVENT0("cc", "RateLimiter::start"); m_active = true; - CCProxy::mainThread()->postTask(RateLimiter::Task::create(this)); + Proxy::mainThread()->postTask(RateLimiter::Task::create(this)); } void RateLimiter::stop() diff --git a/cc/render_pass.cc b/cc/render_pass.cc index 58e7dfe..39cb2b3 100644 --- a/cc/render_pass.cc +++ b/cc/render_pass.cc @@ -17,12 +17,12 @@ using WebKit::WebTransformationMatrix; namespace cc { -scoped_ptr<CCRenderPass> CCRenderPass::create(Id id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) +scoped_ptr<RenderPass> RenderPass::create(Id id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) { - return make_scoped_ptr(new CCRenderPass(id, outputRect, transformToRootTarget)); + return make_scoped_ptr(new RenderPass(id, outputRect, transformToRootTarget)); } -CCRenderPass::CCRenderPass(Id id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) +RenderPass::RenderPass(Id id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) : m_id(id) , m_transformToRootTarget(transformToRootTarget) , m_outputRect(outputRect) @@ -33,15 +33,15 @@ CCRenderPass::CCRenderPass(Id id, IntRect outputRect, const WebKit::WebTransform DCHECK(id.index >= 0); } -CCRenderPass::~CCRenderPass() +RenderPass::~RenderPass() { } -scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const +scoped_ptr<RenderPass> RenderPass::copy(Id newId) const { DCHECK(newId != m_id); - scoped_ptr<CCRenderPass> copyPass(create(newId, m_outputRect, m_transformToRootTarget)); + scoped_ptr<RenderPass> copyPass(create(newId, m_outputRect, m_transformToRootTarget)); copyPass->setDamageRect(m_damageRect); copyPass->setHasTransparentBackground(m_hasTransparentBackground); copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideTargetSurface); @@ -50,18 +50,18 @@ scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const return copyPass.Pass(); } -void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, CCAppendQuadsData& appendQuadsData) +void RenderPass::appendQuadsForLayer(LayerImpl* layer, OcclusionTrackerImpl* occlusionTracker, AppendQuadsData& appendQuadsData) { const bool forSurface = false; - CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); + QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); layer->appendQuads(quadCuller, appendQuadsData); } -void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker, CCAppendQuadsData& appendQuadsData) +void RenderPass::appendQuadsForRenderSurfaceLayer(LayerImpl* layer, const RenderPass* contributingRenderPass, OcclusionTrackerImpl* occlusionTracker, AppendQuadsData& appendQuadsData) { const bool forSurface = true; - CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); + QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); bool isReplica = false; layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isReplica, contributingRenderPass->id()); @@ -73,7 +73,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC } } -void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl& occlusionTracker) +void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBackgroundColor, const OcclusionTrackerImpl& occlusionTracker) { if (!rootLayer || !screenBackgroundColor) return; @@ -83,7 +83,7 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree return; bool forSurface = false; - CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusionTracker, rootLayer->hasDebugBorders(), forSurface); + QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusionTracker, rootLayer->hasDebugBorders(), forSurface); // Manually create the quad state for the gutter quads, as the root layer // doesn't have any bounds and so can't generate this itself. @@ -91,15 +91,15 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree IntRect rootTargetRect = rootLayer->renderSurface()->contentRect(); float opacity = 1; bool opaque = true; - CCSharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(CCSharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque)); + SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque)); DCHECK(rootLayer->screenSpaceTransform().isInvertible()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<WebCore::IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient. - IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i])); + IntRect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i])); // Skip the quad culler and just append the quads directly to avoid occlusion checks. - m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<CCDrawQuad>()); + m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>()); } } diff --git a/cc/render_pass.h b/cc/render_pass.h index 526d715..0349763 100644 --- a/cc/render_pass.h +++ b/cc/render_pass.h @@ -19,17 +19,17 @@ namespace cc { -class CCLayerImpl; +class LayerImpl; template<typename LayerType, typename SurfaceType> -class CCOcclusionTrackerBase; -class CCRenderSurface; +class OcclusionTrackerBase; +class RenderSurfaceImpl; -struct CCAppendQuadsData; +struct AppendQuadsData; -typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl; +typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; -// A list of CCDrawQuad objects, sorted internally in front-to-back order. -class CCQuadList : public ScopedPtrVector<CCDrawQuad> { +// A list of DrawQuad objects, sorted internally in front-to-back order. +class QuadList : public ScopedPtrVector<DrawQuad> { public: typedef reverse_iterator backToFrontIterator; typedef const_reverse_iterator constBackToFrontIterator; @@ -40,11 +40,11 @@ public: inline constBackToFrontIterator backToFrontEnd() const { return rend(); } }; -typedef ScopedPtrVector<CCSharedQuadState> CCSharedQuadStateList; +typedef ScopedPtrVector<SharedQuadState> SharedQuadStateList; -class CCRenderPass { +class RenderPass { public: - ~CCRenderPass(); + ~RenderPass(); struct Id { int layerId; @@ -61,16 +61,16 @@ public: bool operator<(const Id& other) const { return layerId < other.layerId || (layerId == other.layerId && index < other.index); } }; - static scoped_ptr<CCRenderPass> create(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); + static scoped_ptr<RenderPass> create(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); // A shallow copy of the render pass, which does not include its quads. - scoped_ptr<CCRenderPass> copy(Id newId) const; + scoped_ptr<RenderPass> copy(Id newId) const; - void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuadsData&); - void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); - void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl&); + void appendQuadsForLayer(LayerImpl*, OcclusionTrackerImpl*, AppendQuadsData&); + void appendQuadsForRenderSurfaceLayer(LayerImpl*, const RenderPass* contributingRenderPass, OcclusionTrackerImpl*, AppendQuadsData&); + void appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBackgroundColor, const OcclusionTrackerImpl&); - const CCQuadList& quadList() const { return m_quadList; } + const QuadList& quadList() const { return m_quadList; } Id id() const { return m_id; } @@ -96,11 +96,11 @@ public: bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; } void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; } protected: - CCRenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); + RenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); Id m_id; - CCQuadList m_quadList; - CCSharedQuadStateList m_sharedQuadStateList; + QuadList m_quadList; + SharedQuadStateList m_sharedQuadStateList; WebKit::WebTransformationMatrix m_transformToRootTarget; IntRect m_outputRect; FloatRect m_damageRect; @@ -109,7 +109,7 @@ protected: WebKit::WebFilterOperations m_filters; WebKit::WebFilterOperations m_backgroundFilters; - DISALLOW_COPY_AND_ASSIGN(CCRenderPass); + DISALLOW_COPY_AND_ASSIGN(RenderPass); }; } // namespace cc @@ -117,13 +117,13 @@ protected: namespace BASE_HASH_NAMESPACE { #if defined(COMPILER_MSVC) template<> -inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key) { +inline size_t hash_value<cc::RenderPass::Id>(const cc::RenderPass::Id& key) { return hash_value<std::pair<int, int> >(std::pair<int, int>(key.layerId, key.index)); } #elif defined(COMPILER_GCC) template<> -struct hash<cc::CCRenderPass::Id> { - size_t operator()(cc::CCRenderPass::Id key) const { +struct hash<cc::RenderPass::Id> { + size_t operator()(cc::RenderPass::Id key) const { return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key.index)); } }; @@ -133,8 +133,8 @@ struct hash<cc::CCRenderPass::Id> { } namespace cc { -typedef std::vector<CCRenderPass*> CCRenderPassList; -typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap; +typedef std::vector<RenderPass*> RenderPassList; +typedef ScopedPtrHashMap<RenderPass::Id, RenderPass> RenderPassIdHashMap; } // namespace cc #endif diff --git a/cc/render_pass_draw_quad.cc b/cc/render_pass_draw_quad.cc index 8cec50f..728f54f 100644 --- a/cc/render_pass_draw_quad.cc +++ b/cc/render_pass_draw_quad.cc @@ -8,13 +8,13 @@ namespace cc { -scoped_ptr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCRenderPass::Id renderPassId, bool isReplica, const CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY) +scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, RenderPass::Id renderPassId, bool isReplica, const ResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY) { - return make_scoped_ptr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY)); + return make_scoped_ptr(new RenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY)); } -CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY) - : CCDrawQuad(sharedQuadState, CCDrawQuad::RenderPass, quadRect) +RenderPassDrawQuad::RenderPassDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, RenderPass::Id renderPassId, bool isReplica, ResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY) + : DrawQuad(sharedQuadState, DrawQuad::RenderPass, quadRect) , m_renderPassId(renderPassId) , m_isReplica(isReplica) , m_maskResourceId(maskResourceId) @@ -28,18 +28,18 @@ CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadSt DCHECK(m_renderPassId.index >= 0); } -const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const CCDrawQuad* quad) +const RenderPassDrawQuad* RenderPassDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::RenderPass); - return static_cast<const CCRenderPassDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::RenderPass); + return static_cast<const RenderPassDrawQuad*>(quad); } -scoped_ptr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::copy(const CCSharedQuadState* copiedSharedQuadState, CCRenderPass::Id copiedRenderPassId) const +scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::copy(const SharedQuadState* copiedSharedQuadState, RenderPass::Id copiedRenderPassId) const { unsigned bytes = size(); DCHECK(bytes > 0); - scoped_ptr<CCRenderPassDrawQuad> copyQuad(reinterpret_cast<CCRenderPassDrawQuad*>(new char[bytes])); + scoped_ptr<RenderPassDrawQuad> copyQuad(reinterpret_cast<RenderPassDrawQuad*>(new char[bytes])); memcpy(copyQuad.get(), this, bytes); copyQuad->setSharedQuadState(copiedSharedQuadState); copyQuad->m_renderPassId = copiedRenderPassId; diff --git a/cc/render_pass_draw_quad.h b/cc/render_pass_draw_quad.h index 99222d9..4837519 100644 --- a/cc/render_pass_draw_quad.h +++ b/cc/render_pass_draw_quad.h @@ -14,36 +14,36 @@ namespace cc { -class CCRenderPassDrawQuad : public CCDrawQuad { +class RenderPassDrawQuad : public DrawQuad { public: - static scoped_ptr<CCRenderPassDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY); + static scoped_ptr<RenderPassDrawQuad> create(const SharedQuadState*, const IntRect&, RenderPass::Id renderPassId, bool isReplica, ResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY); - CCRenderPass::Id renderPassId() const { return m_renderPassId; } + RenderPass::Id renderPassId() const { return m_renderPassId; } bool isReplica() const { return m_isReplica; } - CCResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; } + ResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; } const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; } - static const CCRenderPassDrawQuad* materialCast(const CCDrawQuad*); + static const RenderPassDrawQuad* materialCast(const DrawQuad*); float maskTexCoordScaleX() const { return m_maskTexCoordScaleX; } float maskTexCoordScaleY() const { return m_maskTexCoordScaleY; } float maskTexCoordOffsetX() const { return m_maskTexCoordOffsetX; } float maskTexCoordOffsetY() const { return m_maskTexCoordOffsetY; } - scoped_ptr<CCRenderPassDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState, CCRenderPass::Id copiedRenderPassId) const; + scoped_ptr<RenderPassDrawQuad> copy(const SharedQuadState* copiedSharedQuadState, RenderPass::Id copiedRenderPassId) const; private: - CCRenderPassDrawQuad(const CCSharedQuadState*, const IntRect&, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY); + RenderPassDrawQuad(const SharedQuadState*, const IntRect&, RenderPass::Id renderPassId, bool isReplica, ResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY); - CCRenderPass::Id m_renderPassId; + RenderPass::Id m_renderPassId; bool m_isReplica; - CCResourceProvider::ResourceId m_maskResourceId; + ResourceProvider::ResourceId m_maskResourceId; IntRect m_contentsChangedSinceLastFrame; float m_maskTexCoordScaleX; float m_maskTexCoordScaleY; float m_maskTexCoordOffsetX; float m_maskTexCoordOffsetY; - DISALLOW_COPY_AND_ASSIGN(CCRenderPassDrawQuad); + DISALLOW_COPY_AND_ASSIGN(RenderPassDrawQuad); }; } diff --git a/cc/render_pass_sink.h b/cc/render_pass_sink.h index f3bac1d..efef7f2 100644 --- a/cc/render_pass_sink.h +++ b/cc/render_pass_sink.h @@ -9,11 +9,11 @@ namespace cc { -class CCRenderPass; +class RenderPass; -class CCRenderPassSink { +class RenderPassSink { public: - virtual void appendRenderPass(scoped_ptr<CCRenderPass>) = 0; + virtual void appendRenderPass(scoped_ptr<RenderPass>) = 0; }; } diff --git a/cc/render_pass_unittest.cc b/cc/render_pass_unittest.cc index 6a3a0ec..bb08221 100644 --- a/cc/render_pass_unittest.cc +++ b/cc/render_pass_unittest.cc @@ -20,17 +20,17 @@ using namespace cc; namespace { -class CCTestRenderPass : public CCRenderPass { +class TestRenderPass : public RenderPass { public: - CCQuadList& quadList() { return m_quadList; } - CCSharedQuadStateList& sharedQuadStateList() { return m_sharedQuadStateList; } + QuadList& quadList() { return m_quadList; } + SharedQuadStateList& sharedQuadStateList() { return m_sharedQuadStateList; } }; -struct CCRenderPassSize { +struct RenderPassSize { // If you add a new field to this class, make sure to add it to the copy() tests. - CCRenderPass::Id m_id; - CCQuadList m_quadList; - CCSharedQuadStateList m_sharedQuadStateList; + RenderPass::Id m_id; + QuadList m_quadList; + SharedQuadStateList m_sharedQuadStateList; WebKit::WebTransformationMatrix m_transformToRootTarget; IntRect m_outputRect; FloatRect m_damageRect; @@ -40,13 +40,13 @@ struct CCRenderPassSize { WebKit::WebFilterOperations m_backgroundFilters; }; -TEST(CCRenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) +TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) { - CCRenderPass::Id id(3, 2); + RenderPass::Id id(3, 2); IntRect outputRect(45, 22, 120, 13); WebTransformationMatrix transformToRoot(1, 0.5, 0.5, -0.5, -1, 0); - scoped_ptr<CCRenderPass> pass = CCRenderPass::create(id, outputRect, transformToRoot); + scoped_ptr<RenderPass> pass = RenderPass::create(id, outputRect, transformToRoot); IntRect damageRect(56, 123, 19, 43); bool hasTransparentBackground = true; @@ -64,13 +64,13 @@ TEST(CCRenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) pass->setBackgroundFilters(backgroundFilters); // Stick a quad in the pass, this should not get copied. - CCTestRenderPass* testPass = static_cast<CCTestRenderPass*>(pass.get()); - testPass->sharedQuadStateList().append(CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1, false)); - testPass->quadList().append(CCCheckerboardDrawQuad::create(testPass->sharedQuadStateList().last(), IntRect(), SkColor()).PassAs<CCDrawQuad>()); + TestRenderPass* testPass = static_cast<TestRenderPass*>(pass.get()); + testPass->sharedQuadStateList().append(SharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1, false)); + testPass->quadList().append(CheckerboardDrawQuad::create(testPass->sharedQuadStateList().last(), IntRect(), SkColor()).PassAs<DrawQuad>()); - CCRenderPass::Id newId(63, 4); + RenderPass::Id newId(63, 4); - scoped_ptr<CCRenderPass> copy = pass->copy(newId); + scoped_ptr<RenderPass> copy = pass->copy(newId); EXPECT_EQ(newId, copy->id()); EXPECT_RECT_EQ(pass->outputRect(), copy->outputRect()); EXPECT_EQ(pass->transformToRootTarget(), copy->transformToRootTarget()); @@ -81,7 +81,7 @@ TEST(CCRenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) EXPECT_EQ(pass->backgroundFilters(), copy->backgroundFilters()); EXPECT_EQ(0u, copy->quadList().size()); - EXPECT_EQ(sizeof(CCRenderPassSize), sizeof(CCRenderPass)); + EXPECT_EQ(sizeof(RenderPassSize), sizeof(RenderPass)); } } // namespace diff --git a/cc/render_surface.cc b/cc/render_surface.cc index 769a622..ffe16d2 100644 --- a/cc/render_surface.cc +++ b/cc/render_surface.cc @@ -14,7 +14,7 @@ using WebKit::WebTransformationMatrix; namespace cc { -RenderSurfaceChromium::RenderSurfaceChromium(LayerChromium* owningLayer) +RenderSurface::RenderSurface(Layer* owningLayer) : m_owningLayer(owningLayer) , m_drawOpacity(1) , m_drawOpacityIsAnimating(false) @@ -24,15 +24,15 @@ RenderSurfaceChromium::RenderSurfaceChromium(LayerChromium* owningLayer) { } -RenderSurfaceChromium::~RenderSurfaceChromium() +RenderSurface::~RenderSurface() { } -FloatRect RenderSurfaceChromium::drawableContentRect() const +FloatRect RenderSurface::drawableContentRect() const { - FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, m_contentRect); + FloatRect drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect); if (m_owningLayer->hasReplica()) - drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect)); + drawableContentRect.unite(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect)); return drawableContentRect; } diff --git a/cc/render_surface.h b/cc/render_surface.h index cd3ea6f..a78b53f 100644 --- a/cc/render_surface.h +++ b/cc/render_surface.h @@ -15,14 +15,14 @@ namespace cc { -class LayerChromium; +class Layer; -class RenderSurfaceChromium { +class RenderSurface { public: - explicit RenderSurfaceChromium(LayerChromium*); - ~RenderSurfaceChromium(); + explicit RenderSurface(Layer*); + ~RenderSurface(); - // Returns the rect that encloses the RenderSurface including any reflection. + // Returns the rect that encloses the RenderSurfaceImpl including any reflection. FloatRect drawableContentRect() const; const IntRect& contentRect() const { return m_contentRect; } @@ -56,20 +56,20 @@ public: const IntRect& clipRect() const { return m_clipRect; } void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; } - typedef std::vector<scoped_refptr<LayerChromium> > LayerList; + typedef std::vector<scoped_refptr<Layer> > LayerList; LayerList& layerList() { return m_layerList; } // A no-op since DelegatedRendererLayers on the main thread don't have any // RenderPasses so they can't contribute to a surface. - void addContributingDelegatedRenderPassLayer(LayerChromium*) { } + void addContributingDelegatedRenderPassLayer(Layer*) { } void clearLayerLists() { m_layerList.clear(); } - void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_nearestAncestorThatMovesPixels = surface; } - const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; } + void setNearestAncestorThatMovesPixels(RenderSurface* surface) { m_nearestAncestorThatMovesPixels = surface; } + const RenderSurface* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; } private: - friend struct CCLayerIteratorActions; + friend struct LayerIteratorActions; - LayerChromium* m_owningLayer; + Layer* m_owningLayer; // Uses this surface's space. IntRect m_contentRect; @@ -90,13 +90,13 @@ private: // The nearest ancestor target surface that will contain the contents of this surface, and that is going // to move pixels within the surface (such as with a blur). This can point to itself. - RenderSurfaceChromium* m_nearestAncestorThatMovesPixels; + RenderSurface* m_nearestAncestorThatMovesPixels; - // For CCLayerIteratorActions + // For LayerIteratorActions int m_targetRenderSurfaceLayerIndexHistory; int m_currentLayerIndexHistory; - DISALLOW_COPY_AND_ASSIGN(RenderSurfaceChromium); + DISALLOW_COPY_AND_ASSIGN(RenderSurface); }; } diff --git a/cc/render_surface_filters.cc b/cc/render_surface_filters.cc index 5f683bf..b385fd8 100644 --- a/cc/render_surface_filters.cc +++ b/cc/render_surface_filters.cc @@ -313,7 +313,7 @@ private: namespace cc { -WebKit::WebFilterOperations CCRenderSurfaceFilters::optimize(const WebKit::WebFilterOperations& filters) +WebKit::WebFilterOperations RenderSurfaceFilters::optimize(const WebKit::WebFilterOperations& filters) { WebKit::WebFilterOperations newList; @@ -368,7 +368,7 @@ WebKit::WebFilterOperations CCRenderSurfaceFilters::optimize(const WebKit::WebFi return newList; } -SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize& size, WebKit::WebGraphicsContext3D* context3D, GrContext* grContext) +SkBitmap RenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize& size, WebKit::WebGraphicsContext3D* context3D, GrContext* grContext) { if (!context3D || !grContext) return SkBitmap(); diff --git a/cc/render_surface_filters.h b/cc/render_surface_filters.h index b8cf60e..4ffc9fd 100644 --- a/cc/render_surface_filters.h +++ b/cc/render_surface_filters.h @@ -17,13 +17,13 @@ class WebGraphicsContext3D; namespace cc { class FloatSize; -class CCRenderSurfaceFilters { +class RenderSurfaceFilters { public: static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize&, WebKit::WebGraphicsContext3D*, GrContext*); static WebKit::WebFilterOperations optimize(const WebKit::WebFilterOperations& filters); private: - CCRenderSurfaceFilters(); + RenderSurfaceFilters(); }; } diff --git a/cc/render_surface_filters_unittest.cc b/cc/render_surface_filters_unittest.cc index a793197..d8be810 100644 --- a/cc/render_surface_filters_unittest.cc +++ b/cc/render_surface_filters_unittest.cc @@ -22,11 +22,11 @@ bool isCombined(const WebFilterOperation& op) WebFilterOperations filters; filters.append(op); filters.append(WebFilterOperation::createBrightnessFilter(0)); // brightness(0) is identity. - WebFilterOperations optimized = CCRenderSurfaceFilters::optimize(filters); + WebFilterOperations optimized = RenderSurfaceFilters::optimize(filters); return optimized.size() == 1; } -TEST(CCRenderSurfaceFiltersTest, testColorMatrixFiltersCombined) +TEST(RenderSurfaceFiltersTest, testColorMatrixFiltersCombined) { // Several filters should always combine for any amount between 0 and 1: // grayscale, saturate, invert, contrast, opacity. @@ -103,37 +103,37 @@ TEST(CCRenderSurfaceFiltersTest, testColorMatrixFiltersCombined) EXPECT_TRUE(isCombined(WebFilterOperation::createColorMatrixFilter(matrix4))); } -TEST(CCRenderSurfaceFiltersTest, testOptimize) +TEST(RenderSurfaceFiltersTest, testOptimize) { WebFilterOperation combines(WebFilterOperation::createBrightnessFilter(0)); WebFilterOperation doesntCombine(WebFilterOperation::createBrightnessFilter(1)); WebFilterOperations filters; - WebFilterOperations optimized = CCRenderSurfaceFilters::optimize(filters); + WebFilterOperations optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(0u, optimized.size()); filters.append(combines); - optimized = CCRenderSurfaceFilters::optimize(filters); + optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(1u, optimized.size()); filters.append(combines); - optimized = CCRenderSurfaceFilters::optimize(filters); + optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(1u, optimized.size()); filters.append(doesntCombine); - optimized = CCRenderSurfaceFilters::optimize(filters); + optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(1u, optimized.size()); filters.append(combines); - optimized = CCRenderSurfaceFilters::optimize(filters); + optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(2u, optimized.size()); filters.append(doesntCombine); - optimized = CCRenderSurfaceFilters::optimize(filters); + optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(2u, optimized.size()); filters.append(doesntCombine); - optimized = CCRenderSurfaceFilters::optimize(filters); + optimized = RenderSurfaceFilters::optimize(filters); EXPECT_EQ(3u, optimized.size()); } diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc index 7f7a568..0643f54 100644 --- a/cc/render_surface_impl.cc +++ b/cc/render_surface_impl.cc @@ -33,7 +33,7 @@ static const int debugReplicaBorderColorRed = 160; static const int debugReplicaBorderColorGreen = 0; static const int debugReplicaBorderColorBlue = 255; -CCRenderSurface::CCRenderSurface(CCLayerImpl* owningLayer) +RenderSurfaceImpl::RenderSurfaceImpl(LayerImpl* owningLayer) : m_owningLayer(owningLayer) , m_surfacePropertyChanged(false) , m_drawOpacity(1) @@ -44,25 +44,25 @@ CCRenderSurface::CCRenderSurface(CCLayerImpl* owningLayer) , m_targetRenderSurfaceLayerIndexHistory(0) , m_currentLayerIndexHistory(0) { - m_damageTracker = CCDamageTracker::create(); + m_damageTracker = DamageTracker::create(); } -CCRenderSurface::~CCRenderSurface() +RenderSurfaceImpl::~RenderSurfaceImpl() { } -FloatRect CCRenderSurface::drawableContentRect() const +FloatRect RenderSurfaceImpl::drawableContentRect() const { - FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, m_contentRect); + FloatRect drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect); if (m_owningLayer->hasReplica()) - drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect)); + drawableContentRect.unite(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect)); return drawableContentRect; } -std::string CCRenderSurface::name() const +std::string RenderSurfaceImpl::name() const { - return base::StringPrintf("RenderSurface(id=%i,owner=%s)", m_owningLayer->id(), m_owningLayer->debugName().data()); + return base::StringPrintf("RenderSurfaceImpl(id=%i,owner=%s)", m_owningLayer->id(), m_owningLayer->debugName().data()); } static std::string indentString(int indent) @@ -73,7 +73,7 @@ static std::string indentString(int indent) return str; } -void CCRenderSurface::dumpSurface(std::string* str, int indent) const +void RenderSurfaceImpl::dumpSurface(std::string* str, int indent) const { std::string indentStr = indentString(indent); str->append(indentStr); @@ -96,13 +96,13 @@ void CCRenderSurface::dumpSurface(std::string* str, int indent) const m_damageTracker->currentDamageRect().width(), m_damageTracker->currentDamageRect().height()); } -int CCRenderSurface::owningLayerId() const +int RenderSurfaceImpl::owningLayerId() const { return m_owningLayer ? m_owningLayer->id() : 0; } -void CCRenderSurface::setClipRect(const IntRect& clipRect) +void RenderSurfaceImpl::setClipRect(const IntRect& clipRect) { if (m_clipRect == clipRect) return; @@ -111,12 +111,12 @@ void CCRenderSurface::setClipRect(const IntRect& clipRect) m_clipRect = clipRect; } -bool CCRenderSurface::contentsChanged() const +bool RenderSurfaceImpl::contentsChanged() const { return !m_damageTracker->currentDamageRect().isEmpty(); } -void CCRenderSurface::setContentRect(const IntRect& contentRect) +void RenderSurfaceImpl::setContentRect(const IntRect& contentRect) { if (m_contentRect == contentRect) return; @@ -125,7 +125,7 @@ void CCRenderSurface::setContentRect(const IntRect& contentRect) m_contentRect = contentRect; } -bool CCRenderSurface::surfacePropertyChanged() const +bool RenderSurfaceImpl::surfacePropertyChanged() const { // Surface property changes are tracked as follows: // @@ -139,30 +139,30 @@ bool CCRenderSurface::surfacePropertyChanged() const return m_surfacePropertyChanged || m_owningLayer->layerPropertyChanged(); } -bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const +bool RenderSurfaceImpl::surfacePropertyChangedOnlyFromDescendant() const { return m_surfacePropertyChanged && !m_owningLayer->layerPropertyChanged(); } -void CCRenderSurface::addContributingDelegatedRenderPassLayer(CCLayerImpl* layer) +void RenderSurfaceImpl::addContributingDelegatedRenderPassLayer(LayerImpl* layer) { DCHECK(std::find(m_layerList.begin(), m_layerList.end(), layer) != m_layerList.end()); - CCDelegatedRendererLayerImpl* delegatedRendererLayer = static_cast<CCDelegatedRendererLayerImpl*>(layer); + DelegatedRendererLayerImpl* delegatedRendererLayer = static_cast<DelegatedRendererLayerImpl*>(layer); m_contributingDelegatedRenderPassLayerList.push_back(delegatedRendererLayer); } -void CCRenderSurface::clearLayerLists() +void RenderSurfaceImpl::clearLayerLists() { m_layerList.clear(); m_contributingDelegatedRenderPassLayerList.clear(); } -static inline IntRect computeClippedRectInTarget(const CCLayerImpl* owningLayer) +static inline IntRect computeClippedRectInTarget(const LayerImpl* owningLayer) { DCHECK(owningLayer->parent()); - const CCLayerImpl* renderTarget = owningLayer->parent()->renderTarget(); - const CCRenderSurface* self = owningLayer->renderSurface(); + const LayerImpl* renderTarget = owningLayer->parent()->renderTarget(); + const RenderSurfaceImpl* self = owningLayer->renderSurface(); IntRect clippedRectInTarget = self->clipRect(); if (owningLayer->backgroundFilters().hasFilterThatMovesPixels()) { @@ -177,50 +177,50 @@ static inline IntRect computeClippedRectInTarget(const CCLayerImpl* owningLayer) return clippedRectInTarget; } -CCRenderPass::Id CCRenderSurface::renderPassId() +RenderPass::Id RenderSurfaceImpl::renderPassId() { int layerId = m_owningLayer->id(); int subId = 0; DCHECK(layerId > 0); - return CCRenderPass::Id(layerId, subId); + return RenderPass::Id(layerId, subId); } -void CCRenderSurface::appendRenderPasses(CCRenderPassSink& passSink) +void RenderSurfaceImpl::appendRenderPasses(RenderPassSink& passSink) { for (size_t i = 0; i < m_contributingDelegatedRenderPassLayerList.size(); ++i) m_contributingDelegatedRenderPassLayerList[i]->appendContributingRenderPasses(passSink); - scoped_ptr<CCRenderPass> pass = CCRenderPass::create(renderPassId(), m_contentRect, m_screenSpaceTransform); + scoped_ptr<RenderPass> pass = RenderPass::create(renderPassId(), m_contentRect, m_screenSpaceTransform); pass->setDamageRect(m_damageTracker->currentDamageRect()); pass->setFilters(m_owningLayer->filters()); pass->setBackgroundFilters(m_owningLayer->backgroundFilters()); passSink.appendRenderPass(pass.Pass()); } -void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData, bool forReplica, CCRenderPass::Id renderPassId) +void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData, bool forReplica, RenderPass::Id renderPassId) { DCHECK(!forReplica || m_owningLayer->hasReplica()); IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); bool isOpaque = false; const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque).Pass()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque).Pass()); if (m_owningLayer->hasDebugBorders()) { int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderColorRed; int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen; int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue; SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue); - quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth).PassAs<DrawQuad>(), appendQuadsData); } - // FIXME: By using the same RenderSurface for both the content and its reflection, + // FIXME: By using the same RenderSurfaceImpl for both the content and its reflection, // it's currently not possible to apply a separate mask to the reflection layer // or correctly handle opacity in reflections (opacity must be applied after drawing - // both the layer and its reflection). The solution is to introduce yet another RenderSurface + // both the layer and its reflection). The solution is to introduce yet another RenderSurfaceImpl // to draw the layer and its reflection in. For now we only apply a separate reflection // mask if the contents don't have a mask of their own. - CCLayerImpl* maskLayer = m_owningLayer->maskLayer(); + LayerImpl* maskLayer = m_owningLayer->maskLayer(); if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty())) maskLayer = 0; @@ -241,11 +241,11 @@ void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appen maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRect().height() * maskTexCoordScaleY; } - CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; + ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); - quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, - maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(RenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, + maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<DrawQuad>(), appendQuadsData); } } diff --git a/cc/render_surface_impl.h b/cc/render_surface_impl.h index 972e613..93b4593 100644 --- a/cc/render_surface_impl.h +++ b/cc/render_surface_impl.h @@ -15,32 +15,32 @@ namespace cc { -class CCDamageTracker; -class CCDelegatedRendererLayerImpl; -class CCQuadSink; -class CCRenderPassSink; -class CCLayerImpl; +class DamageTracker; +class DelegatedRendererLayerImpl; +class QuadSink; +class RenderPassSink; +class LayerImpl; -struct CCAppendQuadsData; +struct AppendQuadsData; -class CCRenderSurface { +class RenderSurfaceImpl { public: - explicit CCRenderSurface(CCLayerImpl*); - virtual ~CCRenderSurface(); + explicit RenderSurfaceImpl(LayerImpl*); + virtual ~RenderSurfaceImpl(); std::string name() const; void dumpSurface(std::string*, int indent) const; FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); } - // Returns the rect that encloses the RenderSurface including any reflection. + // Returns the rect that encloses the RenderSurfaceImpl including any reflection. FloatRect drawableContentRect() const; float drawOpacity() const { return m_drawOpacity; } void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } - void setNearestAncestorThatMovesPixels(CCRenderSurface* surface) { m_nearestAncestorThatMovesPixels = surface; } - const CCRenderSurface* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; } + void setNearestAncestorThatMovesPixels(RenderSurfaceImpl* surface) { m_nearestAncestorThatMovesPixels = surface; } + const RenderSurfaceImpl* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; } bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } @@ -70,8 +70,8 @@ public: void setContentRect(const IntRect&); const IntRect& contentRect() const { return m_contentRect; } - std::vector<CCLayerImpl*>& layerList() { return m_layerList; } - void addContributingDelegatedRenderPassLayer(CCLayerImpl*); + std::vector<LayerImpl*>& layerList() { return m_layerList; } + void addContributingDelegatedRenderPassLayer(LayerImpl*); void clearLayerLists(); int owningLayerId() const; @@ -80,15 +80,15 @@ public: bool surfacePropertyChanged() const; bool surfacePropertyChangedOnlyFromDescendant() const; - CCDamageTracker* damageTracker() const { return m_damageTracker.get(); } + DamageTracker* damageTracker() const { return m_damageTracker.get(); } - CCRenderPass::Id renderPassId(); + RenderPass::Id renderPassId(); - void appendRenderPasses(CCRenderPassSink&); - void appendQuads(CCQuadSink&, CCAppendQuadsData&, bool forReplica, CCRenderPass::Id renderPassId); + void appendRenderPasses(RenderPassSink&); + void appendQuads(QuadSink&, AppendQuadsData&, bool forReplica, RenderPass::Id renderPassId); private: - CCLayerImpl* m_owningLayer; + LayerImpl* m_owningLayer; // Uses this surface's space. IntRect m_contentRect; @@ -106,22 +106,22 @@ private: // Uses the space of the surface's target surface. IntRect m_clipRect; - std::vector<CCLayerImpl*> m_layerList; - std::vector<CCDelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList; + std::vector<LayerImpl*> m_layerList; + std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList; // The nearest ancestor target surface that will contain the contents of this surface, and that is going // to move pixels within the surface (such as with a blur). This can point to itself. - CCRenderSurface* m_nearestAncestorThatMovesPixels; + RenderSurfaceImpl* m_nearestAncestorThatMovesPixels; - scoped_ptr<CCDamageTracker> m_damageTracker; + scoped_ptr<DamageTracker> m_damageTracker; - // For CCLayerIteratorActions + // For LayerIteratorActions int m_targetRenderSurfaceLayerIndexHistory; int m_currentLayerIndexHistory; - friend struct CCLayerIteratorActions; + friend struct LayerIteratorActions; - DISALLOW_COPY_AND_ASSIGN(CCRenderSurface); + DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl); }; } diff --git a/cc/render_surface_unittest.cc b/cc/render_surface_unittest.cc index 31ddd0d..f8858c1 100644 --- a/cc/render_surface_unittest.cc +++ b/cc/render_surface_unittest.cc @@ -32,7 +32,7 @@ namespace { codeToTest; \ EXPECT_FALSE(renderSurface->surfacePropertyChanged()) -TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) +TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) { // // This test checks that surfacePropertyChanged() has the correct behavior. @@ -41,10 +41,10 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - scoped_ptr<CCLayerImpl> owningLayer = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(1); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); - CCRenderSurface* renderSurface = owningLayer->renderSurface(); + RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); IntRect testRect = IntRect(IntPoint(3, 4), IntSize(5, 6)); owningLayer->resetAllChangeTrackingForSubtree(); @@ -61,7 +61,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setClipRect(testRect)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); - scoped_ptr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> dummyMask = LayerImpl::create(1); WebTransformationMatrix dummyMatrix; dummyMatrix.translate(1.0, 2.0); @@ -73,18 +73,18 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerLists()); } -TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) +TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) { // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - scoped_ptr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); - scoped_ptr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); + scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); owningLayer->setRenderTarget(owningLayer.get()); - CCRenderSurface* renderSurface = owningLayer->renderSurface(); + RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); rootLayer->addChild(owningLayer.Pass()); @@ -99,16 +99,16 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) renderSurface->setClipRect(clipRect); renderSurface->setDrawOpacity(1); - CCQuadList quadList; - CCSharedQuadStateList sharedStateList; - MockCCQuadCuller mockQuadCuller(quadList, sharedStateList); - CCAppendQuadsData appendQuadsData; + QuadList quadList; + SharedQuadStateList sharedStateList; + MockQuadCuller mockQuadCuller(quadList, sharedStateList); + AppendQuadsData appendQuadsData; bool forReplica = false; - renderSurface->appendQuads(mockQuadCuller, appendQuadsData, forReplica, CCRenderPass::Id(2, 0)); + renderSurface->appendQuads(mockQuadCuller, appendQuadsData, forReplica, RenderPass::Id(2, 0)); ASSERT_EQ(1u, sharedStateList.size()); - CCSharedQuadState* sharedQuadState = sharedStateList[0]; + SharedQuadState* sharedQuadState = sharedStateList[0]; EXPECT_EQ(30, sharedQuadState->quadTransform.m41()); EXPECT_EQ(40, sharedQuadState->quadTransform.m42()); @@ -117,28 +117,28 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) EXPECT_FALSE(sharedQuadState->opaque); } -class TestCCRenderPassSink : public CCRenderPassSink { +class TestRenderPassSink : public RenderPassSink { public: - virtual void appendRenderPass(scoped_ptr<CCRenderPass> renderPass) OVERRIDE { m_renderPasses.append(renderPass.Pass()); } + virtual void appendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.append(renderPass.Pass()); } - const ScopedPtrVector<CCRenderPass>& renderPasses() const { return m_renderPasses; } + const ScopedPtrVector<RenderPass>& renderPasses() const { return m_renderPasses; } private: - ScopedPtrVector<CCRenderPass> m_renderPasses; + ScopedPtrVector<RenderPass> m_renderPasses; }; -TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) +TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) { // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - scoped_ptr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); + scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); - scoped_ptr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); + scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); owningLayer->setRenderTarget(owningLayer.get()); - CCRenderSurface* renderSurface = owningLayer->renderSurface(); + RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); rootLayer->addChild(owningLayer.Pass()); @@ -149,14 +149,14 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) renderSurface->setScreenSpaceTransform(origin); renderSurface->setContentRect(contentRect); - TestCCRenderPassSink passSink; + TestRenderPassSink passSink; renderSurface->appendRenderPasses(passSink); ASSERT_EQ(1u, passSink.renderPasses().size()); - CCRenderPass* pass = passSink.renderPasses()[0]; + RenderPass* pass = passSink.renderPasses()[0]; - EXPECT_EQ(CCRenderPass::Id(2, 0), pass->id()); + EXPECT_EQ(RenderPass::Id(2, 0), pass->id()); EXPECT_EQ(contentRect, pass->outputRect()); EXPECT_EQ(origin, pass->transformToRootTarget()); } diff --git a/cc/renderer.cc b/cc/renderer.cc index 69c04df..97dc7e8 100644 --- a/cc/renderer.cc +++ b/cc/renderer.cc @@ -8,12 +8,12 @@ namespace cc { -bool CCRenderer::haveCachedResourcesForRenderPassId(CCRenderPass::Id) const +bool Renderer::haveCachedResourcesForRenderPassId(RenderPass::Id) const { return false; } -bool CCRenderer::isContextLost() +bool Renderer::isContextLost() { return false; } diff --git a/cc/renderer.h b/cc/renderer.h index 1b32436..9c5336e 100644 --- a/cc/renderer.h +++ b/cc/renderer.h @@ -13,34 +13,34 @@ namespace cc { -class CCScopedTexture; +class ScopedTexture; -class CCRendererClient { +class RendererClient { public: virtual const IntSize& deviceViewportSize() const = 0; - virtual const CCLayerTreeSettings& settings() const = 0; + virtual const LayerTreeSettings& settings() const = 0; virtual void didLoseContext() = 0; virtual void onSwapBuffersComplete() = 0; virtual void setFullRootLayerDamage() = 0; virtual void setMemoryAllocationLimitBytes(size_t) = 0; protected: - virtual ~CCRendererClient() { } + virtual ~RendererClient() { } }; -class CCRenderer { +class Renderer { public: - // This enum defines the various resource pools for the CCResourceProvider + // This enum defines the various resource pools for the ResourceProvider // where textures get allocated. enum ResourcePool { ImplPool = 1, // This pool is for textures that get allocated on the impl thread (e.g. RenderSurfaces). ContentPool // This pool is for textures that get allocated on the main thread (e.g. tiles). }; - virtual ~CCRenderer() { } + virtual ~Renderer() { } virtual const RendererCapabilities& capabilities() const = 0; - const CCLayerTreeSettings& settings() const { return m_client->settings(); } + const LayerTreeSettings& settings() const { return m_client->settings(); } const IntSize& viewportSize() { return m_client->deviceViewportSize(); } int viewportWidth() { return viewportSize().width(); } @@ -48,10 +48,10 @@ public: virtual void viewportChanged() { } - virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { } - virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const; + virtual void decideRenderPassAllocationsForFrame(const RenderPassList&) { } + virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id) const; - virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&) = 0; + virtual void drawFrame(const RenderPassList&, const RenderPassIdHashMap&) = 0; // waits for rendering to finish virtual void finish() = 0; @@ -67,14 +67,14 @@ public: virtual void setVisible(bool) = 0; protected: - explicit CCRenderer(CCRendererClient* client) + explicit Renderer(RendererClient* client) : m_client(client) { } - CCRendererClient* m_client; + RendererClient* m_client; - DISALLOW_COPY_AND_ASSIGN(CCRenderer); + DISALLOW_COPY_AND_ASSIGN(Renderer); }; } diff --git a/cc/rendering_stats.h b/cc/rendering_stats.h index fb178a8..9663498 100644 --- a/cc/rendering_stats.h +++ b/cc/rendering_stats.h @@ -7,7 +7,7 @@ namespace cc { -struct CCRenderingStats { +struct RenderingStats { // FIXME: Rename these to animationFrameCount and screenFrameCount, crbug.com/138641. int numAnimationFrames; int numFramesSentToScreen; @@ -19,7 +19,7 @@ struct CCRenderingStats { size_t numImplThreadScrolls; size_t numMainThreadScrolls; - CCRenderingStats() + RenderingStats() : numAnimationFrames(0) , numFramesSentToScreen(0) , droppedFrameCount(0) diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc index e3e802d..0af0075 100644 --- a/cc/resource_provider.cc +++ b/cc/resource_provider.cc @@ -48,15 +48,15 @@ static bool isTextureFormatSupportedForStorage(GLenum format) return (format == GL_RGBA || format == GL_BGRA_EXT); } -CCResourceProvider::TransferableResourceList::TransferableResourceList() +ResourceProvider::TransferableResourceList::TransferableResourceList() { } -CCResourceProvider::TransferableResourceList::~TransferableResourceList() +ResourceProvider::TransferableResourceList::~TransferableResourceList() { } -CCResourceProvider::Resource::Resource() +ResourceProvider::Resource::Resource() : glId(0) , pixels(0) , pool(0) @@ -71,7 +71,7 @@ CCResourceProvider::Resource::Resource() { } -CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSize& size, GLenum format) +ResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSize& size, GLenum format) : glId(textureId) , pixels(0) , pool(pool) @@ -86,7 +86,7 @@ CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSi { } -CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format) +ResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format) : glId(0) , pixels(pixels) , pool(pool) @@ -101,23 +101,23 @@ CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize& { } -CCResourceProvider::Child::Child() +ResourceProvider::Child::Child() { } -CCResourceProvider::Child::~Child() +ResourceProvider::Child::~Child() { } -scoped_ptr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* context) +scoped_ptr<ResourceProvider> ResourceProvider::create(GraphicsContext* context) { - scoped_ptr<CCResourceProvider> resourceProvider(new CCResourceProvider(context)); + scoped_ptr<ResourceProvider> resourceProvider(new ResourceProvider(context)); if (!resourceProvider->initialize()) - return scoped_ptr<CCResourceProvider>(); + return scoped_ptr<ResourceProvider>(); return resourceProvider.Pass(); } -CCResourceProvider::~CCResourceProvider() +ResourceProvider::~ResourceProvider() { WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !context3d->makeContextCurrent()) @@ -126,22 +126,22 @@ CCResourceProvider::~CCResourceProvider() m_textureCopier.reset(); } -WebGraphicsContext3D* CCResourceProvider::graphicsContext3D() +WebGraphicsContext3D* ResourceProvider::graphicsContext3D() { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); return m_context->context3D(); } -bool CCResourceProvider::inUseByConsumer(ResourceId id) +bool ResourceProvider::inUseByConsumer(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; return !!resource->lockForReadCount || resource->exported; } -CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, const IntSize& size, GLenum format, TextureUsageHint hint) +ResourceProvider::ResourceId ResourceProvider::createResource(int pool, const IntSize& size, GLenum format, TextureUsageHint hint) { switch (m_defaultResourceType) { case GLTexture: @@ -155,9 +155,9 @@ CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, cons return 0; } -CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, const IntSize& size, GLenum format, TextureUsageHint hint) +ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const IntSize& size, GLenum format, TextureUsageHint hint) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); unsigned textureId = 0; WebGraphicsContext3D* context3d = m_context->context3D(); DCHECK(context3d); @@ -181,9 +181,9 @@ CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, con return id; } -CCResourceProvider::ResourceId CCResourceProvider::createBitmap(int pool, const IntSize& size) +ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const IntSize& size) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); uint8_t* pixels = new uint8_t[size.width() * size.height() * 4]; @@ -193,9 +193,9 @@ CCResourceProvider::ResourceId CCResourceProvider::createBitmap(int pool, const return id; } -CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTexture(unsigned textureId) +ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture(unsigned textureId) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(m_context->context3D()); ResourceId id = m_nextId++; Resource resource(textureId, 0, IntSize(), 0); @@ -204,9 +204,9 @@ CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTex return id; } -void CCResourceProvider::deleteResource(ResourceId id) +void ResourceProvider::deleteResource(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; @@ -221,7 +221,7 @@ void CCResourceProvider::deleteResource(ResourceId id) deleteResourceInternal(it); } -void CCResourceProvider::deleteResourceInternal(ResourceMap::iterator it) +void ResourceProvider::deleteResourceInternal(ResourceMap::iterator it) { Resource* resource = &it->second; if (resource->glId && !resource->external) { @@ -235,9 +235,9 @@ void CCResourceProvider::deleteResourceInternal(ResourceMap::iterator it) m_resources.erase(it); } -void CCResourceProvider::deleteOwnedResources(int pool) +void ResourceProvider::deleteOwnedResources(int pool) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceIdArray toDelete; for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) { if (it->second.pool == pool && !it->second.external && !it->second.markedForDeletion) @@ -247,7 +247,7 @@ void CCResourceProvider::deleteOwnedResources(int pool) deleteResource(*it); } -CCResourceProvider::ResourceType CCResourceProvider::resourceType(ResourceId id) +ResourceProvider::ResourceType ResourceProvider::resourceType(ResourceId id) { ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); @@ -255,9 +255,9 @@ CCResourceProvider::ResourceType CCResourceProvider::resourceType(ResourceId id) return resource->type; } -void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset) +void ResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; @@ -294,7 +294,7 @@ void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRe } } -size_t CCResourceProvider::numBlockingUploads() +size_t ResourceProvider::numBlockingUploads() { if (!m_textureUploader) return 0; @@ -302,7 +302,7 @@ size_t CCResourceProvider::numBlockingUploads() return m_textureUploader->numBlockingUploads(); } -void CCResourceProvider::markPendingUploadsAsNonBlocking() +void ResourceProvider::markPendingUploadsAsNonBlocking() { if (!m_textureUploader) return; @@ -310,7 +310,7 @@ void CCResourceProvider::markPendingUploadsAsNonBlocking() m_textureUploader->markPendingUploadsAsNonBlocking(); } -double CCResourceProvider::estimatedUploadsPerSecond() +double ResourceProvider::estimatedUploadsPerSecond() { if (!m_textureUploader) return 0.0; @@ -318,17 +318,17 @@ double CCResourceProvider::estimatedUploadsPerSecond() return m_textureUploader->estimatedTexturesPerSecond(); } -void CCResourceProvider::flush() +void ResourceProvider::flush() { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (context3d) context3d->flush(); } -bool CCResourceProvider::shallowFlushIfSupported() +bool ResourceProvider::shallowFlushIfSupported() { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !m_useShallowFlush) return false; @@ -337,9 +337,9 @@ bool CCResourceProvider::shallowFlushIfSupported() return true; } -const CCResourceProvider::Resource* CCResourceProvider::lockForRead(ResourceId id) +const ResourceProvider::Resource* ResourceProvider::lockForRead(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); @@ -350,9 +350,9 @@ const CCResourceProvider::Resource* CCResourceProvider::lockForRead(ResourceId i return resource; } -void CCResourceProvider::unlockForRead(ResourceId id) +void ResourceProvider::unlockForRead(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; @@ -361,9 +361,9 @@ void CCResourceProvider::unlockForRead(ResourceId id) resource->lockForReadCount--; } -const CCResourceProvider::Resource* CCResourceProvider::lockForWrite(ResourceId id) +const ResourceProvider::Resource* ResourceProvider::lockForWrite(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; @@ -375,9 +375,9 @@ const CCResourceProvider::Resource* CCResourceProvider::lockForWrite(ResourceId return resource; } -void CCResourceProvider::unlockForWrite(ResourceId id) +void ResourceProvider::unlockForWrite(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; @@ -387,7 +387,7 @@ void CCResourceProvider::unlockForWrite(ResourceId id) resource->lockedForWrite = false; } -CCResourceProvider::ScopedReadLockGL::ScopedReadLockGL(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) +ResourceProvider::ScopedReadLockGL::ScopedReadLockGL(ResourceProvider* resourceProvider, ResourceProvider::ResourceId resourceId) : m_resourceProvider(resourceProvider) , m_resourceId(resourceId) , m_textureId(resourceProvider->lockForRead(resourceId)->glId) @@ -395,12 +395,12 @@ CCResourceProvider::ScopedReadLockGL::ScopedReadLockGL(CCResourceProvider* resou DCHECK(m_textureId); } -CCResourceProvider::ScopedReadLockGL::~ScopedReadLockGL() +ResourceProvider::ScopedReadLockGL::~ScopedReadLockGL() { m_resourceProvider->unlockForRead(m_resourceId); } -CCResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) +ResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL(ResourceProvider* resourceProvider, ResourceProvider::ResourceId resourceId) : m_resourceProvider(resourceProvider) , m_resourceId(resourceId) , m_textureId(resourceProvider->lockForWrite(resourceId)->glId) @@ -408,12 +408,12 @@ CCResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL(CCResourceProvider* res DCHECK(m_textureId); } -CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() +ResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() { m_resourceProvider->unlockForWrite(m_resourceId); } -void CCResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const Resource* resource) +void ResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const Resource* resource) { DCHECK(resource->pixels); DCHECK(resource->format == GL_RGBA); @@ -421,32 +421,32 @@ void CCResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const skBitmap->setPixels(resource->pixels); } -CCResourceProvider::ScopedReadLockSoftware::ScopedReadLockSoftware(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) +ResourceProvider::ScopedReadLockSoftware::ScopedReadLockSoftware(ResourceProvider* resourceProvider, ResourceProvider::ResourceId resourceId) : m_resourceProvider(resourceProvider) , m_resourceId(resourceId) { - CCResourceProvider::populateSkBitmapWithResource(&m_skBitmap, resourceProvider->lockForRead(resourceId)); + ResourceProvider::populateSkBitmapWithResource(&m_skBitmap, resourceProvider->lockForRead(resourceId)); } -CCResourceProvider::ScopedReadLockSoftware::~ScopedReadLockSoftware() +ResourceProvider::ScopedReadLockSoftware::~ScopedReadLockSoftware() { m_resourceProvider->unlockForRead(m_resourceId); } -CCResourceProvider::ScopedWriteLockSoftware::ScopedWriteLockSoftware(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) +ResourceProvider::ScopedWriteLockSoftware::ScopedWriteLockSoftware(ResourceProvider* resourceProvider, ResourceProvider::ResourceId resourceId) : m_resourceProvider(resourceProvider) , m_resourceId(resourceId) { - CCResourceProvider::populateSkBitmapWithResource(&m_skBitmap, resourceProvider->lockForWrite(resourceId)); + ResourceProvider::populateSkBitmapWithResource(&m_skBitmap, resourceProvider->lockForWrite(resourceId)); m_skCanvas.reset(new SkCanvas(m_skBitmap)); } -CCResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() +ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() { m_resourceProvider->unlockForWrite(m_resourceId); } -CCResourceProvider::CCResourceProvider(CCGraphicsContext* context) +ResourceProvider::ResourceProvider(GraphicsContext* context) : m_context(context) , m_nextId(1) , m_nextChild(1) @@ -458,9 +458,9 @@ CCResourceProvider::CCResourceProvider(CCGraphicsContext* context) { } -bool CCResourceProvider::initialize() +bool ResourceProvider::initialize() { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d) { m_maxTextureSize = INT_MAX / 2; @@ -494,9 +494,9 @@ bool CCResourceProvider::initialize() return true; } -int CCResourceProvider::createChild(int pool) +int ResourceProvider::createChild(int pool) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); Child childInfo; childInfo.pool = pool; int child = m_nextChild++; @@ -504,9 +504,9 @@ int CCResourceProvider::createChild(int pool) return child; } -void CCResourceProvider::destroyChild(int child) +void ResourceProvider::destroyChild(int child) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ChildMap::iterator it = m_children.find(child); DCHECK(it != m_children.end()); deleteOwnedResources(it->second.pool); @@ -514,17 +514,17 @@ void CCResourceProvider::destroyChild(int child) trimMailboxDeque(); } -const CCResourceProvider::ResourceIdMap& CCResourceProvider::getChildToParentMap(int child) const +const ResourceProvider::ResourceIdMap& ResourceProvider::getChildToParentMap(int child) const { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ChildMap::const_iterator it = m_children.find(child); DCHECK(it != m_children.end()); return it->second.childToParentMap; } -CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToParent(const ResourceIdArray& resources) +ResourceProvider::TransferableResourceList ResourceProvider::prepareSendToParent(const ResourceIdArray& resources) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); TransferableResourceList list; list.syncPoint = 0; WebGraphicsContext3D* context3d = m_context->context3D(); @@ -544,9 +544,9 @@ CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToPa return list; } -CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToChild(int child, const ResourceIdArray& resources) +ResourceProvider::TransferableResourceList ResourceProvider::prepareSendToChild(int child, const ResourceIdArray& resources) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); TransferableResourceList list; list.syncPoint = 0; WebGraphicsContext3D* context3d = m_context->context3D(); @@ -571,9 +571,9 @@ CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToCh return list; } -void CCResourceProvider::receiveFromChild(int child, const TransferableResourceList& resources) +void ResourceProvider::receiveFromChild(int child, const TransferableResourceList& resources) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !context3d->makeContextCurrent()) { // FIXME: Implement this path for software compositing. @@ -603,9 +603,9 @@ void CCResourceProvider::receiveFromChild(int child, const TransferableResourceL } } -void CCResourceProvider::receiveFromParent(const TransferableResourceList& resources) +void ResourceProvider::receiveFromParent(const TransferableResourceList& resources) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !context3d->makeContextCurrent()) { // FIXME: Implement this path for software compositing. @@ -627,9 +627,9 @@ void CCResourceProvider::receiveFromParent(const TransferableResourceList& resou } } -bool CCResourceProvider::transferResource(WebGraphicsContext3D* context, ResourceId id, TransferableResource* resource) +bool ResourceProvider::transferResource(WebGraphicsContext3D* context, ResourceId id, TransferableResource* resource) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); ResourceMap::const_iterator it = m_resources.find(id); CHECK(it != m_resources.end()); const Resource* source = &it->second; @@ -652,7 +652,7 @@ bool CCResourceProvider::transferResource(WebGraphicsContext3D* context, Resourc return true; } -void CCResourceProvider::trimMailboxDeque() +void ResourceProvider::trimMailboxDeque() { // Trim the mailbox deque to the maximum number of resources we may need to // send. diff --git a/cc/resource_provider.h b/cc/resource_provider.h index 437f1b9..b20097e 100644 --- a/cc/resource_provider.h +++ b/cc/resource_provider.h @@ -30,7 +30,7 @@ class TextureUploader; // Thread-safety notes: this class is not thread-safe and can only be called // from the thread it was created on (in practice, the compositor thread). -class CCResourceProvider { +class ResourceProvider { public: typedef unsigned ResourceId; typedef std::vector<ResourceId> ResourceIdArray; @@ -58,9 +58,9 @@ public: unsigned syncPoint; }; - static scoped_ptr<CCResourceProvider> create(CCGraphicsContext*); + static scoped_ptr<ResourceProvider> create(GraphicsContext*); - virtual ~CCResourceProvider(); + virtual ~ResourceProvider(); WebKit::WebGraphicsContext3D* graphicsContext3D(); TextureCopier* textureCopier() const { return m_textureCopier.get(); } @@ -119,13 +119,13 @@ public: // Prepares resources to be transfered to the parent, moving them to // mailboxes and serializing meta-data into TransferableResources. - // Resources are not removed from the CCResourceProvider, but are markes as + // Resources are not removed from the ResourceProvider, but are markes as // "in use". TransferableResourceList prepareSendToParent(const ResourceIdArray&); // Prepares resources to be transfered back to the child, moving them to // mailboxes and serializing meta-data into TransferableResources. - // Resources are removed from the CCResourceProvider. Note: the resource IDs + // Resources are removed from the ResourceProvider. Note: the resource IDs // passed are in the parent namespace and will be translated to the child // namespace when returned. TransferableResourceList prepareSendToChild(int child, const ResourceIdArray&); @@ -146,20 +146,20 @@ public: // Only for testing size_t mailboxCount() const { return m_mailboxes.size(); } - // The following lock classes are part of the CCResourceProvider API and are + // The following lock classes are part of the ResourceProvider API and are // needed to read and write the resource contents. The user must ensure // that they only use GL locks on GL resources, etc, and this is enforced // by assertions. class ScopedReadLockGL { public: - ScopedReadLockGL(CCResourceProvider*, CCResourceProvider::ResourceId); + ScopedReadLockGL(ResourceProvider*, ResourceProvider::ResourceId); ~ScopedReadLockGL(); unsigned textureId() const { return m_textureId; } private: - CCResourceProvider* m_resourceProvider; - CCResourceProvider::ResourceId m_resourceId; + ResourceProvider* m_resourceProvider; + ResourceProvider::ResourceId m_resourceId; unsigned m_textureId; DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); @@ -167,14 +167,14 @@ public: class ScopedWriteLockGL { public: - ScopedWriteLockGL(CCResourceProvider*, CCResourceProvider::ResourceId); + ScopedWriteLockGL(ResourceProvider*, ResourceProvider::ResourceId); ~ScopedWriteLockGL(); unsigned textureId() const { return m_textureId; } private: - CCResourceProvider* m_resourceProvider; - CCResourceProvider::ResourceId m_resourceId; + ResourceProvider* m_resourceProvider; + ResourceProvider::ResourceId m_resourceId; unsigned m_textureId; DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL); @@ -182,14 +182,14 @@ public: class ScopedReadLockSoftware { public: - ScopedReadLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId); + ScopedReadLockSoftware(ResourceProvider*, ResourceProvider::ResourceId); ~ScopedReadLockSoftware(); const SkBitmap* skBitmap() const { return &m_skBitmap; } private: - CCResourceProvider* m_resourceProvider; - CCResourceProvider::ResourceId m_resourceId; + ResourceProvider* m_resourceProvider; + ResourceProvider::ResourceId m_resourceId; SkBitmap m_skBitmap; DISALLOW_COPY_AND_ASSIGN(ScopedReadLockSoftware); @@ -197,14 +197,14 @@ public: class ScopedWriteLockSoftware { public: - ScopedWriteLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId); + ScopedWriteLockSoftware(ResourceProvider*, ResourceProvider::ResourceId); ~ScopedWriteLockSoftware(); SkCanvas* skCanvas() { return m_skCanvas.get(); } private: - CCResourceProvider* m_resourceProvider; - CCResourceProvider::ResourceId m_resourceId; + ResourceProvider* m_resourceProvider; + ResourceProvider::ResourceId m_resourceId; SkBitmap m_skBitmap; scoped_ptr<SkCanvas> m_skCanvas; @@ -240,7 +240,7 @@ private: }; typedef base::hash_map<int, Child> ChildMap; - explicit CCResourceProvider(CCGraphicsContext*); + explicit ResourceProvider(GraphicsContext*); bool initialize(); const Resource* lockForRead(ResourceId); @@ -253,7 +253,7 @@ private: void trimMailboxDeque(); void deleteResourceInternal(ResourceMap::iterator it); - CCGraphicsContext* m_context; + GraphicsContext* m_context; ResourceId m_nextId; ResourceMap m_resources; int m_nextChild; @@ -269,7 +269,7 @@ private: scoped_ptr<AcceleratedTextureCopier> m_textureCopier; int m_maxTextureSize; - DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); + DISALLOW_COPY_AND_ASSIGN(ResourceProvider); }; } diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc index 8a62c83..4695699 100644 --- a/cc/resource_provider_unittest.cc +++ b/cc/resource_provider_unittest.cc @@ -267,27 +267,27 @@ private: PendingProduceTextureList m_pendingProduceTextures; }; -class CCResourceProviderTest : public testing::TestWithParam<CCResourceProvider::ResourceType> { +class ResourceProviderTest : public testing::TestWithParam<ResourceProvider::ResourceType> { public: - CCResourceProviderTest() + ResourceProviderTest() : m_sharedData(ContextSharedData::create()) , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>().PassAs<WebKit::WebGraphicsContext3D>())) - , m_resourceProvider(CCResourceProvider::create(m_context.get())) + , m_resourceProvider(ResourceProvider::create(m_context.get())) { m_resourceProvider->setDefaultResourceType(GetParam()); } ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->context3D()); } - void getResourcePixels(CCResourceProvider::ResourceId id, const IntSize& size, WGC3Denum format, uint8_t* pixels) + void getResourcePixels(ResourceProvider::ResourceId id, const IntSize& size, WGC3Denum format, uint8_t* pixels) { - if (GetParam() == CCResourceProvider::GLTexture) { - CCResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get(), id); + if (GetParam() == ResourceProvider::GLTexture) { + ResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get(), id); ASSERT_NE(0U, lockGL.textureId()); context()->bindTexture(GL_TEXTURE_2D, lockGL.textureId()); context()->getPixels(size, format, pixels); - } else if (GetParam() == CCResourceProvider::Bitmap) { - CCResourceProvider::ScopedReadLockSoftware lockSoftware(m_resourceProvider.get(), id); + } else if (GetParam() == ResourceProvider::Bitmap) { + ResourceProvider::ScopedReadLockSoftware lockSoftware(m_resourceProvider.get(), id); memcpy(pixels, lockSoftware.skBitmap()->getPixels(), lockSoftware.skBitmap()->getSize()); } } @@ -295,18 +295,18 @@ public: void expectNumResources(int count) { EXPECT_EQ(count, static_cast<int>(m_resourceProvider->numResources())); - if (GetParam() == CCResourceProvider::GLTexture) + if (GetParam() == ResourceProvider::GLTexture) EXPECT_EQ(count, context()->textureCount()); } protected: DebugScopedSetImplThread implThread; scoped_ptr<ContextSharedData> m_sharedData; - scoped_ptr<CCGraphicsContext> m_context; - scoped_ptr<CCResourceProvider> m_resourceProvider; + scoped_ptr<GraphicsContext> m_context; + scoped_ptr<ResourceProvider> m_resourceProvider; }; -TEST_P(CCResourceProviderTest, Basic) +TEST_P(ResourceProviderTest, Basic) { IntSize size(1, 1); WGC3Denum format = GL_RGBA; @@ -314,7 +314,7 @@ TEST_P(CCResourceProviderTest, Basic) size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); - CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny); expectNumResources(1); uint8_t data[4] = {1, 2, 3, 4}; @@ -329,7 +329,7 @@ TEST_P(CCResourceProviderTest, Basic) expectNumResources(0); } -TEST_P(CCResourceProviderTest, DeleteOwnedResources) +TEST_P(ResourceProviderTest, DeleteOwnedResources) { IntSize size(1, 1); WGC3Denum format = GL_RGBA; @@ -337,7 +337,7 @@ TEST_P(CCResourceProviderTest, DeleteOwnedResources) const int count = 3; for (int i = 0; i < count; ++i) - m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + m_resourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny); expectNumResources(3); m_resourceProvider->deleteOwnedResources(pool+1); @@ -347,7 +347,7 @@ TEST_P(CCResourceProviderTest, DeleteOwnedResources) expectNumResources(0); } -TEST_P(CCResourceProviderTest, Upload) +TEST_P(ResourceProviderTest, Upload) { IntSize size(2, 2); WGC3Denum format = GL_RGBA; @@ -355,7 +355,7 @@ TEST_P(CCResourceProviderTest, Upload) size_t pixelSize = textureSize(size, format); ASSERT_EQ(16U, pixelSize); - CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny); uint8_t image[16] = {0}; IntRect imageRect(IntPoint(), size); @@ -411,14 +411,14 @@ TEST_P(CCResourceProviderTest, Upload) m_resourceProvider->deleteResource(id); } -TEST_P(CCResourceProviderTest, TransferResources) +TEST_P(ResourceProviderTest, TransferResources) { // Resource transfer is only supported with GL textures for now. - if (GetParam() != CCResourceProvider::GLTexture) + if (GetParam() != ResourceProvider::GLTexture) return; - scoped_ptr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); - scoped_ptr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); + scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); + scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.get())); IntSize size(1, 1); WGC3Denum format = GL_RGBA; @@ -426,12 +426,12 @@ TEST_P(CCResourceProviderTest, TransferResources) size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); - CCResourceProvider::ResourceId id1 = childResourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId id1 = childResourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny); uint8_t data1[4] = {1, 2, 3, 4}; IntRect rect(IntPoint(), size); childResourceProvider->upload(id1, data1, rect, rect, IntSize()); - CCResourceProvider::ResourceId id2 = childResourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId id2 = childResourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny); uint8_t data2[4] = {5, 5, 5, 5}; childResourceProvider->upload(id2, data2, rect, rect, IntSize()); @@ -440,10 +440,10 @@ TEST_P(CCResourceProviderTest, TransferResources) { // Transfer some resources to the parent. - CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + ResourceProvider::ResourceIdArray resourceIdsToTransfer; resourceIdsToTransfer.push_back(id1); resourceIdsToTransfer.push_back(id2); - CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + ResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); EXPECT_NE(0u, list.syncPoint); EXPECT_EQ(2u, list.resources.size()); EXPECT_TRUE(childResourceProvider->inUseByConsumer(id1)); @@ -453,9 +453,9 @@ TEST_P(CCResourceProviderTest, TransferResources) EXPECT_EQ(2u, m_resourceProvider->numResources()); EXPECT_EQ(2u, m_resourceProvider->mailboxCount()); - CCResourceProvider::ResourceIdMap resourceMap = m_resourceProvider->getChildToParentMap(childId); - CCResourceProvider::ResourceId mappedId1 = resourceMap[id1]; - CCResourceProvider::ResourceId mappedId2 = resourceMap[id2]; + ResourceProvider::ResourceIdMap resourceMap = m_resourceProvider->getChildToParentMap(childId); + ResourceProvider::ResourceId mappedId1 = resourceMap[id1]; + ResourceProvider::ResourceId mappedId2 = resourceMap[id2]; EXPECT_NE(0u, mappedId1); EXPECT_NE(0u, mappedId2); EXPECT_FALSE(m_resourceProvider->inUseByConsumer(id1)); @@ -471,19 +471,19 @@ TEST_P(CCResourceProviderTest, TransferResources) { // Check that transfering again the same resource from the child to the // parent is a noop. - CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + ResourceProvider::ResourceIdArray resourceIdsToTransfer; resourceIdsToTransfer.push_back(id1); - CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + ResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); EXPECT_EQ(0u, list.syncPoint); EXPECT_EQ(0u, list.resources.size()); } { // Transfer resources back from the parent to the child. - CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + ResourceProvider::ResourceIdArray resourceIdsToTransfer; resourceIdsToTransfer.push_back(mappedId1); resourceIdsToTransfer.push_back(mappedId2); - CCResourceProvider::TransferableResourceList list = m_resourceProvider->prepareSendToChild(childId, resourceIdsToTransfer); + ResourceProvider::TransferableResourceList list = m_resourceProvider->prepareSendToChild(childId, resourceIdsToTransfer); EXPECT_NE(0u, list.syncPoint); EXPECT_EQ(2u, list.resources.size()); childResourceProvider->receiveFromParent(list); @@ -495,14 +495,14 @@ TEST_P(CCResourceProviderTest, TransferResources) ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childContext->context3D()); { - CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id1); + ResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id1); ASSERT_NE(0U, lock.textureId()); childContext3D->bindTexture(GL_TEXTURE_2D, lock.textureId()); childContext3D->getPixels(size, format, result); EXPECT_EQ(0, memcmp(data1, result, pixelSize)); } { - CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id2); + ResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id2); ASSERT_NE(0U, lock.textureId()); childContext3D->bindTexture(GL_TEXTURE_2D, lock.textureId()); childContext3D->getPixels(size, format, result); @@ -511,10 +511,10 @@ TEST_P(CCResourceProviderTest, TransferResources) { // Transfer resources to the parent again. - CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + ResourceProvider::ResourceIdArray resourceIdsToTransfer; resourceIdsToTransfer.push_back(id1); resourceIdsToTransfer.push_back(id2); - CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + ResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); EXPECT_NE(0u, list.syncPoint); EXPECT_EQ(2u, list.resources.size()); EXPECT_TRUE(childResourceProvider->inUseByConsumer(id1)); @@ -528,14 +528,14 @@ TEST_P(CCResourceProviderTest, TransferResources) EXPECT_EQ(0u, m_resourceProvider->mailboxCount()); } -TEST_P(CCResourceProviderTest, DeleteTransferredResources) +TEST_P(ResourceProviderTest, DeleteTransferredResources) { // Resource transfer is only supported with GL textures for now. - if (GetParam() != CCResourceProvider::GLTexture) + if (GetParam() != ResourceProvider::GLTexture) return; - scoped_ptr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); - scoped_ptr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); + scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); + scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.get())); IntSize size(1, 1); WGC3Denum format = GL_RGBA; @@ -543,7 +543,7 @@ TEST_P(CCResourceProviderTest, DeleteTransferredResources) size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); - CCResourceProvider::ResourceId id = childResourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId id = childResourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny); uint8_t data[4] = {1, 2, 3, 4}; IntRect rect(IntPoint(), size); childResourceProvider->upload(id, data, rect, rect, IntSize()); @@ -553,9 +553,9 @@ TEST_P(CCResourceProviderTest, DeleteTransferredResources) { // Transfer some resource to the parent. - CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + ResourceProvider::ResourceIdArray resourceIdsToTransfer; resourceIdsToTransfer.push_back(id); - CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + ResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); EXPECT_NE(0u, list.syncPoint); EXPECT_EQ(1u, list.resources.size()); EXPECT_TRUE(childResourceProvider->inUseByConsumer(id)); @@ -568,12 +568,12 @@ TEST_P(CCResourceProviderTest, DeleteTransferredResources) { // Transfer resources back from the parent to the child. - CCResourceProvider::ResourceIdMap resourceMap = m_resourceProvider->getChildToParentMap(childId); - CCResourceProvider::ResourceId mappedId = resourceMap[id]; + ResourceProvider::ResourceIdMap resourceMap = m_resourceProvider->getChildToParentMap(childId); + ResourceProvider::ResourceId mappedId = resourceMap[id]; EXPECT_NE(0u, mappedId); - CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + ResourceProvider::ResourceIdArray resourceIdsToTransfer; resourceIdsToTransfer.push_back(mappedId); - CCResourceProvider::TransferableResourceList list = m_resourceProvider->prepareSendToChild(childId, resourceIdsToTransfer); + ResourceProvider::TransferableResourceList list = m_resourceProvider->prepareSendToChild(childId, resourceIdsToTransfer); EXPECT_NE(0u, list.syncPoint); EXPECT_EQ(1u, list.resources.size()); childResourceProvider->receiveFromParent(list); @@ -581,9 +581,9 @@ TEST_P(CCResourceProviderTest, DeleteTransferredResources) EXPECT_EQ(0u, childResourceProvider->numResources()); } -INSTANTIATE_TEST_CASE_P(CCResourceProviderTests, - CCResourceProviderTest, - ::testing::Values(CCResourceProvider::GLTexture, - CCResourceProvider::Bitmap)); +INSTANTIATE_TEST_CASE_P(ResourceProviderTests, + ResourceProviderTest, + ::testing::Values(ResourceProvider::GLTexture, + ResourceProvider::Bitmap)); } // namespace diff --git a/cc/resource_update.cc b/cc/resource_update.cc index 5650481..6807b84c 100644 --- a/cc/resource_update.cc +++ b/cc/resource_update.cc @@ -8,7 +8,7 @@ namespace cc { -ResourceUpdate ResourceUpdate::Create(CCPrioritizedTexture* texture, +ResourceUpdate ResourceUpdate::Create(PrioritizedTexture* texture, const SkBitmap* bitmap, IntRect content_rect, IntRect source_rect, @@ -22,7 +22,7 @@ ResourceUpdate ResourceUpdate::Create(CCPrioritizedTexture* texture, return update; } -ResourceUpdate ResourceUpdate::CreateFromPicture(CCPrioritizedTexture* texture, +ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedTexture* texture, SkPicture* picture, IntRect content_rect, IntRect source_rect, diff --git a/cc/resource_update.h b/cc/resource_update.h index 402651d..1fac43a 100644 --- a/cc/resource_update.h +++ b/cc/resource_update.h @@ -12,15 +12,15 @@ class SkPicture; namespace cc { -class CCPrioritizedTexture; +class PrioritizedTexture; struct ResourceUpdate { - static ResourceUpdate Create(CCPrioritizedTexture*, + static ResourceUpdate Create(PrioritizedTexture*, const SkBitmap*, IntRect content_rect, IntRect source_rect, IntSize dest_offset); - static ResourceUpdate CreateFromPicture(CCPrioritizedTexture*, + static ResourceUpdate CreateFromPicture(PrioritizedTexture*, SkPicture*, IntRect content_rect, IntRect source_rect, @@ -29,7 +29,7 @@ struct ResourceUpdate { ResourceUpdate(); virtual ~ResourceUpdate(); - CCPrioritizedTexture* texture; + PrioritizedTexture* texture; const SkBitmap* bitmap; SkPicture* picture; IntRect content_rect; diff --git a/cc/scheduler.cc b/cc/scheduler.cc index d89ebb6..defb58b 100644 --- a/cc/scheduler.cc +++ b/cc/scheduler.cc @@ -12,7 +12,7 @@ namespace cc { -CCScheduler::CCScheduler(CCSchedulerClient* client, scoped_ptr<CCFrameRateController> frameRateController) +Scheduler::Scheduler(SchedulerClient* client, scoped_ptr<FrameRateController> frameRateController) : m_client(client) , m_frameRateController(frameRateController.Pass()) , m_insideProcessScheduledActions(false) @@ -22,117 +22,117 @@ CCScheduler::CCScheduler(CCSchedulerClient* client, scoped_ptr<CCFrameRateContro DCHECK(!m_stateMachine.vsyncCallbackNeeded()); } -CCScheduler::~CCScheduler() +Scheduler::~Scheduler() { m_frameRateController->setActive(false); } -void CCScheduler::setCanBeginFrame(bool can) +void Scheduler::setCanBeginFrame(bool can) { m_stateMachine.setCanBeginFrame(can); processScheduledActions(); } -void CCScheduler::setVisible(bool visible) +void Scheduler::setVisible(bool visible) { m_stateMachine.setVisible(visible); processScheduledActions(); } -void CCScheduler::setCanDraw(bool canDraw) +void Scheduler::setCanDraw(bool canDraw) { m_stateMachine.setCanDraw(canDraw); processScheduledActions(); } -void CCScheduler::setNeedsCommit() +void Scheduler::setNeedsCommit() { m_stateMachine.setNeedsCommit(); processScheduledActions(); } -void CCScheduler::setNeedsForcedCommit() +void Scheduler::setNeedsForcedCommit() { m_stateMachine.setNeedsForcedCommit(); processScheduledActions(); } -void CCScheduler::setNeedsRedraw() +void Scheduler::setNeedsRedraw() { m_stateMachine.setNeedsRedraw(); processScheduledActions(); } -void CCScheduler::setNeedsForcedRedraw() +void Scheduler::setNeedsForcedRedraw() { m_stateMachine.setNeedsForcedRedraw(); processScheduledActions(); } -void CCScheduler::setMainThreadNeedsLayerTextures() +void Scheduler::setMainThreadNeedsLayerTextures() { m_stateMachine.setMainThreadNeedsLayerTextures(); processScheduledActions(); } -void CCScheduler::beginFrameComplete() +void Scheduler::beginFrameComplete() { - TRACE_EVENT0("cc", "CCScheduler::beginFrameComplete"); + TRACE_EVENT0("cc", "Scheduler::beginFrameComplete"); m_stateMachine.beginFrameComplete(); processScheduledActions(); } -void CCScheduler::beginFrameAborted() +void Scheduler::beginFrameAborted() { - TRACE_EVENT0("cc", "CCScheduler::beginFrameAborted"); + TRACE_EVENT0("cc", "Scheduler::beginFrameAborted"); m_stateMachine.beginFrameAborted(); processScheduledActions(); } -void CCScheduler::setMaxFramesPending(int maxFramesPending) +void Scheduler::setMaxFramesPending(int maxFramesPending) { m_frameRateController->setMaxFramesPending(maxFramesPending); } -void CCScheduler::setSwapBuffersCompleteSupported(bool supported) +void Scheduler::setSwapBuffersCompleteSupported(bool supported) { m_frameRateController->setSwapBuffersCompleteSupported(supported); } -void CCScheduler::didSwapBuffersComplete() +void Scheduler::didSwapBuffersComplete() { - TRACE_EVENT0("cc", "CCScheduler::didSwapBuffersComplete"); + TRACE_EVENT0("cc", "Scheduler::didSwapBuffersComplete"); m_frameRateController->didFinishFrame(); } -void CCScheduler::didLoseContext() +void Scheduler::didLoseContext() { - TRACE_EVENT0("cc", "CCScheduler::didLoseContext"); + TRACE_EVENT0("cc", "Scheduler::didLoseContext"); m_frameRateController->didAbortAllPendingFrames(); m_stateMachine.didLoseContext(); processScheduledActions(); } -void CCScheduler::didRecreateContext() +void Scheduler::didRecreateContext() { - TRACE_EVENT0("cc", "CCScheduler::didRecreateContext"); + TRACE_EVENT0("cc", "Scheduler::didRecreateContext"); m_stateMachine.didRecreateContext(); processScheduledActions(); } -void CCScheduler::setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) +void Scheduler::setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) { m_frameRateController->setTimebaseAndInterval(timebase, interval); } -base::TimeTicks CCScheduler::anticipatedDrawTime() +base::TimeTicks Scheduler::anticipatedDrawTime() { return m_frameRateController->nextTickTime(); } -void CCScheduler::vsyncTick(bool throttled) +void Scheduler::vsyncTick(bool throttled) { - TRACE_EVENT1("cc", "CCScheduler::vsyncTick", "throttled", throttled); + TRACE_EVENT1("cc", "Scheduler::vsyncTick", "throttled", throttled); if (!throttled) m_stateMachine.didEnterVSync(); processScheduledActions(); @@ -140,7 +140,7 @@ void CCScheduler::vsyncTick(bool throttled) m_stateMachine.didLeaveVSync(); } -void CCScheduler::processScheduledActions() +void Scheduler::processScheduledActions() { // We do not allow processScheduledActions to be recursive. // The top-level call will iteratively execute the next action for us anyway. @@ -149,36 +149,36 @@ void CCScheduler::processScheduledActions() AutoReset<bool> markInside(&m_insideProcessScheduledActions, true); - CCSchedulerStateMachine::Action action = m_stateMachine.nextAction(); - while (action != CCSchedulerStateMachine::ACTION_NONE) { + SchedulerStateMachine::Action action = m_stateMachine.nextAction(); + while (action != SchedulerStateMachine::ACTION_NONE) { m_stateMachine.updateState(action); - TRACE_EVENT1("cc", "CCScheduler::processScheduledActions()", "action", action); + TRACE_EVENT1("cc", "Scheduler::processScheduledActions()", "action", action); switch (action) { - case CCSchedulerStateMachine::ACTION_NONE: + case SchedulerStateMachine::ACTION_NONE: break; - case CCSchedulerStateMachine::ACTION_BEGIN_FRAME: + case SchedulerStateMachine::ACTION_BEGIN_FRAME: m_client->scheduledActionBeginFrame(); break; - case CCSchedulerStateMachine::ACTION_COMMIT: + case SchedulerStateMachine::ACTION_COMMIT: m_client->scheduledActionCommit(); break; - case CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: { - CCScheduledActionDrawAndSwapResult result = m_client->scheduledActionDrawAndSwapIfPossible(); + case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: { + ScheduledActionDrawAndSwapResult result = m_client->scheduledActionDrawAndSwapIfPossible(); m_stateMachine.didDrawIfPossibleCompleted(result.didDraw); if (result.didSwap) m_frameRateController->didBeginFrame(); break; } - case CCSchedulerStateMachine::ACTION_DRAW_FORCED: { - CCScheduledActionDrawAndSwapResult result = m_client->scheduledActionDrawAndSwapForced(); + case SchedulerStateMachine::ACTION_DRAW_FORCED: { + ScheduledActionDrawAndSwapResult result = m_client->scheduledActionDrawAndSwapForced(); if (result.didSwap) m_frameRateController->didBeginFrame(); break; - } case CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION: + } case SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION: m_client->scheduledActionBeginContextRecreation(); break; - case CCSchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: + case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: m_client->scheduledActionAcquireLayerTexturesForMainThread(); break; } diff --git a/cc/scheduler.h b/cc/scheduler.h index dd62b45..15d3a6f 100644 --- a/cc/scheduler.h +++ b/cc/scheduler.h @@ -13,15 +13,15 @@ namespace cc { -class CCThread; +class Thread; -struct CCScheduledActionDrawAndSwapResult { - CCScheduledActionDrawAndSwapResult() +struct ScheduledActionDrawAndSwapResult { + ScheduledActionDrawAndSwapResult() : didDraw(false) , didSwap(false) { } - CCScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) + ScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) : didDraw(didDraw) , didSwap(didSwap) { @@ -30,28 +30,28 @@ struct CCScheduledActionDrawAndSwapResult { bool didSwap; }; -class CCSchedulerClient { +class SchedulerClient { public: virtual void scheduledActionBeginFrame() = 0; - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() = 0; - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() = 0; + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() = 0; + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() = 0; virtual void scheduledActionCommit() = 0; virtual void scheduledActionBeginContextRecreation() = 0; virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0; protected: - virtual ~CCSchedulerClient() { } + virtual ~SchedulerClient() { } }; -class CCScheduler : CCFrameRateControllerClient { +class Scheduler : FrameRateControllerClient { public: - static scoped_ptr<CCScheduler> create(CCSchedulerClient* client, scoped_ptr<CCFrameRateController> frameRateController) + static scoped_ptr<Scheduler> create(SchedulerClient* client, scoped_ptr<FrameRateController> frameRateController) { - return make_scoped_ptr(new CCScheduler(client, frameRateController.Pass())); + return make_scoped_ptr(new Scheduler(client, frameRateController.Pass())); } - virtual ~CCScheduler(); + virtual ~Scheduler(); void setCanBeginFrame(bool); @@ -87,20 +87,20 @@ public: base::TimeTicks anticipatedDrawTime(); - // CCFrameRateControllerClient implementation + // FrameRateControllerClient implementation virtual void vsyncTick(bool throttled) OVERRIDE; private: - CCScheduler(CCSchedulerClient*, scoped_ptr<CCFrameRateController>); + Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>); void processScheduledActions(); - CCSchedulerClient* m_client; - scoped_ptr<CCFrameRateController> m_frameRateController; - CCSchedulerStateMachine m_stateMachine; + SchedulerClient* m_client; + scoped_ptr<FrameRateController> m_frameRateController; + SchedulerStateMachine m_stateMachine; bool m_insideProcessScheduledActions; - DISALLOW_COPY_AND_ASSIGN(CCScheduler); + DISALLOW_COPY_AND_ASSIGN(Scheduler); }; } // namespace cc diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc index 47fa5a0..9605057 100644 --- a/cc/scheduler_state_machine.cc +++ b/cc/scheduler_state_machine.cc @@ -10,7 +10,7 @@ namespace cc { -CCSchedulerStateMachine::CCSchedulerStateMachine() +SchedulerStateMachine::SchedulerStateMachine() : m_commitState(COMMIT_STATE_IDLE) , m_currentFrameNumber(0) , m_lastFrameNumberWhereDrawWasCalled(-1) @@ -32,7 +32,7 @@ CCSchedulerStateMachine::CCSchedulerStateMachine() { } -std::string CCSchedulerStateMachine::toString() +std::string SchedulerStateMachine::toString() { std::string str; base::StringAppendF(&str, "m_commitState = %d; ", m_commitState); @@ -56,12 +56,12 @@ std::string CCSchedulerStateMachine::toString() return str; } -bool CCSchedulerStateMachine::hasDrawnThisFrame() const +bool SchedulerStateMachine::hasDrawnThisFrame() const { return m_currentFrameNumber == m_lastFrameNumberWhereDrawWasCalled; } -bool CCSchedulerStateMachine::drawSuspendedUntilCommit() const +bool SchedulerStateMachine::drawSuspendedUntilCommit() const { if (!m_canDraw) return true; @@ -72,7 +72,7 @@ bool CCSchedulerStateMachine::drawSuspendedUntilCommit() const return false; } -bool CCSchedulerStateMachine::scheduledToDraw() const +bool SchedulerStateMachine::scheduledToDraw() const { if (!m_needsRedraw) return false; @@ -81,7 +81,7 @@ bool CCSchedulerStateMachine::scheduledToDraw() const return true; } -bool CCSchedulerStateMachine::shouldDraw() const +bool SchedulerStateMachine::shouldDraw() const { if (m_needsForcedRedraw) return true; @@ -97,7 +97,7 @@ bool CCSchedulerStateMachine::shouldDraw() const return true; } -bool CCSchedulerStateMachine::shouldAcquireLayerTexturesForMainThread() const +bool SchedulerStateMachine::shouldAcquireLayerTexturesForMainThread() const { if (!m_mainThreadNeedsLayerTextures) return false; @@ -113,7 +113,7 @@ bool CCSchedulerStateMachine::shouldAcquireLayerTexturesForMainThread() const return false; } -CCSchedulerStateMachine::Action CCSchedulerStateMachine::nextAction() const +SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const { if (shouldAcquireLayerTexturesForMainThread()) return ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD; @@ -155,7 +155,7 @@ CCSchedulerStateMachine::Action CCSchedulerStateMachine::nextAction() const return ACTION_NONE; } -void CCSchedulerStateMachine::updateState(Action action) +void SchedulerStateMachine::updateState(Action action) { switch (action) { case ACTION_NONE: @@ -210,14 +210,14 @@ void CCSchedulerStateMachine::updateState(Action action) } } -void CCSchedulerStateMachine::setMainThreadNeedsLayerTextures() +void SchedulerStateMachine::setMainThreadNeedsLayerTextures() { DCHECK(!m_mainThreadNeedsLayerTextures); DCHECK(m_textureState != LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); m_mainThreadNeedsLayerTextures = true; } -bool CCSchedulerStateMachine::vsyncCallbackNeeded() const +bool SchedulerStateMachine::vsyncCallbackNeeded() const { // If we can't draw, don't tick until we are notified that we can draw again. if (!m_canDraw) @@ -229,33 +229,33 @@ bool CCSchedulerStateMachine::vsyncCallbackNeeded() const return m_needsRedraw && m_visible && m_contextState == CONTEXT_ACTIVE; } -void CCSchedulerStateMachine::didEnterVSync() +void SchedulerStateMachine::didEnterVSync() { m_insideVSync = true; } -void CCSchedulerStateMachine::didLeaveVSync() +void SchedulerStateMachine::didLeaveVSync() { m_currentFrameNumber++; m_insideVSync = false; } -void CCSchedulerStateMachine::setVisible(bool visible) +void SchedulerStateMachine::setVisible(bool visible) { m_visible = visible; } -void CCSchedulerStateMachine::setNeedsRedraw() +void SchedulerStateMachine::setNeedsRedraw() { m_needsRedraw = true; } -void CCSchedulerStateMachine::setNeedsForcedRedraw() +void SchedulerStateMachine::setNeedsForcedRedraw() { m_needsForcedRedraw = true; } -void CCSchedulerStateMachine::didDrawIfPossibleCompleted(bool success) +void SchedulerStateMachine::didDrawIfPossibleCompleted(bool success) { m_drawIfPossibleFailed = !success; if (m_drawIfPossibleFailed) { @@ -272,44 +272,44 @@ void CCSchedulerStateMachine::didDrawIfPossibleCompleted(bool success) m_consecutiveFailedDraws = 0; } -void CCSchedulerStateMachine::setNeedsCommit() +void SchedulerStateMachine::setNeedsCommit() { m_needsCommit = true; } -void CCSchedulerStateMachine::setNeedsForcedCommit() +void SchedulerStateMachine::setNeedsForcedCommit() { m_needsForcedCommit = true; } -void CCSchedulerStateMachine::beginFrameComplete() +void SchedulerStateMachine::beginFrameComplete() { DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS); m_commitState = COMMIT_STATE_READY_TO_COMMIT; } -void CCSchedulerStateMachine::beginFrameAborted() +void SchedulerStateMachine::beginFrameAborted() { DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS); m_commitState = COMMIT_STATE_IDLE; setNeedsCommit(); } -void CCSchedulerStateMachine::didLoseContext() +void SchedulerStateMachine::didLoseContext() { if (m_contextState == CONTEXT_LOST || m_contextState == CONTEXT_RECREATING) return; m_contextState = CONTEXT_LOST; } -void CCSchedulerStateMachine::didRecreateContext() +void SchedulerStateMachine::didRecreateContext() { DCHECK(m_contextState == CONTEXT_RECREATING); m_contextState = CONTEXT_ACTIVE; setNeedsCommit(); } -void CCSchedulerStateMachine::setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int numDraws) +void SchedulerStateMachine::setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int numDraws) { m_maximumNumberOfFailedDrawsBeforeDrawIsForced = numDraws; } diff --git a/cc/scheduler_state_machine.h b/cc/scheduler_state_machine.h index 092231f..782c084 100644 --- a/cc/scheduler_state_machine.h +++ b/cc/scheduler_state_machine.h @@ -11,7 +11,7 @@ namespace cc { -// The CCSchedulerStateMachine decides how to coordinate main thread activites +// The SchedulerStateMachine decides how to coordinate main thread activites // like painting/running javascript with rendering and input activities on the // impl thread. // @@ -21,9 +21,9 @@ namespace cc { // // The scheduler seperates "what to do next" from the updating of its internal state to // make testing cleaner. -class CCSchedulerStateMachine { +class SchedulerStateMachine { public: - CCSchedulerStateMachine(); + SchedulerStateMachine(); enum CommitState { COMMIT_STATE_IDLE, @@ -153,7 +153,7 @@ protected: TextureState m_textureState; ContextState m_contextState; - DISALLOW_COPY_AND_ASSIGN(CCSchedulerStateMachine); + DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); }; } diff --git a/cc/scheduler_state_machine_unittest.cc b/cc/scheduler_state_machine_unittest.cc index b588913..6d9f242 100644 --- a/cc/scheduler_state_machine_unittest.cc +++ b/cc/scheduler_state_machine_unittest.cc @@ -12,15 +12,15 @@ using namespace cc; namespace { -const CCSchedulerStateMachine::CommitState allCommitStates[] = { - CCSchedulerStateMachine::COMMIT_STATE_IDLE, - CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, - CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, - CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW +const SchedulerStateMachine::CommitState allCommitStates[] = { + SchedulerStateMachine::COMMIT_STATE_IDLE, + SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, + SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, + SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW }; -// Exposes the protected state fields of the CCSchedulerStateMachine for testing -class StateMachine : public CCSchedulerStateMachine { +// Exposes the protected state fields of the SchedulerStateMachine for testing +class StateMachine : public SchedulerStateMachine { public: void setCommitState(CommitState cs) { m_commitState = cs; } CommitState commitState() const { return m_commitState; } @@ -42,12 +42,12 @@ public: bool visible() const { return m_visible; } }; -TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) +TEST(SchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) { // If no commit needed, do nothing { StateMachine state; - state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE); + state.setCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); state.setCanBeginFrame(true); state.setNeedsRedraw(false); state.setNeedsCommit(false); @@ -56,16 +56,16 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) EXPECT_FALSE(state.vsyncCallbackNeeded()); state.didLeaveVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); EXPECT_FALSE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); } // If commit requested but canBeginFrame is still false, do nothing. { StateMachine state; - state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE); + state.setCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); state.setNeedsRedraw(false); state.setNeedsCommit(false); state.setVisible(true); @@ -73,17 +73,17 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) EXPECT_FALSE(state.vsyncCallbackNeeded()); state.didLeaveVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); EXPECT_FALSE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); } // If commit requested, begin a frame { StateMachine state; - state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE); + state.setCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); state.setCanBeginFrame(true); state.setNeedsRedraw(false); state.setNeedsCommit(true); @@ -96,25 +96,25 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); EXPECT_FALSE(state.needsCommit()); EXPECT_FALSE(state.vsyncCallbackNeeded()); } } -TEST(CCSchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw) +TEST(SchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanDraw(true); state.setNeedsForcedRedraw(); EXPECT_FALSE(state.redrawPending()); EXPECT_TRUE(state.vsyncCallbackNeeded()); } -TEST(CCSchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAgain) +TEST(SchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAgain) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -124,23 +124,23 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAga state.didEnterVSync(); // We're drawing now. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); EXPECT_FALSE(state.redrawPending()); EXPECT_FALSE(state.commitPending()); // Failing the draw makes us require a commit. state.didDrawIfPossibleCompleted(false); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); EXPECT_TRUE(state.redrawPending()); EXPECT_TRUE(state.commitPending()); } -TEST(CCSchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw) +TEST(SchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -150,46 +150,46 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemov state.didEnterVSync(); // We're drawing now. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); EXPECT_FALSE(state.redrawPending()); EXPECT_FALSE(state.commitPending()); // While still in the same vsync callback, set needs redraw again. // This should not redraw. state.setNeedsRedraw(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Failing the draw makes us require a commit. state.didDrawIfPossibleCompleted(false); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); EXPECT_TRUE(state.redrawPending()); } -TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame) +TEST(SchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); // Start a commit. state.setNeedsCommit(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); EXPECT_TRUE(state.commitPending()); // Then initiate a draw. state.setNeedsRedraw(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); EXPECT_TRUE(state.redrawPending()); // Fail the draw. - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); state.didDrawIfPossibleCompleted(false); EXPECT_TRUE(state.redrawPending()); // But the commit is ongoing. @@ -197,37 +197,37 @@ TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame // Finish the commit. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_COMMIT); EXPECT_TRUE(state.redrawPending()); // And we should be allowed to draw again. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotAllowDrawInSameFrame) +TEST(SchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotAllowDrawInSameFrame) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); // Start a commit. state.setNeedsCommit(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); EXPECT_TRUE(state.commitPending()); // Then initiate a draw. state.setNeedsRedraw(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); EXPECT_TRUE(state.redrawPending()); // Fail the draw. - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); state.didDrawIfPossibleCompleted(false); EXPECT_TRUE(state.redrawPending()); // But the commit is ongoing. @@ -235,28 +235,28 @@ TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotA // Force a draw. state.setNeedsForcedRedraw(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); // Do the forced draw. - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_FORCED); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_FORCED); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); EXPECT_FALSE(state.redrawPending()); // And the commit is still ongoing. EXPECT_TRUE(state.commitPending()); // Finish the commit. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_COMMIT); EXPECT_TRUE(state.redrawPending()); // And we should not be allowed to draw again in the same frame.. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTheNextCommit) +TEST(SchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTheNextCommit) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -264,20 +264,20 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTh // Start a commit. state.setNeedsCommit(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); EXPECT_TRUE(state.commitPending()); // Then initiate a draw. state.setNeedsRedraw(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); EXPECT_TRUE(state.redrawPending()); // Fail the draw. - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); state.didDrawIfPossibleCompleted(false); EXPECT_TRUE(state.redrawPending()); // But the commit is ongoing. @@ -286,17 +286,17 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTh // Finish the commit. Note, we should not yet be forcing a draw, but should // continue the commit as usual. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_COMMIT); EXPECT_TRUE(state.redrawPending()); // The redraw should be forced in this case. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync) +TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -305,41 +305,41 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync) state.setNeedsRedraw(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); EXPECT_TRUE(state.redrawPending()); // Fail the draw. - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); state.didDrawIfPossibleCompleted(false); EXPECT_TRUE(state.redrawPending()); // We should not be trying to draw again now, but we have a commit pending. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); state.didLeaveVSync(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); // We should try draw again in the next vsync. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) +TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { - CCSchedulerStateMachine state; + SchedulerStateMachine state; state.setVisible(true); state.setCanDraw(true); state.setNeedsRedraw(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); // While still in the same vsync callback, set needs redraw again. // This should not redraw. state.setNeedsRedraw(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Move to another frame. This should now draw. state.didDrawIfPossibleCompleted(true); @@ -347,16 +347,16 @@ TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); state.didDrawIfPossibleCompleted(true); EXPECT_FALSE(state.vsyncCallbackNeeded()); } -TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) +TEST(SchedulerStateMachineTest, TestNextActionDrawsOnVSync) { // When not on vsync, or on vsync but not visible, don't draw. - size_t numCommitStates = sizeof(allCommitStates) / sizeof(CCSchedulerStateMachine::CommitState); + size_t numCommitStates = sizeof(allCommitStates) / sizeof(SchedulerStateMachine::CommitState); for (size_t i = 0; i < numCommitStates; ++i) { for (unsigned j = 0; j < 2; ++j) { StateMachine state; @@ -370,11 +370,11 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) // Case 1: needsCommit=false state.setNeedsCommit(false); - EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); // Case 2: needsCommit=true state.setNeedsCommit(true); - EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); } } @@ -392,11 +392,11 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) } else state.setNeedsForcedRedraw(true); - CCSchedulerStateMachine::Action expectedAction; - if (allCommitStates[i] != CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT) - expectedAction = forcedDraw ? CCSchedulerStateMachine::ACTION_DRAW_FORCED : CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE; + SchedulerStateMachine::Action expectedAction; + if (allCommitStates[i] != SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT) + expectedAction = forcedDraw ? SchedulerStateMachine::ACTION_DRAW_FORCED : SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE; else - expectedAction = CCSchedulerStateMachine::ACTION_COMMIT; + expectedAction = SchedulerStateMachine::ACTION_COMMIT; // Case 1: needsCommit=false. state.setNeedsCommit(false); @@ -411,9 +411,9 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) } } -TEST(CCSchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) +TEST(SchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) { - size_t numCommitStates = sizeof(allCommitStates) / sizeof(CCSchedulerStateMachine::CommitState); + size_t numCommitStates = sizeof(allCommitStates) / sizeof(SchedulerStateMachine::CommitState); for (size_t i = 0; i < numCommitStates; ++i) { // There shouldn't be any drawing regardless of vsync. for (unsigned j = 0; j < 2; ++j) { @@ -427,18 +427,18 @@ TEST(CCSchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) // Case 1: needsCommit=false. state.setNeedsCommit(false); - EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); // Case 2: needsCommit=true. state.setNeedsCommit(true); - EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); } } } -TEST(CCSchedulerStateMachineTest, TestCanRedraw_StopsDraw) +TEST(SchedulerStateMachineTest, TestCanRedraw_StopsDraw) { - size_t numCommitStates = sizeof(allCommitStates) / sizeof(CCSchedulerStateMachine::CommitState); + size_t numCommitStates = sizeof(allCommitStates) / sizeof(SchedulerStateMachine::CommitState); for (size_t i = 0; i < numCommitStates; ++i) { // There shouldn't be any drawing regardless of vsync. for (unsigned j = 0; j < 2; ++j) { @@ -451,24 +451,24 @@ TEST(CCSchedulerStateMachineTest, TestCanRedraw_StopsDraw) state.didEnterVSync(); state.setCanDraw(false); - EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); } } } -TEST(CCSchedulerStateMachineTest, TestCanRedrawWithWaitingForFirstDrawMakesProgress) +TEST(SchedulerStateMachineTest, TestCanRedrawWithWaitingForFirstDrawMakesProgress) { StateMachine state; - state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW); + state.setCommitState(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW); state.setCanBeginFrame(true); state.setNeedsCommit(true); state.setNeedsRedraw(true); state.setVisible(true); state.setCanDraw(false); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) +TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) { StateMachine state; state.setCanBeginFrame(true); @@ -477,9 +477,9 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) state.setCanDraw(true); // Begin the frame. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); state.updateState(state.nextAction()); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); // Now, while the frame is in progress, set another commit. state.setNeedsCommit(true); @@ -487,27 +487,27 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) // Let the frame finish. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState()); // Expect to commit regardless of vsync state. state.didLeaveVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); // Commit and make sure we draw on next vsync - state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + state.updateState(SchedulerStateMachine::ACTION_COMMIT); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); state.didDrawIfPossibleCompleted(true); // Verify that another commit will begin. state.didLeaveVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestFullCycle) +TEST(SchedulerStateMachineTest, TestFullCycle) { StateMachine state; state.setCanBeginFrame(true); @@ -516,41 +516,41 @@ TEST(CCSchedulerStateMachineTest, TestFullCycle) // Start clean and set commit. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); // Begin the frame. - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); EXPECT_FALSE(state.needsCommit()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Tell the scheduler the frame finished. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); // Commit. - state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_COMMIT); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); EXPECT_TRUE(state.needsRedraw()); // Expect to do nothing until vsync. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // At vsync, draw. state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); state.didDrawIfPossibleCompleted(true); state.didLeaveVSync(); // Should be synchronized, no draw needed, no action needed. - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); EXPECT_FALSE(state.needsRedraw()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) +TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { StateMachine state; state.setCanBeginFrame(true); @@ -559,52 +559,52 @@ TEST(CCSchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) // Start clean and set commit. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); // Begin the frame. - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); EXPECT_FALSE(state.needsCommit()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Request another commit while the commit is in flight. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Tell the scheduler the frame finished. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); // Commit. - state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_COMMIT); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); EXPECT_TRUE(state.needsRedraw()); // Expect to do nothing until vsync. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // At vsync, draw. state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); - state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + state.updateState(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); state.didDrawIfPossibleCompleted(true); state.didLeaveVSync(); // Should be synchronized, no draw needed, no action needed. - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); EXPECT_FALSE(state.needsRedraw()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestRequestCommitInvisible) +TEST(SchedulerStateMachineTest, TestRequestCommitInvisible) { StateMachine state; state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) +TEST(SchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) { StateMachine state; state.setCanBeginFrame(true); @@ -613,37 +613,37 @@ TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) // Start clean and set commit. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); // Begin the frame while visible. - state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); + state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); EXPECT_FALSE(state.needsCommit()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Become invisible and abort the beginFrame. state.setVisible(false); state.beginFrameAborted(); // We should now be back in the idle state as if we didn't start a frame at all. - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Become visible again state.setVisible(true); // We should be beginning a frame now - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); // Begin the frame state.updateState(state.nextAction()); // We should be starting the commit now - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); } -TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) +TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) { StateMachine state; state.setCanBeginFrame(true); @@ -652,21 +652,21 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) state.didLoseContext(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.updateState(state.nextAction()); // Once context recreation begins, nothing should happen. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Recreate the context state.didRecreateContext(); // When the context is recreated, we should begin a commit - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); state.updateState(state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRecreating) +TEST(SchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRecreating) { StateMachine state; state.setCanBeginFrame(true); @@ -675,35 +675,35 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhile state.didLoseContext(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.updateState(state.nextAction()); // Once context recreation begins, nothing should happen. - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // While context is recreating, commits shouldn't begin. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Recreate the context state.didRecreateContext(); // When the context is recreated, we should begin a commit - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); state.updateState(state.nextAction()); // Once the context is recreated, whether we draw should be based on // setCanDraw. state.setNeedsRedraw(true); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); state.setCanDraw(false); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); state.setCanDraw(true); state.didLeaveVSync(); } -TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress) +TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { StateMachine state; state.setCanBeginFrame(true); @@ -712,13 +712,13 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress) // Get a commit in flight. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); state.updateState(state.nextAction()); // Set damage and expect a draw. state.setNeedsRedraw(true); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); state.updateState(state.nextAction()); state.didLeaveVSync(); @@ -727,26 +727,26 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress) // Ask for another draw. Expect nothing happens. state.setNeedsRedraw(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Finish the frame, and commit. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); state.updateState(state.nextAction()); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); state.updateState(state.nextAction()); // Expect to be told to begin context recreation, independent of vsync state state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.didLeaveVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested) +TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested) { StateMachine state; state.setCanBeginFrame(true); @@ -755,13 +755,13 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnother // Get a commit in flight. state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); state.updateState(state.nextAction()); // Set damage and expect a draw. state.setNeedsRedraw(true); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); state.updateState(state.nextAction()); state.didLeaveVSync(); @@ -771,27 +771,27 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnother // Ask for another draw and also set needs commit. Expect nothing happens. state.setNeedsRedraw(true); state.setNeedsCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); // Finish the frame, and commit. state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); state.updateState(state.nextAction()); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction()); state.updateState(state.nextAction()); // Expect to be told to begin context recreation, independent of vsync state state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.didLeaveVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) +TEST(SchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) { StateMachine state; state.setVisible(true); @@ -803,62 +803,62 @@ TEST(CCSchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) // Ask a forced redraw and verify it ocurrs. state.setNeedsForcedRedraw(true); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); state.didLeaveVSync(); // Clear the forced redraw bit. state.setNeedsForcedRedraw(false); // Expect to be told to begin context recreation, independent of vsync state - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.updateState(state.nextAction()); // Ask a forced redraw and verify it ocurrs. state.setNeedsForcedRedraw(true); state.didEnterVSync(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction()); state.didLeaveVSync(); } -TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenInvisibleAndForceCommit) +TEST(SchedulerStateMachineTest, TestBeginFrameWhenInvisibleAndForceCommit) { StateMachine state; state.setCanBeginFrame(true); state.setVisible(false); state.setNeedsCommit(true); state.setNeedsForcedCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceCommit) +TEST(SchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceCommit) { StateMachine state; state.setVisible(true); state.setCanDraw(true); state.setNeedsCommit(true); state.setNeedsForcedCommit(true); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress) +TEST(SchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress) { StateMachine state; state.setCanBeginFrame(true); state.setVisible(false); - state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS); + state.setCommitState(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS); state.setNeedsCommit(true); state.setNeedsForcedCommit(true); state.beginFrameComplete(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.nextAction()); state.updateState(state.nextAction()); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } -TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenContextLost) +TEST(SchedulerStateMachineTest, TestBeginFrameWhenContextLost) { StateMachine state; state.setCanBeginFrame(true); @@ -867,7 +867,7 @@ TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenContextLost) state.setNeedsCommit(true); state.setNeedsForcedCommit(true); state.didLoseContext(); - EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } } diff --git a/cc/scheduler_unittest.cc b/cc/scheduler_unittest.cc index b52554e..8a4cede 100644 --- a/cc/scheduler_unittest.cc +++ b/cc/scheduler_unittest.cc @@ -16,9 +16,9 @@ using namespace WebKitTests; namespace { -class FakeCCSchedulerClient : public CCSchedulerClient { +class FakeSchedulerClient : public SchedulerClient { public: - FakeCCSchedulerClient() { reset(); } + FakeSchedulerClient() { reset(); } void reset() { m_actions.clear(); @@ -40,17 +40,17 @@ public: } virtual void scheduledActionBeginFrame() OVERRIDE { m_actions.push_back("scheduledActionBeginFrame"); } - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE { m_actions.push_back("scheduledActionDrawAndSwapIfPossible"); m_numDraws++; - return CCScheduledActionDrawAndSwapResult(m_drawWillHappen, m_drawWillHappen && m_swapWillHappenIfDrawHappens); + return ScheduledActionDrawAndSwapResult(m_drawWillHappen, m_drawWillHappen && m_swapWillHappenIfDrawHappens); } - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE { m_actions.push_back("scheduledActionDrawAndSwapForced"); - return CCScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHappens); + return ScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHappens); } virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("scheduledActionCommit"); } @@ -68,11 +68,11 @@ protected: std::vector<const char*> m_actions; }; -TEST(CCSchedulerTest, RequestCommit) +TEST(SchedulerTest, RequestCommit) { - FakeCCSchedulerClient client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + FakeSchedulerClient client; + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -102,11 +102,11 @@ TEST(CCSchedulerTest, RequestCommit) EXPECT_FALSE(timeSource->active()); } -TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) +TEST(SchedulerTest, RequestCommitAfterBeginFrame) { - FakeCCSchedulerClient client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + FakeSchedulerClient client; + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -136,11 +136,11 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) client.reset(); } -TEST(CCSchedulerTest, TextureAcquisitionCollision) +TEST(SchedulerTest, TextureAcquisitionCollision) { - FakeCCSchedulerClient client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + FakeSchedulerClient client; + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -175,11 +175,11 @@ TEST(CCSchedulerTest, TextureAcquisitionCollision) client.reset(); } -TEST(CCSchedulerTest, VisibilitySwitchWithTextureAcquisition) +TEST(SchedulerTest, VisibilitySwitchWithTextureAcquisition) { - FakeCCSchedulerClient client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + FakeSchedulerClient client; + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -204,26 +204,26 @@ TEST(CCSchedulerTest, VisibilitySwitchWithTextureAcquisition) client.reset(); } -class SchedulerClientThatSetNeedsDrawInsideDraw : public FakeCCSchedulerClient { +class SchedulerClientThatSetNeedsDrawInsideDraw : public FakeSchedulerClient { public: SchedulerClientThatSetNeedsDrawInsideDraw() : m_scheduler(0) { } - void setScheduler(CCScheduler* scheduler) { m_scheduler = scheduler; } + void setScheduler(Scheduler* scheduler) { m_scheduler = scheduler; } virtual void scheduledActionBeginFrame() OVERRIDE { } - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE { // Only setNeedsRedraw the first time this is called if (!m_numDraws) m_scheduler->setNeedsRedraw(); - return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); + return FakeSchedulerClient::scheduledActionDrawAndSwapIfPossible(); } - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE { NOTREACHED(); - return CCScheduledActionDrawAndSwapResult(true, true); + return ScheduledActionDrawAndSwapResult(true, true); } virtual void scheduledActionCommit() OVERRIDE { } @@ -231,18 +231,18 @@ public: virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } protected: - CCScheduler* m_scheduler; + Scheduler* m_scheduler; }; // Tests for two different situations: // 1. the scheduler dropping setNeedsRedraw requests that happen inside // a scheduledActionDrawAndSwap // 2. the scheduler drawing twice inside a single tick -TEST(CCSchedulerTest, RequestRedrawInsideDraw) +TEST(SchedulerTest, RequestRedrawInsideDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -265,11 +265,11 @@ TEST(CCSchedulerTest, RequestRedrawInsideDraw) } // Test that requesting redraw inside a failed draw doesn't lose the request. -TEST(CCSchedulerTest, RequestRedrawInsideFailedDraw) +TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -306,26 +306,26 @@ TEST(CCSchedulerTest, RequestRedrawInsideFailedDraw) EXPECT_FALSE(timeSource->active()); } -class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeCCSchedulerClient { +class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient { public: SchedulerClientThatSetNeedsCommitInsideDraw() : m_scheduler(0) { } - void setScheduler(CCScheduler* scheduler) { m_scheduler = scheduler; } + void setScheduler(Scheduler* scheduler) { m_scheduler = scheduler; } virtual void scheduledActionBeginFrame() OVERRIDE { } - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE { // Only setNeedsCommit the first time this is called if (!m_numDraws) m_scheduler->setNeedsCommit(); - return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); + return FakeSchedulerClient::scheduledActionDrawAndSwapIfPossible(); } - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE { NOTREACHED(); - return CCScheduledActionDrawAndSwapResult(true, true); + return ScheduledActionDrawAndSwapResult(true, true); } virtual void scheduledActionCommit() OVERRIDE { } @@ -333,16 +333,16 @@ public: virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } protected: - CCScheduler* m_scheduler; + Scheduler* m_scheduler; }; // Tests for the scheduler infinite-looping on setNeedsCommit requests that // happen inside a scheduledActionDrawAndSwap -TEST(CCSchedulerTest, RequestCommitInsideDraw) +TEST(SchedulerTest, RequestCommitInsideDraw) { SchedulerClientThatSetNeedsCommitInsideDraw client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -366,11 +366,11 @@ TEST(CCSchedulerTest, RequestCommitInsideDraw) } // Tests that when a draw fails then the pending commit should not be dropped. -TEST(CCSchedulerTest, RequestCommitInsideFailedDraw) +TEST(SchedulerTest, RequestCommitInsideFailedDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -407,13 +407,13 @@ TEST(CCSchedulerTest, RequestCommitInsideFailedDraw) EXPECT_FALSE(timeSource->active()); } -TEST(CCSchedulerTest, NoBeginFrameWhenDrawFails) +TEST(SchedulerTest, NoBeginFrameWhenDrawFails) { - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); SchedulerClientThatSetNeedsCommitInsideDraw client; - scoped_ptr<FakeCCFrameRateController> controller(new FakeCCFrameRateController(timeSource)); - FakeCCFrameRateController* controllerPtr = controller.get(); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, controller.PassAs<CCFrameRateController>()); + scoped_ptr<FakeFrameRateController> controller(new FakeFrameRateController(timeSource)); + FakeFrameRateController* controllerPtr = controller.get(); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, controller.PassAs<FrameRateController>()); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -444,13 +444,13 @@ TEST(CCSchedulerTest, NoBeginFrameWhenDrawFails) EXPECT_EQ(0, controllerPtr->numFramesPending()); } -TEST(CCSchedulerTest, NoBeginFrameWhenSwapFailsDuringForcedCommit) +TEST(SchedulerTest, NoBeginFrameWhenSwapFailsDuringForcedCommit) { - scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); - FakeCCSchedulerClient client; - scoped_ptr<FakeCCFrameRateController> controller(new FakeCCFrameRateController(timeSource)); - FakeCCFrameRateController* controllerPtr = controller.get(); - scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, controller.PassAs<CCFrameRateController>()); + scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); + FakeSchedulerClient client; + scoped_ptr<FakeFrameRateController> controller(new FakeFrameRateController(timeSource)); + FakeFrameRateController* controllerPtr = controller.get(); + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, controller.PassAs<FrameRateController>()); EXPECT_EQ(0, controllerPtr->numFramesPending()); diff --git a/cc/scoped_texture.cc b/cc/scoped_texture.cc index 383c6e7..d7a7369 100644 --- a/cc/scoped_texture.cc +++ b/cc/scoped_texture.cc @@ -8,18 +8,18 @@ namespace cc { -CCScopedTexture::CCScopedTexture(CCResourceProvider* resourceProvider) +ScopedTexture::ScopedTexture(ResourceProvider* resourceProvider) : m_resourceProvider(resourceProvider) { DCHECK(m_resourceProvider); } -CCScopedTexture::~CCScopedTexture() +ScopedTexture::~ScopedTexture() { free(); } -bool CCScopedTexture::allocate(int pool, const IntSize& size, GLenum format, CCResourceProvider::TextureUsageHint hint) +bool ScopedTexture::allocate(int pool, const IntSize& size, GLenum format, ResourceProvider::TextureUsageHint hint) { DCHECK(!id()); DCHECK(!size.isEmpty()); @@ -34,7 +34,7 @@ bool CCScopedTexture::allocate(int pool, const IntSize& size, GLenum format, CCR return id(); } -void CCScopedTexture::free() +void ScopedTexture::free() { if (id()) { #ifndef NDEBUG @@ -45,7 +45,7 @@ void CCScopedTexture::free() setId(0); } -void CCScopedTexture::leak() +void ScopedTexture::leak() { setId(0); } diff --git a/cc/scoped_texture.h b/cc/scoped_texture.h index 40628b1..90ed719 100644 --- a/cc/scoped_texture.h +++ b/cc/scoped_texture.h @@ -16,31 +16,31 @@ namespace cc { -class CCScopedTexture : protected CCTexture { +class ScopedTexture : protected Texture { public: - static scoped_ptr<CCScopedTexture> create(CCResourceProvider* resourceProvider) { return make_scoped_ptr(new CCScopedTexture(resourceProvider)); } - virtual ~CCScopedTexture(); + static scoped_ptr<ScopedTexture> create(ResourceProvider* resourceProvider) { return make_scoped_ptr(new ScopedTexture(resourceProvider)); } + virtual ~ScopedTexture(); - using CCTexture::id; - using CCTexture::size; - using CCTexture::format; - using CCTexture::bytes; + using Texture::id; + using Texture::size; + using Texture::format; + using Texture::bytes; - bool allocate(int pool, const IntSize&, GLenum format, CCResourceProvider::TextureUsageHint); + bool allocate(int pool, const IntSize&, GLenum format, ResourceProvider::TextureUsageHint); void free(); void leak(); protected: - explicit CCScopedTexture(CCResourceProvider*); + explicit ScopedTexture(ResourceProvider*); private: - CCResourceProvider* m_resourceProvider; + ResourceProvider* m_resourceProvider; #ifndef NDEBUG base::PlatformThreadId m_allocateThreadIdentifier; #endif - DISALLOW_COPY_AND_ASSIGN(CCScopedTexture); + DISALLOW_COPY_AND_ASSIGN(ScopedTexture); }; } diff --git a/cc/scoped_texture_unittest.cc b/cc/scoped_texture_unittest.cc index 27c62c1..ebd31a3 100644 --- a/cc/scoped_texture_unittest.cc +++ b/cc/scoped_texture_unittest.cc @@ -19,12 +19,12 @@ using namespace WebKitTests; namespace { -TEST(CCScopedTextureTest, NewScopedTexture) +TEST(ScopedTextureTest, NewScopedTexture) { - scoped_ptr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); DebugScopedSetImplThread implThread; - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); + scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); // New scoped textures do not hold a texture yet. EXPECT_EQ(0u, texture->id()); @@ -34,13 +34,13 @@ TEST(CCScopedTextureTest, NewScopedTexture) EXPECT_EQ(0u, texture->bytes()); } -TEST(CCScopedTextureTest, CreateScopedTexture) +TEST(ScopedTextureTest, CreateScopedTexture) { - scoped_ptr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); DebugScopedSetImplThread implThread; - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); + scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); + texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); // The texture has an allocated byte-size now. size_t expectedBytes = 30 * 30 * 4; @@ -51,17 +51,17 @@ TEST(CCScopedTextureTest, CreateScopedTexture) EXPECT_EQ(IntSize(30, 30), texture->size()); } -TEST(CCScopedTextureTest, ScopedTextureIsDeleted) +TEST(ScopedTextureTest, ScopedTextureIsDeleted) { - scoped_ptr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); DebugScopedSetImplThread implThread; - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); { - scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); + scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); } @@ -69,9 +69,9 @@ TEST(CCScopedTextureTest, ScopedTextureIsDeleted) EXPECT_EQ(0u, resourceProvider->numResources()); { - scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); + scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); texture->free(); @@ -79,17 +79,17 @@ TEST(CCScopedTextureTest, ScopedTextureIsDeleted) } } -TEST(CCScopedTextureTest, LeakScopedTexture) +TEST(ScopedTextureTest, LeakScopedTexture) { - scoped_ptr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); DebugScopedSetImplThread implThread; - scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); { - scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); + scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); diff --git a/cc/scoped_thread_proxy.cc b/cc/scoped_thread_proxy.cc index c2f1b13..f3f04d4 100644 --- a/cc/scoped_thread_proxy.cc +++ b/cc/scoped_thread_proxy.cc @@ -8,13 +8,13 @@ namespace cc { -CCScopedThreadProxy::CCScopedThreadProxy(CCThread* targetThread) +ScopedThreadProxy::ScopedThreadProxy(Thread* targetThread) : m_targetThread(targetThread) , m_shutdown(false) { } -CCScopedThreadProxy::~CCScopedThreadProxy() +ScopedThreadProxy::~ScopedThreadProxy() { } diff --git a/cc/scoped_thread_proxy.h b/cc/scoped_thread_proxy.h index c6ac440..78f862e 100644 --- a/cc/scoped_thread_proxy.h +++ b/cc/scoped_thread_proxy.h @@ -24,22 +24,22 @@ namespace cc { // Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending tasks are not cancelled by actually // destroying the proxy. Instead each pending task holds a reference to the proxy to avoid maintaining an explicit // list of outstanding tasks. -class CCScopedThreadProxy : public ThreadSafeRefCounted<CCScopedThreadProxy> { +class ScopedThreadProxy : public ThreadSafeRefCounted<ScopedThreadProxy> { public: - static PassRefPtr<CCScopedThreadProxy> create(CCThread* targetThread) + static PassRefPtr<ScopedThreadProxy> create(Thread* targetThread) { DCHECK(base::PlatformThread::CurrentId() == targetThread->threadID()); - return adoptRef(new CCScopedThreadProxy(targetThread)); + return adoptRef(new ScopedThreadProxy(targetThread)); } - ~CCScopedThreadProxy(); + ~ScopedThreadProxy(); // Can be called from any thread. Posts a task to the target thread that runs unless // shutdown() is called before it runs. - void postTask(PassOwnPtr<CCThread::Task> task) + void postTask(PassOwnPtr<Thread::Task> task) { ref(); - m_targetThread->postTask(createCCThreadTask(this, &CCScopedThreadProxy::runTaskIfNotShutdown, task)); + m_targetThread->postTask(createThreadTask(this, &ScopedThreadProxy::runTaskIfNotShutdown, task)); } void shutdown() @@ -50,11 +50,11 @@ public: } private: - explicit CCScopedThreadProxy(CCThread* targetThread); + explicit ScopedThreadProxy(Thread* targetThread); - void runTaskIfNotShutdown(PassOwnPtr<CCThread::Task> popTask) + void runTaskIfNotShutdown(PassOwnPtr<Thread::Task> popTask) { - OwnPtr<CCThread::Task> task = popTask; + OwnPtr<Thread::Task> task = popTask; // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't // touch it. if (m_shutdown) { @@ -66,7 +66,7 @@ private: deref(); } - CCThread* m_targetThread; + Thread* m_targetThread; bool m_shutdown; // Only accessed on the target thread }; diff --git a/cc/scrollbar_animation_controller.cc b/cc/scrollbar_animation_controller.cc index f52099f..0cc5f63 100644 --- a/cc/scrollbar_animation_controller.cc +++ b/cc/scrollbar_animation_controller.cc @@ -16,66 +16,66 @@ namespace cc { #if OS(ANDROID) -scoped_ptr<CCScrollbarAnimationController> CCScrollbarAnimationController::create(CCLayerImpl* scrollLayer) +scoped_ptr<ScrollbarAnimationController> ScrollbarAnimationController::create(LayerImpl* scrollLayer) { static const double fadeoutDelay = 0.3; static const double fadeoutLength = 0.3; - return CCScrollbarAnimationControllerLinearFade::create(scrollLayer, fadeoutDelay, fadeoutLength).PassAs<CCScrollbarAnimationController>(); + return ScrollbarAnimationControllerLinearFade::create(scrollLayer, fadeoutDelay, fadeoutLength).PassAs<ScrollbarAnimationController>(); } #else -scoped_ptr<CCScrollbarAnimationController> CCScrollbarAnimationController::create(CCLayerImpl* scrollLayer) +scoped_ptr<ScrollbarAnimationController> ScrollbarAnimationController::create(LayerImpl* scrollLayer) { - return make_scoped_ptr(new CCScrollbarAnimationController(scrollLayer)); + return make_scoped_ptr(new ScrollbarAnimationController(scrollLayer)); } #endif -CCScrollbarAnimationController::CCScrollbarAnimationController(CCLayerImpl* scrollLayer) +ScrollbarAnimationController::ScrollbarAnimationController(LayerImpl* scrollLayer) : m_horizontalScrollbarLayer(0) , m_verticalScrollbarLayer(0) { - CCScrollbarAnimationController::updateScrollOffsetAtTime(scrollLayer, 0); + ScrollbarAnimationController::updateScrollOffsetAtTime(scrollLayer, 0); } -CCScrollbarAnimationController::~CCScrollbarAnimationController() +ScrollbarAnimationController::~ScrollbarAnimationController() { } -bool CCScrollbarAnimationController::animate(double) +bool ScrollbarAnimationController::animate(double) { return false; } -void CCScrollbarAnimationController::didPinchGestureBegin() +void ScrollbarAnimationController::didPinchGestureBegin() { didPinchGestureBeginAtTime((base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()); } -void CCScrollbarAnimationController::didPinchGestureUpdate() +void ScrollbarAnimationController::didPinchGestureUpdate() { didPinchGestureUpdateAtTime((base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()); } -void CCScrollbarAnimationController::didPinchGestureEnd() +void ScrollbarAnimationController::didPinchGestureEnd() { didPinchGestureEndAtTime((base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()); } -void CCScrollbarAnimationController::updateScrollOffset(CCLayerImpl* scrollLayer) +void ScrollbarAnimationController::updateScrollOffset(LayerImpl* scrollLayer) { updateScrollOffsetAtTime(scrollLayer, (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()); } -IntSize CCScrollbarAnimationController::getScrollLayerBounds(const CCLayerImpl* scrollLayer) +IntSize ScrollbarAnimationController::getScrollLayerBounds(const LayerImpl* scrollLayer) { if (!scrollLayer->children().size()) return IntSize(); - // Copy & paste from CCLayerTreeHostImpl... + // Copy & paste from LayerTreeHostImpl... // FIXME: Hardcoding the first child here is weird. Think of // a cleaner way to get the contentBounds on the Impl side. return scrollLayer->children()[0]->bounds(); } -void CCScrollbarAnimationController::updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double) +void ScrollbarAnimationController::updateScrollOffsetAtTime(LayerImpl* scrollLayer, double) { m_currentPos = scrollLayer->scrollPosition() + scrollLayer->scrollDelta(); m_totalSize = getScrollLayerBounds(scrollLayer); diff --git a/cc/scrollbar_animation_controller.h b/cc/scrollbar_animation_controller.h index 8df057e..9b9c2ca 100644 --- a/cc/scrollbar_animation_controller.h +++ b/cc/scrollbar_animation_controller.h @@ -11,28 +11,28 @@ namespace cc { -class CCLayerImpl; -class CCScrollbarLayerImpl; +class LayerImpl; +class ScrollbarLayerImpl; // This abstract class represents the compositor-side analogy of ScrollbarAnimator. // Individual platforms should subclass it to provide specialized implementation. -class CCScrollbarAnimationController { +class ScrollbarAnimationController { public: - static scoped_ptr<CCScrollbarAnimationController> create(CCLayerImpl* scrollLayer); + static scoped_ptr<ScrollbarAnimationController> create(LayerImpl* scrollLayer); - virtual ~CCScrollbarAnimationController(); + virtual ~ScrollbarAnimationController(); virtual bool animate(double monotonicTime); void didPinchGestureBegin(); void didPinchGestureUpdate(); void didPinchGestureEnd(); - void updateScrollOffset(CCLayerImpl* scrollLayer); + void updateScrollOffset(LayerImpl* scrollLayer); - void setHorizontalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_horizontalScrollbarLayer = layer; } - CCScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalScrollbarLayer; } + void setHorizontalScrollbarLayer(ScrollbarLayerImpl* layer) { m_horizontalScrollbarLayer = layer; } + ScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalScrollbarLayer; } - void setVerticalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_verticalScrollbarLayer = layer; } - CCScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScrollbarLayer; } + void setVerticalScrollbarLayer(ScrollbarLayerImpl* layer) { m_verticalScrollbarLayer = layer; } + ScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScrollbarLayer; } FloatPoint currentPos() const { return m_currentPos; } IntSize totalSize() const { return m_totalSize; } @@ -41,17 +41,17 @@ public: virtual void didPinchGestureBeginAtTime(double monotonicTime) { } virtual void didPinchGestureUpdateAtTime(double monotonicTime) { } virtual void didPinchGestureEndAtTime(double monotonicTime) { } - virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime); + virtual void updateScrollOffsetAtTime(LayerImpl* scrollLayer, double monotonicTime); protected: - explicit CCScrollbarAnimationController(CCLayerImpl* scrollLayer); + explicit ScrollbarAnimationController(LayerImpl* scrollLayer); private: - static IntSize getScrollLayerBounds(const CCLayerImpl*); + static IntSize getScrollLayerBounds(const LayerImpl*); // Beware of dangling pointer. Always update these during tree synchronization. - CCScrollbarLayerImpl* m_horizontalScrollbarLayer; - CCScrollbarLayerImpl* m_verticalScrollbarLayer; + ScrollbarLayerImpl* m_horizontalScrollbarLayer; + ScrollbarLayerImpl* m_verticalScrollbarLayer; FloatPoint m_currentPos; IntSize m_totalSize; diff --git a/cc/scrollbar_animation_controller_linear_fade.cc b/cc/scrollbar_animation_controller_linear_fade.cc index 35b5261..282d19a 100644 --- a/cc/scrollbar_animation_controller_linear_fade.cc +++ b/cc/scrollbar_animation_controller_linear_fade.cc @@ -10,13 +10,13 @@ namespace cc { -scoped_ptr<CCScrollbarAnimationControllerLinearFade> CCScrollbarAnimationControllerLinearFade::create(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength) +scoped_ptr<ScrollbarAnimationControllerLinearFade> ScrollbarAnimationControllerLinearFade::create(LayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength) { - return make_scoped_ptr(new CCScrollbarAnimationControllerLinearFade(scrollLayer, fadeoutDelay, fadeoutLength)); + return make_scoped_ptr(new ScrollbarAnimationControllerLinearFade(scrollLayer, fadeoutDelay, fadeoutLength)); } -CCScrollbarAnimationControllerLinearFade::CCScrollbarAnimationControllerLinearFade(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength) - : CCScrollbarAnimationController(scrollLayer) +ScrollbarAnimationControllerLinearFade::ScrollbarAnimationControllerLinearFade(LayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength) + : ScrollbarAnimationController(scrollLayer) , m_lastAwakenTime(-100000000) // arbitrary invalid timestamp , m_pinchGestureInEffect(false) , m_fadeoutDelay(fadeoutDelay) @@ -24,11 +24,11 @@ CCScrollbarAnimationControllerLinearFade::CCScrollbarAnimationControllerLinearFa { } -CCScrollbarAnimationControllerLinearFade::~CCScrollbarAnimationControllerLinearFade() +ScrollbarAnimationControllerLinearFade::~ScrollbarAnimationControllerLinearFade() { } -bool CCScrollbarAnimationControllerLinearFade::animate(double monotonicTime) +bool ScrollbarAnimationControllerLinearFade::animate(double monotonicTime) { float opacity = opacityAtTime(monotonicTime); if (horizontalScrollbarLayer()) @@ -38,21 +38,21 @@ bool CCScrollbarAnimationControllerLinearFade::animate(double monotonicTime) return opacity; } -void CCScrollbarAnimationControllerLinearFade::didPinchGestureUpdateAtTime(double) +void ScrollbarAnimationControllerLinearFade::didPinchGestureUpdateAtTime(double) { m_pinchGestureInEffect = true; } -void CCScrollbarAnimationControllerLinearFade::didPinchGestureEndAtTime(double monotonicTime) +void ScrollbarAnimationControllerLinearFade::didPinchGestureEndAtTime(double monotonicTime) { m_pinchGestureInEffect = false; m_lastAwakenTime = monotonicTime; } -void CCScrollbarAnimationControllerLinearFade::updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime) +void ScrollbarAnimationControllerLinearFade::updateScrollOffsetAtTime(LayerImpl* scrollLayer, double monotonicTime) { FloatPoint previousPos = currentPos(); - CCScrollbarAnimationController::updateScrollOffsetAtTime(scrollLayer, monotonicTime); + ScrollbarAnimationController::updateScrollOffsetAtTime(scrollLayer, monotonicTime); if (previousPos == currentPos()) return; @@ -60,7 +60,7 @@ void CCScrollbarAnimationControllerLinearFade::updateScrollOffsetAtTime(CCLayerI m_lastAwakenTime = monotonicTime; } -float CCScrollbarAnimationControllerLinearFade::opacityAtTime(double monotonicTime) +float ScrollbarAnimationControllerLinearFade::opacityAtTime(double monotonicTime) { if (m_pinchGestureInEffect) return 1; diff --git a/cc/scrollbar_animation_controller_linear_fade.h b/cc/scrollbar_animation_controller_linear_fade.h index 8b635a1..6d39459 100644 --- a/cc/scrollbar_animation_controller_linear_fade.h +++ b/cc/scrollbar_animation_controller_linear_fade.h @@ -9,20 +9,20 @@ namespace cc { -class CCScrollbarAnimationControllerLinearFade : public CCScrollbarAnimationController { +class ScrollbarAnimationControllerLinearFade : public ScrollbarAnimationController { public: - static scoped_ptr<CCScrollbarAnimationControllerLinearFade> create(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength); + static scoped_ptr<ScrollbarAnimationControllerLinearFade> create(LayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength); - virtual ~CCScrollbarAnimationControllerLinearFade(); + virtual ~ScrollbarAnimationControllerLinearFade(); virtual bool animate(double monotonicTime) OVERRIDE; virtual void didPinchGestureUpdateAtTime(double monotonicTime) OVERRIDE; virtual void didPinchGestureEndAtTime(double monotonicTime) OVERRIDE; - virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime) OVERRIDE; + virtual void updateScrollOffsetAtTime(LayerImpl* scrollLayer, double monotonicTime) OVERRIDE; protected: - CCScrollbarAnimationControllerLinearFade(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength); + ScrollbarAnimationControllerLinearFade(LayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength); private: float opacityAtTime(double monotonicTime); diff --git a/cc/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/scrollbar_animation_controller_linear_fade_unittest.cc index 4fad8ba..79efb1b 100644 --- a/cc/scrollbar_animation_controller_linear_fade_unittest.cc +++ b/cc/scrollbar_animation_controller_linear_fade_unittest.cc @@ -14,32 +14,32 @@ using namespace cc; namespace { -class CCScrollbarAnimationControllerLinearFadeTest : public testing::Test { +class ScrollbarAnimationControllerLinearFadeTest : public testing::Test { protected: virtual void SetUp() { - m_scrollLayer = CCLayerImpl::create(1); - m_scrollLayer->addChild(CCLayerImpl::create(2)); + m_scrollLayer = LayerImpl::create(1); + m_scrollLayer->addChild(LayerImpl::create(2)); m_contentLayer = m_scrollLayer->children()[0]; - m_scrollbarLayer = CCScrollbarLayerImpl::create(3); + m_scrollbarLayer = ScrollbarLayerImpl::create(3); m_scrollLayer->setMaxScrollPosition(IntSize(50, 50)); m_contentLayer->setBounds(IntSize(50, 50)); - m_scrollbarController = CCScrollbarAnimationControllerLinearFade::create(m_scrollLayer.get(), 2, 3); + m_scrollbarController = ScrollbarAnimationControllerLinearFade::create(m_scrollLayer.get(), 2, 3); m_scrollbarController->setHorizontalScrollbarLayer(m_scrollbarLayer.get()); } DebugScopedSetImplThread implThread; - scoped_ptr<CCScrollbarAnimationControllerLinearFade> m_scrollbarController; - scoped_ptr<CCLayerImpl> m_scrollLayer; - CCLayerImpl* m_contentLayer; - scoped_ptr<CCScrollbarLayerImpl> m_scrollbarLayer; + scoped_ptr<ScrollbarAnimationControllerLinearFade> m_scrollbarController; + scoped_ptr<LayerImpl> m_scrollLayer; + LayerImpl* m_contentLayer; + scoped_ptr<ScrollbarLayerImpl> m_scrollbarLayer; }; -TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyHiddenInBegin) +TEST_F(ScrollbarAnimationControllerLinearFadeTest, verifyHiddenInBegin) { m_scrollbarController->animate(0); EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); @@ -48,7 +48,7 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyHiddenInBegin) EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); } -TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll) +TEST_F(ScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll) { m_scrollLayer->setScrollDelta(IntSize(1, 1)); m_scrollbarController->updateScrollOffsetAtTime(m_scrollLayer.get(), 0); @@ -82,7 +82,7 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll) EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); } -TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyForceAwakenByPinch) +TEST_F(ScrollbarAnimationControllerLinearFadeTest, verifyForceAwakenByPinch) { m_scrollbarController->didPinchGestureBeginAtTime(0); m_scrollbarController->didPinchGestureUpdateAtTime(0); diff --git a/cc/scrollbar_geometry_fixed_thumb.cc b/cc/scrollbar_geometry_fixed_thumb.cc index 803aa17..20a5fd6 100644 --- a/cc/scrollbar_geometry_fixed_thumb.cc +++ b/cc/scrollbar_geometry_fixed_thumb.cc @@ -16,18 +16,18 @@ using WebKit::WebScrollbarThemeGeometry; namespace cc { -scoped_ptr<CCScrollbarGeometryFixedThumb> CCScrollbarGeometryFixedThumb::create(scoped_ptr<WebScrollbarThemeGeometry> geometry) +scoped_ptr<ScrollbarGeometryFixedThumb> ScrollbarGeometryFixedThumb::create(scoped_ptr<WebScrollbarThemeGeometry> geometry) { - return make_scoped_ptr(new CCScrollbarGeometryFixedThumb(geometry.Pass())); + return make_scoped_ptr(new ScrollbarGeometryFixedThumb(geometry.Pass())); } -CCScrollbarGeometryFixedThumb::~CCScrollbarGeometryFixedThumb() +ScrollbarGeometryFixedThumb::~ScrollbarGeometryFixedThumb() { } -void CCScrollbarGeometryFixedThumb::update(WebScrollbar* scrollbar) +void ScrollbarGeometryFixedThumb::update(WebScrollbar* scrollbar) { - int length = CCScrollbarGeometryStub::thumbLength(scrollbar); + int length = ScrollbarGeometryStub::thumbLength(scrollbar); if (scrollbar->orientation() == WebScrollbar::Horizontal) m_thumbSize = IntSize(length, scrollbar->size().height); @@ -35,21 +35,21 @@ void CCScrollbarGeometryFixedThumb::update(WebScrollbar* scrollbar) m_thumbSize = IntSize(scrollbar->size().width, length); } -WebScrollbarThemeGeometry* CCScrollbarGeometryFixedThumb::clone() const +WebScrollbarThemeGeometry* ScrollbarGeometryFixedThumb::clone() const { - CCScrollbarGeometryFixedThumb* geometry = new CCScrollbarGeometryFixedThumb(make_scoped_ptr(CCScrollbarGeometryStub::clone())); + ScrollbarGeometryFixedThumb* geometry = new ScrollbarGeometryFixedThumb(make_scoped_ptr(ScrollbarGeometryStub::clone())); geometry->m_thumbSize = m_thumbSize; return geometry; } -int CCScrollbarGeometryFixedThumb::thumbLength(WebScrollbar* scrollbar) +int ScrollbarGeometryFixedThumb::thumbLength(WebScrollbar* scrollbar) { if (scrollbar->orientation() == WebScrollbar::Horizontal) return m_thumbSize.width(); return m_thumbSize.height(); } -int CCScrollbarGeometryFixedThumb::thumbPosition(WebScrollbar* scrollbar) +int ScrollbarGeometryFixedThumb::thumbPosition(WebScrollbar* scrollbar) { if (scrollbar->enabled()) { float size = scrollbar->maximum(); @@ -61,7 +61,7 @@ int CCScrollbarGeometryFixedThumb::thumbPosition(WebScrollbar* scrollbar) } return 0; } -void CCScrollbarGeometryFixedThumb::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect) +void ScrollbarGeometryFixedThumb::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect) { // This is a reimplementation of ScrollbarThemeComposite::splitTrack. // Because the WebScrollbarThemeGeometry functions call down to native @@ -86,8 +86,8 @@ void CCScrollbarGeometryFixedThumb::splitTrack(WebScrollbar* scrollbar, const We } } -CCScrollbarGeometryFixedThumb::CCScrollbarGeometryFixedThumb(scoped_ptr<WebScrollbarThemeGeometry> geometry) - : CCScrollbarGeometryStub(geometry.Pass()) +ScrollbarGeometryFixedThumb::ScrollbarGeometryFixedThumb(scoped_ptr<WebScrollbarThemeGeometry> geometry) + : ScrollbarGeometryStub(geometry.Pass()) { } diff --git a/cc/scrollbar_geometry_fixed_thumb.h b/cc/scrollbar_geometry_fixed_thumb.h index 64e3c22..c74fc6d 100644 --- a/cc/scrollbar_geometry_fixed_thumb.h +++ b/cc/scrollbar_geometry_fixed_thumb.h @@ -14,10 +14,10 @@ namespace cc { // it always returns a fixed thumb length. This allows a page to zoom (changing // the total size of the scrollable area, changing the thumb length) while not // requiring the thumb resource to be repainted. -class CCScrollbarGeometryFixedThumb : public CCScrollbarGeometryStub { +class ScrollbarGeometryFixedThumb : public ScrollbarGeometryStub { public: - static scoped_ptr<CCScrollbarGeometryFixedThumb> create(scoped_ptr<WebKit::WebScrollbarThemeGeometry>); - virtual ~CCScrollbarGeometryFixedThumb(); + static scoped_ptr<ScrollbarGeometryFixedThumb> create(scoped_ptr<WebKit::WebScrollbarThemeGeometry>); + virtual ~ScrollbarGeometryFixedThumb(); // Update thumb length from scrollbar void update(WebKit::WebScrollbar*); @@ -29,7 +29,7 @@ public: virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE; private: - explicit CCScrollbarGeometryFixedThumb(scoped_ptr<WebKit::WebScrollbarThemeGeometry>); + explicit ScrollbarGeometryFixedThumb(scoped_ptr<WebKit::WebScrollbarThemeGeometry>); IntSize m_thumbSize; }; diff --git a/cc/scrollbar_geometry_stub.cc b/cc/scrollbar_geometry_stub.cc index fa68f87..6f0159e 100644 --- a/cc/scrollbar_geometry_stub.cc +++ b/cc/scrollbar_geometry_stub.cc @@ -12,96 +12,96 @@ using WebKit::WebScrollbarThemeGeometry; namespace cc { -CCScrollbarGeometryStub::CCScrollbarGeometryStub(scoped_ptr<WebScrollbarThemeGeometry> geometry) +ScrollbarGeometryStub::ScrollbarGeometryStub(scoped_ptr<WebScrollbarThemeGeometry> geometry) : m_geometry(geometry.Pass()) { } -CCScrollbarGeometryStub::~CCScrollbarGeometryStub() +ScrollbarGeometryStub::~ScrollbarGeometryStub() { } -WebScrollbarThemeGeometry* CCScrollbarGeometryStub::clone() const +WebScrollbarThemeGeometry* ScrollbarGeometryStub::clone() const { return m_geometry->clone(); } -int CCScrollbarGeometryStub::thumbPosition(WebScrollbar* scrollbar) +int ScrollbarGeometryStub::thumbPosition(WebScrollbar* scrollbar) { return m_geometry->thumbPosition(scrollbar); } -int CCScrollbarGeometryStub::thumbLength(WebScrollbar* scrollbar) +int ScrollbarGeometryStub::thumbLength(WebScrollbar* scrollbar) { return m_geometry->thumbLength(scrollbar); } -int CCScrollbarGeometryStub::trackPosition(WebScrollbar* scrollbar) +int ScrollbarGeometryStub::trackPosition(WebScrollbar* scrollbar) { return m_geometry->trackPosition(scrollbar); } -int CCScrollbarGeometryStub::trackLength(WebScrollbar* scrollbar) +int ScrollbarGeometryStub::trackLength(WebScrollbar* scrollbar) { return m_geometry->trackLength(scrollbar); } -bool CCScrollbarGeometryStub::hasButtons(WebScrollbar* scrollbar) +bool ScrollbarGeometryStub::hasButtons(WebScrollbar* scrollbar) { return m_geometry->hasButtons(scrollbar); } -bool CCScrollbarGeometryStub::hasThumb(WebScrollbar* scrollbar) +bool ScrollbarGeometryStub::hasThumb(WebScrollbar* scrollbar) { return m_geometry->hasThumb(scrollbar); } -WebRect CCScrollbarGeometryStub::trackRect(WebScrollbar* scrollbar) +WebRect ScrollbarGeometryStub::trackRect(WebScrollbar* scrollbar) { return m_geometry->trackRect(scrollbar); } -WebRect CCScrollbarGeometryStub::thumbRect(WebScrollbar* scrollbar) +WebRect ScrollbarGeometryStub::thumbRect(WebScrollbar* scrollbar) { return m_geometry->thumbRect(scrollbar); } -int CCScrollbarGeometryStub::minimumThumbLength(WebScrollbar* scrollbar) +int ScrollbarGeometryStub::minimumThumbLength(WebScrollbar* scrollbar) { return m_geometry->minimumThumbLength(scrollbar); } -int CCScrollbarGeometryStub::scrollbarThickness(WebScrollbar* scrollbar) +int ScrollbarGeometryStub::scrollbarThickness(WebScrollbar* scrollbar) { return m_geometry->scrollbarThickness(scrollbar); } -WebRect CCScrollbarGeometryStub::backButtonStartRect(WebScrollbar* scrollbar) +WebRect ScrollbarGeometryStub::backButtonStartRect(WebScrollbar* scrollbar) { return m_geometry->backButtonStartRect(scrollbar); } -WebRect CCScrollbarGeometryStub::backButtonEndRect(WebScrollbar* scrollbar) +WebRect ScrollbarGeometryStub::backButtonEndRect(WebScrollbar* scrollbar) { return m_geometry->backButtonEndRect(scrollbar); } -WebRect CCScrollbarGeometryStub::forwardButtonStartRect(WebScrollbar* scrollbar) +WebRect ScrollbarGeometryStub::forwardButtonStartRect(WebScrollbar* scrollbar) { return m_geometry->forwardButtonStartRect(scrollbar); } -WebRect CCScrollbarGeometryStub::forwardButtonEndRect(WebScrollbar* scrollbar) +WebRect ScrollbarGeometryStub::forwardButtonEndRect(WebScrollbar* scrollbar) { return m_geometry->forwardButtonEndRect(scrollbar); } -WebRect CCScrollbarGeometryStub::constrainTrackRectToTrackPieces(WebScrollbar* scrollbar, const WebRect& rect) +WebRect ScrollbarGeometryStub::constrainTrackRectToTrackPieces(WebScrollbar* scrollbar, const WebRect& rect) { return m_geometry->constrainTrackRectToTrackPieces(scrollbar, rect); } -void CCScrollbarGeometryStub::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect) +void ScrollbarGeometryStub::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect) { m_geometry->splitTrack(scrollbar, unconstrainedTrackRect, beforeThumbRect, thumbRect, afterThumbRect); } diff --git a/cc/scrollbar_geometry_stub.h b/cc/scrollbar_geometry_stub.h index 0ed0d65..ed47eef 100644 --- a/cc/scrollbar_geometry_stub.h +++ b/cc/scrollbar_geometry_stub.h @@ -13,9 +13,9 @@ namespace cc { // This subclass wraps an existing scrollbar geometry class so that // another class can derive from it and override specific functions, while // passing through the remaining ones. -class CCScrollbarGeometryStub : public WebKit::WebScrollbarThemeGeometry { +class ScrollbarGeometryStub : public WebKit::WebScrollbarThemeGeometry { public: - virtual ~CCScrollbarGeometryStub(); + virtual ~ScrollbarGeometryStub(); // Allow derived classes to update themselves from a scrollbar. void update(WebKit::WebScrollbar*) { } @@ -40,7 +40,7 @@ public: virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE; protected: - explicit CCScrollbarGeometryStub(scoped_ptr<WebKit::WebScrollbarThemeGeometry>); + explicit ScrollbarGeometryStub(scoped_ptr<WebKit::WebScrollbarThemeGeometry>); private: scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc index ab3ee32..f2b68c5 100644 --- a/cc/scrollbar_layer.cc +++ b/cc/scrollbar_layer.cc @@ -18,17 +18,17 @@ using WebKit::WebRect; namespace cc { -scoped_ptr<CCLayerImpl> ScrollbarLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> ScrollbarLayer::createLayerImpl() { - return CCScrollbarLayerImpl::create(id()).PassAs<CCLayerImpl>(); + return ScrollbarLayerImpl::create(id()).PassAs<LayerImpl>(); } -scoped_refptr<ScrollbarLayerChromium> ScrollbarLayerChromium::create(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId) +scoped_refptr<ScrollbarLayer> ScrollbarLayer::create(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId) { - return make_scoped_refptr(new ScrollbarLayerChromium(scrollbar.Pass(), painter, geometry.Pass(), scrollLayerId)); + return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), painter, geometry.Pass(), scrollLayerId)); } -ScrollbarLayerChromium::ScrollbarLayerChromium(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId) +ScrollbarLayer::ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId) : m_scrollbar(scrollbar.Pass()) , m_painter(painter) , m_geometry(geometry.Pass()) @@ -37,18 +37,18 @@ ScrollbarLayerChromium::ScrollbarLayerChromium(scoped_ptr<WebKit::WebScrollbar> { } -ScrollbarLayerChromium::~ScrollbarLayerChromium() +ScrollbarLayer::~ScrollbarLayer() { } -void ScrollbarLayerChromium::pushPropertiesTo(CCLayerImpl* layer) +void ScrollbarLayer::pushPropertiesTo(LayerImpl* layer) { - LayerChromium::pushPropertiesTo(layer); + Layer::pushPropertiesTo(layer); - CCScrollbarLayerImpl* scrollbarLayer = static_cast<CCScrollbarLayerImpl*>(layer); + ScrollbarLayerImpl* scrollbarLayer = static_cast<ScrollbarLayerImpl*>(layer); if (!scrollbarLayer->scrollbarGeometry()) - scrollbarLayer->setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(make_scoped_ptr(m_geometry->clone()))); + scrollbarLayer->setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(make_scoped_ptr(m_geometry->clone()))); scrollbarLayer->setScrollbarData(m_scrollbar.get()); @@ -68,12 +68,12 @@ void ScrollbarLayerChromium::pushPropertiesTo(CCLayerImpl* layer) scrollbarLayer->setThumbResourceId(0); } -ScrollbarLayerChromium* ScrollbarLayerChromium::toScrollbarLayerChromium() +ScrollbarLayer* ScrollbarLayer::toScrollbarLayer() { return this; } -class ScrollbarBackgroundPainter : public LayerPainterChromium { +class ScrollbarBackgroundPainter : public LayerPainter { public: static scoped_ptr<ScrollbarBackgroundPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart) { @@ -131,17 +131,17 @@ private: DISALLOW_COPY_AND_ASSIGN(ScrollbarBackgroundPainter); }; -bool ScrollbarLayerChromium::needsContentsScale() const +bool ScrollbarLayer::needsContentsScale() const { return true; } -IntSize ScrollbarLayerChromium::contentBounds() const +IntSize ScrollbarLayer::contentBounds() const { return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds().height() * contentsScale())); } -class ScrollbarThumbPainter : public LayerPainterChromium { +class ScrollbarThumbPainter : public LayerPainter { public: static scoped_ptr<ScrollbarThumbPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry) { @@ -174,7 +174,7 @@ private: DISALLOW_COPY_AND_ASSIGN(ScrollbarThumbPainter); }; -void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) +void ScrollbarLayer::setLayerTreeHost(LayerTreeHost* host) { if (!host || host != layerTreeHost()) { m_backTrackUpdater = NULL; @@ -183,33 +183,33 @@ void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) m_thumb.reset(); } - LayerChromium::setLayerTreeHost(host); + Layer::setLayerTreeHost(host); } -void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() +void ScrollbarLayer::createTextureUpdaterIfNeeded() { m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; if (!m_backTrackUpdater) - m_backTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainterChromium>()); + m_backTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>()); if (!m_backTrack) m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); // Only create two-part track if we think the two parts could be different in appearance. if (m_scrollbar->isCustomScrollbar()) { if (!m_foreTrackUpdater) - m_foreTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainterChromium>()); + m_foreTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>()); if (!m_foreTrack) m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } if (!m_thumbUpdater) - m_thumbUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get()).PassAs<LayerPainterChromium>()); + m_thumbUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get()).PassAs<LayerPainter>()); if (!m_thumb) m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } -void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUpdateQueue& queue, CCRenderingStats& stats) +void ScrollbarLayer::updatePart(CachingBitmapCanvasLayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, TextureUpdateQueue& queue, RenderingStats& stats) { // Skip painting and uploading if there are no invalidations and // we already have valid texture data. @@ -229,7 +229,7 @@ void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater* IntRect paintedOpaqueRect; painter->prepareToUpdate(rect, rect.size(), widthScale, heightScale, paintedOpaqueRect, stats); if (!painter->pixelsDidChange() && texture->texture()->haveBackingTexture()) { - TRACE_EVENT_INSTANT0("cc","ScrollbarLayerChromium::updatePart no texture upload needed"); + TRACE_EVENT_INSTANT0("cc","ScrollbarLayer::updatePart no texture upload needed"); return; } @@ -238,7 +238,7 @@ void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater* } -void ScrollbarLayerChromium::setTexturePriorities(const CCPriorityCalculator&) +void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&) { if (contentBounds().isEmpty()) return; @@ -248,20 +248,20 @@ void ScrollbarLayerChromium::setTexturePriorities(const CCPriorityCalculator&) bool drawsToRoot = !renderTarget()->parent(); if (m_backTrack) { m_backTrack->texture()->setDimensions(contentBounds(), m_textureFormat); - m_backTrack->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(drawsToRoot)); + m_backTrack->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot)); } if (m_foreTrack) { m_foreTrack->texture()->setDimensions(contentBounds(), m_textureFormat); - m_foreTrack->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(drawsToRoot)); + m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot)); } if (m_thumb) { IntSize thumbSize = layerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size(); m_thumb->texture()->setDimensions(thumbSize, m_textureFormat); - m_thumb->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(drawsToRoot)); + m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot)); } } -void ScrollbarLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker*, CCRenderingStats& stats) +void ScrollbarLayer::update(TextureUpdateQueue& queue, const OcclusionTracker*, RenderingStats& stats) { if (contentBounds().isEmpty()) return; diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h index 9ddb9d8..370dca1 100644 --- a/cc/scrollbar_layer.h +++ b/cc/scrollbar_layer.h @@ -16,33 +16,33 @@ namespace cc { class Scrollbar; class ScrollbarThemeComposite; -class CCTextureUpdateQueue; +class TextureUpdateQueue; -class ScrollbarLayerChromium : public LayerChromium { +class ScrollbarLayer : public Layer { public: - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; - static scoped_refptr<ScrollbarLayerChromium> create(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); + static scoped_refptr<ScrollbarLayer> create(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); - // LayerChromium interface + // Layer interface virtual bool needsContentsScale() const OVERRIDE; virtual IntSize contentBounds() const OVERRIDE; - virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; - virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; - virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; + virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; + virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; + virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; int scrollLayerId() const { return m_scrollLayerId; } void setScrollLayerId(int id) { m_scrollLayerId = id; } - virtual ScrollbarLayerChromium* toScrollbarLayerChromium() OVERRIDE; + virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE; protected: - ScrollbarLayerChromium(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); - virtual ~ScrollbarLayerChromium(); + ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); + virtual ~ScrollbarLayer(); private: - void updatePart(CachingBitmapCanvasLayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdateQueue&, CCRenderingStats&); + void updatePart(CachingBitmapCanvasLayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, TextureUpdateQueue&, RenderingStats&); void createTextureUpdaterIfNeeded(); scoped_ptr<WebKit::WebScrollbar> m_scrollbar; diff --git a/cc/scrollbar_layer_impl.cc b/cc/scrollbar_layer_impl.cc index e682b23..e5081db 100644 --- a/cc/scrollbar_layer_impl.cc +++ b/cc/scrollbar_layer_impl.cc @@ -15,13 +15,13 @@ using WebKit::WebScrollbar; namespace cc { -scoped_ptr<CCScrollbarLayerImpl> CCScrollbarLayerImpl::create(int id) +scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(int id) { - return make_scoped_ptr(new CCScrollbarLayerImpl(id)); + return make_scoped_ptr(new ScrollbarLayerImpl(id)); } -CCScrollbarLayerImpl::CCScrollbarLayerImpl(int id) - : CCLayerImpl(id) +ScrollbarLayerImpl::ScrollbarLayerImpl(int id) + : LayerImpl(id) , m_scrollbar(this) , m_backTrackResourceId(0) , m_foreTrackResourceId(0) @@ -39,16 +39,16 @@ CCScrollbarLayerImpl::CCScrollbarLayerImpl(int id) { } -CCScrollbarLayerImpl::~CCScrollbarLayerImpl() +ScrollbarLayerImpl::~ScrollbarLayerImpl() { } -void CCScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<CCScrollbarGeometryFixedThumb> geometry) +void ScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<ScrollbarGeometryFixedThumb> geometry) { m_geometry = geometry.Pass(); } -void CCScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar) +void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar) { m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle(); m_orientation = scrollbar->orientation(); @@ -72,7 +72,7 @@ static FloatRect toUVRect(const WebRect& r, const IntRect& bounds) static_cast<float>(r.width) / bounds.width(), static_cast<float>(r.height) / bounds.height()); } -void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { bool premultipledAlpha = false; bool flipped = false; @@ -80,7 +80,7 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& IntRect boundsRect(IntPoint(), bounds()); IntRect contentBoundsRect(IntPoint(), contentBounds()); - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); WebRect thumbRect, backTrackRect, foreTrackRect; @@ -89,9 +89,9 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& thumbRect = WebRect(); if (m_thumbResourceId && !thumbRect.isEmpty()) { - scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvRect, flipped); + scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedQuadState, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvRect, flipped); quad->setNeedsBlending(); - quadSink.append(quad.PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); } if (!m_backTrackResourceId) @@ -99,102 +99,102 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& // We only paint the track in two parts if we were given a texture for the forward track part. if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) - quadSink.append(CCTextureDrawQuad::create(sharedQuadState, layerRectToContentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(TextureDrawQuad::create(sharedQuadState, layerRectToContentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped).PassAs<DrawQuad>(), appendQuadsData); // Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and // fore track quads. The back track texture contains (and displays) the buttons. if (!contentBoundsRect.isEmpty()) - quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(TextureDrawQuad::create(sharedQuadState, IntRect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData); } -void CCScrollbarLayerImpl::didLoseContext() +void ScrollbarLayerImpl::didLoseContext() { m_backTrackResourceId = 0; m_foreTrackResourceId = 0; m_thumbResourceId = 0; } -bool CCScrollbarLayerImpl::CCScrollbar::isOverlay() const +bool ScrollbarLayerImpl::Scrollbar::isOverlay() const { return m_owner->m_isOverlayScrollbar; } -int CCScrollbarLayerImpl::CCScrollbar::value() const +int ScrollbarLayerImpl::Scrollbar::value() const { return m_owner->m_currentPos; } -WebKit::WebPoint CCScrollbarLayerImpl::CCScrollbar::location() const +WebKit::WebPoint ScrollbarLayerImpl::Scrollbar::location() const { return WebKit::WebPoint(); } -WebKit::WebSize CCScrollbarLayerImpl::CCScrollbar::size() const +WebKit::WebSize ScrollbarLayerImpl::Scrollbar::size() const { return WebKit::WebSize(m_owner->bounds().width(), m_owner->bounds().height()); } -bool CCScrollbarLayerImpl::CCScrollbar::enabled() const +bool ScrollbarLayerImpl::Scrollbar::enabled() const { return m_owner->m_enabled; } -int CCScrollbarLayerImpl::CCScrollbar::maximum() const +int ScrollbarLayerImpl::Scrollbar::maximum() const { return m_owner->m_maximum; } -int CCScrollbarLayerImpl::CCScrollbar::totalSize() const +int ScrollbarLayerImpl::Scrollbar::totalSize() const { return m_owner->m_totalSize; } -bool CCScrollbarLayerImpl::CCScrollbar::isScrollViewScrollbar() const +bool ScrollbarLayerImpl::Scrollbar::isScrollViewScrollbar() const { return m_owner->m_isScrollViewScrollbar; } -bool CCScrollbarLayerImpl::CCScrollbar::isScrollableAreaActive() const +bool ScrollbarLayerImpl::Scrollbar::isScrollableAreaActive() const { return m_owner->m_isScrollableAreaActive; } -void CCScrollbarLayerImpl::CCScrollbar::getTickmarks(WebKit::WebVector<WebRect>& tickmarks) const +void ScrollbarLayerImpl::Scrollbar::getTickmarks(WebKit::WebVector<WebRect>& tickmarks) const { tickmarks = m_owner->m_tickmarks; } -WebScrollbar::ScrollbarControlSize CCScrollbarLayerImpl::CCScrollbar::controlSize() const +WebScrollbar::ScrollbarControlSize ScrollbarLayerImpl::Scrollbar::controlSize() const { return m_owner->m_controlSize; } -WebScrollbar::ScrollbarPart CCScrollbarLayerImpl::CCScrollbar::pressedPart() const +WebScrollbar::ScrollbarPart ScrollbarLayerImpl::Scrollbar::pressedPart() const { return m_owner->m_pressedPart; } -WebScrollbar::ScrollbarPart CCScrollbarLayerImpl::CCScrollbar::hoveredPart() const +WebScrollbar::ScrollbarPart ScrollbarLayerImpl::Scrollbar::hoveredPart() const { return m_owner->m_hoveredPart; } -WebScrollbar::ScrollbarOverlayStyle CCScrollbarLayerImpl::CCScrollbar::scrollbarOverlayStyle() const +WebScrollbar::ScrollbarOverlayStyle ScrollbarLayerImpl::Scrollbar::scrollbarOverlayStyle() const { return m_owner->m_scrollbarOverlayStyle; } -WebScrollbar::Orientation CCScrollbarLayerImpl::CCScrollbar::orientation() const +WebScrollbar::Orientation ScrollbarLayerImpl::Scrollbar::orientation() const { return m_owner->m_orientation; } -bool CCScrollbarLayerImpl::CCScrollbar::isCustomScrollbar() const +bool ScrollbarLayerImpl::Scrollbar::isCustomScrollbar() const { return m_owner->m_isCustomScrollbar; } -const char* CCScrollbarLayerImpl::layerTypeAsString() const +const char* ScrollbarLayerImpl::layerTypeAsString() const { return "ScrollbarLayer"; } diff --git a/cc/scrollbar_layer_impl.h b/cc/scrollbar_layer_impl.h index 3bcd0e1..a815dfc 100644 --- a/cc/scrollbar_layer_impl.h +++ b/cc/scrollbar_layer_impl.h @@ -15,18 +15,18 @@ namespace cc { class ScrollView; -class CCScrollbarLayerImpl : public CCLayerImpl { +class ScrollbarLayerImpl : public LayerImpl { public: - static scoped_ptr<CCScrollbarLayerImpl> create(int id); - virtual ~CCScrollbarLayerImpl(); + static scoped_ptr<ScrollbarLayerImpl> create(int id); + virtual ~ScrollbarLayerImpl(); - CCScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); } - void setScrollbarGeometry(scoped_ptr<CCScrollbarGeometryFixedThumb>); + ScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); } + void setScrollbarGeometry(scoped_ptr<ScrollbarGeometryFixedThumb>); void setScrollbarData(WebKit::WebScrollbar*); - void setBackTrackResourceId(CCResourceProvider::ResourceId id) { m_backTrackResourceId = id; } - void setForeTrackResourceId(CCResourceProvider::ResourceId id) { m_foreTrackResourceId = id; } - void setThumbResourceId(CCResourceProvider::ResourceId id) { m_thumbResourceId = id; } + void setBackTrackResourceId(ResourceProvider::ResourceId id) { m_backTrackResourceId = id; } + void setForeTrackResourceId(ResourceProvider::ResourceId id) { m_foreTrackResourceId = id; } + void setThumbResourceId(ResourceProvider::ResourceId id) { m_thumbResourceId = id; } float currentPos() const { return m_currentPos; } void setCurrentPos(float currentPos) { m_currentPos = currentPos; } @@ -39,18 +39,18 @@ public: WebKit::WebScrollbar::Orientation orientation() const { return m_orientation; } - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; virtual void didLoseContext() OVERRIDE; protected: - explicit CCScrollbarLayerImpl(int id); + explicit ScrollbarLayerImpl(int id); private: // nested class only to avoid namespace problem - class CCScrollbar : public WebKit::WebScrollbar { + class Scrollbar : public WebKit::WebScrollbar { public: - explicit CCScrollbar(CCScrollbarLayerImpl* owner) : m_owner(owner) { } + explicit Scrollbar(ScrollbarLayerImpl* owner) : m_owner(owner) { } // WebScrollbar implementation virtual bool isOverlay() const; @@ -71,21 +71,21 @@ private: virtual bool isCustomScrollbar() const; private: - CCScrollbarLayerImpl* m_owner; + ScrollbarLayerImpl* m_owner; }; virtual const char* layerTypeAsString() const OVERRIDE; - CCScrollbar m_scrollbar; + Scrollbar m_scrollbar; - CCResourceProvider::ResourceId m_backTrackResourceId; - CCResourceProvider::ResourceId m_foreTrackResourceId; - CCResourceProvider::ResourceId m_thumbResourceId; + ResourceProvider::ResourceId m_backTrackResourceId; + ResourceProvider::ResourceId m_foreTrackResourceId; + ResourceProvider::ResourceId m_thumbResourceId; - scoped_ptr<CCScrollbarGeometryFixedThumb> m_geometry; + scoped_ptr<ScrollbarGeometryFixedThumb> m_geometry; - // Data to implement CCScrollbar + // Data to implement Scrollbar WebKit::WebScrollbar::ScrollbarOverlayStyle m_scrollbarOverlayStyle; WebKit::WebVector<WebKit::WebRect> m_tickmarks; WebKit::WebScrollbar::Orientation m_orientation; diff --git a/cc/scrollbar_layer_unittest.cc b/cc/scrollbar_layer_unittest.cc index 5b8b4af..e3e9a19 100644 --- a/cc/scrollbar_layer_unittest.cc +++ b/cc/scrollbar_layer_unittest.cc @@ -43,7 +43,7 @@ public: virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Horizontal; } }; -TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) +TEST(ScrollbarLayerTest, resolveScrollLayerPointer) { DebugScopedSetImplThread impl; @@ -51,16 +51,16 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) { scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); - scoped_refptr<LayerChromium> child1 = LayerChromium::create(); - scoped_refptr<LayerChromium> child2 = ScrollbarLayerChromium::create(scrollbar.Pass(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id()); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); + scoped_refptr<Layer> child1 = Layer::create(); + scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id()); layerTreeRoot->addChild(child1); layerTreeRoot->addChild(child2); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), 0); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), 0); - CCLayerImpl* ccChild1 = ccLayerTreeRoot->children()[0]; - CCScrollbarLayerImpl* ccChild2 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[1]); + LayerImpl* ccChild1 = layerImplTreeRoot->children()[0]; + ScrollbarLayerImpl* ccChild2 = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]); EXPECT_TRUE(ccChild1->scrollbarAnimationController()); EXPECT_EQ(ccChild1->horizontalScrollbarLayer(), ccChild2); @@ -68,32 +68,32 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) { // another traverse order scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); - scoped_refptr<LayerChromium> child2 = LayerChromium::create(); - scoped_refptr<LayerChromium> child1 = ScrollbarLayerChromium::create(scrollbar.Pass(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child2->id()); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); + scoped_refptr<Layer> child2 = Layer::create(); + scoped_refptr<Layer> child1 = ScrollbarLayer::create(scrollbar.Pass(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child2->id()); layerTreeRoot->addChild(child1); layerTreeRoot->addChild(child2); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), 0); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), 0); - CCScrollbarLayerImpl* ccChild1 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[0]); - CCLayerImpl* ccChild2 = ccLayerTreeRoot->children()[1]; + ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[0]); + LayerImpl* ccChild2 = layerImplTreeRoot->children()[1]; EXPECT_TRUE(ccChild2->scrollbarAnimationController()); EXPECT_EQ(ccChild2->horizontalScrollbarLayer(), ccChild1); } } -TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization) +TEST(ScrollbarLayerTest, scrollOffsetSynchronization) { DebugScopedSetImplThread impl; WebKit::WebScrollbarThemePainter painter; scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); - scoped_refptr<LayerChromium> contentLayer = LayerChromium::create(); - scoped_refptr<LayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar.Pass(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id()); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); + scoped_refptr<Layer> contentLayer = Layer::create(); + scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id()); layerTreeRoot->addChild(contentLayer); layerTreeRoot->addChild(scrollbarLayer); @@ -101,9 +101,9 @@ TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization) layerTreeRoot->setMaxScrollPosition(IntSize(30, 50)); contentLayer->setBounds(IntSize(100, 200)); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), 0); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), 0); - CCScrollbarLayerImpl* ccScrollbarLayer = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[1]); + ScrollbarLayerImpl* ccScrollbarLayer = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]); EXPECT_EQ(10, ccScrollbarLayer->currentPos()); EXPECT_EQ(100, ccScrollbarLayer->totalSize()); @@ -113,15 +113,15 @@ TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization) layerTreeRoot->setMaxScrollPosition(IntSize(300, 500)); contentLayer->setBounds(IntSize(1000, 2000)); - CCScrollbarAnimationController* scrollbarController = ccLayerTreeRoot->scrollbarAnimationController(); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), 0); - EXPECT_EQ(scrollbarController, ccLayerTreeRoot->scrollbarAnimationController()); + ScrollbarAnimationController* scrollbarController = layerImplTreeRoot->scrollbarAnimationController(); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), 0); + EXPECT_EQ(scrollbarController, layerImplTreeRoot->scrollbarAnimationController()); EXPECT_EQ(100, ccScrollbarLayer->currentPos()); EXPECT_EQ(1000, ccScrollbarLayer->totalSize()); EXPECT_EQ(300, ccScrollbarLayer->maximum()); - ccLayerTreeRoot->scrollBy(FloatSize(12, 34)); + layerImplTreeRoot->scrollBy(FloatSize(12, 34)); EXPECT_EQ(112, ccScrollbarLayer->currentPos()); EXPECT_EQ(1000, ccScrollbarLayer->totalSize()); diff --git a/cc/settings.h b/cc/settings.h index c606652..a25434d 100644 --- a/cc/settings.h +++ b/cc/settings.h @@ -10,7 +10,7 @@ namespace cc { // This file is for settings that apply to all compositors. Add settings to -// CCLayerTreeSettings if a ui and renderer compositor might not want the same +// LayerTreeSettings if a ui and renderer compositor might not want the same // setting. class Settings { diff --git a/cc/shader.cc b/cc/shader.cc index 7eaee7b..57ebde4 100644 --- a/cc/shader.cc +++ b/cc/shader.cc @@ -759,7 +759,7 @@ void FragmentShaderYUVVideo::init(WebGraphicsContext3D* context, unsigned progra "u_texture", "v_texture", "alpha", - "cc_matrix", + "matrix", "yuv_adj", }; int locations[6]; @@ -789,14 +789,14 @@ std::string FragmentShaderYUVVideo::getShaderString() const uniform sampler2D v_texture; uniform float alpha; uniform vec3 yuv_adj; - uniform mat3 cc_matrix; + uniform mat3 matrix; void main() { float y_raw = texture2D(y_texture, y_texCoord).x; float u_unsigned = texture2D(u_texture, uv_texCoord).x; float v_unsigned = texture2D(v_texture, uv_texCoord).x; vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; - vec3 rgb = cc_matrix * yuv; + vec3 rgb = matrix * yuv; gl_FragColor = vec4(rgb, float(1)) * alpha; } ); diff --git a/cc/shader.h b/cc/shader.h index fa87b68..3934d9f 100644 --- a/cc/shader.h +++ b/cc/shader.h @@ -303,7 +303,7 @@ public: int uTextureLocation() const { return m_uTextureLocation; } int vTextureLocation() const { return m_vTextureLocation; } int alphaLocation() const { return m_alphaLocation; } - int ccMatrixLocation() const { return m_ccMatrixLocation; } + int matrixLocation() const { return m_ccMatrixLocation; } int yuvAdjLocation() const { return m_yuvAdjLocation; } private: diff --git a/cc/shared_quad_state.cc b/cc/shared_quad_state.cc index 926cd7eb..be28795 100644 --- a/cc/shared_quad_state.cc +++ b/cc/shared_quad_state.cc @@ -10,12 +10,12 @@ namespace cc { -scoped_ptr<CCSharedQuadState> CCSharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) +scoped_ptr<SharedQuadState> SharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) { - return make_scoped_ptr(new CCSharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + return make_scoped_ptr(new SharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); } -CCSharedQuadState::CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) +SharedQuadState::SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) : id(-1) , quadTransform(quadTransform) , visibleContentRect(visibleContentRect) @@ -25,9 +25,9 @@ CCSharedQuadState::CCSharedQuadState(const WebKit::WebTransformationMatrix& quad { } -scoped_ptr<CCSharedQuadState> CCSharedQuadState::copy() const +scoped_ptr<SharedQuadState> SharedQuadState::copy() const { - scoped_ptr<CCSharedQuadState> copiedState(create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + scoped_ptr<SharedQuadState> copiedState(create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); copiedState->id = id; return copiedState.Pass(); } diff --git a/cc/shared_quad_state.h b/cc/shared_quad_state.h index 0f5e386..5e17536 100644 --- a/cc/shared_quad_state.h +++ b/cc/shared_quad_state.h @@ -11,7 +11,7 @@ namespace cc { -struct CCSharedQuadState { +struct SharedQuadState { int id; // Transforms from quad's original content space to its target content space. @@ -22,10 +22,10 @@ struct CCSharedQuadState { float opacity; bool opaque; - static scoped_ptr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); - CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); + static scoped_ptr<SharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); + SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); - scoped_ptr<CCSharedQuadState> copy() const; + scoped_ptr<SharedQuadState> copy() const; }; } diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc index 4434d57..a65c9fb 100644 --- a/cc/single_thread_proxy.cc +++ b/cc/single_thread_proxy.cc @@ -16,39 +16,39 @@ namespace cc { -scoped_ptr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) +scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) { - return make_scoped_ptr(new CCSingleThreadProxy(layerTreeHost)).PassAs<CCProxy>(); + return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>(); } -CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) +SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost) : m_layerTreeHost(layerTreeHost) , m_contextLost(false) , m_rendererInitialized(false) , m_nextFrameIsNewlyCommittedFrame(false) , m_totalCommitCount(0) { - TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); + DCHECK(Proxy::isMainThread()); } -void CCSingleThreadProxy::start() +void SingleThreadProxy::start() { DebugScopedSetImplThread impl; m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); } -CCSingleThreadProxy::~CCSingleThreadProxy() +SingleThreadProxy::~SingleThreadProxy() { - TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); + DCHECK(Proxy::isMainThread()); DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called. } -bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) +bool SingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) { - TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "SingleThreadProxy::compositeAndReadback"); + DCHECK(Proxy::isMainThread()); if (!commitAndComposite()) return false; @@ -64,50 +64,50 @@ bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect return true; } -void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) +void SingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) { m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime(), duration); } -void CCSingleThreadProxy::finishAllRendering() +void SingleThreadProxy::finishAllRendering() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); { DebugScopedSetImplThread impl; m_layerTreeHostImpl->finishAllRendering(); } } -bool CCSingleThreadProxy::isStarted() const +bool SingleThreadProxy::isStarted() const { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); return m_layerTreeHostImpl.get(); } -bool CCSingleThreadProxy::initializeContext() +bool SingleThreadProxy::initializeContext() { - DCHECK(CCProxy::isMainThread()); - scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); + DCHECK(Proxy::isMainThread()); + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) return false; m_contextBeforeInitialization = context.Pass(); return true; } -void CCSingleThreadProxy::setSurfaceReady() +void SingleThreadProxy::setSurfaceReady() { // Scheduling is controlled by the embedder in the single thread case, so nothing to do. } -void CCSingleThreadProxy::setVisible(bool visible) +void SingleThreadProxy::setVisible(bool visible) { DebugScopedSetImplThread impl; m_layerTreeHostImpl->setVisible(visible); } -bool CCSingleThreadProxy::initializeRenderer() +bool SingleThreadProxy::initializeRenderer() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); DCHECK(m_contextBeforeInitialization.get()); { DebugScopedSetImplThread impl; @@ -121,13 +121,13 @@ bool CCSingleThreadProxy::initializeRenderer() } } -bool CCSingleThreadProxy::recreateContext() +bool SingleThreadProxy::recreateContext() { - TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "SingleThreadProxy::recreateContext"); + DCHECK(Proxy::isMainThread()); DCHECK(m_contextLost); - scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) return false; @@ -149,36 +149,36 @@ bool CCSingleThreadProxy::recreateContext() return initialized; } -void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) +void SingleThreadProxy::renderingStats(RenderingStats* stats) { stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); stats->totalCommitCount = m_totalCommitCount; m_layerTreeHostImpl->renderingStats(stats); } -const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const +const RendererCapabilities& SingleThreadProxy::rendererCapabilities() const { DCHECK(m_rendererInitialized); // Note: this gets called during the commit by the "impl" thread return m_RendererCapabilitiesForMainThread; } -void CCSingleThreadProxy::loseContext() +void SingleThreadProxy::loseContext() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); m_layerTreeHost->didLoseContext(); m_contextLost = true; } -void CCSingleThreadProxy::setNeedsAnimate() +void SingleThreadProxy::setNeedsAnimate() { - // CCThread-only feature + // Thread-only feature NOTREACHED(); } -void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) +void SingleThreadProxy::doCommit(scoped_ptr<TextureUpdateQueue> queue) { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); // Commit immediately { DebugScopedSetMainThreadBlocked mainThreadBlocked; @@ -190,10 +190,10 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings(); m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); - scoped_ptr<CCTextureUpdateController> updateController = - CCTextureUpdateController::create( + scoped_ptr<TextureUpdateController> updateController = + TextureUpdateController::create( NULL, - CCProxy::mainThread(), + Proxy::mainThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider()); updateController->finalize(); @@ -205,7 +205,7 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) #ifndef NDEBUG // In the single-threaded case, the scroll deltas should never be // touched on the impl layer tree. - scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); + scoped_ptr<ScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); DCHECK(!scrollInfo->scrolls.size()); #endif @@ -217,13 +217,13 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) m_nextFrameIsNewlyCommittedFrame = true; } -void CCSingleThreadProxy::setNeedsCommit() +void SingleThreadProxy::setNeedsCommit() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); m_layerTreeHost->scheduleComposite(); } -void CCSingleThreadProxy::setNeedsRedraw() +void SingleThreadProxy::setNeedsRedraw() { // FIXME: Once we move render_widget scheduling into this class, we can // treat redraw requests more efficiently than commitAndRedraw requests. @@ -231,24 +231,24 @@ void CCSingleThreadProxy::setNeedsRedraw() setNeedsCommit(); } -bool CCSingleThreadProxy::commitRequested() const +bool SingleThreadProxy::commitRequested() const { return false; } -void CCSingleThreadProxy::didAddAnimation() +void SingleThreadProxy::didAddAnimation() { } -size_t CCSingleThreadProxy::maxPartialTextureUpdates() const +size_t SingleThreadProxy::maxPartialTextureUpdates() const { return std::numeric_limits<size_t>::max(); } -void CCSingleThreadProxy::stop() +void SingleThreadProxy::stop() { - TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); - DCHECK(CCProxy::isMainThread()); + TRACE_EVENT0("cc", "SingleThreadProxy::stop"); + DCHECK(Proxy::isMainThread()); { DebugScopedSetMainThreadBlocked mainThreadBlocked; DebugScopedSetImplThread impl; @@ -260,24 +260,24 @@ void CCSingleThreadProxy::stop() m_layerTreeHost = 0; } -void CCSingleThreadProxy::setNeedsRedrawOnImplThread() +void SingleThreadProxy::setNeedsRedrawOnImplThread() { m_layerTreeHost->scheduleComposite(); } -void CCSingleThreadProxy::setNeedsCommitOnImplThread() +void SingleThreadProxy::setNeedsCommitOnImplThread() { m_layerTreeHost->scheduleComposite(); } -void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime) +void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector> events, double wallClockTime) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DebugScopedSetMainThread main; m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); } -bool CCSingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) +bool SingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) { DCHECK(isImplThread()); if (!m_layerTreeHost->contentsTextureManager()) @@ -287,7 +287,7 @@ bool CCSingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBy } // Called by the legacy scheduling path (e.g. where render_widget does the scheduling) -void CCSingleThreadProxy::compositeImmediately() +void SingleThreadProxy::compositeImmediately() { if (commitAndComposite()) { m_layerTreeHostImpl->swapBuffers(); @@ -295,7 +295,7 @@ void CCSingleThreadProxy::compositeImmediately() } } -void CCSingleThreadProxy::forceSerializeOnSwapBuffers() +void SingleThreadProxy::forceSerializeOnSwapBuffers() { { DebugScopedSetImplThread impl; @@ -304,27 +304,27 @@ void CCSingleThreadProxy::forceSerializeOnSwapBuffers() } } -void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() +void SingleThreadProxy::onSwapBuffersCompleteOnImplThread() { NOTREACHED(); } -bool CCSingleThreadProxy::commitAndComposite() +bool SingleThreadProxy::commitAndComposite() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (!m_layerTreeHost->initializeRendererIfNeeded()) return false; // Unlink any texture backings that were deleted - CCPrioritizedTextureManager::BackingList evictedContentsTexturesBackings; + PrioritizedTextureManager::BackingList evictedContentsTexturesBackings; { DebugScopedSetImplThread implThread; m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedContentsTexturesBackings); } m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedContentsTexturesBackings); - scoped_ptr<CCTextureUpdateQueue> queue = make_scoped_ptr(new CCTextureUpdateQueue); + scoped_ptr<TextureUpdateQueue> queue = make_scoped_ptr(new TextureUpdateQueue); m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAllocationLimitBytes()); if (m_layerTreeHostImpl->contentsTexturesPurged()) @@ -337,7 +337,7 @@ bool CCSingleThreadProxy::commitAndComposite() return result; } -bool CCSingleThreadProxy::doComposite() +bool SingleThreadProxy::doComposite() { DCHECK(!m_contextLost); { @@ -356,7 +356,7 @@ bool CCSingleThreadProxy::doComposite() if (!m_layerTreeHostImpl->canDraw()) return false; - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; m_layerTreeHostImpl->prepareToDraw(frame); m_layerTreeHostImpl->drawLayers(frame); m_layerTreeHostImpl->didDrawAllLayers(frame); @@ -371,7 +371,7 @@ bool CCSingleThreadProxy::doComposite() return true; } -void CCSingleThreadProxy::didSwapFrame() +void SingleThreadProxy::didSwapFrame() { if (m_nextFrameIsNewlyCommittedFrame) { m_nextFrameIsNewlyCommittedFrame = false; diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h index 35bd7cc..e5ea048 100644 --- a/cc/single_thread_proxy.h +++ b/cc/single_thread_proxy.h @@ -13,14 +13,14 @@ namespace cc { -class CCLayerTreeHost; +class LayerTreeHost; -class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient { +class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { public: - static scoped_ptr<CCProxy> create(CCLayerTreeHost*); - virtual ~CCSingleThreadProxy(); + static scoped_ptr<Proxy> create(LayerTreeHost*); + virtual ~SingleThreadProxy(); - // CCProxy implementation + // Proxy implementation virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE; virtual void finishAllRendering() OVERRIDE; @@ -30,7 +30,7 @@ public: virtual void setVisible(bool) OVERRIDE; virtual bool initializeRenderer() OVERRIDE; virtual bool recreateContext() OVERRIDE; - virtual void renderingStats(CCRenderingStats*) OVERRIDE; + virtual void renderingStats(RenderingStats*) OVERRIDE; virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; virtual void loseContext() OVERRIDE; virtual void setNeedsAnimate() OVERRIDE; @@ -44,37 +44,37 @@ public: virtual void acquireLayerTextures() OVERRIDE { } virtual void forceSerializeOnSwapBuffers() OVERRIDE; - // CCLayerTreeHostImplClient implementation + // LayerTreeHostImplClient implementation virtual void didLoseContextOnImplThread() OVERRIDE { } virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { } virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { } virtual void setNeedsRedrawOnImplThread() OVERRIDE; virtual void setNeedsCommitOnImplThread() OVERRIDE; - virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE; + virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, double wallClockTime) OVERRIDE; virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) OVERRIDE; // Called by the legacy path where RenderWidget does the scheduling. void compositeImmediately(); private: - explicit CCSingleThreadProxy(CCLayerTreeHost*); + explicit SingleThreadProxy(LayerTreeHost*); bool commitAndComposite(); - void doCommit(scoped_ptr<CCTextureUpdateQueue>); + void doCommit(scoped_ptr<TextureUpdateQueue>); bool doComposite(); void didSwapFrame(); // Accessed on main thread only. - CCLayerTreeHost* m_layerTreeHost; + LayerTreeHost* m_layerTreeHost; bool m_contextLost; // Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't // be used for anything else. - scoped_ptr<CCGraphicsContext> m_contextBeforeInitialization; + scoped_ptr<GraphicsContext> m_contextBeforeInitialization; - // Used on the CCThread, but checked on main thread during initialization/shutdown. - scoped_ptr<CCLayerTreeHostImpl> m_layerTreeHostImpl; + // Used on the Thread, but checked on main thread during initialization/shutdown. + scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; bool m_rendererInitialized; RendererCapabilities m_RendererCapabilitiesForMainThread; @@ -91,13 +91,13 @@ public: DebugScopedSetImplThread() { #ifndef NDEBUG - CCProxy::setCurrentThreadIsImplThread(true); + Proxy::setCurrentThreadIsImplThread(true); #endif } ~DebugScopedSetImplThread() { #ifndef NDEBUG - CCProxy::setCurrentThreadIsImplThread(false); + Proxy::setCurrentThreadIsImplThread(false); #endif } }; @@ -109,13 +109,13 @@ public: DebugScopedSetMainThread() { #ifndef NDEBUG - CCProxy::setCurrentThreadIsImplThread(false); + Proxy::setCurrentThreadIsImplThread(false); #endif } ~DebugScopedSetMainThread() { #ifndef NDEBUG - CCProxy::setCurrentThreadIsImplThread(true); + Proxy::setCurrentThreadIsImplThread(true); #endif } }; diff --git a/cc/skpicture_canvas_layer_texture_updater.cc b/cc/skpicture_canvas_layer_texture_updater.cc index 906117d..af62f43 100644 --- a/cc/skpicture_canvas_layer_texture_updater.cc +++ b/cc/skpicture_canvas_layer_texture_updater.cc @@ -13,7 +13,7 @@ namespace cc { -SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) +SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) : CanvasLayerTextureUpdater(painter.Pass()) , m_layerIsOpaque(false) { @@ -23,7 +23,7 @@ SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() { } -void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) +void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats) { SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height()); paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats); @@ -36,7 +36,7 @@ void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas) canvas->drawPicture(m_picture); } -void SkPictureCanvasLayerTextureUpdater::updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) +void SkPictureCanvasLayerTextureUpdater::updateTexture(TextureUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) { ResourceUpdate upload = ResourceUpdate::CreateFromPicture( texture, &m_picture, contentRect(), sourceRect, destOffset); diff --git a/cc/skpicture_canvas_layer_texture_updater.h b/cc/skpicture_canvas_layer_texture_updater.h index af3818f..0b9701cb 100644 --- a/cc/skpicture_canvas_layer_texture_updater.h +++ b/cc/skpicture_canvas_layer_texture_updater.h @@ -13,7 +13,7 @@ class SkCanvas; namespace cc { -class LayerPainterChromium; +class LayerPainter; // This class records the contentRect into an SkPicture. Subclasses, provide // different implementations of tile updating based on this recorded picture. @@ -25,12 +25,12 @@ public: virtual void setOpaque(bool) OVERRIDE; protected: - explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); + explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); virtual ~SkPictureCanvasLayerTextureUpdater(); - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE; + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&) OVERRIDE; void drawPicture(SkCanvas*); - void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); + void updateTexture(TextureUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); bool layerIsOpaque() const { return m_layerIsOpaque; } diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc index 4b427e8..cec5811 100644 --- a/cc/software_renderer.cc +++ b/cc/software_renderer.cc @@ -64,18 +64,18 @@ bool isScaleAndTranslate(const SkMatrix& matrix) } // anonymous namespace -scoped_ptr<CCRendererSoftware> CCRendererSoftware::create(CCRendererClient* client, CCResourceProvider* resourceProvider, WebCompositorSoftwareOutputDevice* outputDevice) +scoped_ptr<SoftwareRenderer> SoftwareRenderer::create(RendererClient* client, ResourceProvider* resourceProvider, WebCompositorSoftwareOutputDevice* outputDevice) { - return make_scoped_ptr(new CCRendererSoftware(client, resourceProvider, outputDevice)); + return make_scoped_ptr(new SoftwareRenderer(client, resourceProvider, outputDevice)); } -CCRendererSoftware::CCRendererSoftware(CCRendererClient* client, CCResourceProvider* resourceProvider, WebCompositorSoftwareOutputDevice* outputDevice) - : CCDirectRenderer(client, resourceProvider) +SoftwareRenderer::SoftwareRenderer(RendererClient* client, ResourceProvider* resourceProvider, WebCompositorSoftwareOutputDevice* outputDevice) + : DirectRenderer(client, resourceProvider) , m_visible(true) , m_outputDevice(outputDevice) , m_skCurrentCanvas(0) { - m_resourceProvider->setDefaultResourceType(CCResourceProvider::Bitmap); + m_resourceProvider->setDefaultResourceType(ResourceProvider::Bitmap); m_capabilities.maxTextureSize = INT_MAX; m_capabilities.bestTextureFormat = GL_RGBA; @@ -85,26 +85,26 @@ CCRendererSoftware::CCRendererSoftware(CCRendererClient* client, CCResourceProvi viewportChanged(); } -CCRendererSoftware::~CCRendererSoftware() +SoftwareRenderer::~SoftwareRenderer() { } -const RendererCapabilities& CCRendererSoftware::capabilities() const +const RendererCapabilities& SoftwareRenderer::capabilities() const { return m_capabilities; } -void CCRendererSoftware::viewportChanged() +void SoftwareRenderer::viewportChanged() { m_outputDevice->didChangeViewportSize(WebSize(viewportSize().width(), viewportSize().height())); } -void CCRendererSoftware::beginDrawingFrame(DrawingFrame& frame) +void SoftwareRenderer::beginDrawingFrame(DrawingFrame& frame) { m_skRootCanvas = make_scoped_ptr(new SkCanvas(m_outputDevice->lock(true)->getSkBitmap())); } -void CCRendererSoftware::finishDrawingFrame(DrawingFrame& frame) +void SoftwareRenderer::finishDrawingFrame(DrawingFrame& frame) { m_currentFramebufferLock.reset(); m_skCurrentCanvas = 0; @@ -112,24 +112,24 @@ void CCRendererSoftware::finishDrawingFrame(DrawingFrame& frame) m_outputDevice->unlock(); } -bool CCRendererSoftware::flippedFramebuffer() const +bool SoftwareRenderer::flippedFramebuffer() const { return false; } -void CCRendererSoftware::finish() +void SoftwareRenderer::finish() { } -void CCRendererSoftware::bindFramebufferToOutputSurface(DrawingFrame& frame) +void SoftwareRenderer::bindFramebufferToOutputSurface(DrawingFrame& frame) { m_currentFramebufferLock.reset(); m_skCurrentCanvas = m_skRootCanvas.get(); } -bool CCRendererSoftware::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) +bool SoftwareRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedTexture* texture, const IntRect& framebufferRect) { - m_currentFramebufferLock = make_scoped_ptr(new CCResourceProvider::ScopedWriteLockSoftware(m_resourceProvider, texture->id())); + m_currentFramebufferLock = make_scoped_ptr(new ResourceProvider::ScopedWriteLockSoftware(m_resourceProvider, texture->id())); m_skCurrentCanvas = m_currentFramebufferLock->skCanvas(); initializeMatrices(frame, framebufferRect, false); setDrawViewportSize(framebufferRect.size()); @@ -137,18 +137,18 @@ bool CCRendererSoftware::bindFramebufferToTexture(DrawingFrame& frame, const CCS return true; } -void CCRendererSoftware::enableScissorTestRect(const IntRect& scissorRect) +void SoftwareRenderer::enableScissorTestRect(const IntRect& scissorRect) { m_skCurrentCanvas->clipRect(toSkRect(scissorRect), SkRegion::kReplace_Op); } -void CCRendererSoftware::disableScissorTest() +void SoftwareRenderer::disableScissorTest() { IntRect canvasRect(IntPoint(), viewportSize()); m_skCurrentCanvas->clipRect(toSkRect(canvasRect), SkRegion::kReplace_Op); } -void CCRendererSoftware::clearFramebuffer(DrawingFrame& frame) +void SoftwareRenderer::clearFramebuffer(DrawingFrame& frame) { if (frame.currentRenderPass->hasTransparentBackground()) { m_skCurrentCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); @@ -160,16 +160,16 @@ void CCRendererSoftware::clearFramebuffer(DrawingFrame& frame) } } -void CCRendererSoftware::setDrawViewportSize(const IntSize& viewportSize) +void SoftwareRenderer::setDrawViewportSize(const IntSize& viewportSize) { } -bool CCRendererSoftware::isSoftwareResource(CCResourceProvider::ResourceId id) const +bool SoftwareRenderer::isSoftwareResource(ResourceProvider::ResourceId id) const { switch (m_resourceProvider->resourceType(id)) { - case CCResourceProvider::GLTexture: + case ResourceProvider::GLTexture: return false; - case CCResourceProvider::Bitmap: + case ResourceProvider::Bitmap: return true; } @@ -177,7 +177,7 @@ bool CCRendererSoftware::isSoftwareResource(CCResourceProvider::ResourceId id) c return false; } -void CCRendererSoftware::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) +void SoftwareRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad) { WebTransformationMatrix quadRectMatrix; quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect()); @@ -199,20 +199,20 @@ void CCRendererSoftware::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) } switch (quad->material()) { - case CCDrawQuad::DebugBorder: - drawDebugBorderQuad(frame, CCDebugBorderDrawQuad::materialCast(quad)); + case DrawQuad::DebugBorder: + drawDebugBorderQuad(frame, DebugBorderDrawQuad::materialCast(quad)); break; - case CCDrawQuad::SolidColor: - drawSolidColorQuad(frame, CCSolidColorDrawQuad::materialCast(quad)); + case DrawQuad::SolidColor: + drawSolidColorQuad(frame, SolidColorDrawQuad::materialCast(quad)); break; - case CCDrawQuad::TextureContent: - drawTextureQuad(frame, CCTextureDrawQuad::materialCast(quad)); + case DrawQuad::TextureContent: + drawTextureQuad(frame, TextureDrawQuad::materialCast(quad)); break; - case CCDrawQuad::TiledContent: - drawTileQuad(frame, CCTileDrawQuad::materialCast(quad)); + case DrawQuad::TiledContent: + drawTileQuad(frame, TileDrawQuad::materialCast(quad)); break; - case CCDrawQuad::RenderPass: - drawRenderPassQuad(frame, CCRenderPassDrawQuad::materialCast(quad)); + case DrawQuad::RenderPass: + drawRenderPassQuad(frame, RenderPassDrawQuad::materialCast(quad)); break; default: drawUnsupportedQuad(frame, quad); @@ -222,7 +222,7 @@ void CCRendererSoftware::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) m_skCurrentCanvas->resetMatrix(); } -void CCRendererSoftware::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) +void SoftwareRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorderDrawQuad* quad) { // We need to apply the matrix manually to have pixel-sized stroke width. SkPoint vertices[4]; @@ -238,14 +238,14 @@ void CCRendererSoftware::drawDebugBorderQuad(const DrawingFrame& frame, const CC m_skCurrentCanvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, transformedVertices, m_skCurrentPaint); } -void CCRendererSoftware::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidColorDrawQuad* quad) +void SoftwareRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorDrawQuad* quad) { m_skCurrentPaint.setColor(quad->color()); m_skCurrentPaint.setAlpha(quad->opacity() * SkColorGetA(quad->color())); m_skCurrentCanvas->drawRect(toSkRect(quadVertexRect()), m_skCurrentPaint); } -void CCRendererSoftware::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) +void SoftwareRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureDrawQuad* quad) { if (!isSoftwareResource(quad->resourceId())) { drawUnsupportedQuad(frame, quad); @@ -253,7 +253,7 @@ void CCRendererSoftware::drawTextureQuad(const DrawingFrame& frame, const CCText } // FIXME: Add support for non-premultiplied alpha. - CCResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); + ResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); FloatRect uvRect = quad->uvRect(); uvRect.scale(quad->quadRect().width(), quad->quadRect().height()); SkIRect skUvRect = toSkIRect(enclosingIntRect(uvRect)); @@ -262,23 +262,23 @@ void CCRendererSoftware::drawTextureQuad(const DrawingFrame& frame, const CCText m_skCurrentCanvas->drawBitmapRect(*quadResourceLock.skBitmap(), &skUvRect, toSkRect(quadVertexRect()), &m_skCurrentPaint); } -void CCRendererSoftware::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) +void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* quad) { DCHECK(isSoftwareResource(quad->resourceId())); - CCResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); + ResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); SkIRect uvRect = toSkIRect(IntRect(quad->textureOffset(), quad->quadRect().size())); m_skCurrentCanvas->drawBitmapRect(*quadResourceLock.skBitmap(), &uvRect, toSkRect(quadVertexRect()), &m_skCurrentPaint); } -void CCRendererSoftware::drawRenderPassQuad(const DrawingFrame& frame, const CCRenderPassDrawQuad* quad) +void SoftwareRenderer::drawRenderPassQuad(const DrawingFrame& frame, const RenderPassDrawQuad* quad) { CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) return; DCHECK(isSoftwareResource(contentsTexture->id())); - CCResourceProvider::ScopedReadLockSoftware contentsTextureLock(m_resourceProvider, contentsTexture->id()); + ResourceProvider::ScopedReadLockSoftware contentsTextureLock(m_resourceProvider, contentsTexture->id()); const SkBitmap* bitmap = contentsTextureLock.skBitmap(); @@ -297,7 +297,7 @@ void CCRendererSoftware::drawRenderPassQuad(const DrawingFrame& frame, const CCR m_skCurrentPaint.setShader(shader); if (quad->maskResourceId()) { - CCResourceProvider::ScopedReadLockSoftware maskResourceLock(m_resourceProvider, quad->maskResourceId()); + ResourceProvider::ScopedReadLockSoftware maskResourceLock(m_resourceProvider, quad->maskResourceId()); const SkBitmap* maskBitmap = maskResourceLock.skBitmap(); SkMatrix maskMat; @@ -323,21 +323,21 @@ void CCRendererSoftware::drawRenderPassQuad(const DrawingFrame& frame, const CCR } } -void CCRendererSoftware::drawUnsupportedQuad(const DrawingFrame& frame, const CCDrawQuad* quad) +void SoftwareRenderer::drawUnsupportedQuad(const DrawingFrame& frame, const DrawQuad* quad) { m_skCurrentPaint.setColor(SK_ColorMAGENTA); m_skCurrentPaint.setAlpha(quad->opacity() * 255); m_skCurrentCanvas->drawRect(toSkRect(quadVertexRect()), m_skCurrentPaint); } -bool CCRendererSoftware::swapBuffers() +bool SoftwareRenderer::swapBuffers() { - if (CCProxy::hasImplThread()) + if (Proxy::hasImplThread()) m_client->onSwapBuffersComplete(); return true; } -void CCRendererSoftware::getFramebufferPixels(void *pixels, const IntRect& rect) +void SoftwareRenderer::getFramebufferPixels(void *pixels, const IntRect& rect) { SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap(); SkBitmap subsetBitmap; @@ -347,7 +347,7 @@ void CCRendererSoftware::getFramebufferPixels(void *pixels, const IntRect& rect) m_outputDevice->unlock(); } -void CCRendererSoftware::setVisible(bool visible) +void SoftwareRenderer::setVisible(bool visible) { if (m_visible == visible) return; diff --git a/cc/software_renderer.h b/cc/software_renderer.h index 8c0334c..75a09bc 100644 --- a/cc/software_renderer.h +++ b/cc/software_renderer.h @@ -11,18 +11,18 @@ namespace cc { -class CCDebugBorderDrawQuad; -class CCRendererClient; -class CCResourceProvider; -class CCSolidColorDrawQuad; -class CCTextureDrawQuad; -class CCTileDrawQuad; -class CCRenderPassDrawQuad; - -class CCRendererSoftware : public CCDirectRenderer { +class DebugBorderDrawQuad; +class RendererClient; +class ResourceProvider; +class SolidColorDrawQuad; +class TextureDrawQuad; +class TileDrawQuad; +class RenderPassDrawQuad; + +class SoftwareRenderer : public DirectRenderer { public: - static scoped_ptr<CCRendererSoftware> create(CCRendererClient*, CCResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*); - virtual ~CCRendererSoftware(); + static scoped_ptr<SoftwareRenderer> create(RendererClient*, ResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*); + virtual ~SoftwareRenderer(); virtual const RendererCapabilities& capabilities() const OVERRIDE; @@ -38,27 +38,27 @@ public: protected: virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; - virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE; + virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, const IntRect& framebufferRect) OVERRIDE; virtual void setDrawViewportSize(const IntSize&) OVERRIDE; virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; virtual void disableScissorTest() OVERRIDE; virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; - virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE; + virtual void drawQuad(DrawingFrame&, const DrawQuad*) OVERRIDE; virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; virtual bool flippedFramebuffer() const OVERRIDE; private: - CCRendererSoftware(CCRendererClient*, CCResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*); + SoftwareRenderer(RendererClient*, ResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*); - bool isSoftwareResource(CCResourceProvider::ResourceId) const; + bool isSoftwareResource(ResourceProvider::ResourceId) const; - void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*); - void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*); - void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*); - void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*); - void drawRenderPassQuad(const DrawingFrame& frame, const CCRenderPassDrawQuad*); - void drawUnsupportedQuad(const DrawingFrame&, const CCDrawQuad*); + void drawDebugBorderQuad(const DrawingFrame&, const DebugBorderDrawQuad*); + void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); + void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); + void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); + void drawRenderPassQuad(const DrawingFrame& frame, const RenderPassDrawQuad*); + void drawUnsupportedQuad(const DrawingFrame&, const DrawQuad*); RendererCapabilities m_capabilities; bool m_visible; @@ -67,9 +67,9 @@ private: scoped_ptr<SkCanvas> m_skRootCanvas; SkCanvas* m_skCurrentCanvas; SkPaint m_skCurrentPaint; - scoped_ptr<CCResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLock; + scoped_ptr<ResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLock; - DISALLOW_COPY_AND_ASSIGN(CCRendererSoftware); + DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); }; } diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc index e1c59a9..579e2be 100644 --- a/cc/software_renderer_unittest.cc +++ b/cc/software_renderer_unittest.cc @@ -28,23 +28,23 @@ using namespace WebKitTests; namespace { -class CCRendererSoftwareTest : public testing::Test, public CCRendererClient { +class SoftwareRendererTest : public testing::Test, public RendererClient { public: void initializeRenderer() { m_outputSurface = FakeWebCompositorOutputSurface::createSoftware(scoped_ptr<WebKit::WebCompositorSoftwareOutputDevice>(new FakeWebCompositorSoftwareOutputDevice)); - m_resourceProvider = CCResourceProvider::create(m_outputSurface.get()); - m_renderer = CCRendererSoftware::create(this, resourceProvider(), softwareDevice()); + m_resourceProvider = ResourceProvider::create(m_outputSurface.get()); + m_renderer = SoftwareRenderer::create(this, resourceProvider(), softwareDevice()); } WebCompositorSoftwareOutputDevice* softwareDevice() const { return m_outputSurface->softwareDevice(); } FakeWebCompositorOutputSurface* outputSurface() const { return m_outputSurface.get(); } - CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); } - CCRendererSoftware* renderer() const { return m_renderer.get(); } + ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); } + SoftwareRenderer* renderer() const { return m_renderer.get(); } void setViewportSize(IntSize viewportSize) { m_viewportSize = viewportSize; } - // CCRendererClient implementation. + // RendererClient implementation. virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewportSize; } - virtual const CCLayerTreeSettings& settings() const OVERRIDE { return m_settings; } + virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; } virtual void didLoseContext() OVERRIDE { } virtual void onSwapBuffersComplete() OVERRIDE { } virtual void setFullRootLayerDamage() OVERRIDE { } @@ -54,13 +54,13 @@ protected: DebugScopedSetImplThread m_alwaysImplThread; scoped_ptr<FakeWebCompositorOutputSurface> m_outputSurface; - scoped_ptr<CCResourceProvider> m_resourceProvider; - scoped_ptr<CCRendererSoftware> m_renderer; + scoped_ptr<ResourceProvider> m_resourceProvider; + scoped_ptr<SoftwareRenderer> m_renderer; IntSize m_viewportSize; - CCLayerTreeSettings m_settings; + LayerTreeSettings m_settings; }; -TEST_F(CCRendererSoftwareTest, solidColorQuad) +TEST_F(SoftwareRendererTest, solidColorQuad) { IntSize outerSize(100, 100); int outerPixels = outerSize.width() * outerSize.height(); @@ -71,17 +71,17 @@ TEST_F(CCRendererSoftwareTest, solidColorQuad) initializeRenderer(); - scoped_ptr<CCSharedQuadState> sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true); - CCRenderPass::Id rootRenderPassId = CCRenderPass::Id(1, 1); - scoped_ptr<CCRenderPass> rootRenderPass = CCTestRenderPass::create(rootRenderPassId, outerRect, WebTransformationMatrix()); - CCTestRenderPass* testRenderPass = static_cast<CCTestRenderPass*>(rootRenderPass.get()); - scoped_ptr<CCDrawQuad> outerQuad = CCSolidColorDrawQuad::create(sharedQuadState.get(), outerRect, SK_ColorYELLOW).PassAs<CCDrawQuad>(); - scoped_ptr<CCDrawQuad> innerQuad = CCSolidColorDrawQuad::create(sharedQuadState.get(), innerRect, SK_ColorCYAN).PassAs<CCDrawQuad>(); + scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true); + RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1); + scoped_ptr<RenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, outerRect, WebTransformationMatrix()); + TestRenderPass* testRenderPass = static_cast<TestRenderPass*>(rootRenderPass.get()); + scoped_ptr<DrawQuad> outerQuad = SolidColorDrawQuad::create(sharedQuadState.get(), outerRect, SK_ColorYELLOW).PassAs<DrawQuad>(); + scoped_ptr<DrawQuad> innerQuad = SolidColorDrawQuad::create(sharedQuadState.get(), innerRect, SK_ColorCYAN).PassAs<DrawQuad>(); testRenderPass->appendQuad(innerQuad.Pass()); testRenderPass->appendQuad(outerQuad.Pass()); - CCRenderPassList list; - CCRenderPassIdHashMap hashmap; + RenderPassList list; + RenderPassIdHashMap hashmap; list.push_back(rootRenderPass.get()); hashmap.add(rootRenderPassId, rootRenderPass.Pass()); renderer()->drawFrame(list, hashmap); @@ -101,7 +101,7 @@ TEST_F(CCRendererSoftwareTest, solidColorQuad) #endif } -TEST_F(CCRendererSoftwareTest, tileQuad) +TEST_F(SoftwareRendererTest, tileQuad) { IntSize outerSize(100, 100); int outerPixels = outerSize.width() * outerSize.height(); @@ -112,8 +112,8 @@ TEST_F(CCRendererSoftwareTest, tileQuad) setViewportSize(outerSize); initializeRenderer(); - CCResourceProvider::ResourceId resourceYellow = resourceProvider()->createResource(1, outerSize, GL_RGBA, CCResourceProvider::TextureUsageAny); - CCResourceProvider::ResourceId resourceCyan = resourceProvider()->createResource(1, innerSize, GL_RGBA, CCResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId resourceYellow = resourceProvider()->createResource(1, outerSize, GL_RGBA, ResourceProvider::TextureUsageAny); + ResourceProvider::ResourceId resourceCyan = resourceProvider()->createResource(1, innerSize, GL_RGBA, ResourceProvider::TextureUsageAny); SkColor yellow = SK_ColorYELLOW; SkColor cyan = SK_ColorCYAN; @@ -129,17 +129,17 @@ TEST_F(CCRendererSoftwareTest, tileQuad) IntRect rect = IntRect(IntPoint(), deviceViewportSize()); - scoped_ptr<CCSharedQuadState> sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true); - CCRenderPass::Id rootRenderPassId = CCRenderPass::Id(1, 1); - scoped_ptr<CCRenderPass> rootRenderPass = CCTestRenderPass::create(rootRenderPassId, IntRect(IntPoint(), deviceViewportSize()), WebTransformationMatrix()); - CCTestRenderPass* testRenderPass = static_cast<CCTestRenderPass*>(rootRenderPass.get()); - scoped_ptr<CCDrawQuad> outerQuad = CCTileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, IntPoint(), outerSize, 0, false, false, false, false, false).PassAs<CCDrawQuad>(); - scoped_ptr<CCDrawQuad> innerQuad = CCTileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, IntPoint(), innerSize, 0, false, false, false, false, false).PassAs<CCDrawQuad>(); + scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true); + RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1); + scoped_ptr<RenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, IntRect(IntPoint(), deviceViewportSize()), WebTransformationMatrix()); + TestRenderPass* testRenderPass = static_cast<TestRenderPass*>(rootRenderPass.get()); + scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, IntPoint(), outerSize, 0, false, false, false, false, false).PassAs<DrawQuad>(); + scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, IntPoint(), innerSize, 0, false, false, false, false, false).PassAs<DrawQuad>(); testRenderPass->appendQuad(innerQuad.Pass()); testRenderPass->appendQuad(outerQuad.Pass()); - CCRenderPassList list; - CCRenderPassIdHashMap hashmap; + RenderPassList list; + RenderPassIdHashMap hashmap; list.push_back(rootRenderPass.get()); hashmap.add(rootRenderPassId, rootRenderPass.Pass()); renderer()->drawFrame(list, hashmap); diff --git a/cc/solid_color_draw_quad.cc b/cc/solid_color_draw_quad.cc index cd395e5..cec9654 100644 --- a/cc/solid_color_draw_quad.cc +++ b/cc/solid_color_draw_quad.cc @@ -10,13 +10,13 @@ namespace cc { -scoped_ptr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) +scoped_ptr<SolidColorDrawQuad> SolidColorDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) { - return make_scoped_ptr(new CCSolidColorDrawQuad(sharedQuadState, quadRect, color)); + return make_scoped_ptr(new SolidColorDrawQuad(sharedQuadState, quadRect, color)); } -CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) - : CCDrawQuad(sharedQuadState, CCDrawQuad::SolidColor, quadRect) +SolidColorDrawQuad::SolidColorDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) + : DrawQuad(sharedQuadState, DrawQuad::SolidColor, quadRect) , m_color(color) { if (SkColorGetA(m_color) < 255) @@ -25,10 +25,10 @@ CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadSt m_opaqueRect = quadRect; } -const CCSolidColorDrawQuad* CCSolidColorDrawQuad::materialCast(const CCDrawQuad* quad) +const SolidColorDrawQuad* SolidColorDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::SolidColor); - return static_cast<const CCSolidColorDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::SolidColor); + return static_cast<const SolidColorDrawQuad*>(quad); } } // namespacec cc diff --git a/cc/solid_color_draw_quad.h b/cc/solid_color_draw_quad.h index cd0619e..f46729a 100644 --- a/cc/solid_color_draw_quad.h +++ b/cc/solid_color_draw_quad.h @@ -13,15 +13,15 @@ namespace cc { #pragma pack(push, 4) -class CCSolidColorDrawQuad : public CCDrawQuad { +class SolidColorDrawQuad : public DrawQuad { public: - static scoped_ptr<CCSolidColorDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor); + static scoped_ptr<SolidColorDrawQuad> create(const SharedQuadState*, const IntRect&, SkColor); SkColor color() const { return m_color; }; - static const CCSolidColorDrawQuad* materialCast(const CCDrawQuad*); + static const SolidColorDrawQuad* materialCast(const DrawQuad*); private: - CCSolidColorDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor); + SolidColorDrawQuad(const SharedQuadState*, const IntRect&, SkColor); SkColor m_color; }; diff --git a/cc/solid_color_layer.cc b/cc/solid_color_layer.cc index 3f3140f..e562c5ed 100644 --- a/cc/solid_color_layer.cc +++ b/cc/solid_color_layer.cc @@ -10,22 +10,22 @@ namespace cc { -scoped_ptr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> SolidColorLayer::createLayerImpl() { - return CCSolidColorLayerImpl::create(id()).PassAs<CCLayerImpl>(); + return SolidColorLayerImpl::create(id()).PassAs<LayerImpl>(); } -scoped_refptr<SolidColorLayerChromium> SolidColorLayerChromium::create() +scoped_refptr<SolidColorLayer> SolidColorLayer::create() { - return make_scoped_refptr(new SolidColorLayerChromium()); + return make_scoped_refptr(new SolidColorLayer()); } -SolidColorLayerChromium::SolidColorLayerChromium() - : LayerChromium() +SolidColorLayer::SolidColorLayer() + : Layer() { } -SolidColorLayerChromium::~SolidColorLayerChromium() +SolidColorLayer::~SolidColorLayer() { } diff --git a/cc/solid_color_layer.h b/cc/solid_color_layer.h index bc1ede9..0f7396b 100644 --- a/cc/solid_color_layer.h +++ b/cc/solid_color_layer.h @@ -12,17 +12,17 @@ namespace cc { // A Layer that renders a solid color. The color is specified by using // setBackgroundColor() on the base class. -class SolidColorLayerChromium : public LayerChromium { +class SolidColorLayer : public Layer { public: - static scoped_refptr<SolidColorLayerChromium> create(); + static scoped_refptr<SolidColorLayer> create(); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; protected: - SolidColorLayerChromium(); + SolidColorLayer(); private: - virtual ~SolidColorLayerChromium(); + virtual ~SolidColorLayer(); }; } diff --git a/cc/solid_color_layer_impl.cc b/cc/solid_color_layer_impl.cc index 565fa5d..969c87f 100644 --- a/cc/solid_color_layer_impl.cc +++ b/cc/solid_color_layer_impl.cc @@ -15,19 +15,19 @@ using WebKit::WebTransformationMatrix; namespace cc { -CCSolidColorLayerImpl::CCSolidColorLayerImpl(int id) - : CCLayerImpl(id) +SolidColorLayerImpl::SolidColorLayerImpl(int id) + : LayerImpl(id) , m_tileSize(256) { } -CCSolidColorLayerImpl::~CCSolidColorLayerImpl() +SolidColorLayerImpl::~SolidColorLayerImpl() { } -void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void SolidColorLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); // We create a series of smaller quads instead of just one large one so that the @@ -37,12 +37,12 @@ void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& for (int x = 0; x < width; x += m_tileSize) { for (int y = 0; y < height; y += m_tileSize) { IntRect solidTileRect(x, y, min(width - x, m_tileSize), min(height - y, m_tileSize)); - quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor()).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(SolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor()).PassAs<DrawQuad>(), appendQuadsData); } } } -const char* CCSolidColorLayerImpl::layerTypeAsString() const +const char* SolidColorLayerImpl::layerTypeAsString() const { return "SolidColorLayer"; } diff --git a/cc/solid_color_layer_impl.h b/cc/solid_color_layer_impl.h index 72beb25..25af199 100644 --- a/cc/solid_color_layer_impl.h +++ b/cc/solid_color_layer_impl.h @@ -10,18 +10,18 @@ namespace cc { -class CCSolidColorLayerImpl : public CCLayerImpl { +class SolidColorLayerImpl : public LayerImpl { public: - static scoped_ptr<CCSolidColorLayerImpl> create(int id) + static scoped_ptr<SolidColorLayerImpl> create(int id) { - return make_scoped_ptr(new CCSolidColorLayerImpl(id)); + return make_scoped_ptr(new SolidColorLayerImpl(id)); } - virtual ~CCSolidColorLayerImpl(); + virtual ~SolidColorLayerImpl(); - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; protected: - explicit CCSolidColorLayerImpl(int id); + explicit SolidColorLayerImpl(int id); private: virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/solid_color_layer_impl_unittest.cc b/cc/solid_color_layer_impl_unittest.cc index 6838d09..381b0d2 100644 --- a/cc/solid_color_layer_impl_unittest.cc +++ b/cc/solid_color_layer_impl_unittest.cc @@ -15,42 +15,42 @@ #include "testing/gtest/include/gtest/gtest.h" using namespace cc; -using namespace CCLayerTestCommon; +using namespace LayerTestCommon; namespace { -TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) +TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) { DebugScopedSetImplThread scopedImplThread; - MockCCQuadCuller quadCuller; + MockQuadCuller quadCuller; IntSize layerSize = IntSize(800, 600); IntRect visibleContentRect = IntRect(IntPoint(), layerSize); - scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); + scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setContentBounds(layerSize); layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - CCAppendQuadsData data; + AppendQuadsData data; layer->appendQuads(quadCuller, data); verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); } -TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) +TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) { DebugScopedSetImplThread scopedImplThread; SkColor testColor = 0xFFA55AFF; - MockCCQuadCuller quadCuller; + MockQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); IntRect visibleContentRect = IntRect(IntPoint(), layerSize); - scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); + scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -58,24 +58,24 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - CCAppendQuadsData data; + AppendQuadsData data; layer->appendQuads(quadCuller, data); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color(), testColor); + EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color(), testColor); } -TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) +TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad) { DebugScopedSetImplThread scopedImplThread; const float opacity = 0.5f; - MockCCQuadCuller quadCuller; + MockQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); IntRect visibleContentRect = IntRect(IntPoint(), layerSize); - scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); + scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -83,11 +83,11 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - CCAppendQuadsData data; + AppendQuadsData data; layer->appendQuads(quadCuller, data); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->opacity()); + EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->opacity()); } } // namespace diff --git a/cc/stream_video_draw_quad.cc b/cc/stream_video_draw_quad.cc index 5d29d45..286849b 100644 --- a/cc/stream_video_draw_quad.cc +++ b/cc/stream_video_draw_quad.cc @@ -10,22 +10,22 @@ namespace cc { -scoped_ptr<CCStreamVideoDrawQuad> CCStreamVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) +scoped_ptr<StreamVideoDrawQuad> StreamVideoDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) { - return make_scoped_ptr(new CCStreamVideoDrawQuad(sharedQuadState, quadRect, textureId, matrix)); + return make_scoped_ptr(new StreamVideoDrawQuad(sharedQuadState, quadRect, textureId, matrix)); } -CCStreamVideoDrawQuad::CCStreamVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) - : CCDrawQuad(sharedQuadState, CCDrawQuad::StreamVideoContent, quadRect) +StreamVideoDrawQuad::StreamVideoDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) + : DrawQuad(sharedQuadState, DrawQuad::StreamVideoContent, quadRect) , m_textureId(textureId) , m_matrix(matrix) { } -const CCStreamVideoDrawQuad* CCStreamVideoDrawQuad::materialCast(const CCDrawQuad* quad) +const StreamVideoDrawQuad* StreamVideoDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::StreamVideoContent); - return static_cast<const CCStreamVideoDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::StreamVideoContent); + return static_cast<const StreamVideoDrawQuad*>(quad); } } // namespace cc diff --git a/cc/stream_video_draw_quad.h b/cc/stream_video_draw_quad.h index 6a1b6c4..6d1d699 100644 --- a/cc/stream_video_draw_quad.h +++ b/cc/stream_video_draw_quad.h @@ -13,16 +13,16 @@ namespace cc { #pragma pack(push, 4) -class CCStreamVideoDrawQuad : public CCDrawQuad { +class StreamVideoDrawQuad : public DrawQuad { public: - static scoped_ptr<CCStreamVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); + static scoped_ptr<StreamVideoDrawQuad> create(const SharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); unsigned textureId() const { return m_textureId; } const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; } - static const CCStreamVideoDrawQuad* materialCast(const CCDrawQuad*); + static const StreamVideoDrawQuad* materialCast(const DrawQuad*); private: - CCStreamVideoDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); + StreamVideoDrawQuad(const SharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); unsigned m_textureId; WebKit::WebTransformationMatrix m_matrix; diff --git a/cc/stubs/skia_utils.h b/cc/stubs/skia_utils.h index fb81f3e..d7b1fbf 100644 --- a/cc/stubs/skia_utils.h +++ b/cc/stubs/skia_utils.h @@ -7,7 +7,7 @@ namespace cc { -inline SkScalar CCFloatToSkScalar(float f) +inline SkScalar FloatToSkScalar(float f) { return SkFloatToScalar(isfinite(f) ? f : 0); } diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc index 7ceaf3f..0cfb794 100644 --- a/cc/test/animation_test_common.cc +++ b/cc/test/animation_test_common.cc @@ -19,16 +19,16 @@ namespace { template <class Target> void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity, bool useTimingFunction) { - scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve::create()); - scoped_ptr<CCTimingFunction> func; + scoped_ptr<TimingFunction> func; if (!useTimingFunction) - func = CCEaseTimingFunction::create(); + func = EaseTimingFunction::create(); if (duration > 0) - curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, func.Pass())); - curve->addKeyframe(CCFloatKeyframe::create(duration, endOpacity, scoped_ptr<cc::CCTimingFunction>())); + curve->addKeyframe(FloatKeyframe::create(0, startOpacity, func.Pass())); + curve->addKeyframe(FloatKeyframe::create(duration, endOpacity, scoped_ptr<cc::TimingFunction>())); - scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.PassAs<CCAnimationCurve>(), 0, 0, CCActiveAnimation::Opacity)); + scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<AnimationCurve>(), 0, 0, ActiveAnimation::Opacity)); animation->setNeedsSynchronizedStartTime(true); target.addAnimation(animation.Pass()); @@ -38,19 +38,19 @@ template <class Target> void addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY) { static int id = 0; - scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); + scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create()); if (duration > 0) { WebKit::WebTransformOperations startOperations; startOperations.appendTranslate(deltaX, deltaY, 0); - curve->addKeyframe(CCTransformKeyframe::create(0, startOperations, scoped_ptr<cc::CCTimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ptr<cc::TimingFunction>())); } WebKit::WebTransformOperations operations; operations.appendTranslate(deltaX, deltaY, 0); - curve->addKeyframe(CCTransformKeyframe::create(duration, operations, scoped_ptr<cc::CCTimingFunction>())); + curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_ptr<cc::TimingFunction>())); - scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.PassAs<CCAnimationCurve>(), id++, 0, CCActiveAnimation::Transform)); + scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<AnimationCurve>(), id++, 0, ActiveAnimation::Transform)); animation->setNeedsSynchronizedStartTime(true); target.addAnimation(animation.Pass()); @@ -84,9 +84,9 @@ float FakeFloatAnimationCurve::getValue(double now) const return 0; } -scoped_ptr<cc::CCAnimationCurve> FakeFloatAnimationCurve::clone() const +scoped_ptr<cc::AnimationCurve> FakeFloatAnimationCurve::clone() const { - return make_scoped_ptr(new FakeFloatAnimationCurve).PassAs<cc::CCAnimationCurve>(); + return make_scoped_ptr(new FakeFloatAnimationCurve).PassAs<cc::AnimationCurve>(); } FakeTransformTransition::FakeTransformTransition(double duration) @@ -108,9 +108,9 @@ WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c return WebKit::WebTransformationMatrix(); } -scoped_ptr<cc::CCAnimationCurve> FakeTransformTransition::clone() const +scoped_ptr<cc::AnimationCurve> FakeTransformTransition::clone() const { - return make_scoped_ptr(new FakeTransformTransition(*this)).PassAs<cc::CCAnimationCurve>(); + return make_scoped_ptr(new FakeTransformTransition(*this)).PassAs<cc::AnimationCurve>(); } @@ -172,37 +172,37 @@ const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans return m_transform; } -scoped_ptr<cc::CCAnimationCurve> FakeFloatTransition::clone() const +scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const { - return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::CCAnimationCurve>(); + return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationCurve>(); } -void addOpacityTransitionToController(cc::CCLayerAnimationController& controller, double duration, float startOpacity, float endOpacity, bool useTimingFunction) +void addOpacityTransitionToController(cc::LayerAnimationController& controller, double duration, float startOpacity, float endOpacity, bool useTimingFunction) { addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimingFunction); } -void addAnimatedTransformToController(cc::CCLayerAnimationController& controller, double duration, int deltaX, int deltaY) +void addAnimatedTransformToController(cc::LayerAnimationController& controller, double duration, int deltaX, int deltaY) { addAnimatedTransform(controller, duration, deltaX, deltaY); } -void addOpacityTransitionToLayer(cc::LayerChromium& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction) +void addOpacityTransitionToLayer(cc::Layer& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction) { addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFunction); } -void addOpacityTransitionToLayer(cc::CCLayerImpl& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction) +void addOpacityTransitionToLayer(cc::LayerImpl& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction) { addOpacityTransition(*layer.layerAnimationController(), duration, startOpacity, endOpacity, useTimingFunction); } -void addAnimatedTransformToLayer(cc::LayerChromium& layer, double duration, int deltaX, int deltaY) +void addAnimatedTransformToLayer(cc::Layer& layer, double duration, int deltaX, int deltaY) { addAnimatedTransform(layer, duration, deltaX, deltaY); } -void addAnimatedTransformToLayer(cc::CCLayerImpl& layer, double duration, int deltaX, int deltaY) +void addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int deltaX, int deltaY) { addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, deltaY); } diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h index a768930..8c00efb 100644 --- a/cc/test/animation_test_common.h +++ b/cc/test/animation_test_common.h @@ -11,13 +11,13 @@ #include "IntSize.h" namespace cc { -class CCLayerImpl; -class LayerChromium; +class LayerImpl; +class Layer; } namespace WebKitTests { -class FakeFloatAnimationCurve : public cc::CCFloatAnimationCurve { +class FakeFloatAnimationCurve : public cc::FloatAnimationCurve { public: FakeFloatAnimationCurve(); explicit FakeFloatAnimationCurve(double duration); @@ -25,13 +25,13 @@ public: virtual double duration() const OVERRIDE; virtual float getValue(double now) const OVERRIDE; - virtual scoped_ptr<cc::CCAnimationCurve> clone() const OVERRIDE; + virtual scoped_ptr<cc::AnimationCurve> clone() const OVERRIDE; private: double m_duration; }; -class FakeTransformTransition : public cc::CCTransformAnimationCurve { +class FakeTransformTransition : public cc::TransformAnimationCurve { public: FakeTransformTransition(double duration); virtual ~FakeTransformTransition(); @@ -39,13 +39,13 @@ public: virtual double duration() const OVERRIDE; virtual WebKit::WebTransformationMatrix getValue(double time) const OVERRIDE; - virtual scoped_ptr<cc::CCAnimationCurve> clone() const OVERRIDE; + virtual scoped_ptr<cc::AnimationCurve> clone() const OVERRIDE; private: double m_duration; }; -class FakeFloatTransition : public cc::CCFloatAnimationCurve { +class FakeFloatTransition : public cc::FloatAnimationCurve { public: FakeFloatTransition(double duration, float from, float to); virtual ~FakeFloatTransition(); @@ -53,7 +53,7 @@ public: virtual double duration() const OVERRIDE; virtual float getValue(double time) const OVERRIDE; - virtual scoped_ptr<cc::CCAnimationCurve> clone() const OVERRIDE; + virtual scoped_ptr<cc::AnimationCurve> clone() const OVERRIDE; private: double m_duration; @@ -61,12 +61,12 @@ private: float m_to; }; -class FakeLayerAnimationControllerClient : public cc::CCLayerAnimationControllerClient { +class FakeLayerAnimationControllerClient : public cc::LayerAnimationControllerClient { public: FakeLayerAnimationControllerClient(); virtual ~FakeLayerAnimationControllerClient(); - // CCLayerAnimationControllerClient implementation + // LayerAnimationControllerClient implementation virtual int id() const OVERRIDE; virtual void setOpacityFromAnimation(float) OVERRIDE; virtual float opacity() const OVERRIDE; @@ -78,14 +78,14 @@ private: WebKit::WebTransformationMatrix m_transform; }; -void addOpacityTransitionToController(cc::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); -void addAnimatedTransformToController(cc::CCLayerAnimationController&, double duration, int deltaX, int deltaY); +void addOpacityTransitionToController(cc::LayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); +void addAnimatedTransformToController(cc::LayerAnimationController&, double duration, int deltaX, int deltaY); -void addOpacityTransitionToLayer(cc::LayerChromium&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); -void addOpacityTransitionToLayer(cc::CCLayerImpl&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); +void addOpacityTransitionToLayer(cc::Layer&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); +void addOpacityTransitionToLayer(cc::LayerImpl&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); -void addAnimatedTransformToLayer(cc::LayerChromium&, double duration, int deltaX, int deltaY); -void addAnimatedTransformToLayer(cc::CCLayerImpl&, double duration, int deltaX, int deltaY); +void addAnimatedTransformToLayer(cc::Layer&, double duration, int deltaX, int deltaY); +void addAnimatedTransformToLayer(cc::LayerImpl&, double duration, int deltaX, int deltaY); } // namespace WebKitTests diff --git a/cc/test/fake_graphics_context.h b/cc/test/fake_graphics_context.h index 276e978..aaeb964 100644 --- a/cc/test/fake_graphics_context.h +++ b/cc/test/fake_graphics_context.h @@ -12,9 +12,9 @@ namespace WebKit { -static inline scoped_ptr<cc::CCGraphicsContext> createFakeCCGraphicsContext() +static inline scoped_ptr<cc::GraphicsContext> createFakeGraphicsContext() { - return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::CCGraphicsContext>(); + return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::GraphicsContext>(); } } // namespace WebKit diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index fecbb82..542f4bc 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc @@ -8,15 +8,15 @@ namespace cc { -scoped_ptr<WebKit::WebCompositorOutputSurface> FakeCCLayerTreeHostClient::createOutputSurface() +scoped_ptr<WebKit::WebCompositorOutputSurface> FakeLayerImplTreeHostClient::createOutputSurface() { WebKit::WebGraphicsContext3D::Attributes attrs; return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<WebKit::WebCompositorOutputSurface>(); } -scoped_ptr<CCInputHandler> FakeCCLayerTreeHostClient::createInputHandler() +scoped_ptr<InputHandler> FakeLayerImplTreeHostClient::createInputHandler() { - return scoped_ptr<CCInputHandler>(); + return scoped_ptr<InputHandler>(); } } diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h index e4e335f..328ec76 100644 --- a/cc/test/fake_layer_tree_host_client.h +++ b/cc/test/fake_layer_tree_host_client.h @@ -14,7 +14,7 @@ namespace cc { -class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient { +class FakeLayerImplTreeHostClient : public LayerTreeHostClient { public: virtual void willBeginFrame() OVERRIDE { } virtual void didBeginFrame() OVERRIDE { } @@ -24,7 +24,7 @@ public: virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface() OVERRIDE; virtual void didRecreateOutputSurface(bool success) OVERRIDE { } - virtual scoped_ptr<CCInputHandler> createInputHandler() OVERRIDE; + virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE; virtual void willCommit() OVERRIDE { } virtual void didCommit() OVERRIDE { } virtual void didCommitAndDrawFrame() OVERRIDE { } diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index fda251c..30037b6 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -9,17 +9,17 @@ #include "CCDrawQuad.h" #include "testing/gtest/include/gtest/gtest.h" -namespace CCLayerTestCommon { +namespace LayerTestCommon { // Align with expected and actual output const char* quadString = " Quad: "; -void verifyQuadsExactlyCoverRect(const cc::CCQuadList& quads, +void verifyQuadsExactlyCoverRect(const cc::QuadList& quads, const cc::IntRect& rect) { cc::Region remaining(rect); for (size_t i = 0; i < quads.size(); ++i) { - cc::CCDrawQuad* quad = quads[i]; + cc::DrawQuad* quad = quads[i]; cc::IntRect quadRect = quad->quadRect(); EXPECT_TRUE(rect.contains(quadRect)) << quadString << i; @@ -30,4 +30,4 @@ void verifyQuadsExactlyCoverRect(const cc::CCQuadList& quads, EXPECT_TRUE(remaining.isEmpty()); } -} // namespace CCLayerTestCommon +} // namespace LayerTestCommon diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 9627ba1..b67ca8f 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -9,11 +9,11 @@ #include "IntRect.h" #include "Region.h" -namespace CCLayerTestCommon { +namespace LayerTestCommon { extern const char* quadString; -void verifyQuadsExactlyCoverRect(const cc::CCQuadList&, const cc::IntRect&); +void verifyQuadsExactlyCoverRect(const cc::QuadList&, const cc::IntRect&); -} // namespace CCLayerTestCommon +} // namespace LayerTestCommon #endif // CCLayerTestCommon_h diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc index a151b4e..f86fe36 100644 --- a/cc/test/layer_tree_test_common.cc +++ b/cc/test/layer_tree_test_common.cc @@ -84,7 +84,7 @@ CompositorFakeWebGraphicsContext3DWithTextureTracking::~CompositorFakeWebGraphic { } -bool TestHooks::prepareToDrawOnCCThread(cc::CCLayerTreeHostImpl*) +bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*) { return true; } @@ -94,41 +94,41 @@ scoped_ptr<WebCompositorOutputSurface> TestHooks::createOutputSurface() return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<WebKit::WebCompositorOutputSurface>(); } -scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client) +scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client) { return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client)); } void MockLayerTreeHostImpl::beginCommit() { - CCLayerTreeHostImpl::beginCommit(); - m_testHooks->beginCommitOnCCThread(this); + LayerTreeHostImpl::beginCommit(); + m_testHooks->beginCommitOnThread(this); } void MockLayerTreeHostImpl::commitComplete() { - CCLayerTreeHostImpl::commitComplete(); - m_testHooks->commitCompleteOnCCThread(this); + LayerTreeHostImpl::commitComplete(); + m_testHooks->commitCompleteOnThread(this); } bool MockLayerTreeHostImpl::prepareToDraw(FrameData& frame) { - bool result = CCLayerTreeHostImpl::prepareToDraw(frame); - if (!m_testHooks->prepareToDrawOnCCThread(this)) + bool result = LayerTreeHostImpl::prepareToDraw(frame); + if (!m_testHooks->prepareToDrawOnThread(this)) result = false; return result; } void MockLayerTreeHostImpl::drawLayers(const FrameData& frame) { - CCLayerTreeHostImpl::drawLayers(frame); - m_testHooks->drawLayersOnCCThread(this); + LayerTreeHostImpl::drawLayers(frame); + m_testHooks->drawLayersOnThread(this); } void MockLayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTime) { m_testHooks->willAnimateLayers(this, monotonicTime); - CCLayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime); + LayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime); m_testHooks->animateLayers(this, monotonicTime); } @@ -137,16 +137,16 @@ base::TimeDelta MockLayerTreeHostImpl::lowFrequencyAnimationInterval() const return base::TimeDelta::FromMilliseconds(16); } -MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client) - : CCLayerTreeHostImpl(settings, client) +MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client) + : LayerTreeHostImpl(settings, client) , m_testHooks(testHooks) { } -// Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl. -class MockLayerTreeHost : public cc::CCLayerTreeHost { +// Adapts LayerTreeHost for test. Injects MockLayerTreeHostImpl. +class MockLayerTreeHost : public cc::LayerTreeHost { public: - static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::CCLayerTreeHostClient* client, scoped_refptr<cc::LayerChromium> rootLayer, const cc::CCLayerTreeSettings& settings) + static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::LayerTreeHostClient* client, scoped_refptr<cc::Layer> rootLayer, const cc::LayerTreeSettings& settings) { scoped_ptr<MockLayerTreeHost> layerTreeHost(new MockLayerTreeHost(testHooks, client, settings)); bool success = layerTreeHost->initialize(); @@ -161,20 +161,20 @@ public: return layerTreeHost.Pass(); } - virtual scoped_ptr<cc::CCLayerTreeHostImpl> createLayerTreeHostImpl(cc::CCLayerTreeHostImplClient* client) + virtual scoped_ptr<cc::LayerTreeHostImpl> createLayerTreeHostImpl(cc::LayerTreeHostImplClient* client) { - return MockLayerTreeHostImpl::create(m_testHooks, settings(), client).PassAs<cc::CCLayerTreeHostImpl>(); + return MockLayerTreeHostImpl::create(m_testHooks, settings(), client).PassAs<cc::LayerTreeHostImpl>(); } virtual void didAddAnimation() OVERRIDE { - CCLayerTreeHost::didAddAnimation(); + LayerTreeHost::didAddAnimation(); m_testHooks->didAddAnimation(); } private: - MockLayerTreeHost(TestHooks* testHooks, cc::CCLayerTreeHostClient* client, const cc::CCLayerTreeSettings& settings) - : CCLayerTreeHost(client, settings) + MockLayerTreeHost(TestHooks* testHooks, cc::LayerTreeHostClient* client, const cc::LayerTreeSettings& settings) + : LayerTreeHost(client, settings) , m_testHooks(testHooks) { } @@ -182,12 +182,12 @@ private: TestHooks* m_testHooks; }; -// Implementation of CCLayerTreeHost callback interface. -class MockLayerTreeHostClient : public MockCCLayerTreeHostClient { +// Implementation of LayerTreeHost callback interface. +class ThreadedMockLayerTreeHostClient : public MockLayerImplTreeHostClient { public: - static scoped_ptr<MockLayerTreeHostClient> create(TestHooks* testHooks) + static scoped_ptr<ThreadedMockLayerTreeHostClient> create(TestHooks* testHooks) { - return make_scoped_ptr(new MockLayerTreeHostClient(testHooks)); + return make_scoped_ptr(new ThreadedMockLayerTreeHostClient(testHooks)); } virtual void willBeginFrame() OVERRIDE @@ -223,9 +223,9 @@ public: m_testHooks->didRecreateOutputSurface(succeeded); } - virtual scoped_ptr<CCInputHandler> createInputHandler() OVERRIDE + virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE { - return scoped_ptr<CCInputHandler>(); + return scoped_ptr<InputHandler>(); } virtual void willCommit() OVERRIDE @@ -252,14 +252,14 @@ public: } private: - explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { } + explicit ThreadedMockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { } TestHooks* m_testHooks; }; class TimeoutTask : public WebThread::Task { public: - explicit TimeoutTask(CCThreadedTest* test) + explicit TimeoutTask(ThreadedTest* test) : m_test(test) { } @@ -282,12 +282,12 @@ public: } private: - CCThreadedTest* m_test; + ThreadedTest* m_test; }; class BeginTask : public WebThread::Task { public: - explicit BeginTask(CCThreadedTest* test) + explicit BeginTask(ThreadedTest* test) : m_test(test) { } @@ -298,10 +298,10 @@ public: m_test->doBeginTest(); } private: - CCThreadedTest* m_test; + ThreadedTest* m_test; }; -CCThreadedTest::CCThreadedTest() +ThreadedTest::ThreadedTest() : m_beginning(false) , m_endWhenBeginReturns(false) , m_timedOut(false) @@ -311,11 +311,11 @@ CCThreadedTest::CCThreadedTest() { } -CCThreadedTest::~CCThreadedTest() +ThreadedTest::~ThreadedTest() { } -void CCThreadedTest::endTest() +void ThreadedTest::endTest() { m_finished = true; @@ -324,65 +324,65 @@ void CCThreadedTest::endTest() if (m_beginning) m_endWhenBeginReturns = true; else - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::realEndTest)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::realEndTest)); } -void CCThreadedTest::endTestAfterDelay(int delayMilliseconds) +void ThreadedTest::endTestAfterDelay(int delayMilliseconds) { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::endTest)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::endTest)); } -void CCThreadedTest::postSetNeedsAnimateToMainThread() +void ThreadedTest::postSetNeedsAnimateToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchSetNeedsAnimate)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchSetNeedsAnimate)); } -void CCThreadedTest::postAddAnimationToMainThread() +void ThreadedTest::postAddAnimationToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchAddAnimation)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchAddAnimation)); } -void CCThreadedTest::postAddInstantAnimationToMainThread() +void ThreadedTest::postAddInstantAnimationToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchAddInstantAnimation)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchAddInstantAnimation)); } -void CCThreadedTest::postSetNeedsCommitToMainThread() +void ThreadedTest::postSetNeedsCommitToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchSetNeedsCommit)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchSetNeedsCommit)); } -void CCThreadedTest::postAcquireLayerTextures() +void ThreadedTest::postAcquireLayerTextures() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchAcquireLayerTextures)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchAcquireLayerTextures)); } -void CCThreadedTest::postSetNeedsRedrawToMainThread() +void ThreadedTest::postSetNeedsRedrawToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchSetNeedsRedraw)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchSetNeedsRedraw)); } -void CCThreadedTest::postSetNeedsAnimateAndCommitToMainThread() +void ThreadedTest::postSetNeedsAnimateAndCommitToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchSetNeedsAnimateAndCommit)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchSetNeedsAnimateAndCommit)); } -void CCThreadedTest::postSetVisibleToMainThread(bool visible) +void ThreadedTest::postSetVisibleToMainThread(bool visible) { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchSetVisible, visible)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchSetVisible, visible)); } -void CCThreadedTest::postDidAddAnimationToMainThread() +void ThreadedTest::postDidAddAnimationToMainThread() { - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchDidAddAnimation)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchDidAddAnimation)); } -void CCThreadedTest::doBeginTest() +void ThreadedTest::doBeginTest() { - DCHECK(CCProxy::isMainThread()); - m_client = MockLayerTreeHostClient::create(this); + DCHECK(Proxy::isMainThread()); + m_client = ThreadedMockLayerTreeHostClient::create(this); - scoped_refptr<LayerChromium> rootLayer = LayerChromium::create(); + scoped_refptr<Layer> rootLayer = Layer::create(); m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings); ASSERT_TRUE(m_layerTreeHost.get()); rootLayer->setLayerTreeHost(m_layerTreeHost.get()); @@ -396,29 +396,29 @@ void CCThreadedTest::doBeginTest() realEndTest(); } -void CCThreadedTest::timeout() +void ThreadedTest::timeout() { m_timedOut = true; endTest(); } -void CCThreadedTest::scheduleComposite() +void ThreadedTest::scheduleComposite() { if (!m_started || m_scheduled || m_finished) return; m_scheduled = true; - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::dispatchComposite)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadedTest::dispatchComposite)); } -void CCThreadedTest::realEndTest() +void ThreadedTest::realEndTest() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); WebKit::Platform::current()->currentThread()->exitRunLoop(); } -void CCThreadedTest::dispatchSetNeedsAnimate() +void ThreadedTest::dispatchSetNeedsAnimate() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -427,9 +427,9 @@ void CCThreadedTest::dispatchSetNeedsAnimate() m_layerTreeHost->setNeedsAnimate(); } -void CCThreadedTest::dispatchAddInstantAnimation() +void ThreadedTest::dispatchAddInstantAnimation() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -438,9 +438,9 @@ void CCThreadedTest::dispatchAddInstantAnimation() addOpacityTransitionToLayer(*m_layerTreeHost->rootLayer(), 0, 0, 0.5, false); } -void CCThreadedTest::dispatchAddAnimation() +void ThreadedTest::dispatchAddAnimation() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -449,9 +449,9 @@ void CCThreadedTest::dispatchAddAnimation() addOpacityTransitionToLayer(*m_layerTreeHost->rootLayer(), 10, 0, 0.5, true); } -void CCThreadedTest::dispatchSetNeedsAnimateAndCommit() +void ThreadedTest::dispatchSetNeedsAnimateAndCommit() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -462,9 +462,9 @@ void CCThreadedTest::dispatchSetNeedsAnimateAndCommit() } } -void CCThreadedTest::dispatchSetNeedsCommit() +void ThreadedTest::dispatchSetNeedsCommit() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -473,9 +473,9 @@ void CCThreadedTest::dispatchSetNeedsCommit() m_layerTreeHost->setNeedsCommit(); } -void CCThreadedTest::dispatchAcquireLayerTextures() +void ThreadedTest::dispatchAcquireLayerTextures() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -484,9 +484,9 @@ void CCThreadedTest::dispatchAcquireLayerTextures() m_layerTreeHost->acquireLayerTextures(); } -void CCThreadedTest::dispatchSetNeedsRedraw() +void ThreadedTest::dispatchSetNeedsRedraw() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -495,9 +495,9 @@ void CCThreadedTest::dispatchSetNeedsRedraw() m_layerTreeHost->setNeedsRedraw(); } -void CCThreadedTest::dispatchSetVisible(bool visible) +void ThreadedTest::dispatchSetVisible(bool visible) { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -506,16 +506,16 @@ void CCThreadedTest::dispatchSetVisible(bool visible) m_layerTreeHost->setVisible(visible); } -void CCThreadedTest::dispatchComposite() +void ThreadedTest::dispatchComposite() { m_scheduled = false; if (m_layerTreeHost.get() && !m_finished) m_layerTreeHost->composite(); } -void CCThreadedTest::dispatchDidAddAnimation() +void ThreadedTest::dispatchDidAddAnimation() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); if (m_finished) return; @@ -524,20 +524,20 @@ void CCThreadedTest::dispatchDidAddAnimation() m_layerTreeHost->didAddAnimation(); } -void CCThreadedTest::runTest(bool threaded) +void ThreadedTest::runTest(bool threaded) { // For these tests, we will enable threaded animations. - CCScopedSettings scopedSettings; + ScopedSettings scopedSettings; Settings::setAcceleratedAnimationEnabled(true); if (threaded) { - m_webThread.reset(WebKit::Platform::current()->createThread("CCThreadedTest")); + m_webThread.reset(WebKit::Platform::current()->createThread("ThreadedTest")); Platform::current()->compositorSupport()->initialize(m_webThread.get()); } else Platform::current()->compositorSupport()->initialize(0); - DCHECK(CCProxy::isMainThread()); - m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); + DCHECK(Proxy::isMainThread()); + m_mainThreadProxy = ScopedThreadProxy::create(Proxy::mainThread()); initializeSettings(m_settings); diff --git a/cc/test/layer_tree_test_common.h b/cc/test/layer_tree_test_common.h index abdcb9a..72d854c 100644 --- a/cc/test/layer_tree_test_common.h +++ b/cc/test/layer_tree_test_common.h @@ -15,10 +15,10 @@ #include <public/WebThread.h> namespace cc { -class CCLayerImpl; -class CCLayerTreeHost; -class CCLayerTreeHostClient; -class CCLayerTreeHostImpl; +class LayerImpl; +class LayerTreeHost; +class LayerTreeHostClient; +class LayerTreeHostImpl; } namespace WebKitTests { @@ -26,12 +26,12 @@ namespace WebKitTests { // Used by test stubs to notify the test when something interesting happens. class TestHooks : public WebKit::WebAnimationDelegate { public: - virtual void beginCommitOnCCThread(cc::CCLayerTreeHostImpl*) { } - virtual void commitCompleteOnCCThread(cc::CCLayerTreeHostImpl*) { } - virtual bool prepareToDrawOnCCThread(cc::CCLayerTreeHostImpl*); - virtual void drawLayersOnCCThread(cc::CCLayerTreeHostImpl*) { } - virtual void animateLayers(cc::CCLayerTreeHostImpl*, double monotonicTime) { } - virtual void willAnimateLayers(cc::CCLayerTreeHostImpl*, double monotonicTime) { } + virtual void beginCommitOnThread(cc::LayerTreeHostImpl*) { } + virtual void commitCompleteOnThread(cc::LayerTreeHostImpl*) { } + virtual bool prepareToDrawOnThread(cc::LayerTreeHostImpl*); + virtual void drawLayersOnThread(cc::LayerTreeHostImpl*) { } + virtual void animateLayers(cc::LayerTreeHostImpl*, double monotonicTime) { } + virtual void willAnimateLayers(cc::LayerTreeHostImpl*, double monotonicTime) { } virtual void applyScrollAndScale(const cc::IntSize&, float) { } virtual void animate(double monotonicTime) { } virtual void layout() { } @@ -51,22 +51,22 @@ public: class TimeoutTask; class BeginTask; -class MockCCLayerTreeHostClient : public cc::CCLayerTreeHostClient { +class MockLayerImplTreeHostClient : public cc::LayerTreeHostClient { }; -// The CCThreadedTests runs with the main loop running. It instantiates a single MockLayerTreeHost and associated -// MockLayerTreeHostImpl/MockLayerTreeHostClient. +// The ThreadedTests runs with the main loop running. It instantiates a single MockLayerTreeHost and associated +// MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. // // beginTest() is called once the main message loop is running and the layer tree host is initialized. // -// Key stages of the drawing loop, e.g. drawing or commiting, redirect to CCThreadedTest methods of similar names. +// Key stages of the drawing loop, e.g. drawing or commiting, redirect to ThreadedTest methods of similar names. // To track the commit process, override these functions. // // The test continues until someone calls endTest. endTest can be called on any thread, but be aware that // ending the test is an asynchronous process. -class CCThreadedTest : public testing::Test, public TestHooks { +class ThreadedTest : public testing::Test, public TestHooks { public: - virtual ~CCThreadedTest(); + virtual ~ThreadedTest(); virtual void afterTest() = 0; virtual void beginTest() = 0; @@ -89,12 +89,12 @@ public: void clearTimeout() { m_timeoutTask = 0; } - cc::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } + cc::LayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } protected: - CCThreadedTest(); + ThreadedTest(); - virtual void initializeSettings(cc::CCLayerTreeSettings&) { } + virtual void initializeSettings(cc::LayerTreeSettings&) { } virtual void scheduleComposite() OVERRIDE; @@ -114,12 +114,12 @@ protected: virtual void runTest(bool threaded); WebKit::WebThread* webThread() const { return m_webThread.get(); } - cc::CCLayerTreeSettings m_settings; - scoped_ptr<MockCCLayerTreeHostClient> m_client; - scoped_ptr<cc::CCLayerTreeHost> m_layerTreeHost; + cc::LayerTreeSettings m_settings; + scoped_ptr<MockLayerImplTreeHostClient> m_client; + scoped_ptr<cc::LayerTreeHost> m_layerTreeHost; protected: - RefPtr<cc::CCScopedThreadProxy> m_mainThreadProxy; + RefPtr<cc::ScopedThreadProxy> m_mainThreadProxy; private: bool m_beginning; @@ -134,18 +134,18 @@ private: BeginTask* m_beginTask; }; -class CCThreadedTestThreadOnly : public CCThreadedTest { +class ThreadedTestThreadOnly : public ThreadedTest { public: void runTestThreaded() { - CCThreadedTest::runTest(true); + ThreadedTest::runTest(true); } }; -// Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks. -class MockLayerTreeHostImpl : public cc::CCLayerTreeHostImpl { +// Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. +class MockLayerTreeHostImpl : public cc::LayerTreeHostImpl { public: - static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const cc::CCLayerTreeSettings&, cc::CCLayerTreeHostImplClient*); + static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const cc::LayerTreeSettings&, cc::LayerTreeHostImplClient*); virtual void beginCommit() OVERRIDE; virtual void commitComplete() OVERRIDE; @@ -153,15 +153,15 @@ public: virtual void drawLayers(const FrameData&) OVERRIDE; // Make these public. - typedef std::vector<cc::CCLayerImpl*> CCLayerList; - using CCLayerTreeHostImpl::calculateRenderSurfaceLayerList; + typedef std::vector<cc::LayerImpl*> LayerList; + using LayerTreeHostImpl::calculateRenderSurfaceLayerList; protected: virtual void animateLayers(double monotonicTime, double wallClockTime) OVERRIDE; virtual base::TimeDelta lowFrequencyAnimationInterval() const OVERRIDE; private: - MockLayerTreeHostImpl(TestHooks*, const cc::CCLayerTreeSettings&, cc::CCLayerTreeHostImplClient*); + MockLayerTreeHostImpl(TestHooks*, const cc::LayerTreeSettings&, cc::LayerTreeHostImplClient*); TestHooks* m_testHooks; }; diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc index 282dddc..08b8e3e 100644 --- a/cc/test/mock_quad_culler.cc +++ b/cc/test/mock_quad_culler.cc @@ -8,23 +8,23 @@ namespace cc { -MockCCQuadCuller::MockCCQuadCuller() +MockQuadCuller::MockQuadCuller() : m_activeQuadList(m_quadListStorage) , m_activeSharedQuadStateList(m_sharedQuadStateStorage) { } -MockCCQuadCuller::MockCCQuadCuller(CCQuadList& externalQuadList, CCSharedQuadStateList& externalSharedQuadStateList) +MockQuadCuller::MockQuadCuller(QuadList& externalQuadList, SharedQuadStateList& externalSharedQuadStateList) : m_activeQuadList(externalQuadList) , m_activeSharedQuadStateList(externalSharedQuadStateList) { } -MockCCQuadCuller::~MockCCQuadCuller() +MockQuadCuller::~MockQuadCuller() { } -bool MockCCQuadCuller::append(scoped_ptr<CCDrawQuad> drawQuad, CCAppendQuadsData&) +bool MockQuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData&) { if (!drawQuad->quadRect().isEmpty()) { m_activeQuadList.append(drawQuad.Pass()); @@ -33,11 +33,11 @@ bool MockCCQuadCuller::append(scoped_ptr<CCDrawQuad> drawQuad, CCAppendQuadsData return false; } -CCSharedQuadState* MockCCQuadCuller::useSharedQuadState(scoped_ptr<CCSharedQuadState> sharedQuadState) +SharedQuadState* MockQuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> sharedQuadState) { sharedQuadState->id = m_activeSharedQuadStateList.size(); - CCSharedQuadState* rawPtr = sharedQuadState.get(); + SharedQuadState* rawPtr = sharedQuadState.get(); m_activeSharedQuadStateList.append(sharedQuadState.Pass()); return rawPtr; } diff --git a/cc/test/mock_quad_culler.h b/cc/test/mock_quad_culler.h index d853b58..39c0e31 100644 --- a/cc/test/mock_quad_culler.h +++ b/cc/test/mock_quad_culler.h @@ -13,25 +13,25 @@ namespace cc { -class MockCCQuadCuller : public CCQuadSink { +class MockQuadCuller : public QuadSink { public: - MockCCQuadCuller(); - virtual ~MockCCQuadCuller(); + MockQuadCuller(); + virtual ~MockQuadCuller(); - MockCCQuadCuller(CCQuadList& externalQuadList, CCSharedQuadStateList& externalSharedQuadStateList); + MockQuadCuller(QuadList& externalQuadList, SharedQuadStateList& externalSharedQuadStateList); - virtual bool append(scoped_ptr<CCDrawQuad> newQuad, CCAppendQuadsData&) OVERRIDE; + virtual bool append(scoped_ptr<DrawQuad> newQuad, AppendQuadsData&) OVERRIDE; - virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState> passSharedQuadState) OVERRIDE; + virtual SharedQuadState* useSharedQuadState(scoped_ptr<SharedQuadState> passSharedQuadState) OVERRIDE; - const CCQuadList& quadList() const { return m_activeQuadList; }; - const CCSharedQuadStateList& sharedQuadStateList() const { return m_activeSharedQuadStateList; }; + const QuadList& quadList() const { return m_activeQuadList; }; + const SharedQuadStateList& sharedQuadStateList() const { return m_activeSharedQuadStateList; }; private: - CCQuadList& m_activeQuadList; - CCQuadList m_quadListStorage; - CCSharedQuadStateList& m_activeSharedQuadStateList; - CCSharedQuadStateList m_sharedQuadStateStorage; + QuadList& m_activeQuadList; + QuadList m_quadListStorage; + SharedQuadStateList& m_activeSharedQuadStateList; + SharedQuadStateList m_sharedQuadStateStorage; }; } // namespace cc diff --git a/cc/test/occlusion_tracker_test_common.h b/cc/test/occlusion_tracker_test_common.h index 0bc9a4c..a5086e8 100644 --- a/cc/test/occlusion_tracker_test_common.h +++ b/cc/test/occlusion_tracker_test_common.h @@ -15,22 +15,22 @@ namespace WebKitTests { // A subclass to expose the total current occlusion. template<typename LayerType, typename RenderSurfaceType> -class TestCCOcclusionTrackerBase : public cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType> { +class TestOcclusionTrackerBase : public cc::OcclusionTrackerBase<LayerType, RenderSurfaceType> { public: - TestCCOcclusionTrackerBase(cc::IntRect screenScissorRect, bool recordMetricsForFrame = false) - : cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame) + TestOcclusionTrackerBase(cc::IntRect screenScissorRect, bool recordMetricsForFrame = false) + : cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame) { } - cc::Region occlusionInScreenSpace() const { return cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; } - cc::Region occlusionInTargetSurface() const { return cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; } + cc::Region occlusionInScreenSpace() const { return cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; } + cc::Region occlusionInTargetSurface() const { return cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; } - void setOcclusionInScreenSpace(const cc::Region& region) { cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = region; } - void setOcclusionInTargetSurface(const cc::Region& region) { cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = region; } + void setOcclusionInScreenSpace(const cc::Region& region) { cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = region; } + void setOcclusionInTargetSurface(const cc::Region& region) { cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = region; } }; -typedef TestCCOcclusionTrackerBase<cc::LayerChromium, cc::RenderSurfaceChromium> TestCCOcclusionTracker; -typedef TestCCOcclusionTrackerBase<cc::CCLayerImpl, cc::CCRenderSurface> TestCCOcclusionTrackerImpl; +typedef TestOcclusionTrackerBase<cc::Layer, cc::RenderSurface> TestOcclusionTracker; +typedef TestOcclusionTrackerBase<cc::LayerImpl, cc::RenderSurfaceImpl> TestOcclusionTrackerImpl; } diff --git a/cc/test/render_pass_test_common.h b/cc/test/render_pass_test_common.h index 9f17781..53356cd 100644 --- a/cc/test/render_pass_test_common.h +++ b/cc/test/render_pass_test_common.h @@ -9,13 +9,13 @@ namespace WebKitTests { -class CCTestRenderPass : public cc::CCRenderPass { +class TestRenderPass : public cc::RenderPass { public: - cc::CCQuadList& quadList() { return m_quadList; } - cc::CCSharedQuadStateList& sharedQuadStateList() { return m_sharedQuadStateList; } + cc::QuadList& quadList() { return m_quadList; } + cc::SharedQuadStateList& sharedQuadStateList() { return m_sharedQuadStateList; } - void appendQuad(scoped_ptr<cc::CCDrawQuad> quad) { m_quadList.append(quad.Pass()); } - void appendSharedQuadState(scoped_ptr<cc::CCSharedQuadState> state) { m_sharedQuadStateList.append(state.Pass()); } + void appendQuad(scoped_ptr<cc::DrawQuad> quad) { m_quadList.append(quad.Pass()); } + void appendSharedQuadState(scoped_ptr<cc::SharedQuadState> state) { m_sharedQuadStateList.append(state.Pass()); } }; } //namespace WebKitTests diff --git a/cc/test/scheduler_test_common.cc b/cc/test/scheduler_test_common.cc index e956b5d..b2bedd8 100644 --- a/cc/test/scheduler_test_common.cc +++ b/cc/test/scheduler_test_common.cc @@ -10,26 +10,26 @@ namespace WebKitTests { -void FakeCCTimeSourceClient::onTimerTick() +void FakeTimeSourceClient::onTimerTick() { m_tickCalled = true; } -FakeCCThread::FakeCCThread() +FakeThread::FakeThread() { reset(); } -FakeCCThread::~FakeCCThread() +FakeThread::~FakeThread() { } -void FakeCCThread::postTask(PassOwnPtr<Task>) +void FakeThread::postTask(PassOwnPtr<Task>) { NOTREACHED(); } -void FakeCCThread::postDelayedTask(PassOwnPtr<Task> task, long long delay) +void FakeThread::postDelayedTask(PassOwnPtr<Task> task, long long delay) { if (m_runPendingTaskOnOverwrite && hasPendingTask()) runPendingTask(); @@ -39,37 +39,37 @@ void FakeCCThread::postDelayedTask(PassOwnPtr<Task> task, long long delay) m_pendingTaskDelay = delay; } -base::PlatformThreadId FakeCCThread::threadID() const +base::PlatformThreadId FakeThread::threadID() const { return 0; } -void FakeCCTimeSource::setClient(cc::CCTimeSourceClient* client) +void FakeTimeSource::setClient(cc::TimeSourceClient* client) { m_client = client; } -void FakeCCTimeSource::setActive(bool b) +void FakeTimeSource::setActive(bool b) { m_active = b; } -bool FakeCCTimeSource::active() const +bool FakeTimeSource::active() const { return m_active; } -base::TimeTicks FakeCCTimeSource::lastTickTime() +base::TimeTicks FakeTimeSource::lastTickTime() { return base::TimeTicks(); } -base::TimeTicks FakeCCTimeSource::nextTickTime() +base::TimeTicks FakeTimeSource::nextTickTime() { return base::TimeTicks(); } -base::TimeTicks FakeCCDelayBasedTimeSource::now() const +base::TimeTicks FakeDelayBasedTimeSource::now() const { return m_now; } diff --git a/cc/test/scheduler_test_common.h b/cc/test/scheduler_test_common.h index aeb0d55..58f779b 100644 --- a/cc/test/scheduler_test_common.h +++ b/cc/test/scheduler_test_common.h @@ -14,9 +14,9 @@ namespace WebKitTests { -class FakeCCTimeSourceClient : public cc::CCTimeSourceClient { +class FakeTimeSourceClient : public cc::TimeSourceClient { public: - FakeCCTimeSourceClient() { reset(); } + FakeTimeSourceClient() { reset(); } void reset() { m_tickCalled = false; } bool tickCalled() const { return m_tickCalled; } @@ -26,10 +26,10 @@ protected: bool m_tickCalled; }; -class FakeCCThread : public cc::CCThread { +class FakeThread : public cc::Thread { public: - FakeCCThread(); - virtual ~FakeCCThread(); + FakeThread(); + virtual ~FakeThread(); void reset() { @@ -67,15 +67,15 @@ protected: bool m_runPendingTaskOnOverwrite; }; -class FakeCCTimeSource : public cc::CCTimeSource { +class FakeTimeSource : public cc::TimeSource { public: - FakeCCTimeSource() + FakeTimeSource() : m_active(false) , m_client(0) { } - virtual void setClient(cc::CCTimeSourceClient* client) OVERRIDE; + virtual void setClient(cc::TimeSourceClient* client) OVERRIDE; virtual void setActive(bool b) OVERRIDE; virtual bool active() const OVERRIDE; virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE { } @@ -92,36 +92,36 @@ public: void setNextTickTime(base::TimeTicks nextTickTime) { m_nextTickTime = nextTickTime; } protected: - virtual ~FakeCCTimeSource() { } + virtual ~FakeTimeSource() { } bool m_active; base::TimeTicks m_nextTickTime; - cc::CCTimeSourceClient* m_client; + cc::TimeSourceClient* m_client; }; -class FakeCCDelayBasedTimeSource : public cc::CCDelayBasedTimeSource { +class FakeDelayBasedTimeSource : public cc::DelayBasedTimeSource { public: - static scoped_refptr<FakeCCDelayBasedTimeSource> create(base::TimeDelta interval, cc::CCThread* thread) + static scoped_refptr<FakeDelayBasedTimeSource> create(base::TimeDelta interval, cc::Thread* thread) { - return make_scoped_refptr(new FakeCCDelayBasedTimeSource(interval, thread)); + return make_scoped_refptr(new FakeDelayBasedTimeSource(interval, thread)); } void setNow(base::TimeTicks time) { m_now = time; } virtual base::TimeTicks now() const OVERRIDE; protected: - FakeCCDelayBasedTimeSource(base::TimeDelta interval, cc::CCThread* thread) - : CCDelayBasedTimeSource(interval, thread) + FakeDelayBasedTimeSource(base::TimeDelta interval, cc::Thread* thread) + : DelayBasedTimeSource(interval, thread) { } - virtual ~FakeCCDelayBasedTimeSource() { } + virtual ~FakeDelayBasedTimeSource() { } base::TimeTicks m_now; }; -class FakeCCFrameRateController : public cc::CCFrameRateController { +class FakeFrameRateController : public cc::FrameRateController { public: - FakeCCFrameRateController(scoped_refptr<cc::CCTimeSource> timer) : cc::CCFrameRateController(timer) { } + FakeFrameRateController(scoped_refptr<cc::TimeSource> timer) : cc::FrameRateController(timer) { } int numFramesPending() const { return m_numFramesPending; } }; diff --git a/cc/test/test_common.h b/cc/test/test_common.h index 572a5c9..9c6c0ce 100644 --- a/cc/test/test_common.h +++ b/cc/test/test_common.h @@ -11,10 +11,10 @@ namespace WebKitTests { // If you have a test that modifies or uses global settings, keep an instance // of this class to ensure that you start and end with a clean slate. -class CCScopedSettings { +class ScopedSettings { public: - CCScopedSettings() { cc::Settings::resetForTest(); } - ~CCScopedSettings() { cc::Settings::resetForTest(); } + ScopedSettings() { cc::Settings::resetForTest(); } + ~ScopedSettings() { cc::Settings::resetForTest(); } }; } // namespace WebKitTests diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 7f42177..ccc593b 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -10,7 +10,7 @@ using namespace cc; namespace WebKitTests { -FakeLayerTextureUpdater::Texture::Texture(FakeLayerTextureUpdater* layer, scoped_ptr<CCPrioritizedTexture> texture) +FakeLayerTextureUpdater::Texture::Texture(FakeLayerTextureUpdater* layer, scoped_ptr<PrioritizedTexture> texture) : LayerTextureUpdater::Texture(texture.Pass()) , m_layer(layer) { @@ -22,7 +22,7 @@ FakeLayerTextureUpdater::Texture::~Texture() { } -void FakeLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queue, const IntRect&, const IntSize&, bool partialUpdate, CCRenderingStats&) +void FakeLayerTextureUpdater::Texture::update(TextureUpdateQueue& queue, const IntRect&, const IntSize&, bool partialUpdate, RenderingStats&) { const IntRect rect(0, 0, 10, 10); ResourceUpdate upload = ResourceUpdate::Create( @@ -45,7 +45,7 @@ FakeLayerTextureUpdater::~FakeLayerTextureUpdater() { } -void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect, CCRenderingStats&) +void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect, RenderingStats&) { m_prepareCount++; m_lastUpdateRect = contentRect; @@ -57,15 +57,15 @@ void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const resultingOpaqueRect = m_opaquePaintRect; } -void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayerChromium* layer) +void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayer* layer) { m_rectToInvalidate = rect; m_layer = layer; } -scoped_ptr<LayerTextureUpdater::Texture> FakeLayerTextureUpdater::createTexture(CCPrioritizedTextureManager* manager) +scoped_ptr<LayerTextureUpdater::Texture> FakeLayerTextureUpdater::createTexture(PrioritizedTextureManager* manager) { - return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); + return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); } LayerTextureUpdater::SampledTexelFormat FakeLayerTextureUpdater::sampledTexelFormat(GLenum) @@ -73,28 +73,28 @@ LayerTextureUpdater::SampledTexelFormat FakeLayerTextureUpdater::sampledTexelFor return SampledTexelFormatRGBA; } -FakeCCTiledLayerImpl::FakeCCTiledLayerImpl(int id) - : CCTiledLayerImpl(id) +FakeTiledLayerImpl::FakeTiledLayerImpl(int id) + : TiledLayerImpl(id) { } -FakeCCTiledLayerImpl::~FakeCCTiledLayerImpl() +FakeTiledLayerImpl::~FakeTiledLayerImpl() { } -FakeTiledLayerChromium::FakeTiledLayerChromium(CCPrioritizedTextureManager* textureManager) - : TiledLayerChromium() +FakeTiledLayer::FakeTiledLayer(PrioritizedTextureManager* textureManager) + : TiledLayer() , m_fakeTextureUpdater(make_scoped_refptr(new FakeLayerTextureUpdater)) , m_textureManager(textureManager) { setTileSize(tileSize()); setTextureFormat(GL_RGBA); - setBorderTexelOption(CCLayerTilingData::NoBorderTexels); + setBorderTexelOption(LayerTilingData::NoBorderTexels); setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons. } -FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(CCPrioritizedTextureManager* textureManager) - : FakeTiledLayerChromium(textureManager) +FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedTextureManager* textureManager) + : FakeTiledLayer(textureManager) { } @@ -102,17 +102,17 @@ FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() { } -FakeTiledLayerChromium::~FakeTiledLayerChromium() +FakeTiledLayer::~FakeTiledLayer() { } -void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) +void FakeTiledLayer::setNeedsDisplayRect(const FloatRect& rect) { m_lastNeedsDisplayRect = rect; - TiledLayerChromium::setNeedsDisplayRect(rect); + TiledLayer::setNeedsDisplayRect(rect); } -void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) +void FakeTiledLayer::setTexturePriorities(const PriorityCalculator& calculator) { // Ensure there is always a target render surface available. If none has been // set (the layer is an orphan for the test), then just set a surface on itself. @@ -121,7 +121,7 @@ void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& ca if (missingTargetRenderSurface) createRenderSurface(); - TiledLayerChromium::setTexturePriorities(calculator); + TiledLayer::setTexturePriorities(calculator); if (missingTargetRenderSurface) { clearRenderSurface(); @@ -129,12 +129,12 @@ void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& ca } } -cc::CCPrioritizedTextureManager* FakeTiledLayerChromium::textureManager() const +cc::PrioritizedTextureManager* FakeTiledLayer::textureManager() const { return m_textureManager; } -cc::LayerTextureUpdater* FakeTiledLayerChromium::textureUpdater() const +cc::LayerTextureUpdater* FakeTiledLayer::textureUpdater() const { return m_fakeTextureUpdater.get(); } diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index 844688e..1c0f75d 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -20,16 +20,16 @@ namespace WebKitTests { -class FakeTiledLayerChromium; +class FakeTiledLayer; class FakeLayerTextureUpdater : public cc::LayerTextureUpdater { public: class Texture : public cc::LayerTextureUpdater::Texture { public: - Texture(FakeLayerTextureUpdater*, scoped_ptr<cc::CCPrioritizedTexture>); + Texture(FakeLayerTextureUpdater*, scoped_ptr<cc::PrioritizedTexture>); virtual ~Texture(); - virtual void update(cc::CCTextureUpdateQueue&, const cc::IntRect&, const cc::IntSize&, bool, cc::CCRenderingStats&) OVERRIDE; + virtual void update(cc::TextureUpdateQueue&, const cc::IntRect&, const cc::IntSize&, bool, cc::RenderingStats&) OVERRIDE; private: FakeLayerTextureUpdater* m_layer; @@ -38,13 +38,13 @@ public: FakeLayerTextureUpdater(); - virtual scoped_ptr<cc::LayerTextureUpdater::Texture> createTexture(cc::CCPrioritizedTextureManager*) OVERRIDE; + virtual scoped_ptr<cc::LayerTextureUpdater::Texture> createTexture(cc::PrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GLenum) OVERRIDE; - virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSize&, float, float, cc::IntRect& resultingOpaqueRect, cc::CCRenderingStats&) OVERRIDE; + virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSize&, float, float, cc::IntRect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE; // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next // call to prepareToUpdate() the rect is reset. - void setRectToInvalidate(const cc::IntRect&, FakeTiledLayerChromium*); + void setRectToInvalidate(const cc::IntRect&, FakeTiledLayer*); // Last rect passed to prepareToUpdate(). const cc::IntRect& lastUpdateRect() const { return m_lastUpdateRect; } @@ -68,53 +68,53 @@ private: cc::IntRect m_rectToInvalidate; cc::IntRect m_lastUpdateRect; cc::IntRect m_opaquePaintRect; - scoped_refptr<FakeTiledLayerChromium> m_layer; + scoped_refptr<FakeTiledLayer> m_layer; }; -class FakeCCTiledLayerImpl : public cc::CCTiledLayerImpl { +class FakeTiledLayerImpl : public cc::TiledLayerImpl { public: - explicit FakeCCTiledLayerImpl(int id); - virtual ~FakeCCTiledLayerImpl(); + explicit FakeTiledLayerImpl(int id); + virtual ~FakeTiledLayerImpl(); - using cc::CCTiledLayerImpl::hasTileAt; - using cc::CCTiledLayerImpl::hasResourceIdForTileAt; + using cc::TiledLayerImpl::hasTileAt; + using cc::TiledLayerImpl::hasResourceIdForTileAt; }; -class FakeTiledLayerChromium : public cc::TiledLayerChromium { +class FakeTiledLayer : public cc::TiledLayer { public: - explicit FakeTiledLayerChromium(cc::CCPrioritizedTextureManager*); + explicit FakeTiledLayer(cc::PrioritizedTextureManager*); static cc::IntSize tileSize() { return cc::IntSize(100, 100); } - using cc::TiledLayerChromium::invalidateContentRect; - using cc::TiledLayerChromium::needsIdlePaint; - using cc::TiledLayerChromium::skipsDraw; - using cc::TiledLayerChromium::numPaintedTiles; - using cc::TiledLayerChromium::idlePaintRect; + using cc::TiledLayer::invalidateContentRect; + using cc::TiledLayer::needsIdlePaint; + using cc::TiledLayer::skipsDraw; + using cc::TiledLayer::numPaintedTiles; + using cc::TiledLayer::idlePaintRect; virtual void setNeedsDisplayRect(const cc::FloatRect&) OVERRIDE; const cc::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } - virtual void setTexturePriorities(const cc::CCPriorityCalculator&) OVERRIDE; + virtual void setTexturePriorities(const cc::PriorityCalculator&) OVERRIDE; - virtual cc::CCPrioritizedTextureManager* textureManager() const OVERRIDE; + virtual cc::PrioritizedTextureManager* textureManager() const OVERRIDE; FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); } cc::FloatRect updateRect() { return m_updateRect; } protected: virtual cc::LayerTextureUpdater* textureUpdater() const OVERRIDE; virtual void createTextureUpdaterIfNeeded() OVERRIDE { } - virtual ~FakeTiledLayerChromium(); + virtual ~FakeTiledLayer(); private: scoped_refptr<FakeLayerTextureUpdater> m_fakeTextureUpdater; - cc::CCPrioritizedTextureManager* m_textureManager; + cc::PrioritizedTextureManager* m_textureManager; cc::FloatRect m_lastNeedsDisplayRect; }; -class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium { +class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { public: - explicit FakeTiledLayerWithScaledBounds(cc::CCPrioritizedTextureManager*); + explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedTextureManager*); void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBounds = contentBounds; } virtual cc::IntSize contentBounds() const OVERRIDE; diff --git a/cc/texture.cc b/cc/texture.cc index 3413862..9fd8ebe 100644 --- a/cc/texture.cc +++ b/cc/texture.cc @@ -8,13 +8,13 @@ namespace cc { -void CCTexture::setDimensions(const IntSize& size, GLenum format) +void Texture::setDimensions(const IntSize& size, GLenum format) { m_size = size; m_format = format; } -size_t CCTexture::bytes() const +size_t Texture::bytes() const { if (m_size.isEmpty()) return 0u; @@ -22,7 +22,7 @@ size_t CCTexture::bytes() const return memorySizeBytes(m_size, m_format); } -size_t CCTexture::memorySizeBytes(const IntSize& size, GLenum format) +size_t Texture::memorySizeBytes(const IntSize& size, GLenum format) { unsigned int componentsPerPixel = 4; unsigned int bytesPerComponent = 1; diff --git a/cc/texture.h b/cc/texture.h index d673186..41aea7b 100644 --- a/cc/texture.h +++ b/cc/texture.h @@ -11,19 +11,19 @@ namespace cc { -class CCTexture { +class Texture { public: - CCTexture() : m_id(0) { } - CCTexture(unsigned id, IntSize size, GLenum format) + Texture() : m_id(0) { } + Texture(unsigned id, IntSize size, GLenum format) : m_id(id) , m_size(size) , m_format(format) { } - CCResourceProvider::ResourceId id() const { return m_id; } + ResourceProvider::ResourceId id() const { return m_id; } const IntSize& size() const { return m_size; } GLenum format() const { return m_format; } - void setId(CCResourceProvider::ResourceId id) { m_id = id; } + void setId(ResourceProvider::ResourceId id) { m_id = id; } void setDimensions(const IntSize&, GLenum format); size_t bytes() const; @@ -31,7 +31,7 @@ public: static size_t memorySizeBytes(const IntSize&, GLenum format); private: - CCResourceProvider::ResourceId m_id; + ResourceProvider::ResourceId m_id; IntSize m_size; GLenum m_format; }; diff --git a/cc/texture_draw_quad.cc b/cc/texture_draw_quad.cc index 5be8545..5a45c78 100644 --- a/cc/texture_draw_quad.cc +++ b/cc/texture_draw_quad.cc @@ -10,13 +10,13 @@ namespace cc { -scoped_ptr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +scoped_ptr<TextureDrawQuad> TextureDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) { - return make_scoped_ptr(new CCTextureDrawQuad(sharedQuadState, quadRect, resourceId, premultipliedAlpha, uvRect, flipped)); + return make_scoped_ptr(new TextureDrawQuad(sharedQuadState, quadRect, resourceId, premultipliedAlpha, uvRect, flipped)); } -CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) - : CCDrawQuad(sharedQuadState, CCDrawQuad::TextureContent, quadRect) +TextureDrawQuad::TextureDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) + : DrawQuad(sharedQuadState, DrawQuad::TextureContent, quadRect) , m_resourceId(resourceId) , m_premultipliedAlpha(premultipliedAlpha) , m_uvRect(uvRect) @@ -24,15 +24,15 @@ CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, c { } -void CCTextureDrawQuad::setNeedsBlending() +void TextureDrawQuad::setNeedsBlending() { m_needsBlending = true; } -const CCTextureDrawQuad* CCTextureDrawQuad::materialCast(const CCDrawQuad* quad) +const TextureDrawQuad* TextureDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::TextureContent); - return static_cast<const CCTextureDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::TextureContent); + return static_cast<const TextureDrawQuad*>(quad); } } diff --git a/cc/texture_draw_quad.h b/cc/texture_draw_quad.h index daa600f..df34ad0 100644 --- a/cc/texture_draw_quad.h +++ b/cc/texture_draw_quad.h @@ -13,9 +13,9 @@ namespace cc { #pragma pack(push, 4) -class CCTextureDrawQuad : public CCDrawQuad { +class TextureDrawQuad : public DrawQuad { public: - static scoped_ptr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); + static scoped_ptr<TextureDrawQuad> create(const SharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); FloatRect uvRect() const { return m_uvRect; } unsigned resourceId() const { return m_resourceId; } @@ -24,9 +24,9 @@ public: void setNeedsBlending(); - static const CCTextureDrawQuad* materialCast(const CCDrawQuad*); + static const TextureDrawQuad* materialCast(const DrawQuad*); private: - CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); + TextureDrawQuad(const SharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); unsigned m_resourceId; bool m_premultipliedAlpha; diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc index 7bd258d..89fc68b 100644 --- a/cc/texture_layer.cc +++ b/cc/texture_layer.cc @@ -13,13 +13,13 @@ namespace cc { -scoped_refptr<TextureLayerChromium> TextureLayerChromium::create(TextureLayerChromiumClient* client) +scoped_refptr<TextureLayer> TextureLayer::create(TextureLayerClient* client) { - return scoped_refptr<TextureLayerChromium>(new TextureLayerChromium(client)); + return scoped_refptr<TextureLayer>(new TextureLayer(client)); } -TextureLayerChromium::TextureLayerChromium(TextureLayerChromiumClient* client) - : LayerChromium() +TextureLayer::TextureLayer(TextureLayerClient* client) + : Layer() , m_client(client) , m_flipped(true) , m_uvRect(0, 0, 1, 1) @@ -30,7 +30,7 @@ TextureLayerChromium::TextureLayerChromium(TextureLayerChromiumClient* client) { } -TextureLayerChromium::~TextureLayerChromium() +TextureLayer::~TextureLayer() { if (layerTreeHost()) { if (m_textureId) @@ -40,30 +40,30 @@ TextureLayerChromium::~TextureLayerChromium() } } -scoped_ptr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> TextureLayer::createLayerImpl() { - return CCTextureLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return TextureLayerImpl::create(m_layerId).PassAs<LayerImpl>(); } -void TextureLayerChromium::setFlipped(bool flipped) +void TextureLayer::setFlipped(bool flipped) { m_flipped = flipped; setNeedsCommit(); } -void TextureLayerChromium::setUVRect(const FloatRect& rect) +void TextureLayer::setUVRect(const FloatRect& rect) { m_uvRect = rect; setNeedsCommit(); } -void TextureLayerChromium::setPremultipliedAlpha(bool premultipliedAlpha) +void TextureLayer::setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; setNeedsCommit(); } -void TextureLayerChromium::setRateLimitContext(bool rateLimit) +void TextureLayer::setRateLimitContext(bool rateLimit) { if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost()) layerTreeHost()->stopRateLimiter(m_client->context()); @@ -71,7 +71,7 @@ void TextureLayerChromium::setRateLimitContext(bool rateLimit) m_rateLimitContext = rateLimit; } -void TextureLayerChromium::setTextureId(unsigned id) +void TextureLayer::setTextureId(unsigned id) { if (m_textureId == id) return; @@ -81,33 +81,33 @@ void TextureLayerChromium::setTextureId(unsigned id) setNeedsCommit(); } -void TextureLayerChromium::willModifyTexture() +void TextureLayer::willModifyTexture() { if (layerTreeHost()) layerTreeHost()->acquireLayerTextures(); } -void TextureLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) +void TextureLayer::setNeedsDisplayRect(const FloatRect& dirtyRect) { - LayerChromium::setNeedsDisplayRect(dirtyRect); + Layer::setNeedsDisplayRect(dirtyRect); if (m_rateLimitContext && m_client && layerTreeHost()) layerTreeHost()->startRateLimiter(m_client->context()); } -void TextureLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) +void TextureLayer::setLayerTreeHost(LayerTreeHost* host) { if (m_textureId && layerTreeHost() && host != layerTreeHost()) layerTreeHost()->acquireLayerTextures(); - LayerChromium::setLayerTreeHost(host); + Layer::setLayerTreeHost(host); } -bool TextureLayerChromium::drawsContent() const +bool TextureLayer::drawsContent() const { - return (m_client || m_textureId) && !m_contextLost && LayerChromium::drawsContent(); + return (m_client || m_textureId) && !m_contextLost && Layer::drawsContent(); } -void TextureLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker*, CCRenderingStats&) +void TextureLayer::update(TextureUpdateQueue& queue, const OcclusionTracker*, RenderingStats&) { if (m_client) { m_textureId = m_client->prepareTexture(queue); @@ -117,11 +117,11 @@ void TextureLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusion m_needsDisplay = false; } -void TextureLayerChromium::pushPropertiesTo(CCLayerImpl* layer) +void TextureLayer::pushPropertiesTo(LayerImpl* layer) { - LayerChromium::pushPropertiesTo(layer); + Layer::pushPropertiesTo(layer); - CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer); + TextureLayerImpl* textureLayer = static_cast<TextureLayerImpl*>(layer); textureLayer->setFlipped(m_flipped); textureLayer->setUVRect(m_uvRect); textureLayer->setPremultipliedAlpha(m_premultipliedAlpha); diff --git a/cc/texture_layer.h b/cc/texture_layer.h index b1d5b9f..f72282f 100644 --- a/cc/texture_layer.h +++ b/cc/texture_layer.h @@ -13,19 +13,19 @@ class WebGraphicsContext3D; namespace cc { -class TextureLayerChromiumClient; +class TextureLayerClient; // A Layer containing a the rendered output of a plugin instance. -class TextureLayerChromium : public LayerChromium { +class TextureLayer : public Layer { public: // If this texture layer requires special preparation logic for each frame driven by // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates // are driven by an external process. - static scoped_refptr<TextureLayerChromium> create(TextureLayerChromiumClient*); + static scoped_refptr<TextureLayer> create(TextureLayerClient*); void clearClient() { m_client = 0; } - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; // Sets whether this texture should be Y-flipped at draw time. Defaults to true. void setFlipped(bool); @@ -48,17 +48,17 @@ public: virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE; - virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; + virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; virtual bool drawsContent() const OVERRIDE; - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; - virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; + virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; protected: - explicit TextureLayerChromium(TextureLayerChromiumClient*); - virtual ~TextureLayerChromium(); + explicit TextureLayer(TextureLayerClient*); + virtual ~TextureLayer(); private: - TextureLayerChromiumClient* m_client; + TextureLayerClient* m_client; bool m_flipped; FloatRect m_uvRect; diff --git a/cc/texture_layer_client.h b/cc/texture_layer_client.h index 4edbe9f..35e7fc5 100644 --- a/cc/texture_layer_client.h +++ b/cc/texture_layer_client.h @@ -10,20 +10,20 @@ class WebGraphicsContext3D; } namespace cc { -class CCTextureUpdateQueue; +class TextureUpdateQueue; -class TextureLayerChromiumClient { +class TextureLayerClient { public: // Called to prepare this layer's texture for compositing. The client may queue a texture - // upload or copy on the CCTextureUpdateQueue. + // upload or copy on the TextureUpdateQueue. // Returns the texture ID to be used for compositing. - virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0; + virtual unsigned prepareTexture(TextureUpdateQueue&) = 0; // Returns the context that is providing the texture. Used for rate limiting and detecting lost context. virtual WebKit::WebGraphicsContext3D* context() = 0; protected: - virtual ~TextureLayerChromiumClient() { } + virtual ~TextureLayerClient() { } }; } diff --git a/cc/texture_layer_impl.cc b/cc/texture_layer_impl.cc index e88f85d..ff66b70 100644 --- a/cc/texture_layer_impl.cc +++ b/cc/texture_layer_impl.cc @@ -13,8 +13,8 @@ namespace cc { -CCTextureLayerImpl::CCTextureLayerImpl(int id) - : CCLayerImpl(id) +TextureLayerImpl::TextureLayerImpl(int id) + : LayerImpl(id) , m_textureId(0) , m_externalTextureResource(0) , m_premultipliedAlpha(true) @@ -23,11 +23,11 @@ CCTextureLayerImpl::CCTextureLayerImpl(int id) { } -CCTextureLayerImpl::~CCTextureLayerImpl() +TextureLayerImpl::~TextureLayerImpl() { } -void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) +void TextureLayerImpl::willDraw(ResourceProvider* resourceProvider) { if (!m_textureId) return; @@ -35,19 +35,19 @@ void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); } -void CCTextureLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void TextureLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { if (!m_externalTextureResource) return; - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); IntRect quadRect(IntPoint(), contentBounds()); - quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<DrawQuad>(), appendQuadsData); } -void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) +void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) { if (!m_externalTextureResource) return; @@ -59,20 +59,20 @@ void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) m_externalTextureResource = 0; } -void CCTextureLayerImpl::dumpLayerProperties(std::string* str, int indent) const +void TextureLayerImpl::dumpLayerProperties(std::string* str, int indent) const { str->append(indentString(indent)); base::StringAppendF(str, "texture layer texture id: %u premultiplied: %d\n", m_textureId, m_premultipliedAlpha); - CCLayerImpl::dumpLayerProperties(str, indent); + LayerImpl::dumpLayerProperties(str, indent); } -void CCTextureLayerImpl::didLoseContext() +void TextureLayerImpl::didLoseContext() { m_textureId = 0; m_externalTextureResource = 0; } -const char* CCTextureLayerImpl::layerTypeAsString() const +const char* TextureLayerImpl::layerTypeAsString() const { return "TextureLayer"; } diff --git a/cc/texture_layer_impl.h b/cc/texture_layer_impl.h index ff88ff3..5d1f8dd 100644 --- a/cc/texture_layer_impl.h +++ b/cc/texture_layer_impl.h @@ -9,17 +9,17 @@ namespace cc { -class CCTextureLayerImpl : public CCLayerImpl { +class TextureLayerImpl : public LayerImpl { public: - static scoped_ptr<CCTextureLayerImpl> create(int id) + static scoped_ptr<TextureLayerImpl> create(int id) { - return make_scoped_ptr(new CCTextureLayerImpl(id)); + return make_scoped_ptr(new TextureLayerImpl(id)); } - virtual ~CCTextureLayerImpl(); + virtual ~TextureLayerImpl(); - virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; - virtual void didDraw(CCResourceProvider*) OVERRIDE; + virtual void willDraw(ResourceProvider*) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; + virtual void didDraw(ResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; @@ -32,12 +32,12 @@ public: void setUVRect(const FloatRect& rect) { m_uvRect = rect; } private: - explicit CCTextureLayerImpl(int); + explicit TextureLayerImpl(int); virtual const char* layerTypeAsString() const OVERRIDE; unsigned m_textureId; - CCResourceProvider::ResourceId m_externalTextureResource; + ResourceProvider::ResourceId m_externalTextureResource; bool m_premultipliedAlpha; bool m_flipped; FloatRect m_uvRect; diff --git a/cc/texture_layer_unittest.cc b/cc/texture_layer_unittest.cc index 9ca4732..ffec87e 100644 --- a/cc/texture_layer_unittest.cc +++ b/cc/texture_layer_unittest.cc @@ -20,10 +20,10 @@ using ::testing::AnyNumber; namespace { -class MockCCLayerTreeHost : public CCLayerTreeHost { +class MockLayerImplTreeHost : public LayerTreeHost { public: - MockCCLayerTreeHost() - : CCLayerTreeHost(&m_fakeClient, CCLayerTreeSettings()) + MockLayerImplTreeHost() + : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) { initialize(); } @@ -31,13 +31,13 @@ public: MOCK_METHOD0(acquireLayerTextures, void()); private: - FakeCCLayerTreeHostClient m_fakeClient; + FakeLayerImplTreeHostClient m_fakeClient; }; -class TextureLayerChromiumTest : public testing::Test { +class TextureLayerTest : public testing::Test { public: - TextureLayerChromiumTest() + TextureLayerTest() : m_compositorInitializer(0) { } @@ -45,7 +45,7 @@ public: protected: virtual void SetUp() { - m_layerTreeHost.reset(new MockCCLayerTreeHost); + m_layerTreeHost.reset(new MockLayerImplTreeHost); } virtual void TearDown() @@ -57,14 +57,14 @@ protected: m_layerTreeHost.reset(); } - scoped_ptr<MockCCLayerTreeHost> m_layerTreeHost; + scoped_ptr<MockLayerImplTreeHost> m_layerTreeHost; private: WebKitTests::WebCompositorInitializer m_compositorInitializer; }; -TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId) +TEST_F(TextureLayerTest, syncImplWhenChangingTextureId) { - scoped_refptr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); + scoped_refptr<TextureLayer> testLayer = TextureLayer::create(0); ASSERT_TRUE(testLayer); EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); @@ -85,14 +85,14 @@ TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId) Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); } -TEST_F(TextureLayerChromiumTest, syncImplWhenRemovingFromTree) +TEST_F(TextureLayerTest, syncImplWhenRemovingFromTree) { - scoped_refptr<LayerChromium> rootLayer = LayerChromium::create(); + scoped_refptr<Layer> rootLayer = Layer::create(); ASSERT_TRUE(rootLayer); - scoped_refptr<LayerChromium> childLayer = LayerChromium::create(); + scoped_refptr<Layer> childLayer = Layer::create(); ASSERT_TRUE(childLayer); rootLayer->addChild(childLayer); - scoped_refptr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); + scoped_refptr<TextureLayer> testLayer = TextureLayer::create(0); ASSERT_TRUE(testLayer); testLayer->setTextureId(0); childLayer->addChild(testLayer); diff --git a/cc/texture_update_controller.cc b/cc/texture_update_controller.cc index b1c5af0..d15c9c9 100644 --- a/cc/texture_update_controller.cc +++ b/cc/texture_update_controller.cc @@ -57,22 +57,22 @@ scoped_ptr<SkCanvas> createAcceleratedCanvas( namespace cc { -size_t CCTextureUpdateController::maxPartialTextureUpdates() +size_t TextureUpdateController::maxPartialTextureUpdates() { return partialTextureUpdatesMax; } -size_t CCTextureUpdateController::maxFullUpdatesPerTick( - CCResourceProvider* resourceProvider) +size_t TextureUpdateController::maxFullUpdatesPerTick( + ResourceProvider* resourceProvider) { double texturesPerSecond = resourceProvider->estimatedUploadsPerSecond(); size_t texturesPerTick = floor(textureUpdateTickRate * texturesPerSecond); return texturesPerTick ? texturesPerTick : 1; } -CCTextureUpdateController::CCTextureUpdateController(CCTextureUpdateControllerClient* client, CCThread* thread, scoped_ptr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider) +TextureUpdateController::TextureUpdateController(TextureUpdateControllerClient* client, Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvider* resourceProvider) : m_client(client) - , m_timer(new CCTimer(thread, this)) + , m_timer(new Timer(thread, this)) , m_queue(queue.Pass()) , m_resourceProvider(resourceProvider) , m_textureUpdatesPerTick(maxFullUpdatesPerTick(resourceProvider)) @@ -80,11 +80,11 @@ CCTextureUpdateController::CCTextureUpdateController(CCTextureUpdateControllerCl { } -CCTextureUpdateController::~CCTextureUpdateController() +TextureUpdateController::~TextureUpdateController() { } -void CCTextureUpdateController::performMoreUpdates( +void TextureUpdateController::performMoreUpdates( base::TimeTicks timeLimit) { m_timeLimit = timeLimit; @@ -107,15 +107,15 @@ void CCTextureUpdateController::performMoreUpdates( updateMoreTexturesNow(); } -void CCTextureUpdateController::discardUploadsToEvictedResources() +void TextureUpdateController::discardUploadsToEvictedResources() { m_queue->clearUploadsToEvictedResources(); } -void CCTextureUpdateController::updateTexture(ResourceUpdate update) +void TextureUpdateController::updateTexture(ResourceUpdate update) { if (update.picture) { - CCPrioritizedTexture* texture = update.texture; + PrioritizedTexture* texture = update.texture; IntRect pictureRect = update.content_rect; IntRect sourceRect = update.source_rect; IntSize destOffset = update.dest_offset; @@ -124,12 +124,12 @@ void CCTextureUpdateController::updateTexture(ResourceUpdate update) DCHECK(texture->haveBackingTexture()); DCHECK(m_resourceProvider->resourceType(texture->resourceId()) == - CCResourceProvider::GLTexture); + ResourceProvider::GLTexture); - WebGraphicsContext3D* paintContext = CCProxy::hasImplThread() ? + WebGraphicsContext3D* paintContext = Proxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThreadContext(); - GrContext* paintGrContext = CCProxy::hasImplThread() ? + GrContext* paintGrContext = Proxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrContext(); @@ -138,7 +138,7 @@ void CCTextureUpdateController::updateTexture(ResourceUpdate update) // because the backing texture is created in one context while it is // being written to in another. m_resourceProvider->flush(); - CCResourceProvider::ScopedWriteLockGL lock( + ResourceProvider::ScopedWriteLockGL lock( m_resourceProvider, texture->resourceId()); // Make sure ganesh uses the correct GL context. @@ -186,7 +186,7 @@ void CCTextureUpdateController::updateTexture(ResourceUpdate update) } } -void CCTextureUpdateController::finalize() +void TextureUpdateController::finalize() { size_t uploadCount = 0; while (m_queue->fullUploadSize()) { @@ -221,33 +221,33 @@ void CCTextureUpdateController::finalize() } } -void CCTextureUpdateController::onTimerFired() +void TextureUpdateController::onTimerFired() { if (!updateMoreTexturesIfEnoughTimeRemaining()) m_client->readyToFinalizeTextureUpdates(); } -base::TimeTicks CCTextureUpdateController::now() const +base::TimeTicks TextureUpdateController::now() const { return base::TimeTicks::Now(); } -base::TimeDelta CCTextureUpdateController::updateMoreTexturesTime() const +base::TimeDelta TextureUpdateController::updateMoreTexturesTime() const { return base::TimeDelta::FromMilliseconds(textureUpdateTickRate * 1000); } -size_t CCTextureUpdateController::updateMoreTexturesSize() const +size_t TextureUpdateController::updateMoreTexturesSize() const { return m_textureUpdatesPerTick; } -size_t CCTextureUpdateController::maxBlockingUpdates() const +size_t TextureUpdateController::maxBlockingUpdates() const { return updateMoreTexturesSize() * maxBlockingUpdateIntervals; } -bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining() +bool TextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining() { // Blocking uploads will increase when we're too aggressive in our upload // time estimate. We use a different timeout here to prevent unnecessary @@ -268,7 +268,7 @@ bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining() return true; } -void CCTextureUpdateController::updateMoreTexturesNow() +void TextureUpdateController::updateMoreTexturesNow() { size_t uploads = std::min( m_queue->fullUploadSize(), updateMoreTexturesSize()); diff --git a/cc/texture_update_controller.h b/cc/texture_update_controller.h index a027fa6..7d82502 100644 --- a/cc/texture_update_controller.h +++ b/cc/texture_update_controller.h @@ -13,25 +13,25 @@ namespace cc { -class CCResourceProvider; +class ResourceProvider; -class CCTextureUpdateControllerClient { +class TextureUpdateControllerClient { public: virtual void readyToFinalizeTextureUpdates() = 0; protected: - virtual ~CCTextureUpdateControllerClient() { } + virtual ~TextureUpdateControllerClient() { } }; -class CCTextureUpdateController : public CCTimerClient { +class TextureUpdateController : public TimerClient { public: - static scoped_ptr<CCTextureUpdateController> create(CCTextureUpdateControllerClient* client, CCThread* thread, scoped_ptr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider) + static scoped_ptr<TextureUpdateController> create(TextureUpdateControllerClient* client, Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvider* resourceProvider) { - return make_scoped_ptr(new CCTextureUpdateController(client, thread, queue.Pass(), resourceProvider)); + return make_scoped_ptr(new TextureUpdateController(client, thread, queue.Pass(), resourceProvider)); } static size_t maxPartialTextureUpdates(); - virtual ~CCTextureUpdateController(); + virtual ~TextureUpdateController(); // Discard uploads to textures that were evicted on the impl thread. void discardUploadsToEvictedResources(); @@ -39,7 +39,7 @@ public: void performMoreUpdates(base::TimeTicks timeLimit); void finalize(); - // CCTimerClient implementation. + // TimerClient implementation. virtual void onTimerFired() OVERRIDE; // Virtual for testing. @@ -48,9 +48,9 @@ public: virtual size_t updateMoreTexturesSize() const; protected: - CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, scoped_ptr<CCTextureUpdateQueue>, CCResourceProvider*); + TextureUpdateController(TextureUpdateControllerClient*, Thread*, scoped_ptr<TextureUpdateQueue>, ResourceProvider*); - static size_t maxFullUpdatesPerTick(CCResourceProvider*); + static size_t maxFullUpdatesPerTick(ResourceProvider*); size_t maxBlockingUpdates() const; @@ -60,17 +60,17 @@ protected: bool updateMoreTexturesIfEnoughTimeRemaining(); void updateMoreTexturesNow(); - CCTextureUpdateControllerClient* m_client; - scoped_ptr<CCTimer> m_timer; - scoped_ptr<CCTextureUpdateQueue> m_queue; + TextureUpdateControllerClient* m_client; + scoped_ptr<Timer> m_timer; + scoped_ptr<TextureUpdateQueue> m_queue; bool m_contentsTexturesPurged; - CCResourceProvider* m_resourceProvider; + ResourceProvider* m_resourceProvider; base::TimeTicks m_timeLimit; size_t m_textureUpdatesPerTick; bool m_firstUpdateAttempt; private: - DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateController); + DISALLOW_COPY_AND_ASSIGN(TextureUpdateController); }; } // namespace cc diff --git a/cc/texture_update_controller_unittest.cc b/cc/texture_update_controller_unittest.cc index 8b80f98..36677c4 100644 --- a/cc/texture_update_controller_unittest.cc +++ b/cc/texture_update_controller_unittest.cc @@ -26,11 +26,11 @@ namespace { const int kFlushPeriodFull = 4; const int kFlushPeriodPartial = kFlushPeriodFull; -class CCTextureUpdateControllerTest; +class TextureUpdateControllerTest; class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D { public: - WebGraphicsContext3DForUploadTest(CCTextureUpdateControllerTest *test) + WebGraphicsContext3DForUploadTest(TextureUpdateControllerTest *test) : m_test(test) , m_supportShallowFlush(true) { } @@ -56,16 +56,16 @@ public: } private: - CCTextureUpdateControllerTest* m_test; + TextureUpdateControllerTest* m_test; bool m_supportShallowFlush; }; -class CCTextureUpdateControllerTest : public Test { +class TextureUpdateControllerTest : public Test { public: - CCTextureUpdateControllerTest() - : m_queue(make_scoped_ptr(new CCTextureUpdateQueue)) - , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) + TextureUpdateControllerTest() + : m_queue(make_scoped_ptr(new TextureUpdateQueue)) + , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool)) , m_compositorInitializer(m_thread.get()) , m_fullUploadCountExpected(0) , m_partialCountExpected(0) @@ -78,7 +78,7 @@ public: { } - ~CCTextureUpdateControllerTest() + ~TextureUpdateControllerTest() { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; @@ -117,15 +117,15 @@ protected: m_bitmap.allocPixels(); for (int i = 0; i < 4; i++) { - m_textures[i] = CCPrioritizedTexture::create( + m_textures[i] = PrioritizedTexture::create( m_textureManager.get(), IntSize(300, 150), GL_RGBA); m_textures[i]->setRequestPriority( - CCPriorityCalculator::visiblePriority(true)); + PriorityCalculator::visiblePriority(true)); } m_textureManager->prioritizeTextures(); DebugScopedSetImplThread implThread; - m_resourceProvider = CCResourceProvider::create(m_context.get()); + m_resourceProvider = ResourceProvider::create(m_context.get()); } @@ -172,24 +172,24 @@ protected: { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; - scoped_ptr<CCTextureUpdateController> updateController = - CCTextureUpdateController::create( + scoped_ptr<TextureUpdateController> updateController = + TextureUpdateController::create( NULL, - CCProxy::implThread(), + Proxy::implThread(), m_queue.Pass(), m_resourceProvider.get()); updateController->finalize(); } protected: - // Classes required to interact and test the CCTextureUpdateController - scoped_ptr<CCGraphicsContext> m_context; - scoped_ptr<CCResourceProvider> m_resourceProvider; - scoped_ptr<CCTextureUpdateQueue> m_queue; - scoped_ptr<CCPrioritizedTexture> m_textures[4]; + // Classes required to interact and test the TextureUpdateController + scoped_ptr<GraphicsContext> m_context; + scoped_ptr<ResourceProvider> m_resourceProvider; + scoped_ptr<TextureUpdateQueue> m_queue; + scoped_ptr<PrioritizedTexture> m_textures[4]; scoped_ptr<WebThread> m_thread; WebCompositorInitializer m_compositorInitializer; - scoped_ptr<CCPrioritizedTextureManager> m_textureManager; + scoped_ptr<PrioritizedTextureManager> m_textureManager; SkBitmap m_bitmap; // Properties / expectations of this test @@ -229,7 +229,7 @@ void WebGraphicsContext3DForUploadTest::texSubImage2D(WGC3Denum target, } // ZERO UPLOADS TESTS -TEST_F(CCTextureUpdateControllerTest, ZeroUploads) +TEST_F(TextureUpdateControllerTest, ZeroUploads) { appendFullUploadsToUpdateQueue(0); appendPartialUploadsToUpdateQueue(0); @@ -241,7 +241,7 @@ TEST_F(CCTextureUpdateControllerTest, ZeroUploads) // ONE UPLOAD TESTS -TEST_F(CCTextureUpdateControllerTest, OneFullUpload) +TEST_F(TextureUpdateControllerTest, OneFullUpload) { appendFullUploadsToUpdateQueue(1); appendPartialUploadsToUpdateQueue(0); @@ -252,7 +252,7 @@ TEST_F(CCTextureUpdateControllerTest, OneFullUpload) EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; } -TEST_F(CCTextureUpdateControllerTest, OnePartialUpload) +TEST_F(TextureUpdateControllerTest, OnePartialUpload) { appendFullUploadsToUpdateQueue(0); appendPartialUploadsToUpdateQueue(1); @@ -263,7 +263,7 @@ TEST_F(CCTextureUpdateControllerTest, OnePartialUpload) EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; } -TEST_F(CCTextureUpdateControllerTest, OneFullOnePartialUpload) +TEST_F(TextureUpdateControllerTest, OneFullOnePartialUpload) { appendFullUploadsToUpdateQueue(1); appendPartialUploadsToUpdateQueue(1); @@ -282,7 +282,7 @@ const int fullCount = fullUploadFlushMultipler * kFlushPeriodFull; const int partialUploadFlushMultipler = 11; const int partialCount = partialUploadFlushMultipler * kFlushPeriodPartial; -TEST_F(CCTextureUpdateControllerTest, ManyFullUploads) +TEST_F(TextureUpdateControllerTest, ManyFullUploads) { appendFullUploadsToUpdateQueue(fullCount); appendPartialUploadsToUpdateQueue(0); @@ -293,7 +293,7 @@ TEST_F(CCTextureUpdateControllerTest, ManyFullUploads) EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; } -TEST_F(CCTextureUpdateControllerTest, ManyPartialUploads) +TEST_F(TextureUpdateControllerTest, ManyPartialUploads) { appendFullUploadsToUpdateQueue(0); appendPartialUploadsToUpdateQueue(partialCount); @@ -304,7 +304,7 @@ TEST_F(CCTextureUpdateControllerTest, ManyPartialUploads) EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; } -TEST_F(CCTextureUpdateControllerTest, ManyFullManyPartialUploads) +TEST_F(TextureUpdateControllerTest, ManyFullManyPartialUploads) { appendFullUploadsToUpdateQueue(fullCount); appendPartialUploadsToUpdateQueue(partialCount); @@ -315,9 +315,9 @@ TEST_F(CCTextureUpdateControllerTest, ManyFullManyPartialUploads) EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; } -class FakeCCTextureUpdateControllerClient : public cc::CCTextureUpdateControllerClient { +class FakeTextureUpdateControllerClient : public cc::TextureUpdateControllerClient { public: - FakeCCTextureUpdateControllerClient() { reset(); } + FakeTextureUpdateControllerClient() { reset(); } void reset() { m_readyToFinalizeCalled = false; } bool readyToFinalizeCalled() const { return m_readyToFinalizeCalled; } @@ -327,11 +327,11 @@ protected: bool m_readyToFinalizeCalled; }; -class FakeCCTextureUpdateController : public cc::CCTextureUpdateController { +class FakeTextureUpdateController : public cc::TextureUpdateController { public: - static scoped_ptr<FakeCCTextureUpdateController> create(cc::CCTextureUpdateControllerClient* client, cc::CCThread* thread, scoped_ptr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider) + static scoped_ptr<FakeTextureUpdateController> create(cc::TextureUpdateControllerClient* client, cc::Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvider* resourceProvider) { - return make_scoped_ptr(new FakeCCTextureUpdateController(client, thread, queue.Pass(), resourceProvider)); + return make_scoped_ptr(new FakeTextureUpdateController(client, thread, queue.Pass(), resourceProvider)); } void setNow(base::TimeTicks time) { m_now = time; } @@ -342,8 +342,8 @@ public: virtual size_t updateMoreTexturesSize() const OVERRIDE { return m_updateMoreTexturesSize; } protected: - FakeCCTextureUpdateController(cc::CCTextureUpdateControllerClient* client, cc::CCThread* thread, scoped_ptr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider) - : cc::CCTextureUpdateController(client, thread, queue.Pass(), resourceProvider) + FakeTextureUpdateController(cc::TextureUpdateControllerClient* client, cc::Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvider* resourceProvider) + : cc::TextureUpdateController(client, thread, queue.Pass(), resourceProvider) , m_updateMoreTexturesSize(0) { } base::TimeTicks m_now; @@ -351,17 +351,17 @@ protected: size_t m_updateMoreTexturesSize; }; -static void runPendingTask(FakeCCThread* thread, FakeCCTextureUpdateController* controller) +static void runPendingTask(FakeThread* thread, FakeTextureUpdateController* controller) { EXPECT_TRUE(thread->hasPendingTask()); controller->setNow(controller->now() + base::TimeDelta::FromMilliseconds(thread->pendingDelayMs())); thread->runPendingTask(); } -TEST_F(CCTextureUpdateControllerTest, UpdateMoreTextures) +TEST_F(TextureUpdateControllerTest, UpdateMoreTextures) { - FakeCCTextureUpdateControllerClient client; - FakeCCThread thread; + FakeTextureUpdateControllerClient client; + FakeThread thread; setMaxUploadCountPerUpdate(1); appendFullUploadsToUpdateQueue(3); @@ -369,7 +369,7 @@ TEST_F(CCTextureUpdateControllerTest, UpdateMoreTextures) DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; - scoped_ptr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get())); + scoped_ptr<FakeTextureUpdateController> controller(FakeTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get())); controller->setNow( controller->now() + base::TimeDelta::FromMilliseconds(1)); @@ -404,10 +404,10 @@ TEST_F(CCTextureUpdateControllerTest, UpdateMoreTextures) EXPECT_EQ(3, m_numTotalUploads); } -TEST_F(CCTextureUpdateControllerTest, NoMoreUpdates) +TEST_F(TextureUpdateControllerTest, NoMoreUpdates) { - FakeCCTextureUpdateControllerClient client; - FakeCCThread thread; + FakeTextureUpdateControllerClient client; + FakeThread thread; setMaxUploadCountPerUpdate(1); appendFullUploadsToUpdateQueue(2); @@ -415,7 +415,7 @@ TEST_F(CCTextureUpdateControllerTest, NoMoreUpdates) DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; - scoped_ptr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get())); + scoped_ptr<FakeTextureUpdateController> controller(FakeTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get())); controller->setNow( controller->now() + base::TimeDelta::FromMilliseconds(1)); @@ -444,10 +444,10 @@ TEST_F(CCTextureUpdateControllerTest, NoMoreUpdates) EXPECT_EQ(2, m_numTotalUploads); } -TEST_F(CCTextureUpdateControllerTest, UpdatesCompleteInFiniteTime) +TEST_F(TextureUpdateControllerTest, UpdatesCompleteInFiniteTime) { - FakeCCTextureUpdateControllerClient client; - FakeCCThread thread; + FakeTextureUpdateControllerClient client; + FakeThread thread; setMaxUploadCountPerUpdate(1); appendFullUploadsToUpdateQueue(2); @@ -455,7 +455,7 @@ TEST_F(CCTextureUpdateControllerTest, UpdatesCompleteInFiniteTime) DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; - scoped_ptr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get())); + scoped_ptr<FakeTextureUpdateController> controller(FakeTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get())); controller->setNow( controller->now() + base::TimeDelta::FromMilliseconds(1)); diff --git a/cc/texture_update_queue.cc b/cc/texture_update_queue.cc index 8e19193..0dc0683 100644 --- a/cc/texture_update_queue.cc +++ b/cc/texture_update_queue.cc @@ -10,36 +10,36 @@ namespace cc { -CCTextureUpdateQueue::CCTextureUpdateQueue() +TextureUpdateQueue::TextureUpdateQueue() { } -CCTextureUpdateQueue::~CCTextureUpdateQueue() +TextureUpdateQueue::~TextureUpdateQueue() { } -void CCTextureUpdateQueue::appendFullUpload(const ResourceUpdate& upload) +void TextureUpdateQueue::appendFullUpload(const ResourceUpdate& upload) { m_fullEntries.push_back(upload); } -void CCTextureUpdateQueue::appendPartialUpload(const ResourceUpdate& upload) +void TextureUpdateQueue::appendPartialUpload(const ResourceUpdate& upload) { m_partialEntries.push_back(upload); } -void CCTextureUpdateQueue::appendCopy(TextureCopier::Parameters copy) +void TextureUpdateQueue::appendCopy(TextureCopier::Parameters copy) { m_copyEntries.push_back(copy); } -void CCTextureUpdateQueue::clearUploadsToEvictedResources() +void TextureUpdateQueue::clearUploadsToEvictedResources() { clearUploadsToEvictedResources(m_fullEntries); clearUploadsToEvictedResources(m_partialEntries); } -void CCTextureUpdateQueue::clearUploadsToEvictedResources(std::deque<ResourceUpdate>& entryQueue) +void TextureUpdateQueue::clearUploadsToEvictedResources(std::deque<ResourceUpdate>& entryQueue) { std::deque<ResourceUpdate> temp; entryQueue.swap(temp); @@ -51,28 +51,28 @@ void CCTextureUpdateQueue::clearUploadsToEvictedResources(std::deque<ResourceUpd } } -ResourceUpdate CCTextureUpdateQueue::takeFirstFullUpload() +ResourceUpdate TextureUpdateQueue::takeFirstFullUpload() { ResourceUpdate first = m_fullEntries.front(); m_fullEntries.pop_front(); return first; } -ResourceUpdate CCTextureUpdateQueue::takeFirstPartialUpload() +ResourceUpdate TextureUpdateQueue::takeFirstPartialUpload() { ResourceUpdate first = m_partialEntries.front(); m_partialEntries.pop_front(); return first; } -TextureCopier::Parameters CCTextureUpdateQueue::takeFirstCopy() +TextureCopier::Parameters TextureUpdateQueue::takeFirstCopy() { TextureCopier::Parameters first = m_copyEntries.front(); m_copyEntries.pop_front(); return first; } -bool CCTextureUpdateQueue::hasMoreUpdates() const +bool TextureUpdateQueue::hasMoreUpdates() const { return m_fullEntries.size() || m_partialEntries.size() || m_copyEntries.size(); } diff --git a/cc/texture_update_queue.h b/cc/texture_update_queue.h index bebde7a..933929b 100644 --- a/cc/texture_update_queue.h +++ b/cc/texture_update_queue.h @@ -12,10 +12,10 @@ namespace cc { -class CCTextureUpdateQueue { +class TextureUpdateQueue { public: - CCTextureUpdateQueue(); - virtual ~CCTextureUpdateQueue(); + TextureUpdateQueue(); + virtual ~TextureUpdateQueue(); void appendFullUpload(const ResourceUpdate&); void appendPartialUpload(const ResourceUpdate&); @@ -39,7 +39,7 @@ private: std::deque<ResourceUpdate> m_partialEntries; std::deque<TextureCopier::Parameters> m_copyEntries; - DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateQueue); + DISALLOW_COPY_AND_ASSIGN(TextureUpdateQueue); }; } diff --git a/cc/thread.h b/cc/thread.h index 1ac4946..341b2db 100644 --- a/cc/thread.h +++ b/cc/thread.h @@ -11,11 +11,11 @@ namespace cc { -// CCThread provides basic infrastructure for messaging with the compositor in a +// Thread provides basic infrastructure for messaging with the compositor in a // platform-neutral way. -class CCThread { +class Thread { public: - virtual ~CCThread() { } + virtual ~Thread() { } class Task { public: diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc index 0263390..cd6212f 100644 --- a/cc/thread_proxy.cc +++ b/cc/thread_proxy.cc @@ -30,12 +30,12 @@ const double contextRecreationTickRate = 0.03; namespace cc { -scoped_ptr<CCProxy> CCThreadProxy::create(CCLayerTreeHost* layerTreeHost) +scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost) { - return make_scoped_ptr(new CCThreadProxy(layerTreeHost)).PassAs<CCProxy>(); + return make_scoped_ptr(new ThreadProxy(layerTreeHost)).PassAs<Proxy>(); } -CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) +ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost) : m_animateRequested(false) , m_commitRequested(false) , m_commitRequestSentToImplThread(false) @@ -45,7 +45,7 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) , m_started(false) , m_texturesAcquired(true) , m_inCompositeAndReadback(false) - , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) + , m_mainThreadProxy(ScopedThreadProxy::create(Proxy::mainThread())) , m_beginFrameCompletionEventOnImplThread(0) , m_readbackRequestOnImplThread(0) , m_commitCompletionEventOnImplThread(0) @@ -54,20 +54,20 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) , m_totalCommitCount(0) { - TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy"); + TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); DCHECK(isMainThread()); } -CCThreadProxy::~CCThreadProxy() +ThreadProxy::~ThreadProxy() { - TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy"); + TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); DCHECK(isMainThread()); DCHECK(!m_started); } -bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) +bool ThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) { - TRACE_EVENT0("cc", "CCThreadPRoxy::compositeAndReadback"); + TRACE_EVENT0("cc", "ThreadPRoxy::compositeAndReadback"); DCHECK(isMainThread()); DCHECK(m_layerTreeHost); @@ -80,8 +80,8 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) // Perform a synchronous commit. { DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent beginFrameCompletion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, &beginFrameCompletion)); + CompletionEvent beginFrameCompletion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::forceBeginFrameOnImplThread, &beginFrameCompletion)); beginFrameCompletion.wait(); } m_inCompositeAndReadback = true; @@ -94,15 +94,15 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) request.pixels = pixels; { DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestReadbackOnImplThread, &request)); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::requestReadbackOnImplThread, &request)); request.completion.wait(); } return request.success; } -void CCThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) +void ThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(!m_readbackRequestOnImplThread); if (!m_layerTreeHostImpl.get()) { request->success = false; @@ -115,87 +115,87 @@ void CCThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) m_schedulerOnImplThread->setNeedsForcedRedraw(); } -void CCThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) +void ThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) { - DCHECK(CCProxy::isMainThread()); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestStartPageScaleAnimationOnImplThread, targetPosition, useAnchor, scale, duration)); + DCHECK(Proxy::isMainThread()); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::requestStartPageScaleAnimationOnImplThread, targetPosition, useAnchor, scale, duration)); } -void CCThreadProxy::requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double duration) +void ThreadProxy::requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double duration) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); if (m_layerTreeHostImpl.get()) m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime(), duration); } -void CCThreadProxy::finishAllRendering() +void ThreadProxy::finishAllRendering() { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); // Make sure all GL drawing is finished on the impl thread. DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnImplThread, &completion)); + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::finishAllRenderingOnImplThread, &completion)); completion.wait(); } -bool CCThreadProxy::isStarted() const +bool ThreadProxy::isStarted() const { - DCHECK(CCProxy::isMainThread()); + DCHECK(Proxy::isMainThread()); return m_started; } -bool CCThreadProxy::initializeContext() +bool ThreadProxy::initializeContext() { - TRACE_EVENT0("cc", "CCThreadProxy::initializeContext"); - scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); + TRACE_EVENT0("cc", "ThreadProxy::initializeContext"); + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) return false; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeContextOnImplThread, + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::initializeContextOnImplThread, context.release())); return true; } -void CCThreadProxy::setSurfaceReady() +void ThreadProxy::setSurfaceReady() { - TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReady"); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setSurfaceReadyOnImplThread)); + TRACE_EVENT0("cc", "ThreadProxy::setSurfaceReady"); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setSurfaceReadyOnImplThread)); } -void CCThreadProxy::setSurfaceReadyOnImplThread() +void ThreadProxy::setSurfaceReadyOnImplThread() { - TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReadyOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::setSurfaceReadyOnImplThread"); m_schedulerOnImplThread->setCanBeginFrame(true); } -void CCThreadProxy::setVisible(bool visible) +void ThreadProxy::setVisible(bool visible) { - TRACE_EVENT0("cc", "CCThreadProxy::setVisible"); + TRACE_EVENT0("cc", "ThreadProxy::setVisible"); DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, &completion, visible)); + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setVisibleOnImplThread, &completion, visible)); completion.wait(); } -void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool visible) +void ThreadProxy::setVisibleOnImplThread(CompletionEvent* completion, bool visible) { - TRACE_EVENT0("cc", "CCThreadProxy::setVisibleOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::setVisibleOnImplThread"); m_layerTreeHostImpl->setVisible(visible); m_schedulerOnImplThread->setVisible(visible); completion->signal(); } -bool CCThreadProxy::initializeRenderer() +bool ThreadProxy::initializeRenderer() { - TRACE_EVENT0("cc", "CCThreadProxy::initializeRenderer"); + TRACE_EVENT0("cc", "ThreadProxy::initializeRenderer"); // Make a blocking call to initializeRendererOnImplThread. The results of that call // are pushed into the initializeSucceeded and capabilities local variables. - CCCompletionEvent completion; + CompletionEvent completion; bool initializeSucceeded = false; RendererCapabilities capabilities; DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeRendererOnImplThread, + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::initializeRendererOnImplThread, &completion, &initializeSucceeded, &capabilities)); @@ -208,13 +208,13 @@ bool CCThreadProxy::initializeRenderer() return initializeSucceeded; } -bool CCThreadProxy::recreateContext() +bool ThreadProxy::recreateContext() { - TRACE_EVENT0("cc", "CCThreadProxy::recreateContext"); + TRACE_EVENT0("cc", "ThreadProxy::recreateContext"); DCHECK(isMainThread()); // Try to create the context. - scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) return false; if (m_layerTreeHost->needsSharedContext()) @@ -224,11 +224,11 @@ bool CCThreadProxy::recreateContext() // Make a blocking call to recreateContextOnImplThread. The results of that // call are pushed into the recreateSucceeded and capabilities local // variables. - CCCompletionEvent completion; + CompletionEvent completion; bool recreateSucceeded = false; RendererCapabilities capabilities; DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread, + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::recreateContextOnImplThread, &completion, context.release(), &recreateSucceeded, @@ -240,13 +240,13 @@ bool CCThreadProxy::recreateContext() return recreateSucceeded; } -void CCThreadProxy::renderingStats(CCRenderingStats* stats) +void ThreadProxy::renderingStats(RenderingStats* stats) { DCHECK(isMainThread()); DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::renderingStatsOnImplThread, + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::renderingStatsOnImplThread, &completion, stats)); stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); @@ -255,100 +255,100 @@ void CCThreadProxy::renderingStats(CCRenderingStats* stats) completion.wait(); } -const RendererCapabilities& CCThreadProxy::rendererCapabilities() const +const RendererCapabilities& ThreadProxy::rendererCapabilities() const { DCHECK(m_rendererInitialized); return m_RendererCapabilitiesMainThreadCopy; } -void CCThreadProxy::loseContext() +void ThreadProxy::loseContext() { - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::didLoseContextOnImplThread)); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::didLoseContextOnImplThread)); } -void CCThreadProxy::setNeedsAnimate() +void ThreadProxy::setNeedsAnimate() { DCHECK(isMainThread()); if (m_animateRequested) return; - TRACE_EVENT0("cc", "CCThreadProxy::setNeedsAnimate"); + TRACE_EVENT0("cc", "ThreadProxy::setNeedsAnimate"); m_animateRequested = true; if (m_commitRequestSentToImplThread) return; m_commitRequestSentToImplThread = true; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnImplThread)); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsCommitOnImplThread)); } -void CCThreadProxy::setNeedsCommit() +void ThreadProxy::setNeedsCommit() { DCHECK(isMainThread()); if (m_commitRequested) return; - TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommit"); + TRACE_EVENT0("cc", "ThreadProxy::setNeedsCommit"); m_commitRequested = true; if (m_commitRequestSentToImplThread) return; m_commitRequestSentToImplThread = true; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnImplThread)); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsCommitOnImplThread)); } -void CCThreadProxy::didLoseContextOnImplThread() +void ThreadProxy::didLoseContextOnImplThread() { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::didLoseContextOnImplThread"); m_schedulerOnImplThread->didLoseContext(); } -void CCThreadProxy::onSwapBuffersCompleteOnImplThread() +void ThreadProxy::onSwapBuffersCompleteOnImplThread() { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "CCThreadProxy::onSwapBuffersCompleteOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::onSwapBuffersCompleteOnImplThread"); m_schedulerOnImplThread->didSwapBuffersComplete(); - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCompleteSwapBuffers)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::didCompleteSwapBuffers)); } -void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) +void ThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) { DCHECK(isImplThread()); - TRACE_EVENT2("cc", "CCThreadProxy::onVSyncParametersChanged", "monotonicTimebase", monotonicTimebase, "intervalInSeconds", intervalInSeconds); + TRACE_EVENT2("cc", "ThreadProxy::onVSyncParametersChanged", "monotonicTimebase", monotonicTimebase, "intervalInSeconds", intervalInSeconds); base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimebase * base::Time::kMicrosecondsPerSecond); base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSeconds * base::Time::kMicrosecondsPerSecond); m_schedulerOnImplThread->setTimebaseAndInterval(timebase, interval); } -void CCThreadProxy::onCanDrawStateChanged(bool canDraw) +void ThreadProxy::onCanDrawStateChanged(bool canDraw) { DCHECK(isImplThread()); - TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDraw); + TRACE_EVENT1("cc", "ThreadProxy::onCanDrawStateChanged", "canDraw", canDraw); m_schedulerOnImplThread->setCanDraw(canDraw); } -void CCThreadProxy::setNeedsCommitOnImplThread() +void ThreadProxy::setNeedsCommitOnImplThread() { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommitOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::setNeedsCommitOnImplThread"); m_schedulerOnImplThread->setNeedsCommit(); } -void CCThreadProxy::setNeedsForcedCommitOnImplThread() +void ThreadProxy::setNeedsForcedCommitOnImplThread() { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "CCThreadProxy::setNeedsForcedCommitOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::setNeedsForcedCommitOnImplThread"); m_schedulerOnImplThread->setNeedsCommit(); m_schedulerOnImplThread->setNeedsForcedCommit(); } -void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime) +void ThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector> events, double wallClockTime) { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "CCThreadProxy::postAnimationEventsToMainThreadOnImplThread"); - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events.release(), wallClockTime)); + TRACE_EVENT0("cc", "ThreadProxy::postAnimationEventsToMainThreadOnImplThread"); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::setAnimationEvents, events.release(), wallClockTime)); } -bool CCThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) +bool ThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) { DCHECK(isImplThread()); @@ -365,44 +365,44 @@ bool CCThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes) return true; } -void CCThreadProxy::setNeedsRedraw() +void ThreadProxy::setNeedsRedraw() { DCHECK(isMainThread()); - TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedraw"); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setFullRootLayerDamageOnImplThread)); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsRedrawOnImplThread)); + TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedraw"); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setFullRootLayerDamageOnImplThread)); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsRedrawOnImplThread)); } -bool CCThreadProxy::commitRequested() const +bool ThreadProxy::commitRequested() const { DCHECK(isMainThread()); return m_commitRequested; } -void CCThreadProxy::setNeedsRedrawOnImplThread() +void ThreadProxy::setNeedsRedrawOnImplThread() { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedrawOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedrawOnImplThread"); m_schedulerOnImplThread->setNeedsRedraw(); } -void CCThreadProxy::start() +void ThreadProxy::start() { DCHECK(isMainThread()); - DCHECK(CCProxy::implThread()); + DCHECK(Proxy::implThread()); // Create LayerTreeHostImpl. DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - scoped_ptr<CCInputHandler> handler = m_layerTreeHost->createInputHandler(); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnImplThread, &completion, handler.release())); + CompletionEvent completion; + scoped_ptr<InputHandler> handler = m_layerTreeHost->createInputHandler(); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::initializeImplOnImplThread, &completion, handler.release())); completion.wait(); m_started = true; } -void CCThreadProxy::stop() +void ThreadProxy::stop() { - TRACE_EVENT0("cc", "CCThreadProxy::stop"); + TRACE_EVENT0("cc", "ThreadProxy::stop"); DCHECK(isMainThread()); DCHECK(m_started); @@ -410,8 +410,8 @@ void CCThreadProxy::stop() { DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnImplThread, &completion)); + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::layerTreeHostClosedOnImplThread, &completion)); completion.wait(); } @@ -422,15 +422,15 @@ void CCThreadProxy::stop() m_started = false; } -void CCThreadProxy::forceSerializeOnSwapBuffers() +void ThreadProxy::forceSerializeOnSwapBuffers() { DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread, &completion)); + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::forceSerializeOnSwapBuffersOnImplThread, &completion)); completion.wait(); } -void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* completion) +void ThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion) { if (m_rendererInitialized) m_layerTreeHostImpl->renderer()->doNoOp(); @@ -438,17 +438,17 @@ void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* c } -void CCThreadProxy::finishAllRenderingOnImplThread(CCCompletionEvent* completion) +void ThreadProxy::finishAllRenderingOnImplThread(CompletionEvent* completion) { - TRACE_EVENT0("cc", "CCThreadProxy::finishAllRenderingOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::finishAllRenderingOnImplThread"); DCHECK(isImplThread()); m_layerTreeHostImpl->finishAllRendering(); completion->signal(); } -void CCThreadProxy::forceBeginFrameOnImplThread(CCCompletionEvent* completion) +void ThreadProxy::forceBeginFrameOnImplThread(CompletionEvent* completion) { - TRACE_EVENT0("cc", "CCThreadProxy::forceBeginFrameOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::forceBeginFrameOnImplThread"); DCHECK(!m_beginFrameCompletionEventOnImplThread); if (m_schedulerOnImplThread->commitPending()) { @@ -460,9 +460,9 @@ void CCThreadProxy::forceBeginFrameOnImplThread(CCCompletionEvent* completion) setNeedsForcedCommitOnImplThread(); } -void CCThreadProxy::scheduledActionBeginFrame() +void ThreadProxy::scheduledActionBeginFrame() { - TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame"); + TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame"); DCHECK(!m_pendingBeginFrameRequest); m_pendingBeginFrameRequest = make_scoped_ptr(new BeginFrameAndCommitState()); m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasingTime(); @@ -472,7 +472,7 @@ void CCThreadProxy::scheduledActionBeginFrame() if (m_layerTreeHost->contentsTextureManager()) m_layerTreeHost->contentsTextureManager()->getEvictedBackings(m_pendingBeginFrameRequest->evictedContentsTexturesBackings); - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame)); if (m_beginFrameCompletionEventOnImplThread) { m_beginFrameCompletionEventOnImplThread->signal(); @@ -480,9 +480,9 @@ void CCThreadProxy::scheduledActionBeginFrame() } } -void CCThreadProxy::beginFrame() +void ThreadProxy::beginFrame() { - TRACE_EVENT0("cc", "CCThreadProxy::beginFrame"); + TRACE_EVENT0("cc", "ThreadProxy::beginFrame"); DCHECK(isMainThread()); if (!m_layerTreeHost) return; @@ -521,7 +521,7 @@ void CCThreadProxy::beginFrame() m_forcedCommitRequested = false; TRACE_EVENT0("cc", "EarlyOut_NotVisible"); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameAbortedOnImplThread)); + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::beginFrameAbortedOnImplThread)); return; } @@ -544,7 +544,7 @@ void CCThreadProxy::beginFrame() m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(request->evictedContentsTexturesBackings); - scoped_ptr<CCTextureUpdateQueue> queue = make_scoped_ptr(new CCTextureUpdateQueue); + scoped_ptr<TextureUpdateQueue> queue = make_scoped_ptr(new TextureUpdateQueue); m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes); // Once single buffered layers are committed, they cannot be modified until @@ -566,15 +566,15 @@ void CCThreadProxy::beginFrame() // Notify the impl thread that the beginFrame has completed. This will // begin the commit process, which is blocking from the main thread's // point of view, but asynchronously performed on the impl thread, - // coordinated by the CCScheduler. + // coordinated by the Scheduler. { TRACE_EVENT0("cc", "commit"); DebugScopedSetMainThreadBlocked mainThreadBlocked; base::TimeTicks startTime = base::TimeTicks::HighResNow(); - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release())); + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release())); completion.wait(); base::TimeTicks endTime = base::TimeTicks::HighResNow(); @@ -586,11 +586,11 @@ void CCThreadProxy::beginFrame() m_layerTreeHost->didBeginFrame(); } -void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, CCTextureUpdateQueue* rawQueue) +void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, TextureUpdateQueue* rawQueue) { - scoped_ptr<CCTextureUpdateQueue> queue(rawQueue); + scoped_ptr<TextureUpdateQueue> queue(rawQueue); - TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::beginFrameCompleteOnImplThread"); DCHECK(!m_commitCompletionEventOnImplThread); DCHECK(isImplThread() && isMainThreadBlocked()); DCHECK(m_schedulerOnImplThread); @@ -613,16 +613,16 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings(); - m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(this, CCProxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider()); + m_currentTextureUpdateControllerOnImplThread = TextureUpdateController::create(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider()); m_currentTextureUpdateControllerOnImplThread->performMoreUpdates( m_schedulerOnImplThread->anticipatedDrawTime()); m_commitCompletionEventOnImplThread = completion; } -void CCThreadProxy::beginFrameAbortedOnImplThread() +void ThreadProxy::beginFrameAbortedOnImplThread() { - TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::beginFrameAbortedOnImplThread"); DCHECK(isImplThread()); DCHECK(m_schedulerOnImplThread); DCHECK(m_schedulerOnImplThread->commitPending()); @@ -630,9 +630,9 @@ void CCThreadProxy::beginFrameAbortedOnImplThread() m_schedulerOnImplThread->beginFrameAborted(); } -void CCThreadProxy::scheduledActionCommit() +void ThreadProxy::scheduledActionCommit() { - TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); + TRACE_EVENT0("cc", "ThreadProxy::scheduledActionCommit"); DCHECK(isImplThread()); DCHECK(m_commitCompletionEventOnImplThread); DCHECK(m_currentTextureUpdateControllerOnImplThread); @@ -665,16 +665,16 @@ void CCThreadProxy::scheduledActionCommit() m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); } -void CCThreadProxy::scheduledActionBeginContextRecreation() +void ThreadProxy::scheduledActionBeginContextRecreation() { DCHECK(isImplThread()); - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginContextRecreation)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginContextRecreation)); } -CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInternal(bool forcedDraw) +ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal(bool forcedDraw) { - TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionDrawAndSwap"); - CCScheduledActionDrawAndSwapResult result; + TRACE_EVENT0("cc", "ThreadProxy::scheduledActionDrawAndSwap"); + ScheduledActionDrawAndSwapResult result; result.didDraw = false; result.didSwap = false; DCHECK(isImplThread()); @@ -703,7 +703,7 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte // be used when such a frame is possible. Since drawLayers() depends on the result of // prepareToDraw(), it is guarded on canDraw() as well. - CCLayerTreeHostImpl::FrameData frame; + LayerTreeHostImpl::FrameData frame; bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw); if (drawFrame) { m_layerTreeHostImpl->drawLayers(frame); @@ -726,13 +726,13 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte // Tell the main thread that the the newly-commited frame was drawn. if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { m_nextFrameIsNewlyCommittedFrameOnImplThread = false; - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCommitAndDrawFrame)); + m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::didCommitAndDrawFrame)); } return result; } -void CCThreadProxy::acquireLayerTextures() +void ThreadProxy::acquireLayerTextures() { // Called when the main thread needs to modify a layer texture that is used // directly by the compositor. @@ -744,16 +744,16 @@ void CCThreadProxy::acquireLayerTextures() if (m_texturesAcquired) return; - TRACE_EVENT0("cc", "CCThreadProxy::acquireLayerTextures"); + TRACE_EVENT0("cc", "ThreadProxy::acquireLayerTextures"); DebugScopedSetMainThreadBlocked mainThreadBlocked; - CCCompletionEvent completion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread, &completion)); + CompletionEvent completion; + Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::acquireLayerTexturesForMainThreadOnImplThread, &completion)); completion.wait(); // Block until it is safe to write to layer textures from the main thread. m_texturesAcquired = true; } -void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent* completion) +void ThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent* completion) { DCHECK(isImplThread()); DCHECK(!m_textureAcquisitionCompletionEventOnImplThread); @@ -762,24 +762,24 @@ void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEv m_schedulerOnImplThread->setMainThreadNeedsLayerTextures(); } -void CCThreadProxy::scheduledActionAcquireLayerTexturesForMainThread() +void ThreadProxy::scheduledActionAcquireLayerTexturesForMainThread() { DCHECK(m_textureAcquisitionCompletionEventOnImplThread); m_textureAcquisitionCompletionEventOnImplThread->signal(); m_textureAcquisitionCompletionEventOnImplThread = 0; } -CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapIfPossible() +ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapIfPossible() { return scheduledActionDrawAndSwapInternal(false); } -CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapForced() +ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapForced() { return scheduledActionDrawAndSwapInternal(true); } -void CCThreadProxy::didAnticipatedDrawTimeChange(base::TimeTicks time) +void ThreadProxy::didAnticipatedDrawTimeChange(base::TimeTicks time) { if (!m_currentTextureUpdateControllerOnImplThread) return; @@ -787,13 +787,13 @@ void CCThreadProxy::didAnticipatedDrawTimeChange(base::TimeTicks time) m_currentTextureUpdateControllerOnImplThread->performMoreUpdates(time); } -void CCThreadProxy::readyToFinalizeTextureUpdates() +void ThreadProxy::readyToFinalizeTextureUpdates() { DCHECK(isImplThread()); m_schedulerOnImplThread->beginFrameComplete(); } -void CCThreadProxy::didCommitAndDrawFrame() +void ThreadProxy::didCommitAndDrawFrame() { DCHECK(isMainThread()); if (!m_layerTreeHost) @@ -801,7 +801,7 @@ void CCThreadProxy::didCommitAndDrawFrame() m_layerTreeHost->didCommitAndDrawFrame(); } -void CCThreadProxy::didCompleteSwapBuffers() +void ThreadProxy::didCompleteSwapBuffers() { DCHECK(isMainThread()); if (!m_layerTreeHost) @@ -809,20 +809,20 @@ void CCThreadProxy::didCompleteSwapBuffers() m_layerTreeHost->didCompleteSwapBuffers(); } -void CCThreadProxy::setAnimationEvents(CCAnimationEventsVector* passed_events, double wallClockTime) +void ThreadProxy::setAnimationEvents(AnimationEventsVector* passed_events, double wallClockTime) { - scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(passed_events)); + scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(passed_events)); - TRACE_EVENT0("cc", "CCThreadProxy::setAnimationEvents"); + TRACE_EVENT0("cc", "ThreadProxy::setAnimationEvents"); DCHECK(isMainThread()); if (!m_layerTreeHost) return; m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); } -class CCThreadProxyContextRecreationTimer : public CCTimer, CCTimerClient { +class ThreadProxyContextRecreationTimer : public Timer, TimerClient { public: - static scoped_ptr<CCThreadProxyContextRecreationTimer> create(CCThreadProxy* proxy) { return make_scoped_ptr(new CCThreadProxyContextRecreationTimer(proxy)); } + static scoped_ptr<ThreadProxyContextRecreationTimer> create(ThreadProxy* proxy) { return make_scoped_ptr(new ThreadProxyContextRecreationTimer(proxy)); } virtual void onTimerFired() OVERRIDE { @@ -830,67 +830,67 @@ public: } private: - explicit CCThreadProxyContextRecreationTimer(CCThreadProxy* proxy) - : CCTimer(CCProxy::mainThread(), this) + explicit ThreadProxyContextRecreationTimer(ThreadProxy* proxy) + : Timer(Proxy::mainThread(), this) , m_proxy(proxy) { } - CCThreadProxy* m_proxy; + ThreadProxy* m_proxy; }; -void CCThreadProxy::beginContextRecreation() +void ThreadProxy::beginContextRecreation() { - TRACE_EVENT0("cc", "CCThreadProxy::beginContextRecreation"); + TRACE_EVENT0("cc", "ThreadProxy::beginContextRecreation"); DCHECK(isMainThread()); DCHECK(!m_contextRecreationTimer); - m_contextRecreationTimer = CCThreadProxyContextRecreationTimer::create(this); + m_contextRecreationTimer = ThreadProxyContextRecreationTimer::create(this); m_layerTreeHost->didLoseContext(); m_contextRecreationTimer->startOneShot(contextRecreationTickRate); } -void CCThreadProxy::tryToRecreateContext() +void ThreadProxy::tryToRecreateContext() { DCHECK(isMainThread()); DCHECK(m_layerTreeHost); - CCLayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext(); - if (result == CCLayerTreeHost::RecreateFailedButTryAgain) + LayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext(); + if (result == LayerTreeHost::RecreateFailedButTryAgain) m_contextRecreationTimer->startOneShot(contextRecreationTickRate); - else if (result == CCLayerTreeHost::RecreateSucceeded) + else if (result == LayerTreeHost::RecreateSucceeded) m_contextRecreationTimer.reset(); } -void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion, CCInputHandler* handler) +void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputHandler* handler) { - TRACE_EVENT0("cc", "CCThreadProxy::initializeImplOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::initializeImplOnImplThread"); DCHECK(isImplThread()); m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); const base::TimeDelta displayRefreshInterval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); - scoped_ptr<CCFrameRateController> frameRateController; + scoped_ptr<FrameRateController> frameRateController; if (m_renderVSyncEnabled) - frameRateController.reset(new CCFrameRateController(CCDelayBasedTimeSource::create(displayRefreshInterval, CCProxy::implThread()))); + frameRateController.reset(new FrameRateController(DelayBasedTimeSource::create(displayRefreshInterval, Proxy::implThread()))); else - frameRateController.reset(new CCFrameRateController(CCProxy::implThread())); - m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.Pass()); + frameRateController.reset(new FrameRateController(Proxy::implThread())); + m_schedulerOnImplThread = Scheduler::create(this, frameRateController.Pass()); m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); - m_inputHandlerOnImplThread = scoped_ptr<CCInputHandler>(handler); + m_inputHandlerOnImplThread = scoped_ptr<InputHandler>(handler); if (m_inputHandlerOnImplThread.get()) m_inputHandlerOnImplThread->bindToClient(m_layerTreeHostImpl.get()); completion->signal(); } -void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context) +void ThreadProxy::initializeContextOnImplThread(GraphicsContext* context) { - TRACE_EVENT0("cc", "CCThreadProxy::initializeContextOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::initializeContextOnImplThread"); DCHECK(isImplThread()); - m_contextBeforeInitializationOnImplThread = scoped_ptr<CCGraphicsContext>(context).Pass(); + m_contextBeforeInitializationOnImplThread = scoped_ptr<GraphicsContext>(context).Pass(); } -void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities) +void ThreadProxy::initializeRendererOnImplThread(CompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities) { - TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::initializeRendererOnImplThread"); DCHECK(isImplThread()); DCHECK(m_contextBeforeInitializationOnImplThread.get()); *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.Pass()); @@ -903,9 +903,9 @@ void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion completion->signal(); } -void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completion) +void ThreadProxy::layerTreeHostClosedOnImplThread(CompletionEvent* completion) { - TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::layerTreeHostClosedOnImplThread"); DCHECK(isImplThread()); m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_inputHandlerOnImplThread.reset(); @@ -914,23 +914,23 @@ void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio completion->signal(); } -void CCThreadProxy::setFullRootLayerDamageOnImplThread() +void ThreadProxy::setFullRootLayerDamageOnImplThread() { DCHECK(isImplThread()); m_layerTreeHostImpl->setFullRootLayerDamage(); } -size_t CCThreadProxy::maxPartialTextureUpdates() const +size_t ThreadProxy::maxPartialTextureUpdates() const { - return CCTextureUpdateController::maxPartialTextureUpdates(); + return TextureUpdateController::maxPartialTextureUpdates(); } -void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities) +void ThreadProxy::recreateContextOnImplThread(CompletionEvent* completion, GraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities) { - TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::recreateContextOnImplThread"); DCHECK(isImplThread()); m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(scoped_ptr<CCGraphicsContext>(contextPtr).Pass()); + *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(scoped_ptr<GraphicsContext>(contextPtr).Pass()); if (*recreateSucceeded) { *capabilities = m_layerTreeHostImpl->rendererCapabilities(); m_schedulerOnImplThread->didRecreateContext(); @@ -938,19 +938,19 @@ void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, C completion->signal(); } -void CCThreadProxy::renderingStatsOnImplThread(CCCompletionEvent* completion, CCRenderingStats* stats) +void ThreadProxy::renderingStatsOnImplThread(CompletionEvent* completion, RenderingStats* stats) { DCHECK(isImplThread()); m_layerTreeHostImpl->renderingStats(stats); completion->signal(); } -CCThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() +ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() : monotonicFrameBeginTime(0) { } -CCThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() +ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() { } diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h index 95c8d9b..67d6147 100644 --- a/cc/thread_proxy.h +++ b/cc/thread_proxy.h @@ -15,21 +15,21 @@ namespace cc { -class CCInputHandler; -class CCLayerTreeHost; -class CCScheduler; -class CCScopedThreadProxy; -class CCTextureUpdateQueue; -class CCThread; -class CCThreadProxyContextRecreationTimer; - -class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClient, CCTextureUpdateControllerClient { +class InputHandler; +class LayerTreeHost; +class Scheduler; +class ScopedThreadProxy; +class TextureUpdateQueue; +class Thread; +class ThreadProxyContextRecreationTimer; + +class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, TextureUpdateControllerClient { public: - static scoped_ptr<CCProxy> create(CCLayerTreeHost*); + static scoped_ptr<Proxy> create(LayerTreeHost*); - virtual ~CCThreadProxy(); + virtual ~ThreadProxy(); - // CCProxy implementation + // Proxy implementation virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE; virtual void finishAllRendering() OVERRIDE; @@ -39,7 +39,7 @@ public: virtual void setVisible(bool) OVERRIDE; virtual bool initializeRenderer() OVERRIDE; virtual bool recreateContext() OVERRIDE; - virtual void renderingStats(CCRenderingStats*) OVERRIDE; + virtual void renderingStats(RenderingStats*) OVERRIDE; virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; virtual void loseContext() OVERRIDE; virtual void setNeedsAnimate() OVERRIDE; @@ -53,31 +53,31 @@ public: virtual void acquireLayerTextures() OVERRIDE; virtual void forceSerializeOnSwapBuffers() OVERRIDE; - // CCLayerTreeHostImplClient implementation + // LayerTreeHostImplClient implementation virtual void didLoseContextOnImplThread() OVERRIDE; virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE; virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE; virtual void setNeedsRedrawOnImplThread() OVERRIDE; virtual void setNeedsCommitOnImplThread() OVERRIDE; - virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE; + virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, double wallClockTime) OVERRIDE; virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) OVERRIDE; - // CCSchedulerClient implementation + // SchedulerClient implementation virtual void scheduledActionBeginFrame() OVERRIDE; - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE; - virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE; + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE; + virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE; virtual void scheduledActionCommit() OVERRIDE; virtual void scheduledActionBeginContextRecreation() OVERRIDE; virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; - // CCTextureUpdateControllerClient implementation + // TextureUpdateControllerClient implementation virtual void readyToFinalizeTextureUpdates() OVERRIDE; private: - explicit CCThreadProxy(CCLayerTreeHost*); - friend class CCThreadProxyContextRecreationTimer; + explicit ThreadProxy(LayerTreeHost*); + friend class ThreadProxyContextRecreationTimer; // Set on impl thread, read on main thread. struct BeginFrameAndCommitState { @@ -85,9 +85,9 @@ private: ~BeginFrameAndCommitState(); double monotonicFrameBeginTime; - scoped_ptr<CCScrollAndScaleSet> scrollInfo; + scoped_ptr<ScrollAndScaleSet> scrollInfo; WebKit::WebTransformationMatrix implTransform; - CCPrioritizedTextureManager::BackingList evictedContentsTexturesBackings; + PrioritizedTextureManager::BackingList evictedContentsTexturesBackings; size_t memoryAllocationLimitBytes; }; scoped_ptr<BeginFrameAndCommitState> m_pendingBeginFrameRequest; @@ -96,35 +96,35 @@ private: void beginFrame(); void didCommitAndDrawFrame(); void didCompleteSwapBuffers(); - void setAnimationEvents(CCAnimationEventsVector*, double wallClockTime); + void setAnimationEvents(AnimationEventsVector*, double wallClockTime); void beginContextRecreation(); void tryToRecreateContext(); // Called on impl thread struct ReadbackRequest { - CCCompletionEvent completion; + CompletionEvent completion; bool success; void* pixels; IntRect rect; }; - void forceBeginFrameOnImplThread(CCCompletionEvent*); - void beginFrameCompleteOnImplThread(CCCompletionEvent*, CCTextureUpdateQueue*); + void forceBeginFrameOnImplThread(CompletionEvent*); + void beginFrameCompleteOnImplThread(CompletionEvent*, TextureUpdateQueue*); void beginFrameAbortedOnImplThread(); void requestReadbackOnImplThread(ReadbackRequest*); void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec); - void finishAllRenderingOnImplThread(CCCompletionEvent*); - void initializeImplOnImplThread(CCCompletionEvent*, CCInputHandler*); + void finishAllRenderingOnImplThread(CompletionEvent*); + void initializeImplOnImplThread(CompletionEvent*, InputHandler*); void setSurfaceReadyOnImplThread(); - void setVisibleOnImplThread(CCCompletionEvent*, bool); - void initializeContextOnImplThread(CCGraphicsContext*); - void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, RendererCapabilities*); - void layerTreeHostClosedOnImplThread(CCCompletionEvent*); + void setVisibleOnImplThread(CompletionEvent*, bool); + void initializeContextOnImplThread(GraphicsContext*); + void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSucceeded, RendererCapabilities*); + void layerTreeHostClosedOnImplThread(CompletionEvent*); void setFullRootLayerDamageOnImplThread(); - void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*); - void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, RendererCapabilities*); - void renderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*); - CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw); - void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*); + void acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*); + void recreateContextOnImplThread(CompletionEvent*, GraphicsContext*, bool* recreateSucceeded, RendererCapabilities*); + void renderingStatsOnImplThread(CompletionEvent*, RenderingStats*); + ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw); + void forceSerializeOnSwapBuffersOnImplThread(CompletionEvent*); void setNeedsForcedCommitOnImplThread(); // Accessed on main thread only. @@ -132,39 +132,39 @@ private: bool m_commitRequested; // Set only when setNeedsCommit is called. bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsAnimate. bool m_forcedCommitRequested; - scoped_ptr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; - CCLayerTreeHost* m_layerTreeHost; + scoped_ptr<ThreadProxyContextRecreationTimer> m_contextRecreationTimer; + LayerTreeHost* m_layerTreeHost; bool m_rendererInitialized; RendererCapabilities m_RendererCapabilitiesMainThreadCopy; bool m_started; bool m_texturesAcquired; bool m_inCompositeAndReadback; - scoped_ptr<CCLayerTreeHostImpl> m_layerTreeHostImpl; + scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; - scoped_ptr<CCInputHandler> m_inputHandlerOnImplThread; + scoped_ptr<InputHandler> m_inputHandlerOnImplThread; - scoped_ptr<CCScheduler> m_schedulerOnImplThread; + scoped_ptr<Scheduler> m_schedulerOnImplThread; - RefPtr<CCScopedThreadProxy> m_mainThreadProxy; + RefPtr<ScopedThreadProxy> m_mainThreadProxy; // Holds on to the context we might use for compositing in between initializeContext() // and initializeRenderer() calls. - scoped_ptr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread; + scoped_ptr<GraphicsContext> m_contextBeforeInitializationOnImplThread; // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued. - CCCompletionEvent* m_beginFrameCompletionEventOnImplThread; + CompletionEvent* m_beginFrameCompletionEventOnImplThread; // Set when the main thread is waiting on a readback. ReadbackRequest* m_readbackRequestOnImplThread; // Set when the main thread is waiting on a commit to complete. - CCCompletionEvent* m_commitCompletionEventOnImplThread; + CompletionEvent* m_commitCompletionEventOnImplThread; // Set when the main thread is waiting on layers to be drawn. - CCCompletionEvent* m_textureAcquisitionCompletionEventOnImplThread; + CompletionEvent* m_textureAcquisitionCompletionEventOnImplThread; - scoped_ptr<CCTextureUpdateController> m_currentTextureUpdateControllerOnImplThread; + scoped_ptr<TextureUpdateController> m_currentTextureUpdateControllerOnImplThread; // Set when the next draw should post didCommitAndDrawFrame to the main thread. bool m_nextFrameIsNewlyCommittedFrameOnImplThread; diff --git a/cc/thread_task.h b/cc/thread_task.h index 25c5509..84bb288 100644 --- a/cc/thread_task.h +++ b/cc/thread_task.h @@ -11,19 +11,19 @@ namespace cc { template<typename T> -class CCThreadTask0 : public CCThread::Task { +class ThreadTask0 : public Thread::Task { public: typedef void (T::*Method)(); - typedef CCThreadTask0<T> CCThreadTaskImpl; + typedef ThreadTask0<T> ThreadTaskImpl; - static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method) + static PassOwnPtr<ThreadTaskImpl> create(T* instance, Method method) { - return adoptPtr(new CCThreadTaskImpl(instance, method)); + return adoptPtr(new ThreadTaskImpl(instance, method)); } private: - CCThreadTask0(T* instance, Method method) - : CCThread::Task(instance) + ThreadTask0(T* instance, Method method) + : Thread::Task(instance) , m_method(method) { } @@ -38,19 +38,19 @@ private: }; template<typename T, typename P1, typename MP1> -class CCThreadTask1 : public CCThread::Task { +class ThreadTask1 : public Thread::Task { public: typedef void (T::*Method)(MP1); - typedef CCThreadTask1<T, P1, MP1> CCThreadTaskImpl; + typedef ThreadTask1<T, P1, MP1> ThreadTaskImpl; - static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1) + static PassOwnPtr<ThreadTaskImpl> create(T* instance, Method method, P1 parameter1) { - return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1)); + return adoptPtr(new ThreadTaskImpl(instance, method, parameter1)); } private: - CCThreadTask1(T* instance, Method method, P1 parameter1) - : CCThread::Task(instance) + ThreadTask1(T* instance, Method method, P1 parameter1) + : Thread::Task(instance) , m_method(method) , m_parameter1(parameter1) { @@ -67,19 +67,19 @@ private: }; template<typename T, typename P1, typename MP1, typename P2, typename MP2> -class CCThreadTask2 : public CCThread::Task { +class ThreadTask2 : public Thread::Task { public: typedef void (T::*Method)(MP1, MP2); - typedef CCThreadTask2<T, P1, MP1, P2, MP2> CCThreadTaskImpl; + typedef ThreadTask2<T, P1, MP1, P2, MP2> ThreadTaskImpl; - static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2) + static PassOwnPtr<ThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2) { - return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2)); + return adoptPtr(new ThreadTaskImpl(instance, method, parameter1, parameter2)); } private: - CCThreadTask2(T* instance, Method method, P1 parameter1, P2 parameter2) - : CCThread::Task(instance) + ThreadTask2(T* instance, Method method, P1 parameter1, P2 parameter2) + : Thread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -98,19 +98,19 @@ private: }; template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> -class CCThreadTask3 : public CCThread::Task { +class ThreadTask3 : public Thread::Task { public: typedef void (T::*Method)(MP1, MP2, MP3); - typedef CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> CCThreadTaskImpl; + typedef ThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> ThreadTaskImpl; - static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3) + static PassOwnPtr<ThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3) { - return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3)); + return adoptPtr(new ThreadTaskImpl(instance, method, parameter1, parameter2, parameter3)); } private: - CCThreadTask3(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3) - : CCThread::Task(instance) + ThreadTask3(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3) + : Thread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -132,19 +132,19 @@ private: template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4> -class CCThreadTask4 : public CCThread::Task { +class ThreadTask4 : public Thread::Task { public: typedef void (T::*Method)(MP1, MP2, MP3, MP4); - typedef CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4> CCThreadTaskImpl; + typedef ThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4> ThreadTaskImpl; - static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4) + static PassOwnPtr<ThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4) { - return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4)); + return adoptPtr(new ThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4)); } private: - CCThreadTask4(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4) - : CCThread::Task(instance) + ThreadTask4(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4) + : Thread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -167,19 +167,19 @@ private: }; template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5> -class CCThreadTask5 : public CCThread::Task { +class ThreadTask5 : public Thread::Task { public: typedef void (T::*Method)(MP1, MP2, MP3, MP4, MP5); - typedef CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CCThreadTaskImpl; + typedef ThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> ThreadTaskImpl; - static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5) + static PassOwnPtr<ThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5) { - return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4, parameter5)); + return adoptPtr(new ThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4, parameter5)); } private: - CCThreadTask5(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5) - : CCThread::Task(instance) + ThreadTask5(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5) + : Thread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -204,40 +204,40 @@ private: }; template<typename T> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)()); template<typename T> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)()) { - return CCThreadTask0<T>::create( + return ThreadTask0<T>::create( callee, method); } template<typename T, typename P1, typename MP1> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)(MP1), const P1& parameter1) { - return CCThreadTask1<T, P1, MP1>::create( + return ThreadTask1<T, P1, MP1>::create( callee, method, parameter1); } template<typename T, typename P1, typename MP1, typename P2, typename MP2> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)(MP1, MP2), const P1& parameter1, const P2& parameter2) { - return CCThreadTask2<T, P1, MP1, P2, MP2>::create( + return ThreadTask2<T, P1, MP1, P2, MP2>::create( callee, method, parameter1, @@ -245,14 +245,14 @@ PassOwnPtr<CCThread::Task> createCCThreadTask( } template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)(MP1, MP2, MP3), const P1& parameter1, const P2& parameter2, const P3& parameter3) { - return CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3>::create( + return ThreadTask3<T, P1, MP1, P2, MP2, P3, MP3>::create( callee, method, parameter1, @@ -261,7 +261,7 @@ PassOwnPtr<CCThread::Task> createCCThreadTask( } template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)(MP1, MP2, MP3, MP4), const P1& parameter1, @@ -269,7 +269,7 @@ PassOwnPtr<CCThread::Task> createCCThreadTask( const P3& parameter3, const P4& parameter4) { - return CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4>::create( + return ThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4>::create( callee, method, parameter1, @@ -280,7 +280,7 @@ PassOwnPtr<CCThread::Task> createCCThreadTask( } template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5> -PassOwnPtr<CCThread::Task> createCCThreadTask( +PassOwnPtr<Thread::Task> createThreadTask( T* const callee, void (T::*method)(MP1, MP2, MP3, MP4, MP5), const P1& parameter1, @@ -289,7 +289,7 @@ PassOwnPtr<CCThread::Task> createCCThreadTask( const P4& parameter4, const P5& parameter5) { - return CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5>::create( + return ThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5>::create( callee, method, parameter1, diff --git a/cc/thread_task_unittest.cc b/cc/thread_task_unittest.cc index 3f653d2..6036b79 100644 --- a/cc/thread_task_unittest.cc +++ b/cc/thread_task_unittest.cc @@ -24,7 +24,7 @@ public: MOCK_METHOD5(method5, void(int a1, int a2, int a3, int a4, int a5)); }; -TEST(CCThreadTaskTest, runnableMethods) +TEST(ThreadTaskTest, runnableMethods) { Mock mock; EXPECT_CALL(mock, method0()).Times(1); @@ -34,12 +34,12 @@ TEST(CCThreadTaskTest, runnableMethods) EXPECT_CALL(mock, method4(9, 8, 7, 6)).Times(1); EXPECT_CALL(mock, method5(9, 8, 7, 6, 5)).Times(1); - createCCThreadTask(&mock, &Mock::method0)->performTask(); - createCCThreadTask(&mock, &Mock::method1, 9)->performTask(); - createCCThreadTask(&mock, &Mock::method2, 9, 8)->performTask(); - createCCThreadTask(&mock, &Mock::method3, 9, 8, 7)->performTask(); - createCCThreadTask(&mock, &Mock::method4, 9, 8, 7, 6)->performTask(); - createCCThreadTask(&mock, &Mock::method5, 9, 8, 7, 6, 5)->performTask(); + createThreadTask(&mock, &Mock::method0)->performTask(); + createThreadTask(&mock, &Mock::method1, 9)->performTask(); + createThreadTask(&mock, &Mock::method2, 9, 8)->performTask(); + createThreadTask(&mock, &Mock::method3, 9, 8, 7)->performTask(); + createThreadTask(&mock, &Mock::method4, 9, 8, 7, 6)->performTask(); + createThreadTask(&mock, &Mock::method5, 9, 8, 7, 6, 5)->performTask(); } } // namespace diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc index e50861e..5237400 100644 --- a/cc/tile_draw_quad.cc +++ b/cc/tile_draw_quad.cc @@ -11,13 +11,13 @@ namespace cc { -scoped_ptr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) { - return make_scoped_ptr(new CCTileDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + return make_scoped_ptr(new TileDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } -CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) - : CCDrawQuad(sharedQuadState, CCDrawQuad::TiledContent, quadRect) +TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) + : DrawQuad(sharedQuadState, DrawQuad::TiledContent, quadRect) , m_resourceId(resourceId) , m_textureOffset(textureOffset) , m_textureSize(textureSize) @@ -33,10 +33,10 @@ CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const I m_opaqueRect = opaqueRect; } -const CCTileDrawQuad* CCTileDrawQuad::materialCast(const CCDrawQuad* quad) +const TileDrawQuad* TileDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::TiledContent); - return static_cast<const CCTileDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::TiledContent); + return static_cast<const TileDrawQuad*>(quad); } } diff --git a/cc/tile_draw_quad.h b/cc/tile_draw_quad.h index 4802d82..12e9a61 100644 --- a/cc/tile_draw_quad.h +++ b/cc/tile_draw_quad.h @@ -15,9 +15,9 @@ namespace cc { #pragma pack(push, 4) -class CCTileDrawQuad : public CCDrawQuad { +class TileDrawQuad : public DrawQuad { public: - static scoped_ptr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); + static scoped_ptr<TileDrawQuad> create(const SharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); unsigned resourceId() const { return m_resourceId; } IntPoint textureOffset() const { return m_textureOffset; } @@ -32,9 +32,9 @@ public: bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); } - static const CCTileDrawQuad* materialCast(const CCDrawQuad*); + static const TileDrawQuad* materialCast(const DrawQuad*); private: - CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); + TileDrawQuad(const SharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); unsigned m_resourceId; IntPoint m_textureOffset; diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index b28f1a6..587dd49 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -19,7 +19,7 @@ using WebKit::WebTransformationMatrix; namespace cc { -class UpdatableTile : public CCLayerTilingData::Tile { +class UpdatableTile : public LayerTilingData::Tile { public: static scoped_ptr<UpdatableTile> create(scoped_ptr<LayerTextureUpdater::Texture> texture) { @@ -27,7 +27,7 @@ public: } LayerTextureUpdater::Texture* texture() { return m_texture.get(); } - CCPrioritizedTexture* managedTexture() { return m_texture->texture(); } + PrioritizedTexture* managedTexture() { return m_texture->texture(); } bool isDirty() const { return !dirtyRect.isEmpty(); } @@ -75,27 +75,27 @@ private: DISALLOW_COPY_AND_ASSIGN(UpdatableTile); }; -TiledLayerChromium::TiledLayerChromium() - : LayerChromium() +TiledLayer::TiledLayer() + : Layer() , m_textureFormat(GL_INVALID_ENUM) , m_skipsDraw(false) , m_failedUpdate(false) , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid) , m_tilingOption(AutoTile) { - m_tiler = CCLayerTilingData::create(IntSize(), CCLayerTilingData::HasBorderTexels); + m_tiler = LayerTilingData::create(IntSize(), LayerTilingData::HasBorderTexels); } -TiledLayerChromium::~TiledLayerChromium() +TiledLayer::~TiledLayer() { } -scoped_ptr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> TiledLayer::createLayerImpl() { - return CCTiledLayerImpl::create(id()).PassAs<CCLayerImpl>(); + return TiledLayerImpl::create(id()).PassAs<LayerImpl>(); } -void TiledLayerChromium::updateTileSizeAndTilingOption() +void TiledLayer::updateTileSizeAndTilingOption() { DCHECK(layerTreeHost()); @@ -130,7 +130,7 @@ void TiledLayerChromium::updateTileSizeAndTilingOption() setTileSize(clampedSize); } -void TiledLayerChromium::updateBounds() +void TiledLayer::updateBounds() { IntSize oldBounds = m_tiler->bounds(); IntSize newBounds = contentBounds(); @@ -147,19 +147,19 @@ void TiledLayerChromium::updateBounds() invalidateContentRect(rects[i]); } -void TiledLayerChromium::setTileSize(const IntSize& size) +void TiledLayer::setTileSize(const IntSize& size) { m_tiler->setTileSize(size); } -void TiledLayerChromium::setBorderTexelOption(CCLayerTilingData::BorderTexelOption borderTexelOption) +void TiledLayer::setBorderTexelOption(LayerTilingData::BorderTexelOption borderTexelOption) { m_tiler->setBorderTexelOption(borderTexelOption); } -bool TiledLayerChromium::drawsContent() const +bool TiledLayer::drawsContent() const { - if (!LayerChromium::drawsContent()) + if (!Layer::drawsContent()) return false; bool hasMoreThanOneTile = m_tiler->numTilesX() > 1 || m_tiler->numTilesY() > 1; @@ -169,38 +169,38 @@ bool TiledLayerChromium::drawsContent() const return true; } -bool TiledLayerChromium::needsContentsScale() const +bool TiledLayer::needsContentsScale() const { return true; } -IntSize TiledLayerChromium::contentBounds() const +IntSize TiledLayer::contentBounds() const { return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds().height() * contentsScale())); } -void TiledLayerChromium::setTilingOption(TilingOption tilingOption) +void TiledLayer::setTilingOption(TilingOption tilingOption) { m_tilingOption = tilingOption; } -void TiledLayerChromium::setIsMask(bool isMask) +void TiledLayer::setIsMask(bool isMask) { setTilingOption(isMask ? NeverTile : AutoTile); } -void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) +void TiledLayer::pushPropertiesTo(LayerImpl* layer) { - LayerChromium::pushPropertiesTo(layer); + Layer::pushPropertiesTo(layer); - CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); + TiledLayerImpl* tiledLayer = static_cast<TiledLayerImpl*>(layer); tiledLayer->setSkipsDraw(m_skipsDraw); tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater::SampledTexelFormatRGBA); tiledLayer->setTilingData(*m_tiler); Vector<UpdatableTile*> invalidTiles; - for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { + for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { int i = iter->first.first; int j = iter->first.second; UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); @@ -229,17 +229,17 @@ void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) m_tiler->takeTile((*iter)->i(), (*iter)->j()); } -CCPrioritizedTextureManager* TiledLayerChromium::textureManager() const +PrioritizedTextureManager* TiledLayer::textureManager() const { if (!layerTreeHost()) return 0; return layerTreeHost()->contentsTextureManager(); } -void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) +void TiledLayer::setLayerTreeHost(LayerTreeHost* host) { if (host && host != layerTreeHost()) { - for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { + for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) @@ -247,15 +247,15 @@ void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) tile->managedTexture()->setTextureManager(host->contentsTextureManager()); } } - LayerChromium::setLayerTreeHost(host); + Layer::setLayerTreeHost(host); } -UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const +UpdatableTile* TiledLayer::tileAt(int i, int j) const { return static_cast<UpdatableTile*>(m_tiler->tileAt(i, j)); } -UpdatableTile* TiledLayerChromium::createTile(int i, int j) +UpdatableTile* TiledLayer::createTile(int i, int j) { createTextureUpdaterIfNeeded(); @@ -263,7 +263,7 @@ UpdatableTile* TiledLayerChromium::createTile(int i, int j) tile->managedTexture()->setDimensions(m_tiler->tileSize(), m_textureFormat); UpdatableTile* addedTile = tile.get(); - m_tiler->addTile(tile.PassAs<CCLayerTilingData::Tile>(), i, j); + m_tiler->addTile(tile.PassAs<LayerTilingData::Tile>(), i, j); addedTile->dirtyRect = m_tiler->tileRect(addedTile); @@ -276,7 +276,7 @@ UpdatableTile* TiledLayerChromium::createTile(int i, int j) return addedTile; } -void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) +void TiledLayer::setNeedsDisplayRect(const FloatRect& dirtyRect) { float contentsWidthScale = static_cast<float>(contentBounds().width()) / bounds().width(); float contentsHeightScale = static_cast<float>(contentBounds().height()) / bounds().height(); @@ -284,30 +284,30 @@ void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale); IntRect dirty = enclosingIntRect(scaledDirtyRect); invalidateContentRect(dirty); - LayerChromium::setNeedsDisplayRect(dirtyRect); + Layer::setNeedsDisplayRect(dirtyRect); } -void TiledLayerChromium::setUseLCDText(bool useLCDText) +void TiledLayer::setUseLCDText(bool useLCDText) { - LayerChromium::setUseLCDText(useLCDText); + Layer::setUseLCDText(useLCDText); - CCLayerTilingData::BorderTexelOption borderTexelOption; + LayerTilingData::BorderTexelOption borderTexelOption; #if OS(ANDROID) // Always want border texels and GL_LINEAR due to pinch zoom. - borderTexelOption = CCLayerTilingData::HasBorderTexels; + borderTexelOption = LayerTilingData::HasBorderTexels; #else - borderTexelOption = useLCDText ? CCLayerTilingData::NoBorderTexels : CCLayerTilingData::HasBorderTexels; + borderTexelOption = useLCDText ? LayerTilingData::NoBorderTexels : LayerTilingData::HasBorderTexels; #endif setBorderTexelOption(borderTexelOption); } -void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) +void TiledLayer::invalidateContentRect(const IntRect& contentRect) { updateBounds(); if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw) return; - for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { + for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); DCHECK(tile); // FIXME: This should not ever be null. @@ -320,14 +320,14 @@ void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) } // Returns true if tile is dirty and only part of it needs to be updated. -bool TiledLayerChromium::tileOnlyNeedsPartialUpdate(UpdatableTile* tile) +bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile) { return !tile->dirtyRect.contains(m_tiler->tileRect(tile)); } // Dirty tiles with valid textures needs buffered update to guarantee that // we don't modify textures currently used for drawing by the impl thread. -bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile) +bool TiledLayer::tileNeedsBufferedUpdate(UpdatableTile* tile) { if (!tile->managedTexture()->haveBackingTexture()) return false; @@ -342,7 +342,7 @@ bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile) } -bool TiledLayerChromium::updateTiles(int left, int top, int right, int bottom, CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats, bool& didPaint) +bool TiledLayer::updateTiles(int left, int top, int right, int bottom, TextureUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats, bool& didPaint) { didPaint = false; createTextureUpdaterIfNeeded(); @@ -366,7 +366,7 @@ bool TiledLayerChromium::updateTiles(int left, int top, int right, int bottom, C return true; } -void TiledLayerChromium::markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker* occlusion) +void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const OcclusionTracker* occlusion) { // There is some difficult dependancies between occlusions, recording occlusion metrics // and requesting memory so those are encapsulated in this function: @@ -402,7 +402,7 @@ void TiledLayerChromium::markOcclusionsAndRequestTextures(int left, int top, int occlusion->overdrawMetrics().didCullTileForUpload(); } -bool TiledLayerChromium::haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions) +bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions) { for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { @@ -428,7 +428,7 @@ bool TiledLayerChromium::haveTexturesForTiles(int left, int top, int right, int return true; } -IntRect TiledLayerChromium::markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions) +IntRect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions) { IntRect paintRect; for (int j = top; j <= bottom; ++j) { @@ -447,7 +447,7 @@ IntRect TiledLayerChromium::markTilesForUpdate(int left, int top, int right, int return paintRect; } -void TiledLayerChromium::updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) +void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, TextureUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats) { // The updateRect should be in layer space. So we have to convert the paintRect from content space to layer space. m_updateRect = FloatRect(paintRect); @@ -535,7 +535,7 @@ namespace { // This picks a small animated layer to be anything less than one viewport. This // is specifically for page transitions which are viewport-sized layers. The extra // 64 pixels is due to these layers being slightly larger than the viewport in some cases. -bool isSmallAnimatedLayer(TiledLayerChromium* layer) +bool isSmallAnimatedLayer(TiledLayer* layer) { if (!layer->drawTransformIsAnimating() && !layer->screenSpaceTransformIsAnimating()) return false; @@ -552,19 +552,19 @@ void setPriorityForTexture(const IntRect& visibleRect, const IntRect& tileRect, bool drawsToRoot, bool isSmallAnimatedLayer, - CCPrioritizedTexture* texture) + PrioritizedTexture* texture) { - int priority = CCPriorityCalculator::lowestPriority(); + int priority = PriorityCalculator::lowestPriority(); if (!visibleRect.isEmpty()) - priority = CCPriorityCalculator::priorityFromDistance(visibleRect, tileRect, drawsToRoot); + priority = PriorityCalculator::priorityFromDistance(visibleRect, tileRect, drawsToRoot); if (isSmallAnimatedLayer) - priority = CCPriorityCalculator::maxPriority(priority, CCPriorityCalculator::smallAnimatedLayerMinPriority()); - if (priority != CCPriorityCalculator::lowestPriority()) + priority = PriorityCalculator::maxPriority(priority, PriorityCalculator::smallAnimatedLayerMinPriority()); + if (priority != PriorityCalculator::lowestPriority()) texture->setRequestPriority(priority); } } -void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc) +void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc) { updateBounds(); resetUpdateState(); @@ -620,7 +620,7 @@ void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori tile->dirtyRect = tileRect; LayerTextureUpdater::Texture* backBuffer = tile->texture(); setPriorityForTexture(visibleContentRect(), tile->dirtyRect, drawsToRoot, smallAnimatedLayer, backBuffer->texture()); - scoped_ptr<CCPrioritizedTexture> frontBuffer = CCPrioritizedTexture::create(backBuffer->texture()->textureManager(), + scoped_ptr<PrioritizedTexture> frontBuffer = PrioritizedTexture::create(backBuffer->texture()->textureManager(), backBuffer->texture()->size(), backBuffer->texture()->format()); // Swap backBuffer into frontBuffer and add it to delete after commit queue. @@ -631,7 +631,7 @@ void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori } // Now update priorities on all tiles we have in the layer, no matter where they are. - for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { + for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) @@ -641,7 +641,7 @@ void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori } } -Region TiledLayerChromium::visibleContentOpaqueRegion() const +Region TiledLayer::visibleContentOpaqueRegion() const { if (m_skipsDraw) return Region(); @@ -650,13 +650,13 @@ Region TiledLayerChromium::visibleContentOpaqueRegion() const return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } -void TiledLayerChromium::resetUpdateState() +void TiledLayer::resetUpdateState() { m_skipsDraw = false; m_failedUpdate = false; - CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); - for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != end; ++iter) { + LayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); + for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != end; ++iter) { UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) @@ -665,7 +665,7 @@ void TiledLayerChromium::resetUpdateState() } } -void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) +void TiledLayer::update(TextureUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats) { DCHECK(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped? updateBounds(); @@ -738,7 +738,7 @@ void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTr } } -bool TiledLayerChromium::needsIdlePaint() +bool TiledLayer::needsIdlePaint() { // Don't trigger more paints if we failed (as we'll just fail again). if (m_failedUpdate || visibleContentRect().isEmpty() || m_tiler->hasEmptyBounds() || !drawsContent()) @@ -768,7 +768,7 @@ bool TiledLayerChromium::needsIdlePaint() return false; } -IntRect TiledLayerChromium::idlePaintRect() +IntRect TiledLayer::idlePaintRect() { // Don't inflate an empty rect. if (visibleContentRect().isEmpty()) diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h index fa701e0..33b2207 100644 --- a/cc/tiled_layer.h +++ b/cc/tiled_layer.h @@ -12,13 +12,13 @@ namespace cc { class UpdatableTile; -class TiledLayerChromium : public LayerChromium { +class TiledLayer : public Layer { public: enum TilingOption { AlwaysTile, NeverTile, AutoTile }; virtual void setIsMask(bool) OVERRIDE; - virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; + virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; virtual bool drawsContent() const OVERRIDE; virtual bool needsContentsScale() const OVERRIDE; @@ -29,17 +29,17 @@ public: virtual void setUseLCDText(bool) OVERRIDE; - virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; + virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; - virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; + virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; virtual Region visibleContentOpaqueRegion() const OVERRIDE; - virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; + virtual void update(TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; protected: - TiledLayerChromium(); - virtual ~TiledLayerChromium(); + TiledLayer(); + virtual ~TiledLayer(); void updateTileSizeAndTilingOption(); void updateBounds(); @@ -47,7 +47,7 @@ protected: // Exposed to subclasses for testing. void setTileSize(const IntSize&); void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureFormat; } - void setBorderTexelOption(CCLayerTilingData::BorderTexelOption); + void setBorderTexelOption(LayerTilingData::BorderTexelOption); void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; } size_t numPaintedTiles() { return m_tiler->tiles().size(); } @@ -67,10 +67,10 @@ protected: bool skipsDraw() const { return m_skipsDraw; } // Virtual for testing - virtual CCPrioritizedTextureManager* textureManager() const; + virtual PrioritizedTextureManager* textureManager() const; private: - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; void createTilerIfNeeded(); void setTilingOption(TilingOption); @@ -78,12 +78,12 @@ private: bool tileOnlyNeedsPartialUpdate(UpdatableTile*); bool tileNeedsBufferedUpdate(UpdatableTile*); - void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker*); + void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const OcclusionTracker*); - bool updateTiles(int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&, bool& didPaint); + bool updateTiles(int left, int top, int right, int bottom, TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&, bool& didPaint); bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions); IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions); - void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&); + void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, TextureUpdateQueue&, const OcclusionTracker*, RenderingStats&); UpdatableTile* tileAt(int, int) const; UpdatableTile* createTile(int, int); @@ -94,7 +94,7 @@ private: LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat; TilingOption m_tilingOption; - scoped_ptr<CCLayerTilingData> m_tiler; + scoped_ptr<LayerTilingData> m_tiler; }; } diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc index 206b2a1..f7aa668 100644 --- a/cc/tiled_layer_impl.cc +++ b/cc/tiled_layer_impl.cc @@ -44,33 +44,33 @@ static const int debugTileInvalidatedCheckerboardColorRed = 128; static const int debugTileInvalidatedCheckerboardColorGreen = 200; static const int debugTileInvalidatedCheckerboardColorBlue = 245; -class DrawableTile : public CCLayerTilingData::Tile { +class DrawableTile : public LayerTilingData::Tile { public: static scoped_ptr<DrawableTile> create() { return make_scoped_ptr(new DrawableTile()); } - CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } - void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; } + ResourceProvider::ResourceId resourceId() const { return m_resourceId; } + void setResourceId(ResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; } private: DrawableTile() : m_resourceId(0) { } - CCResourceProvider::ResourceId m_resourceId; + ResourceProvider::ResourceId m_resourceId; DISALLOW_COPY_AND_ASSIGN(DrawableTile); }; -CCTiledLayerImpl::CCTiledLayerImpl(int id) - : CCLayerImpl(id) +TiledLayerImpl::TiledLayerImpl(int id) + : LayerImpl(id) , m_skipsDraw(true) , m_contentsSwizzled(false) { } -CCTiledLayerImpl::~CCTiledLayerImpl() +TiledLayerImpl::~TiledLayerImpl() { } -CCResourceProvider::ResourceId CCTiledLayerImpl::contentsResourceId() const +ResourceProvider::ResourceId TiledLayerImpl::contentsResourceId() const { // This function is only valid for single texture layers, e.g. masks. DCHECK(m_tiler); @@ -78,48 +78,48 @@ CCResourceProvider::ResourceId CCTiledLayerImpl::contentsResourceId() const DCHECK(m_tiler->numTilesY() == 1); DrawableTile* tile = tileAt(0, 0); - CCResourceProvider::ResourceId resourceId = tile ? tile->resourceId() : 0; + ResourceProvider::ResourceId resourceId = tile ? tile->resourceId() : 0; return resourceId; } -void CCTiledLayerImpl::dumpLayerProperties(std::string* str, int indent) const +void TiledLayerImpl::dumpLayerProperties(std::string* str, int indent) const { str->append(indentString(indent)); base::StringAppendF(str, "skipsDraw: %d\n", (!m_tiler || m_skipsDraw)); - CCLayerImpl::dumpLayerProperties(str, indent); + LayerImpl::dumpLayerProperties(str, indent); } -bool CCTiledLayerImpl::hasTileAt(int i, int j) const +bool TiledLayerImpl::hasTileAt(int i, int j) const { return m_tiler->tileAt(i, j); } -bool CCTiledLayerImpl::hasResourceIdForTileAt(int i, int j) const +bool TiledLayerImpl::hasResourceIdForTileAt(int i, int j) const { return hasTileAt(i, j) && tileAt(i, j)->resourceId(); } -DrawableTile* CCTiledLayerImpl::tileAt(int i, int j) const +DrawableTile* TiledLayerImpl::tileAt(int i, int j) const { return static_cast<DrawableTile*>(m_tiler->tileAt(i, j)); } -DrawableTile* CCTiledLayerImpl::createTile(int i, int j) +DrawableTile* TiledLayerImpl::createTile(int i, int j) { scoped_ptr<DrawableTile> tile(DrawableTile::create()); DrawableTile* addedTile = tile.get(); - m_tiler->addTile(tile.PassAs<CCLayerTilingData::Tile>(), i, j); + m_tiler->addTile(tile.PassAs<LayerTilingData::Tile>(), i, j); return addedTile; } -void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { const IntRect& contentRect = visibleContentRect(); if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) return; - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); int left, top, right, bottom; @@ -136,7 +136,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorderMissingTileColorBlue); else borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); - quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, tileRect, borderColor, debugTileBorderWidth).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(DebugBorderDrawQuad::create(sharedQuadState, tileRect, borderColor, debugTileBorderWidth).PassAs<DrawQuad>(), appendQuadsData); } } } @@ -167,9 +167,9 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe else checkerColor = defaultColor; - appendQuadsData.hadMissingTiles |= quadSink.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect, checkerColor).PassAs<CCDrawQuad>(), appendQuadsData); + appendQuadsData.hadMissingTiles |= quadSink.append(CheckerboardDrawQuad::create(sharedQuadState, tileRect, checkerColor).PassAs<DrawQuad>(), appendQuadsData); } else - appendQuadsData.hadMissingTiles |= quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, tileRect, backgroundColor()).PassAs<CCDrawQuad>(), appendQuadsData); + appendQuadsData.hadMissingTiles |= quadSink.append(SolidColorDrawQuad::create(sharedQuadState, tileRect, backgroundColor()).PassAs<DrawQuad>(), appendQuadsData); continue; } @@ -185,7 +185,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe IntSize textureSize(tileWidth, tileHeight); bool clipped = false; - FloatQuad visibleContentInTargetQuad = CCMathUtil::mapQuad(drawTransform(), FloatQuad(visibleContentRect()), clipped); + FloatQuad visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), FloatQuad(visibleContentRect()), clipped); bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.isRectilinear(); bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; @@ -195,21 +195,21 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; const GLint textureFilter = m_tiler->hasBorderTexels() ? GL_LINEAR : GL_NEAREST; - quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<CCDrawQuad>(), appendQuadsData); + quadSink.append(TileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<DrawQuad>(), appendQuadsData); } } } -void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler) +void TiledLayerImpl::setTilingData(const LayerTilingData& tiler) { if (m_tiler) m_tiler->reset(); else - m_tiler = CCLayerTilingData::create(tiler.tileSize(), tiler.hasBorderTexels() ? CCLayerTilingData::HasBorderTexels : CCLayerTilingData::NoBorderTexels); + m_tiler = LayerTilingData::create(tiler.tileSize(), tiler.hasBorderTexels() ? LayerTilingData::HasBorderTexels : LayerTilingData::NoBorderTexels); *m_tiler = tiler; } -void CCTiledLayerImpl::pushTileProperties(int i, int j, CCResourceProvider::ResourceId resourceId, const IntRect& opaqueRect) +void TiledLayerImpl::pushTileProperties(int i, int j, ResourceProvider::ResourceId resourceId, const IntRect& opaqueRect) { DrawableTile* tile = tileAt(i, j); if (!tile) @@ -218,7 +218,7 @@ void CCTiledLayerImpl::pushTileProperties(int i, int j, CCResourceProvider::Reso tile->setOpaqueRect(opaqueRect); } -void CCTiledLayerImpl::pushInvalidTile(int i, int j) +void TiledLayerImpl::pushInvalidTile(int i, int j) { DrawableTile* tile = tileAt(i, j); if (!tile) @@ -227,7 +227,7 @@ void CCTiledLayerImpl::pushInvalidTile(int i, int j) tile->setOpaqueRect(IntRect()); } -Region CCTiledLayerImpl::visibleContentOpaqueRegion() const +Region TiledLayerImpl::visibleContentOpaqueRegion() const { if (m_skipsDraw) return Region(); @@ -236,12 +236,12 @@ Region CCTiledLayerImpl::visibleContentOpaqueRegion() const return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } -void CCTiledLayerImpl::didLoseContext() +void TiledLayerImpl::didLoseContext() { m_tiler->reset(); } -const char* CCTiledLayerImpl::layerTypeAsString() const +const char* TiledLayerImpl::layerTypeAsString() const { return "ContentLayer"; } diff --git a/cc/tiled_layer_impl.h b/cc/tiled_layer_impl.h index aedcb18..80f7d20 100644 --- a/cc/tiled_layer_impl.h +++ b/cc/tiled_layer_impl.h @@ -10,26 +10,26 @@ namespace cc { -class CCLayerTilingData; +class LayerTilingData; class DrawableTile; -class CCTiledLayerImpl : public CCLayerImpl { +class TiledLayerImpl : public LayerImpl { public: - static scoped_ptr<CCTiledLayerImpl> create(int id) + static scoped_ptr<TiledLayerImpl> create(int id) { - return make_scoped_ptr(new CCTiledLayerImpl(id)); + return make_scoped_ptr(new TiledLayerImpl(id)); } - virtual ~CCTiledLayerImpl(); + virtual ~TiledLayerImpl(); - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; - virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE; + virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE; virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; } - void setTilingData(const CCLayerTilingData& tiler); - void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect); + void setTilingData(const LayerTilingData& tiler); + void pushTileProperties(int, int, ResourceProvider::ResourceId, const IntRect& opaqueRect); void pushInvalidTile(int, int); void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; } @@ -39,7 +39,7 @@ public: virtual void didLoseContext() OVERRIDE; protected: - explicit CCTiledLayerImpl(int id); + explicit TiledLayerImpl(int id); // Exposed for testing. bool hasTileAt(int, int) const; bool hasResourceIdForTileAt(int, int) const; @@ -54,7 +54,7 @@ private: bool m_skipsDraw; bool m_contentsSwizzled; - scoped_ptr<CCLayerTilingData> m_tiler; + scoped_ptr<LayerTilingData> m_tiler; }; } diff --git a/cc/tiled_layer_impl_unittest.cc b/cc/tiled_layer_impl_unittest.cc index 9c131f5..6d0ccde 100644 --- a/cc/tiled_layer_impl_unittest.cc +++ b/cc/tiled_layer_impl_unittest.cc @@ -16,16 +16,16 @@ #include "testing/gtest/include/gtest/gtest.h" using namespace cc; -using namespace CCLayerTestCommon; +using namespace LayerTestCommon; namespace { // Create a default tiled layer with textures for all tiles and a default // visibility of the entire layer size. -static scoped_ptr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels) +static scoped_ptr<TiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, LayerTilingData::BorderTexelOption borderTexels) { - scoped_ptr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); - scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(tileSize, borderTexels); + scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1); + scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(tileSize, borderTexels); tiler->setBounds(layerSize); layer->setTilingData(*tiler); layer->setSkipsDraw(false); @@ -36,7 +36,7 @@ static scoped_ptr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - CCResourceProvider::ResourceId resourceId = 1; + ResourceProvider::ResourceId resourceId = 1; for (int i = 0; i < tiler->numTilesX(); ++i) for (int j = 0; j < tiler->numTilesY(); ++j) layer->pushTileProperties(i, j, resourceId++, IntRect(0, 0, 1, 1)); @@ -44,7 +44,7 @@ static scoped_ptr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I return layer.Pass(); } -TEST(CCTiledLayerImplTest, emptyQuadList) +TEST(TiledLayerImplTest, emptyQuadList) { DebugScopedSetImplThread scopedImplThread; @@ -55,9 +55,9 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Verify default layer does creates quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); - MockCCQuadCuller quadCuller; - CCAppendQuadsData data; + scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels); + MockQuadCuller quadCuller; + AppendQuadsData data; layer->appendQuads(quadCuller, data); const unsigned numTiles = numTilesX * numTilesY; EXPECT_EQ(quadCuller.quadList().size(), numTiles); @@ -65,41 +65,41 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with empty visible layer rect produces no quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels); layer->setVisibleContentRect(IntRect()); - MockCCQuadCuller quadCuller; - CCAppendQuadsData data; + MockQuadCuller quadCuller; + AppendQuadsData data; layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 0u); } // Layer with non-intersecting visible layer rect produces no quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels); IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50)); layer->setVisibleContentRect(outsideBounds); - MockCCQuadCuller quadCuller; - CCAppendQuadsData data; + MockQuadCuller quadCuller; + AppendQuadsData data; layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 0u); } // Layer with skips draw produces no quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels); layer->setSkipsDraw(true); - MockCCQuadCuller quadCuller; - CCAppendQuadsData data; + MockQuadCuller quadCuller; + AppendQuadsData data; layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 0u); } } -TEST(CCTiledLayerImplTest, checkerboarding) +TEST(TiledLayerImplTest, checkerboarding) { DebugScopedSetImplThread scopedImplThread; @@ -108,18 +108,18 @@ TEST(CCTiledLayerImplTest, checkerboarding) const int numTilesY = 2; const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels); // No checkerboarding { - MockCCQuadCuller quadCuller; - CCAppendQuadsData data; + MockQuadCuller quadCuller; + AppendQuadsData data; layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 4u); EXPECT_FALSE(data.hadMissingTiles); for (size_t i = 0; i < quadCuller.quadList().size(); ++i) - EXPECT_EQ(quadCuller.quadList()[i]->material(), CCDrawQuad::TiledContent); + EXPECT_EQ(quadCuller.quadList()[i]->material(), DrawQuad::TiledContent); } for (int i = 0; i < numTilesX; ++i) @@ -128,51 +128,51 @@ TEST(CCTiledLayerImplTest, checkerboarding) // All checkerboarding { - MockCCQuadCuller quadCuller; - CCAppendQuadsData data; + MockQuadCuller quadCuller; + AppendQuadsData data; layer->appendQuads(quadCuller, data); EXPECT_TRUE(data.hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 4u); for (size_t i = 0; i < quadCuller.quadList().size(); ++i) - EXPECT_NE(quadCuller.quadList()[i]->material(), CCDrawQuad::TiledContent); + EXPECT_NE(quadCuller.quadList()[i]->material(), DrawQuad::TiledContent); } } -static void getQuads(CCQuadList& quads, CCSharedQuadStateList& sharedStates, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) +static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, IntSize tileSize, const IntSize& layerSize, LayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); + scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); - MockCCQuadCuller quadCuller(quads, sharedStates); - CCAppendQuadsData data; + MockQuadCuller quadCuller(quads, sharedStates); + AppendQuadsData data; layer->appendQuads(quadCuller, data); } // Test with both border texels and without. #define WITH_AND_WITHOUT_BORDER_TEST(testFixtureName) \ - TEST(CCTiledLayerImplTest, testFixtureName##NoBorders) \ + TEST(TiledLayerImplTest, testFixtureName##NoBorders) \ { \ - testFixtureName(CCLayerTilingData::NoBorderTexels); \ + testFixtureName(LayerTilingData::NoBorderTexels); \ } \ - TEST(CCTiledLayerImplTest, testFixtureName##HasBorders) \ + TEST(TiledLayerImplTest, testFixtureName##HasBorders) \ { \ - testFixtureName(CCLayerTilingData::HasBorderTexels);\ + testFixtureName(LayerTilingData::HasBorderTexels);\ } -static void coverageVisibleRectOnTileBoundaries(CCLayerTilingData::BorderTexelOption borders) +static void coverageVisibleRectOnTileBoundaries(LayerTilingData::BorderTexelOption borders) { DebugScopedSetImplThread scopedImplThread; IntSize layerSize(1000, 1000); - CCQuadList quads; - CCSharedQuadStateList sharedStates; + QuadList quads; + SharedQuadStateList sharedStates; getQuads(quads, sharedStates, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); verifyQuadsExactlyCoverRect(quads, IntRect(IntPoint(), layerSize)); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries); -static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOption borders) +static void coverageVisibleRectIntersectsTiles(LayerTilingData::BorderTexelOption borders) { DebugScopedSetImplThread scopedImplThread; @@ -182,39 +182,39 @@ static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOpt IntRect visibleContentRect(topLeft, bottomRight - topLeft); IntSize layerSize(250, 250); - CCQuadList quads; - CCSharedQuadStateList sharedStates; - getQuads(quads, sharedStates, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleContentRect); + QuadList quads; + SharedQuadStateList sharedStates; + getQuads(quads, sharedStates, IntSize(50, 50), IntSize(250, 250), LayerTilingData::NoBorderTexels, visibleContentRect); verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); -static void coverageVisibleRectIntersectsBounds(CCLayerTilingData::BorderTexelOption borders) +static void coverageVisibleRectIntersectsBounds(LayerTilingData::BorderTexelOption borders) { DebugScopedSetImplThread scopedImplThread; IntSize layerSize(220, 210); IntRect visibleContentRect(IntPoint(), layerSize); - CCQuadList quads; - CCSharedQuadStateList sharedStates; - getQuads(quads, sharedStates, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleContentRect); + QuadList quads; + SharedQuadStateList sharedStates; + getQuads(quads, sharedStates, IntSize(100, 100), layerSize, LayerTilingData::NoBorderTexels, visibleContentRect); verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); -TEST(CCTiledLayerImplTest, textureInfoForLayerNoBorders) +TEST(TiledLayerImplTest, textureInfoForLayerNoBorders) { DebugScopedSetImplThread scopedImplThread; IntSize tileSize(50, 50); IntSize layerSize(250, 250); - CCQuadList quads; - CCSharedQuadStateList sharedStates; - getQuads(quads, sharedStates, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); + QuadList quads; + SharedQuadStateList sharedStates; + getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); for (size_t i = 0; i < quads.size(); ++i) { - ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; - CCTileDrawQuad* quad = static_cast<CCTileDrawQuad*>(quads[i]); + ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i; + TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]); EXPECT_NE(quad->resourceId(), 0u) << quadString << i; EXPECT_EQ(quad->textureOffset(), IntPoint()) << quadString << i; @@ -223,19 +223,19 @@ TEST(CCTiledLayerImplTest, textureInfoForLayerNoBorders) } } -TEST(CCTiledLayerImplTest, tileOpaqueRectForLayerNoBorders) +TEST(TiledLayerImplTest, tileOpaqueRectForLayerNoBorders) { DebugScopedSetImplThread scopedImplThread; IntSize tileSize(50, 50); IntSize layerSize(250, 250); - CCQuadList quads; - CCSharedQuadStateList sharedStates; - getQuads(quads, sharedStates, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); + QuadList quads; + SharedQuadStateList sharedStates; + getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); for (size_t i = 0; i < quads.size(); ++i) { - ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; - CCTileDrawQuad* quad = static_cast<CCTileDrawQuad*>(quads[i]); + ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i; + TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]); EXPECT_EQ(IntRect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; } diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc index 601e911..a5fe593 100644 --- a/cc/tiled_layer_unittest.cc +++ b/cc/tiled_layer_unittest.cc @@ -27,10 +27,10 @@ using WebKit::WebTransformationMatrix; namespace { -class TestCCOcclusionTracker : public CCOcclusionTracker { +class TestOcclusionTracker : public OcclusionTracker { public: - TestCCOcclusionTracker() - : CCOcclusionTracker(IntRect(0, 0, 1000, 1000), true) + TestOcclusionTracker() + : OcclusionTracker(IntRect(0, 0, 1000, 1000), true) , m_layerClipRectInTarget(IntRect(0, 0, 1000, 1000)) { // Pretend we have visited a render surface. @@ -40,26 +40,26 @@ public: void setOcclusion(const Region& occlusion) { m_stack.last().occlusionInScreen = occlusion; } protected: - virtual IntRect layerClipRectInTarget(const LayerChromium* layer) const OVERRIDE { return m_layerClipRectInTarget; } + virtual IntRect layerClipRectInTarget(const Layer* layer) const OVERRIDE { return m_layerClipRectInTarget; } private: IntRect m_layerClipRectInTarget; }; -class TiledLayerChromiumTest : public testing::Test { +class TiledLayerTest : public testing::Test { public: - TiledLayerChromiumTest() + TiledLayerTest() : m_compositorInitializer(0) - , m_context(WebKit::createFakeCCGraphicsContext()) - , m_queue(make_scoped_ptr(new CCTextureUpdateQueue)) - , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) + , m_context(WebKit::createFakeGraphicsContext()) + , m_queue(make_scoped_ptr(new TextureUpdateQueue)) + , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool)) , m_occlusion(0) { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; - m_resourceProvider = CCResourceProvider::create(m_context.get()); + m_resourceProvider = ResourceProvider::create(m_context.get()); } - virtual ~TiledLayerChromiumTest() + virtual ~TiledLayerTest() { textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get()); DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; @@ -68,30 +68,30 @@ public: // Helper classes and functions that set the current thread to be the impl thread // before doing the action that they wrap. - class ScopedFakeCCTiledLayerImpl { + class ScopedFakeTiledLayerImpl { public: - ScopedFakeCCTiledLayerImpl(int id) + ScopedFakeTiledLayerImpl(int id) { DebugScopedSetImplThread implThread; - m_layerImpl = new FakeCCTiledLayerImpl(id); + m_layerImpl = new FakeTiledLayerImpl(id); } - ~ScopedFakeCCTiledLayerImpl() + ~ScopedFakeTiledLayerImpl() { DebugScopedSetImplThread implThread; delete m_layerImpl; } - FakeCCTiledLayerImpl* get() + FakeTiledLayerImpl* get() { return m_layerImpl; } - FakeCCTiledLayerImpl* operator->() + FakeTiledLayerImpl* operator->() { return m_layerImpl; } private: - FakeCCTiledLayerImpl* m_layerImpl; + FakeTiledLayerImpl* m_layerImpl; }; - void textureManagerClearAllMemory(CCPrioritizedTextureManager* textureManager, CCResourceProvider* resourceProvider) + void textureManagerClearAllMemory(PrioritizedTextureManager* textureManager, ResourceProvider* resourceProvider) { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider); @@ -101,30 +101,30 @@ public: { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; DCHECK(m_queue); - scoped_ptr<CCTextureUpdateController> updateController = - CCTextureUpdateController::create( + scoped_ptr<TextureUpdateController> updateController = + TextureUpdateController::create( NULL, - CCProxy::implThread(), + Proxy::implThread(), m_queue.Pass(), m_resourceProvider.get()); updateController->finalize(); - m_queue = make_scoped_ptr(new CCTextureUpdateQueue); + m_queue = make_scoped_ptr(new TextureUpdateQueue); } - void layerPushPropertiesTo(FakeTiledLayerChromium* layer, FakeCCTiledLayerImpl* layerImpl) + void layerPushPropertiesTo(FakeTiledLayer* layer, FakeTiledLayerImpl* layerImpl) { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; layer->pushPropertiesTo(layerImpl); } - void layerUpdate(FakeTiledLayerChromium* layer, TestCCOcclusionTracker* occluded) + void layerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded) { DebugScopedSetMainThread mainThread; layer->update(*m_queue.get(), occluded, m_stats); } - bool updateAndPush(FakeTiledLayerChromium* layer1, - FakeCCTiledLayerImpl* layerImpl1, - FakeTiledLayerChromium* layer2 = 0, - FakeCCTiledLayerImpl* layerImpl2 = 0) + bool updateAndPush(FakeTiledLayer* layer1, + FakeTiledLayerImpl* layerImpl1, + FakeTiledLayer* layer2 = 0, + FakeTiledLayerImpl* layerImpl2 = 0) { // Get textures m_textureManager->clearPriorities(); @@ -158,19 +158,19 @@ public: public: WebKitTests::WebCompositorInitializer m_compositorInitializer; - scoped_ptr<CCGraphicsContext> m_context; - scoped_ptr<CCResourceProvider> m_resourceProvider; - scoped_ptr<CCTextureUpdateQueue> m_queue; - CCRenderingStats m_stats; - CCPriorityCalculator m_priorityCalculator; - scoped_ptr<CCPrioritizedTextureManager> m_textureManager; - TestCCOcclusionTracker* m_occlusion; + scoped_ptr<GraphicsContext> m_context; + scoped_ptr<ResourceProvider> m_resourceProvider; + scoped_ptr<TextureUpdateQueue> m_queue; + RenderingStats m_stats; + PriorityCalculator m_priorityCalculator; + scoped_ptr<PrioritizedTextureManager> m_textureManager; + TestOcclusionTracker* m_occlusion; }; -TEST_F(TiledLayerChromiumTest, pushDirtyTiles) +TEST_F(TiledLayerTest, pushDirtyTiles) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -193,11 +193,11 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1)); } -TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) +TEST_F(TiledLayerTest, pushOccludedDirtyTiles) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); + TestOcclusionTracker occluded; m_occlusion = &occluded; // The tile size is 100x100, so this invalidates and then paints two tiles. @@ -229,10 +229,10 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1)); } -TEST_F(TiledLayerChromiumTest, pushDeletedTiles) +TEST_F(TiledLayerTest, pushDeletedTiles) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -264,10 +264,10 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1)); } -TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) +TEST_F(TiledLayerTest, pushIdlePaintTiles) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. // This paints 1 visible of the 25 invalid tiles. @@ -300,14 +300,14 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) EXPECT_FALSE(needsUpdate); } -TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) +TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed) { // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); - scoped_refptr<FakeTiledLayerChromium> layer1 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl1(1); - scoped_refptr<FakeTiledLayerChromium> layer2 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl2(2); + scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl1(1); + scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl2(2); // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from // layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint @@ -354,11 +354,11 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) EXPECT_FALSE(layerImpl2->hasResourceIdForTileAt(0, 2)); } -TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) +TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); + TestOcclusionTracker occluded; m_occlusion = &occluded; // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it. @@ -373,10 +373,10 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) +TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. // However, during the paint, we invalidate one of the tiles. This should @@ -391,12 +391,12 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1)); } -TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) +TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { - scoped_refptr<FakeTiledLayerChromium> layer1 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - scoped_refptr<FakeTiledLayerChromium> layer2 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layer1Impl(1); - ScopedFakeCCTiledLayerImpl layer2Impl(2); + scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layer1Impl(1); + ScopedFakeTiledLayerImpl layer2Impl(2); // Invalidate a tile on layer1, during update of layer 2. layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); @@ -414,12 +414,12 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) EXPECT_TRUE(layer2Impl->hasResourceIdForTileAt(0, 1)); } -TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) +TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) { - scoped_refptr<FakeTiledLayerChromium> layer1 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - scoped_refptr<FakeTiledLayerChromium> layer2 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layer1Impl(1); - ScopedFakeCCTiledLayerImpl layer2Impl(2); + scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layer1Impl(1); + ScopedFakeTiledLayerImpl layer2Impl(2); layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); layer1->setBounds(IntSize(100, 200)); @@ -436,21 +436,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay EXPECT_TRUE(layer2Impl->hasResourceIdForTileAt(0, 1)); } -TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) +TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately) { - // Create a CCLayerTreeHost that has the right viewportsize, + // Create a LayerTreeHost that has the right viewportsize, // so the layer is considered small enough. - FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; - scoped_ptr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); + FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient; + scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, LayerTreeSettings()); bool runOutOfMemory[2] = {false, true}; for (int i = 0; i < 2; i++) { // Create a layer with 4x4 tiles. - int layerWidth = 4 * FakeTiledLayerChromium::tileSize().width(); - int layerHeight = 4 * FakeTiledLayerChromium::tileSize().height(); + int layerWidth = 4 * FakeTiledLayer::tileSize().width(); + int layerHeight = 4 * FakeTiledLayer::tileSize().height(); int memoryForLayer = layerWidth * layerHeight * 4; IntSize viewportSize = IntSize(layerWidth, layerHeight); - ccLayerTreeHost->setViewportSize(viewportSize, viewportSize); + layerTreeHost->setViewportSize(viewportSize, viewportSize); // Use 8x4 tiles to run out of memory. if (runOutOfMemory[i]) @@ -458,8 +458,8 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) m_textureManager->setMaxMemoryLimitBytes(memoryForLayer); - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // Full size layer with half being visible. IntSize contentBounds(layerWidth, layerHeight); @@ -471,7 +471,7 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) layer->setBounds(contentBounds); layer->setVisibleContentRect(visibleRect); layer->invalidateContentRect(contentRect); - layer->setLayerTreeHost(ccLayerTreeHost.get()); + layer->setLayerTreeHost(layerTreeHost.get()); // The layer should paint it's entire contents on the first paint // if it is close to the viewport size and has the available memory. @@ -498,10 +498,10 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) } } -TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) +TEST_F(TiledLayerTest, idlePaintOutOfMemory) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. @@ -521,10 +521,10 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(1, 1)); } -TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) +TEST_F(TiledLayerTest, idlePaintZeroSizedLayer) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); bool animating[2] = {false, true}; for (int i = 0; i < 2; i++) { @@ -548,10 +548,10 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) } } -TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) +TEST_F(TiledLayerTest, idlePaintNonVisibleLayers) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // Alternate between not visible and visible. IntRect v(0, 0, 100, 100); @@ -578,10 +578,10 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) } } -TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) +TEST_F(TiledLayerTest, invalidateFromPrepare) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -611,7 +611,7 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } -TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) +TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled) { // The updateRect (that indicates what was actually painted) should be in // layer space, not the content space. @@ -651,10 +651,10 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } -TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) +TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - ScopedFakeCCTiledLayerImpl layerImpl(1); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + ScopedFakeTiledLayerImpl layerImpl(1); // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); @@ -705,11 +705,11 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 1)); } -TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) +TEST_F(TiledLayerTest, skipsDrawGetsReset) { - FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; - scoped_ptr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); - ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); + FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient; + scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, LayerTreeSettings()); + ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded()); // Create two 300 x 300 tiled layers. IntSize contentBounds(300, 300); @@ -718,8 +718,8 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) // We have enough memory for only one of the two layers. int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. - scoped_refptr<FakeTiledLayerChromium> rootLayer = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); - scoped_refptr<FakeTiledLayerChromium> childLayer = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> rootLayer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> childLayer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager())); rootLayer->addChild(childLayer); rootLayer->setBounds(contentBounds); @@ -731,30 +731,30 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) rootLayer->invalidateContentRect(contentRect); childLayer->invalidateContentRect(contentRect); - ccLayerTreeHost->setRootLayer(rootLayer); - ccLayerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300)); + layerTreeHost->setRootLayer(rootLayer); + layerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300)); - ccLayerTreeHost->updateLayers(*m_queue.get(), memoryLimit); + layerTreeHost->updateLayers(*m_queue.get(), memoryLimit); // We'll skip the root layer. EXPECT_TRUE(rootLayer->skipsDraw()); EXPECT_FALSE(childLayer->skipsDraw()); - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // Remove the child layer. rootLayer->removeAllChildren(); - ccLayerTreeHost->updateLayers(*m_queue.get(), memoryLimit); + layerTreeHost->updateLayers(*m_queue.get(), memoryLimit); EXPECT_FALSE(rootLayer->skipsDraw()); - textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); - ccLayerTreeHost->setRootLayer(0); + textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get()); + layerTreeHost->setRootLayer(0); } -TEST_F(TiledLayerChromiumTest, resizeToSmaller) +TEST_F(TiledLayerTest, resizeToSmaller) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); layer->setBounds(IntSize(700, 700)); layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); @@ -768,9 +768,9 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) layer->invalidateContentRect(IntRect(0, 0, 200, 200)); } -TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) +TEST_F(TiledLayerTest, hugeLayerUpdateCrash) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); int size = 1 << 30; layer->setBounds(IntSize(size, size)); @@ -783,33 +783,33 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) layer->update(*m_queue.get(), 0, m_stats); } -TEST_F(TiledLayerChromiumTest, partialUpdates) +TEST_F(TiledLayerTest, partialUpdates) { - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; - FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; - scoped_ptr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); - ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); + FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient; + scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, settings); + ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded()); // Create one 300 x 200 tiled layer with 3 x 2 tiles. IntSize contentBounds(300, 200); IntRect contentRect(IntPoint::zero(), contentBounds); - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager())); layer->setBounds(contentBounds); layer->setPosition(FloatPoint(0, 0)); layer->setVisibleContentRect(contentRect); layer->invalidateContentRect(contentRect); - ccLayerTreeHost->setRootLayer(layer); - ccLayerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200)); + layerTreeHost->setRootLayer(layer); + layerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200)); // Full update of all 6 tiles. - ccLayerTreeHost->updateLayers( + layerTreeHost->updateLayers( *m_queue.get(), std::numeric_limits<size_t>::max()); { - ScopedFakeCCTiledLayerImpl layerImpl(1); + ScopedFakeTiledLayerImpl layerImpl(1); EXPECT_EQ(6, m_queue->fullUploadSize()); EXPECT_EQ(0, m_queue->partialUploadSize()); updateTextures(); @@ -818,13 +818,13 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->fakeLayerTextureUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // Full update of 3 tiles and partial update of 3 tiles. layer->invalidateContentRect(IntRect(0, 0, 300, 150)); - ccLayerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); { - ScopedFakeCCTiledLayerImpl layerImpl(1); + ScopedFakeTiledLayerImpl layerImpl(1); EXPECT_EQ(3, m_queue->fullUploadSize()); EXPECT_EQ(3, m_queue->partialUploadSize()); updateTextures(); @@ -833,13 +833,13 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->fakeLayerTextureUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // Partial update of 6 tiles. layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { - ScopedFakeCCTiledLayerImpl layerImpl(1); - ccLayerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + ScopedFakeTiledLayerImpl layerImpl(1); + layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(2, m_queue->fullUploadSize()); EXPECT_EQ(4, m_queue->partialUploadSize()); updateTextures(); @@ -848,21 +848,21 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->fakeLayerTextureUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // Checkerboard all tiles. layer->invalidateContentRect(IntRect(0, 0, 300, 200)); { - ScopedFakeCCTiledLayerImpl layerImpl(1); + ScopedFakeTiledLayerImpl layerImpl(1); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // Partial update of 6 checkerboard tiles. layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { - ScopedFakeCCTiledLayerImpl layerImpl(1); - ccLayerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + ScopedFakeTiledLayerImpl layerImpl(1); + layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(6, m_queue->fullUploadSize()); EXPECT_EQ(0, m_queue->partialUploadSize()); updateTextures(); @@ -871,13 +871,13 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->fakeLayerTextureUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // Partial update of 4 tiles. layer->invalidateContentRect(IntRect(50, 50, 100, 100)); { - ScopedFakeCCTiledLayerImpl layerImpl(1); - ccLayerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + ScopedFakeTiledLayerImpl layerImpl(1); + layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(0, m_queue->fullUploadSize()); EXPECT_EQ(4, m_queue->partialUploadSize()); updateTextures(); @@ -886,15 +886,15 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->fakeLayerTextureUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); - textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); - ccLayerTreeHost->setRootLayer(0); + textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get()); + layerTreeHost->setRootLayer(0); } -TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) +TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -908,10 +908,10 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); } -TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) +TEST_F(TiledLayerTest, tilesPaintedWithOcclusion) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100. @@ -958,10 +958,10 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) EXPECT_EQ(3 + 2, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) +TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100. @@ -1016,10 +1016,10 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) } -TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) +TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100. @@ -1054,10 +1054,10 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) EXPECT_EQ(6, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) +TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100. @@ -1083,10 +1083,10 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) +TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100. @@ -1156,10 +1156,10 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) EXPECT_EQ(1 + 1, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) +TEST_F(TiledLayerTest, visibleContentOpaqueRegion) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1248,10 +1248,10 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) +TEST_F(TiledLayerTest, pixelsPaintedMetrics) { - scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get())); - TestCCOcclusionTracker occluded; + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get())); + TestOcclusionTracker occluded; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1300,22 +1300,22 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload()); } -TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) +TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) { // Tile size is 100x100. IntRect rootRect(0, 0, 300, 200); IntRect childRect(0, 0, 300, 100); IntRect child2Rect(0, 100, 300, 100); - CCLayerTreeSettings settings; - FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; - scoped_ptr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); - ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); + LayerTreeSettings settings; + FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient; + scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, settings); + ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded()); - scoped_refptr<FakeTiledLayerChromium> root = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); - scoped_refptr<LayerChromium> surface = LayerChromium::create(); - scoped_refptr<FakeTiledLayerChromium> child = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); - scoped_refptr<FakeTiledLayerChromium> child2 = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager())); + scoped_refptr<Layer> surface = Layer::create(); + scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager())); root->setBounds(rootRect.size()); root->setAnchorPoint(FloatPoint()); @@ -1341,14 +1341,14 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->setVisibleContentRect(child2Rect); child2->setDrawableContentRect(rootRect); - ccLayerTreeHost->setRootLayer(root); - ccLayerTreeHost->setViewportSize(rootRect.size(), rootRect.size()); + layerTreeHost->setRootLayer(root); + layerTreeHost->setViewportSize(rootRect.size(), rootRect.size()); // With a huge memory limit, all layers should update and push their textures. root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - ccLayerTreeHost->updateLayers( + layerTreeHost->updateLayers( *m_queue.get(), std::numeric_limits<size_t>::max()); { updateTextures(); @@ -1361,9 +1361,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - ScopedFakeCCTiledLayerImpl rootImpl(root->id()); - ScopedFakeCCTiledLayerImpl childImpl(child->id()); - ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + ScopedFakeTiledLayerImpl rootImpl(root->id()); + ScopedFakeTiledLayerImpl childImpl(child->id()); + ScopedFakeTiledLayerImpl child2Impl(child2->id()); layerPushPropertiesTo(root.get(), rootImpl.get()); layerPushPropertiesTo(child.get(), childImpl.get()); layerPushPropertiesTo(child2.get(), child2Impl.get()); @@ -1375,7 +1375,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca EXPECT_TRUE(child2Impl->hasResourceIdForTileAt(i, 0)); } } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // With a memory limit that includes only the root layer (3x2 tiles) and half the surface that // the child layers draw into, the child layers will not be allocated. If the surface isn't @@ -1383,7 +1383,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - ccLayerTreeHost->updateLayers( + layerTreeHost->updateLayers( *m_queue.get(), (3 * 2 + 3 * 1) * (100 * 100) * 4); { updateTextures(); @@ -1396,9 +1396,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - ScopedFakeCCTiledLayerImpl rootImpl(root->id()); - ScopedFakeCCTiledLayerImpl childImpl(child->id()); - ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + ScopedFakeTiledLayerImpl rootImpl(root->id()); + ScopedFakeTiledLayerImpl childImpl(child->id()); + ScopedFakeTiledLayerImpl child2Impl(child2->id()); layerPushPropertiesTo(root.get(), rootImpl.get()); layerPushPropertiesTo(child.get(), childImpl.get()); layerPushPropertiesTo(child2.get(), child2Impl.get()); @@ -1410,7 +1410,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca EXPECT_FALSE(child2Impl->hasResourceIdForTileAt(i, 0)); } } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); // With a memory limit that includes only half the root layer, no contents will be // allocated. If render surface memory wasn't accounted for, there is enough space @@ -1419,7 +1419,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - ccLayerTreeHost->updateLayers( + layerTreeHost->updateLayers( *m_queue.get(), (3 * 1) * (100 * 100) * 4); { updateTextures(); @@ -1432,9 +1432,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - ScopedFakeCCTiledLayerImpl rootImpl(root->id()); - ScopedFakeCCTiledLayerImpl childImpl(child->id()); - ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + ScopedFakeTiledLayerImpl rootImpl(root->id()); + ScopedFakeTiledLayerImpl childImpl(child->id()); + ScopedFakeTiledLayerImpl child2Impl(child2->id()); layerPushPropertiesTo(root.get(), rootImpl.get()); layerPushPropertiesTo(child.get(), childImpl.get()); layerPushPropertiesTo(child2.get(), child2Impl.get()); @@ -1446,13 +1446,13 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca EXPECT_FALSE(child2Impl->hasResourceIdForTileAt(i, 0)); } } - ccLayerTreeHost->commitComplete(); + layerTreeHost->commitComplete(); - textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); - ccLayerTreeHost->setRootLayer(0); + textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get()); + layerTreeHost->setRootLayer(0); } -class TrackingLayerPainter : public LayerPainterChromium { +class TrackingLayerPainter : public LayerPainter { public: static scoped_ptr<TrackingLayerPainter> create() { return make_scoped_ptr(new TrackingLayerPainter()); } @@ -1470,20 +1470,20 @@ private: IntRect m_paintedRect; }; -class UpdateTrackingTiledLayerChromium : public FakeTiledLayerChromium { +class UpdateTrackingTiledLayer : public FakeTiledLayer { public: - explicit UpdateTrackingTiledLayerChromium(CCPrioritizedTextureManager* manager) - : FakeTiledLayerChromium(manager) + explicit UpdateTrackingTiledLayer(PrioritizedTextureManager* manager) + : FakeTiledLayer(manager) { scoped_ptr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::create()); m_trackingLayerPainter = trackingLayerPainter.get(); - m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.PassAs<LayerPainterChromium>()); + m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.PassAs<LayerPainter>()); } TrackingLayerPainter* trackingLayerPainter() const { return m_trackingLayerPainter; } protected: - virtual ~UpdateTrackingTiledLayerChromium() { } + virtual ~UpdateTrackingTiledLayer() { } virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_layerTextureUpdater.get(); } @@ -1492,9 +1492,9 @@ private: scoped_refptr<BitmapCanvasLayerTextureUpdater> m_layerTextureUpdater; }; -TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) +TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) { - scoped_refptr<UpdateTrackingTiledLayerChromium> layer = make_scoped_refptr(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); + scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get())); IntRect layerRect(0, 0, 30, 31); layer->setPosition(layerRect.location()); @@ -1523,9 +1523,9 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } -TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) +TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) { - scoped_refptr<UpdateTrackingTiledLayerChromium> layer = make_scoped_refptr(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); + scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get())); IntRect layerRect(0, 0, 30, 31); layer->setPosition(layerRect.location()); diff --git a/cc/time_source.h b/cc/time_source.h index 778be8cd..ae1252e 100644 --- a/cc/time_source.h +++ b/cc/time_source.h @@ -10,14 +10,14 @@ namespace cc { -class CCThread; +class Thread; -class CCTimeSourceClient { +class TimeSourceClient { public: virtual void onTimerTick() = 0; protected: - virtual ~CCTimeSourceClient() { } + virtual ~TimeSourceClient() { } }; // An generic interface for getting a reliably-ticking timesource of @@ -25,9 +25,9 @@ protected: // // Be sure to call setActive(false) before releasing your reference to the // timer, or it will keep on ticking! -class CCTimeSource : public base::RefCounted<CCTimeSource> { +class TimeSource : public base::RefCounted<TimeSource> { public: - virtual void setClient(CCTimeSourceClient*) = 0; + virtual void setClient(TimeSourceClient*) = 0; virtual void setActive(bool) = 0; virtual bool active() const = 0; virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) = 0; @@ -35,10 +35,10 @@ public: virtual base::TimeTicks nextTickTime() = 0; protected: - virtual ~CCTimeSource() { } + virtual ~TimeSource() { } private: - friend class base::RefCounted<CCTimeSource>; + friend class base::RefCounted<TimeSource>; }; } diff --git a/cc/timer.cc b/cc/timer.cc index b5b9206..85f1f93 100644 --- a/cc/timer.cc +++ b/cc/timer.cc @@ -12,15 +12,15 @@ namespace cc { -class CCTimerTask : public CCThread::Task { +class TimerTask : public Thread::Task { public: - explicit CCTimerTask(CCTimer* timer) - : CCThread::Task(0) + explicit TimerTask(Timer* timer) + : Thread::Task(0) , m_timer(timer) { } - virtual ~CCTimerTask() + virtual ~TimerTask() { if (!m_timer) return; @@ -34,7 +34,7 @@ public: if (!m_timer) return; - CCTimerClient* client = m_timer->m_client; + TimerClient* client = m_timer->m_client; m_timer->stop(); if (client) @@ -42,34 +42,34 @@ public: } private: - friend class CCTimer; + friend class Timer; - CCTimer* m_timer; // null if cancelled + Timer* m_timer; // null if cancelled }; -CCTimer::CCTimer(CCThread* thread, CCTimerClient* client) +Timer::Timer(Thread* thread, TimerClient* client) : m_client(client) , m_thread(thread) , m_task(0) { } -CCTimer::~CCTimer() +Timer::~Timer() { stop(); } -void CCTimer::startOneShot(double intervalSeconds) +void Timer::startOneShot(double intervalSeconds) { stop(); - m_task = new CCTimerTask(this); + m_task = new TimerTask(this); // The thread expects delays in milliseconds. m_thread->postDelayedTask(adoptPtr(m_task), intervalSeconds * 1000.0); } -void CCTimer::stop() +void Timer::stop() { if (!m_task) return; @@ -7,20 +7,20 @@ namespace cc { -class CCThread; -class CCTimerTask; +class Thread; +class TimerTask; -class CCTimerClient { +class TimerClient { public: - virtual ~CCTimerClient() { } + virtual ~TimerClient() { } virtual void onTimerFired() = 0; }; -class CCTimer { +class Timer { public: - CCTimer(CCThread*, CCTimerClient*); - ~CCTimer(); + Timer(Thread*, TimerClient*); + ~Timer(); // If a previous task is pending, it will be replaced with the new one. void startOneShot(double intervalSeconds); @@ -29,11 +29,11 @@ public: bool isActive() const { return m_task; } private: - friend class CCTimerTask; + friend class TimerTask; - CCTimerClient* m_client; - CCThread* m_thread; - CCTimerTask* m_task; // weak pointer + TimerClient* m_client; + Thread* m_thread; + TimerTask* m_task; // weak pointer }; } // namespace cc diff --git a/cc/timer_unittest.cc b/cc/timer_unittest.cc index 3cc497f..2f16003 100644 --- a/cc/timer_unittest.cc +++ b/cc/timer_unittest.cc @@ -14,20 +14,20 @@ using namespace WebKitTests; namespace { -class CCTimerTest : public testing::Test, public CCTimerClient { +class TimerTest : public testing::Test, public TimerClient { public: - CCTimerTest() : m_flag(false) { } + TimerTest() : m_flag(false) { } void onTimerFired() { m_flag = true; } protected: - FakeCCThread m_thread; + FakeThread m_thread; bool m_flag; }; -TEST_F(CCTimerTest, OneShot) +TEST_F(TimerTest, OneShot) { - CCTimer timer(&m_thread, this); + Timer timer(&m_thread, this); timer.startOneShot(0.001); EXPECT_TRUE(timer.isActive()); m_thread.runPendingTask(); @@ -36,9 +36,9 @@ TEST_F(CCTimerTest, OneShot) EXPECT_FALSE(m_thread.hasPendingTask()); } -TEST_F(CCTimerTest, StopManually) +TEST_F(TimerTest, StopManually) { - CCTimer timer(&m_thread, this); + Timer timer(&m_thread, this); timer.startOneShot(0.001); EXPECT_TRUE(timer.isActive()); timer.stop(); @@ -49,10 +49,10 @@ TEST_F(CCTimerTest, StopManually) EXPECT_FALSE(m_thread.hasPendingTask()); } -TEST_F(CCTimerTest, StopByScope) +TEST_F(TimerTest, StopByScope) { { - CCTimer timer(&m_thread, this); + Timer timer(&m_thread, this); timer.startOneShot(0.001); } diff --git a/cc/timing_function.cc b/cc/timing_function.cc index 3a4ecd4..b64602e 100644 --- a/cc/timing_function.cc +++ b/cc/timing_function.cc @@ -12,63 +12,63 @@ const double epsilon = 1e-6; namespace cc { -CCTimingFunction::CCTimingFunction() +TimingFunction::TimingFunction() { } -CCTimingFunction::~CCTimingFunction() +TimingFunction::~TimingFunction() { } -double CCTimingFunction::duration() const +double TimingFunction::duration() const { return 1.0; } -scoped_ptr<CCCubicBezierTimingFunction> CCCubicBezierTimingFunction::create(double x1, double y1, double x2, double y2) +scoped_ptr<CubicBezierTimingFunction> CubicBezierTimingFunction::create(double x1, double y1, double x2, double y2) { - return make_scoped_ptr(new CCCubicBezierTimingFunction(x1, y1, x2, y2)); + return make_scoped_ptr(new CubicBezierTimingFunction(x1, y1, x2, y2)); } -CCCubicBezierTimingFunction::CCCubicBezierTimingFunction(double x1, double y1, double x2, double y2) +CubicBezierTimingFunction::CubicBezierTimingFunction(double x1, double y1, double x2, double y2) : m_curve(x1, y1, x2, y2) { } -CCCubicBezierTimingFunction::~CCCubicBezierTimingFunction() +CubicBezierTimingFunction::~CubicBezierTimingFunction() { } -float CCCubicBezierTimingFunction::getValue(double x) const +float CubicBezierTimingFunction::getValue(double x) const { UnitBezier temp(m_curve); return static_cast<float>(temp.solve(x, epsilon)); } -scoped_ptr<CCAnimationCurve> CCCubicBezierTimingFunction::clone() const +scoped_ptr<AnimationCurve> CubicBezierTimingFunction::clone() const { - return make_scoped_ptr(new CCCubicBezierTimingFunction(*this)).PassAs<CCAnimationCurve>(); + return make_scoped_ptr(new CubicBezierTimingFunction(*this)).PassAs<AnimationCurve>(); } // These numbers come from http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. -scoped_ptr<CCTimingFunction> CCEaseTimingFunction::create() +scoped_ptr<TimingFunction> EaseTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1).PassAs<CCTimingFunction>(); + return CubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1).PassAs<TimingFunction>(); } -scoped_ptr<CCTimingFunction> CCEaseInTimingFunction::create() +scoped_ptr<TimingFunction> EaseInTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0.42, 0, 1.0, 1).PassAs<CCTimingFunction>(); + return CubicBezierTimingFunction::create(0.42, 0, 1.0, 1).PassAs<TimingFunction>(); } -scoped_ptr<CCTimingFunction> CCEaseOutTimingFunction::create() +scoped_ptr<TimingFunction> EaseOutTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0, 0, 0.58, 1).PassAs<CCTimingFunction>(); + return CubicBezierTimingFunction::create(0, 0, 0.58, 1).PassAs<TimingFunction>(); } -scoped_ptr<CCTimingFunction> CCEaseInOutTimingFunction::create() +scoped_ptr<TimingFunction> EaseInOutTimingFunction::create() { - return CCCubicBezierTimingFunction::create(0.42, 0, 0.58, 1).PassAs<CCTimingFunction>(); + return CubicBezierTimingFunction::create(0.42, 0, 0.58, 1).PassAs<TimingFunction>(); } } // namespace cc diff --git a/cc/timing_function.h b/cc/timing_function.h index 993ab87..3d99539 100644 --- a/cc/timing_function.h +++ b/cc/timing_function.h @@ -11,50 +11,50 @@ namespace cc { // See http://www.w3.org/TR/css3-transitions/. -class CCTimingFunction : public CCFloatAnimationCurve { +class TimingFunction : public FloatAnimationCurve { public: - virtual ~CCTimingFunction(); + virtual ~TimingFunction(); - // Partial implementation of CCFloatAnimationCurve. + // Partial implementation of FloatAnimationCurve. virtual double duration() const OVERRIDE; protected: - CCTimingFunction(); + TimingFunction(); }; -class CCCubicBezierTimingFunction : public CCTimingFunction { +class CubicBezierTimingFunction : public TimingFunction { public: - static scoped_ptr<CCCubicBezierTimingFunction> create(double x1, double y1, double x2, double y2); - virtual ~CCCubicBezierTimingFunction(); + static scoped_ptr<CubicBezierTimingFunction> create(double x1, double y1, double x2, double y2); + virtual ~CubicBezierTimingFunction(); - // Partial implementation of CCFloatAnimationCurve. + // Partial implementation of FloatAnimationCurve. virtual float getValue(double time) const OVERRIDE; - virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; + virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; protected: - CCCubicBezierTimingFunction(double x1, double y1, double x2, double y2); + CubicBezierTimingFunction(double x1, double y1, double x2, double y2); UnitBezier m_curve; }; -class CCEaseTimingFunction { +class EaseTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static scoped_ptr<TimingFunction> create(); }; -class CCEaseInTimingFunction { +class EaseInTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static scoped_ptr<TimingFunction> create(); }; -class CCEaseOutTimingFunction { +class EaseOutTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static scoped_ptr<TimingFunction> create(); }; -class CCEaseInOutTimingFunction { +class EaseInOutTimingFunction { public: - static scoped_ptr<CCTimingFunction> create(); + static scoped_ptr<TimingFunction> create(); }; } // namespace cc diff --git a/cc/tree_synchronizer.cc b/cc/tree_synchronizer.cc index 201d0f4..386bc71 100644 --- a/cc/tree_synchronizer.cc +++ b/cc/tree_synchronizer.cc @@ -14,99 +14,99 @@ namespace cc { -scoped_ptr<CCLayerImpl> TreeSynchronizer::synchronizeTrees(LayerChromium* layerChromiumRoot, scoped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeHostImpl* hostImpl) { - ScopedPtrCCLayerImplMap oldLayers; - RawPtrCCLayerImplMap newLayers; + ScopedPtrLayerImplMap oldLayers; + RawPtrLayerImplMap newLayers; - collectExistingCCLayerImplRecursive(oldLayers, oldCCLayerImplRoot.Pass()); + collectExistingLayerImplRecursive(oldLayers, oldLayerImplRoot.Pass()); - scoped_ptr<CCLayerImpl> newTree = synchronizeTreeRecursive(newLayers, oldLayers, layerChromiumRoot, hostImpl); + scoped_ptr<LayerImpl> newTree = synchronizeTreeRecursive(newLayers, oldLayers, layerRoot, hostImpl); - updateScrollbarLayerPointersRecursive(newLayers, layerChromiumRoot); + updateScrollbarLayerPointersRecursive(newLayers, layerRoot); return newTree.Pass(); } -void TreeSynchronizer::collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& oldLayers, scoped_ptr<CCLayerImpl> ccLayerImpl) +void TreeSynchronizer::collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& oldLayers, scoped_ptr<LayerImpl> layerImpl) { - if (!ccLayerImpl) + if (!layerImpl) return; - ScopedPtrVector<CCLayerImpl>& children = ccLayerImpl->m_children; + ScopedPtrVector<LayerImpl>& children = layerImpl->m_children; for (size_t i = 0; i < children.size(); ++i) - collectExistingCCLayerImplRecursive(oldLayers, children.take(i)); + collectExistingLayerImplRecursive(oldLayers, children.take(i)); - collectExistingCCLayerImplRecursive(oldLayers, ccLayerImpl->m_maskLayer.Pass()); - collectExistingCCLayerImplRecursive(oldLayers, ccLayerImpl->m_replicaLayer.Pass()); + collectExistingLayerImplRecursive(oldLayers, layerImpl->m_maskLayer.Pass()); + collectExistingLayerImplRecursive(oldLayers, layerImpl->m_replicaLayer.Pass()); - int id = ccLayerImpl->id(); - oldLayers.set(id, ccLayerImpl.Pass()); + int id = layerImpl->id(); + oldLayers.set(id, layerImpl.Pass()); } -scoped_ptr<CCLayerImpl> TreeSynchronizer::reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium* layer) +scoped_ptr<LayerImpl> TreeSynchronizer::reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer) { - scoped_ptr<CCLayerImpl> ccLayerImpl = oldLayers.take(layer->id()); + scoped_ptr<LayerImpl> layerImpl = oldLayers.take(layer->id()); - if (!ccLayerImpl) - ccLayerImpl = layer->createCCLayerImpl(); + if (!layerImpl) + layerImpl = layer->createLayerImpl(); - newLayers[layer->id()] = ccLayerImpl.get(); - return ccLayerImpl.Pass(); + newLayers[layer->id()] = layerImpl.get(); + return layerImpl.Pass(); } -scoped_ptr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium* layer, CCLayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeHostImpl* hostImpl) { if (!layer) - return scoped_ptr<CCLayerImpl>(); + return scoped_ptr<LayerImpl>(); - scoped_ptr<CCLayerImpl> ccLayerImpl = reuseOrCreateCCLayerImpl(newLayers, oldLayers, layer); + scoped_ptr<LayerImpl> layerImpl = reuseOrCreateLayerImpl(newLayers, oldLayers, layer); - ccLayerImpl->clearChildList(); - const std::vector<scoped_refptr<LayerChromium> >& children = layer->children(); + layerImpl->clearChildList(); + const std::vector<scoped_refptr<Layer> >& children = layer->children(); for (size_t i = 0; i < children.size(); ++i) - ccLayerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, children[i].get(), hostImpl)); + layerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, children[i].get(), hostImpl)); - ccLayerImpl->setMaskLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->maskLayer(), hostImpl)); - ccLayerImpl->setReplicaLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->replicaLayer(), hostImpl)); + layerImpl->setMaskLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->maskLayer(), hostImpl)); + layerImpl->setReplicaLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->replicaLayer(), hostImpl)); - layer->pushPropertiesTo(ccLayerImpl.get()); - ccLayerImpl->setLayerTreeHostImpl(hostImpl); + layer->pushPropertiesTo(layerImpl.get()); + layerImpl->setLayerTreeHostImpl(hostImpl); // Remove all dangling pointers. The pointers will be setup later in updateScrollbarLayerPointersRecursive phase - if (CCScrollbarAnimationController* scrollbarController = ccLayerImpl->scrollbarAnimationController()) { + if (ScrollbarAnimationController* scrollbarController = layerImpl->scrollbarAnimationController()) { scrollbarController->setHorizontalScrollbarLayer(0); scrollbarController->setVerticalScrollbarLayer(0); } - return ccLayerImpl.Pass(); + return layerImpl.Pass(); } -void TreeSynchronizer::updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap& newLayers, LayerChromium* layer) +void TreeSynchronizer::updateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap& newLayers, Layer* layer) { if (!layer) return; - const std::vector<scoped_refptr<LayerChromium> >& children = layer->children(); + const std::vector<scoped_refptr<Layer> >& children = layer->children(); for (size_t i = 0; i < children.size(); ++i) updateScrollbarLayerPointersRecursive(newLayers, children[i].get()); - ScrollbarLayerChromium* scrollbarLayer = layer->toScrollbarLayerChromium(); + ScrollbarLayer* scrollbarLayer = layer->toScrollbarLayer(); if (!scrollbarLayer) return; - RawPtrCCLayerImplMap::const_iterator iter = newLayers.find(scrollbarLayer->id()); - CCScrollbarLayerImpl* ccScrollbarLayerImpl = iter != newLayers.end() ? static_cast<CCScrollbarLayerImpl*>(iter->second) : NULL; + RawPtrLayerImplMap::const_iterator iter = newLayers.find(scrollbarLayer->id()); + ScrollbarLayerImpl* scrollbarLayerImpl = iter != newLayers.end() ? static_cast<ScrollbarLayerImpl*>(iter->second) : NULL; iter = newLayers.find(scrollbarLayer->scrollLayerId()); - CCLayerImpl* ccScrollLayerImpl = iter != newLayers.end() ? iter->second : NULL; + LayerImpl* scrollLayerImpl = iter != newLayers.end() ? iter->second : NULL; - DCHECK(ccScrollbarLayerImpl); - DCHECK(ccScrollLayerImpl); + DCHECK(scrollbarLayerImpl); + DCHECK(scrollLayerImpl); - if (ccScrollbarLayerImpl->orientation() == WebKit::WebScrollbar::Horizontal) - ccScrollLayerImpl->setHorizontalScrollbarLayer(ccScrollbarLayerImpl); + if (scrollbarLayerImpl->orientation() == WebKit::WebScrollbar::Horizontal) + scrollLayerImpl->setHorizontalScrollbarLayer(scrollbarLayerImpl); else - ccScrollLayerImpl->setVerticalScrollbarLayer(ccScrollbarLayerImpl); + scrollLayerImpl->setVerticalScrollbarLayer(scrollbarLayerImpl); } } // namespace cc diff --git a/cc/tree_synchronizer.h b/cc/tree_synchronizer.h index 2609841..5931a59 100644 --- a/cc/tree_synchronizer.h +++ b/cc/tree_synchronizer.h @@ -11,27 +11,27 @@ namespace cc { -class CCLayerImpl; -class CCLayerTreeHostImpl; -class LayerChromium; +class LayerImpl; +class LayerTreeHostImpl; +class Layer; class TreeSynchronizer { public: - // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tree that duplicates the structure - // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided by oldCCLayerImplRoot if possible. - static scoped_ptr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, scoped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*); + // Accepts a Layer tree and returns a reference to a LayerImpl tree that duplicates the structure + // of the Layer tree, reusing the LayerImpls in the tree provided by oldLayerImplRoot if possible. + static scoped_ptr<LayerImpl> synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeHostImpl*); private: TreeSynchronizer(); // Not instantiable. - typedef ScopedPtrHashMap<int, CCLayerImpl> ScopedPtrCCLayerImplMap; - typedef base::hash_map<int, CCLayerImpl*> RawPtrCCLayerImplMap; + typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap; + typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; - // Declared as static member functions so they can access functions on LayerChromium as a friend class. - static scoped_ptr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*); - static void collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& oldLayers, scoped_ptr<CCLayerImpl>); - static scoped_ptr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHostImpl*); - static void updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap& newLayers, LayerChromium*); + // Declared as static member functions so they can access functions on Layer as a friend class. + static scoped_ptr<LayerImpl> reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*); + static void collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& oldLayers, scoped_ptr<LayerImpl>); + static scoped_ptr<LayerImpl> synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeHostImpl*); + static void updateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap& newLayers, Layer*); DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); }; diff --git a/cc/tree_synchronizer_unittest.cc b/cc/tree_synchronizer_unittest.cc index 288cc20..8344704 100644 --- a/cc/tree_synchronizer_unittest.cc +++ b/cc/tree_synchronizer_unittest.cc @@ -20,64 +20,64 @@ using namespace WebKitTests; namespace { -class MockCCLayerImpl : public CCLayerImpl { +class MockLayerImpl : public LayerImpl { public: - static scoped_ptr<MockCCLayerImpl> create(int layerId) + static scoped_ptr<MockLayerImpl> create(int layerId) { - return make_scoped_ptr(new MockCCLayerImpl(layerId)); + return make_scoped_ptr(new MockLayerImpl(layerId)); } - virtual ~MockCCLayerImpl() + virtual ~MockLayerImpl() { - if (m_ccLayerDestructionList) - m_ccLayerDestructionList->append(id()); + if (m_layerImplDestructionList) + m_layerImplDestructionList->append(id()); } - void setCCLayerDestructionList(Vector<int>* list) { m_ccLayerDestructionList = list; } + void setLayerImplDestructionList(Vector<int>* list) { m_layerImplDestructionList = list; } private: - MockCCLayerImpl(int layerId) - : CCLayerImpl(layerId) - , m_ccLayerDestructionList(0) + MockLayerImpl(int layerId) + : LayerImpl(layerId) + , m_layerImplDestructionList(0) { } - Vector<int>* m_ccLayerDestructionList; + Vector<int>* m_layerImplDestructionList; }; -class MockLayerChromium : public LayerChromium { +class MockLayer : public Layer { public: - static scoped_refptr<MockLayerChromium> create(Vector<int>* ccLayerDestructionList) + static scoped_refptr<MockLayer> create(Vector<int>* layerImplDestructionList) { - return make_scoped_refptr(new MockLayerChromium(ccLayerDestructionList)); + return make_scoped_refptr(new MockLayer(layerImplDestructionList)); } - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE { - return MockCCLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return MockLayerImpl::create(m_layerId).PassAs<LayerImpl>(); } - virtual void pushPropertiesTo(CCLayerImpl* ccLayer) OVERRIDE + virtual void pushPropertiesTo(LayerImpl* layerImpl) OVERRIDE { - LayerChromium::pushPropertiesTo(ccLayer); + Layer::pushPropertiesTo(layerImpl); - MockCCLayerImpl* mockCCLayer = static_cast<MockCCLayerImpl*>(ccLayer); - mockCCLayer->setCCLayerDestructionList(m_ccLayerDestructionList); + MockLayerImpl* mockLayerImpl = static_cast<MockLayerImpl*>(layerImpl); + mockLayerImpl->setLayerImplDestructionList(m_layerImplDestructionList); } private: - MockLayerChromium(Vector<int>* ccLayerDestructionList) - : LayerChromium() - , m_ccLayerDestructionList(ccLayerDestructionList) + MockLayer(Vector<int>* layerImplDestructionList) + : Layer() + , m_layerImplDestructionList(layerImplDestructionList) { } - virtual ~MockLayerChromium() { } + virtual ~MockLayer() { } - Vector<int>* m_ccLayerDestructionList; + Vector<int>* m_layerImplDestructionList; }; -class FakeLayerAnimationController : public CCLayerAnimationController { +class FakeLayerAnimationController : public LayerAnimationController { public: - static scoped_ptr<FakeLayerAnimationController> create(CCLayerAnimationControllerClient* client) + static scoped_ptr<FakeLayerAnimationController> create(LayerAnimationControllerClient* client) { return make_scoped_ptr(new FakeLayerAnimationController(client)); } @@ -85,46 +85,46 @@ public: bool synchronizedAnimations() const { return m_synchronizedAnimations; } private: - explicit FakeLayerAnimationController(CCLayerAnimationControllerClient* client) - : CCLayerAnimationController(client) + explicit FakeLayerAnimationController(LayerAnimationControllerClient* client) + : LayerAnimationController(client) , m_synchronizedAnimations(false) { } - virtual void pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl) + virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl) { - CCLayerAnimationController::pushAnimationUpdatesTo(controllerImpl); + LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); m_synchronizedAnimations = true; } bool m_synchronizedAnimations; }; -void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer, CCLayerTreeHostImpl* hostImpl) +void expectTreesAreIdentical(Layer* layer, LayerImpl* layerImpl, LayerTreeHostImpl* hostImpl) { ASSERT_TRUE(layer); - ASSERT_TRUE(ccLayer); + ASSERT_TRUE(layerImpl); - EXPECT_EQ(layer->id(), ccLayer->id()); - EXPECT_EQ(ccLayer->layerTreeHostImpl(), hostImpl); + EXPECT_EQ(layer->id(), layerImpl->id()); + EXPECT_EQ(layerImpl->layerTreeHostImpl(), hostImpl); - EXPECT_EQ(layer->nonFastScrollableRegion(), ccLayer->nonFastScrollableRegion()); + EXPECT_EQ(layer->nonFastScrollableRegion(), layerImpl->nonFastScrollableRegion()); - ASSERT_EQ(!!layer->maskLayer(), !!ccLayer->maskLayer()); + ASSERT_EQ(!!layer->maskLayer(), !!layerImpl->maskLayer()); if (layer->maskLayer()) - expectTreesAreIdentical(layer->maskLayer(), ccLayer->maskLayer(), hostImpl); + expectTreesAreIdentical(layer->maskLayer(), layerImpl->maskLayer(), hostImpl); - ASSERT_EQ(!!layer->replicaLayer(), !!ccLayer->replicaLayer()); + ASSERT_EQ(!!layer->replicaLayer(), !!layerImpl->replicaLayer()); if (layer->replicaLayer()) - expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer(), hostImpl); + expectTreesAreIdentical(layer->replicaLayer(), layerImpl->replicaLayer(), hostImpl); - const std::vector<scoped_refptr<LayerChromium> >& layerChildren = layer->children(); - const ScopedPtrVector<CCLayerImpl>& ccLayerChildren = ccLayer->children(); + const std::vector<scoped_refptr<Layer> >& layerChildren = layer->children(); + const ScopedPtrVector<LayerImpl>& layerImplChildren = layerImpl->children(); - ASSERT_EQ(layerChildren.size(), ccLayerChildren.size()); + ASSERT_EQ(layerChildren.size(), layerImplChildren.size()); for (size_t i = 0; i < layerChildren.size(); ++i) - expectTreesAreIdentical(layerChildren[i].get(), ccLayerChildren[i], hostImpl); + expectTreesAreIdentical(layerChildren[i].get(), layerImplChildren[i], hostImpl); } // Attempts to synchronizes a null tree. This should not crash, and should @@ -133,9 +133,9 @@ TEST(TreeSynchronizerTest, syncNullTree) { DebugScopedSetImplThread impl; - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, scoped_ptr<CCLayerImpl>(), 0); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(0, scoped_ptr<LayerImpl>(), 0); - EXPECT_TRUE(!ccLayerTreeRoot.get()); + EXPECT_TRUE(!layerImplTreeRoot.get()); } // Constructs a very simple tree and synchronizes it without trying to reuse any preexisting layers. @@ -143,89 +143,89 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) { DebugScopedSetImplThread impl; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); - layerTreeRoot->addChild(LayerChromium::create()); - layerTreeRoot->addChild(LayerChromium::create()); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); + layerTreeRoot->addChild(Layer::create()); + layerTreeRoot->addChild(Layer::create()); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); } // Constructs a very simple tree and synchronizes it attempting to reuse some layers TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) { DebugScopedSetImplThread impl; - Vector<int> ccLayerDestructionList; + Vector<int> layerImplDestructionList; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); - scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); - layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); - layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList); + layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); + layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); - // Add a new layer to the LayerChromium side - layerTreeRoot->children()[0]->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + // Add a new layer to the Layer side + layerTreeRoot->children()[0]->addChild(MockLayer::create(&layerImplDestructionList)); // Remove one. layerTreeRoot->children()[1]->removeFromParent(); - int secondCCLayerId = ccLayerTreeRoot->children()[1]->id(); + int secondLayerImplId = layerImplTreeRoot->children()[1]->id(); - // Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one CCLayerImpl. - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + // Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one LayerImpl. + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); - ASSERT_EQ(1u, ccLayerDestructionList.size()); - EXPECT_EQ(secondCCLayerId, ccLayerDestructionList[0]); + ASSERT_EQ(1u, layerImplDestructionList.size()); + EXPECT_EQ(secondLayerImplId, layerImplDestructionList[0]); } // Constructs a very simple tree and checks that a stacking-order change is tracked properly. TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange) { DebugScopedSetImplThread impl; - Vector<int> ccLayerDestructionList; + Vector<int> layerImplDestructionList; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); // Set up the tree and sync once. child2 needs to be synced here, too, even though we // remove it to set up the intended scenario. - scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); - scoped_refptr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList); - layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList); + scoped_refptr<Layer> child2 = MockLayer::create(&layerImplDestructionList); + layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); layerTreeRoot->addChild(child2); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); - ccLayerTreeRoot->resetAllChangeTrackingForSubtree(); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot->resetAllChangeTrackingForSubtree(); // re-insert the layer and sync again. child2->removeFromParent(); layerTreeRoot->addChild(child2); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); // Check that the impl thread properly tracked the change. - EXPECT_FALSE(ccLayerTreeRoot->layerPropertyChanged()); - EXPECT_FALSE(ccLayerTreeRoot->children()[0]->layerPropertyChanged()); - EXPECT_TRUE(ccLayerTreeRoot->children()[1]->layerPropertyChanged()); + EXPECT_FALSE(layerImplTreeRoot->layerPropertyChanged()); + EXPECT_FALSE(layerImplTreeRoot->children()[0]->layerPropertyChanged()); + EXPECT_TRUE(layerImplTreeRoot->children()[1]->layerPropertyChanged()); } TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) { DebugScopedSetImplThread impl; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); - layerTreeRoot->addChild(LayerChromium::create()); - layerTreeRoot->addChild(LayerChromium::create()); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); + layerTreeRoot->addChild(Layer::create()); + layerTreeRoot->addChild(Layer::create()); // Pick some random properties to set. The values are not important, we're just testing that at least some properties are making it through. FloatPoint rootPosition = FloatPoint(2.3f, 7.4f); @@ -237,48 +237,48 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) IntSize secondChildBounds = IntSize(25, 53); layerTreeRoot->children()[1]->setBounds(secondChildBounds); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); - // Check that the property values we set on the LayerChromium tree are reflected in the CCLayerImpl tree. - FloatPoint rootCCLayerPosition = ccLayerTreeRoot->position(); - EXPECT_EQ(rootPosition.x(), rootCCLayerPosition.x()); - EXPECT_EQ(rootPosition.y(), rootCCLayerPosition.y()); + // Check that the property values we set on the Layer tree are reflected in the LayerImpl tree. + FloatPoint rootLayerImplPosition = layerImplTreeRoot->position(); + EXPECT_EQ(rootPosition.x(), rootLayerImplPosition.x()); + EXPECT_EQ(rootPosition.y(), rootLayerImplPosition.y()); - EXPECT_EQ(firstChildOpacity, ccLayerTreeRoot->children()[0]->opacity()); + EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity()); - IntSize secondCCLayerChildBounds = ccLayerTreeRoot->children()[1]->bounds(); - EXPECT_EQ(secondChildBounds.width(), secondCCLayerChildBounds.width()); - EXPECT_EQ(secondChildBounds.height(), secondCCLayerChildBounds.height()); + IntSize secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bounds(); + EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width()); + EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height()); } -TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) +TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange) { DebugScopedSetImplThread impl; - Vector<int> ccLayerDestructionList; + Vector<int> layerImplDestructionList; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); // Set up a tree with this sort of structure: // root --- A --- B ---+--- C // | // +--- D - scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); - layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList); + layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); - scoped_refptr<LayerChromium> layerA = layerTreeRoot->children()[0].get(); - layerA->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + scoped_refptr<Layer> layerA = layerTreeRoot->children()[0].get(); + layerA->addChild(MockLayer::create(&layerImplDestructionList)); - scoped_refptr<LayerChromium> layerB = layerA->children()[0].get(); - layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + scoped_refptr<Layer> layerB = layerA->children()[0].get(); + layerB->addChild(MockLayer::create(&layerImplDestructionList)); - scoped_refptr<LayerChromium> layerC = layerB->children()[0].get(); - layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList)); - scoped_refptr<LayerChromium> layerD = layerB->children()[1].get(); + scoped_refptr<Layer> layerC = layerB->children()[0].get(); + layerB->addChild(MockLayer::create(&layerImplDestructionList)); + scoped_refptr<Layer> layerD = layerB->children()[1].get(); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); // Now restructure the tree to look like this: // root --- D ---+--- A @@ -294,45 +294,45 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) layerB->removeAllChildren(); layerC->addChild(layerB); - // After another synchronize our trees should match and we should not have destroyed any CCLayerImpls - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + // After another synchronize our trees should match and we should not have destroyed any LayerImpls + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); - EXPECT_EQ(0u, ccLayerDestructionList.size()); + EXPECT_EQ(0u, layerImplDestructionList.size()); } // Constructs a very simple tree, synchronizes it, then synchronizes to a totally new tree. All layers from the old tree should be deleted. TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) { DebugScopedSetImplThread impl; - Vector<int> ccLayerDestructionList; + Vector<int> layerImplDestructionList; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); - scoped_refptr<LayerChromium> oldLayerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); - oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); - oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); + scoped_refptr<Layer> oldLayerTreeRoot = MockLayer::create(&layerImplDestructionList); + oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); + oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); int oldTreeRootLayerId = oldLayerTreeRoot->id(); int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id(); int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id(); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + expectTreesAreIdentical(oldLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); - // Remove all children on the LayerChromium side. + // Remove all children on the Layer side. oldLayerTreeRoot->removeAllChildren(); - // Synchronize again. After the sync all CCLayerImpls from the old tree should be deleted. - scoped_refptr<LayerChromium> newLayerTreeRoot = LayerChromium::create(); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + // Synchronize again. After the sync all LayerImpls from the old tree should be deleted. + scoped_refptr<Layer> newLayerTreeRoot = Layer::create(); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(newLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); - ASSERT_EQ(3u, ccLayerDestructionList.size()); - EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeRootLayerId)); - EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeFirstChildLayerId)); - EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeSecondChildLayerId)); + ASSERT_EQ(3u, layerImplDestructionList.size()); + EXPECT_TRUE(layerImplDestructionList.contains(oldTreeRootLayerId)); + EXPECT_TRUE(layerImplDestructionList.contains(oldTreeFirstChildLayerId)); + EXPECT_TRUE(layerImplDestructionList.contains(oldTreeSecondChildLayerId)); } // Constructs+syncs a tree with mask, replica, and replica mask layers. @@ -340,64 +340,64 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) { DebugScopedSetImplThread impl; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); - layerTreeRoot->addChild(LayerChromium::create()); - layerTreeRoot->addChild(LayerChromium::create()); - layerTreeRoot->addChild(LayerChromium::create()); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); + layerTreeRoot->addChild(Layer::create()); + layerTreeRoot->addChild(Layer::create()); + layerTreeRoot->addChild(Layer::create()); // First child gets a mask layer. - scoped_refptr<LayerChromium> maskLayer = LayerChromium::create(); + scoped_refptr<Layer> maskLayer = Layer::create(); layerTreeRoot->children()[0]->setMaskLayer(maskLayer.get()); // Second child gets a replica layer. - scoped_refptr<LayerChromium> replicaLayer = LayerChromium::create(); + scoped_refptr<Layer> replicaLayer = Layer::create(); layerTreeRoot->children()[1]->setReplicaLayer(replicaLayer.get()); // Third child gets a replica layer with a mask layer. - scoped_refptr<LayerChromium> replicaLayerWithMask = LayerChromium::create(); - scoped_refptr<LayerChromium> replicaMaskLayer = LayerChromium::create(); + scoped_refptr<Layer> replicaLayerWithMask = Layer::create(); + scoped_refptr<Layer> replicaMaskLayer = Layer::create(); replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get()); layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get()); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); // Remove the mask layer. layerTreeRoot->children()[0]->setMaskLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); // Remove the replica layer. layerTreeRoot->children()[1]->setReplicaLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); // Remove the replica mask. replicaLayerWithMask->setMaskLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); } TEST(TreeSynchronizerTest, synchronizeAnimations) { DebugScopedSetImplThread impl; - CCLayerTreeSettings settings; - scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); + LayerTreeSettings settings; + scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); - scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); + scoped_refptr<Layer> layerTreeRoot = Layer::create(); FakeLayerAnimationControllerClient dummy; - layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy).PassAs<CCLayerAnimationController>()); + layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy).PassAs<LayerAnimationController>()); EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); } diff --git a/cc/video_layer.cc b/cc/video_layer.cc index 459c6dc..f661ae9 100644 --- a/cc/video_layer.cc +++ b/cc/video_layer.cc @@ -10,25 +10,25 @@ namespace cc { -scoped_refptr<VideoLayerChromium> VideoLayerChromium::create(WebKit::WebVideoFrameProvider* provider) +scoped_refptr<VideoLayer> VideoLayer::create(WebKit::WebVideoFrameProvider* provider) { - return make_scoped_refptr(new VideoLayerChromium(provider)); + return make_scoped_refptr(new VideoLayer(provider)); } -VideoLayerChromium::VideoLayerChromium(WebKit::WebVideoFrameProvider* provider) - : LayerChromium() +VideoLayer::VideoLayer(WebKit::WebVideoFrameProvider* provider) + : Layer() , m_provider(provider) { DCHECK(m_provider); } -VideoLayerChromium::~VideoLayerChromium() +VideoLayer::~VideoLayer() { } -scoped_ptr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl() +scoped_ptr<LayerImpl> VideoLayer::createLayerImpl() { - return CCVideoLayerImpl::create(m_layerId, m_provider).PassAs<CCLayerImpl>(); + return VideoLayerImpl::create(m_layerId, m_provider).PassAs<LayerImpl>(); } } // namespace cc diff --git a/cc/video_layer.h b/cc/video_layer.h index 9f415f2..5d71fff 100644 --- a/cc/video_layer.h +++ b/cc/video_layer.h @@ -13,20 +13,20 @@ class WebVideoFrameProvider; namespace cc { -class CCVideoLayerImpl; +class VideoLayerImpl; // A Layer that contains a Video element. -class VideoLayerChromium : public LayerChromium { +class VideoLayer : public Layer { public: - static scoped_refptr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*); + static scoped_refptr<VideoLayer> create(WebKit::WebVideoFrameProvider*); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; private: - explicit VideoLayerChromium(WebKit::WebVideoFrameProvider*); - virtual ~VideoLayerChromium(); + explicit VideoLayer(WebKit::WebVideoFrameProvider*); + virtual ~VideoLayer(); - // This pointer is only for passing to CCVideoLayerImpl's constructor. It should never be dereferenced by this class. + // This pointer is only for passing to VideoLayerImpl's constructor. It should never be dereferenced by this class. WebKit::WebVideoFrameProvider* m_provider; }; diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc index 3f0f78b..fd8a924 100644 --- a/cc/video_layer_impl.cc +++ b/cc/video_layer_impl.cc @@ -21,8 +21,8 @@ namespace cc { -CCVideoLayerImpl::CCVideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provider) - : CCLayerImpl(id) +VideoLayerImpl::VideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provider) + : LayerImpl(id) , m_provider(provider) , m_frame(0) , m_externalTextureResource(0) @@ -38,14 +38,14 @@ CCVideoLayerImpl::CCVideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provid // thread is blocked. That makes this a thread-safe call to set the video // frame provider client that does not require a lock. The same is true of // the call in the destructor. - DCHECK(CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isMainThreadBlocked()); m_provider->setVideoFrameProviderClient(this); } -CCVideoLayerImpl::~CCVideoLayerImpl() +VideoLayerImpl::~VideoLayerImpl() { // See comment in constructor for why this doesn't need a lock. - DCHECK(CCProxy::isMainThreadBlocked()); + DCHECK(Proxy::isMainThreadBlocked()); if (m_provider) { m_provider->setVideoFrameProviderClient(0); m_provider = 0; @@ -59,7 +59,7 @@ CCVideoLayerImpl::~CCVideoLayerImpl() #endif } -void CCVideoLayerImpl::stopUsingProvider() +void VideoLayerImpl::stopUsingProvider() { // Block the provider from shutting down until this client is done // using the frame. @@ -86,10 +86,10 @@ static GLenum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) return GL_INVALID_VALUE; } -void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) +void VideoLayerImpl::willDraw(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); - CCLayerImpl::willDraw(resourceProvider); + DCHECK(Proxy::isImplThread()); + LayerImpl::willDraw(resourceProvider); // Explicitly acquire and release the provider mutex so it can be held from // willDraw to didDraw. Since the compositor thread is in the middle of @@ -107,9 +107,9 @@ void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_providerLock.Release(); } -void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) +void VideoLayerImpl::willDrawInternal(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); DCHECK(!m_externalTextureResource); if (!m_provider) { @@ -152,14 +152,14 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_frame->textureId()); } -void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) +void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { - DCHECK(CCProxy::isImplThread()); + DCHECK(Proxy::isImplThread()); if (!m_frame) return; - CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); // FIXME: When we pass quads out of process, we need to double-buffer, or @@ -173,8 +173,8 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe const FramePlane& yPlane = m_framePlanes[WebKit::WebVideoFrame::yPlane]; const FramePlane& uPlane = m_framePlanes[WebKit::WebVideoFrame::uPlane]; const FramePlane& vPlane = m_framePlanes[WebKit::WebVideoFrame::vPlane]; - scoped_ptr<CCYUVVideoDrawQuad> yuvVideoQuad = CCYUVVideoDrawQuad::create(sharedQuadState, quadRect, yPlane, uPlane, vPlane); - quadSink.append(yuvVideoQuad.PassAs<CCDrawQuad>(), appendQuadsData); + scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::create(sharedQuadState, quadRect, yPlane, uPlane, vPlane); + quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData); break; } case GL_RGBA: { @@ -185,8 +185,8 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe bool premultipliedAlpha = true; FloatRect uvRect(0, 0, widthScaleFactor, 1); bool flipped = false; - scoped_ptr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); - quadSink.append(textureQuad.PassAs<CCDrawQuad>(), appendQuadsData); + scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); + quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData); break; } case GL_TEXTURE_2D: { @@ -194,20 +194,20 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe bool premultipliedAlpha = true; FloatRect uvRect(0, 0, 1, 1); bool flipped = false; - scoped_ptr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped); - quadSink.append(textureQuad.PassAs<CCDrawQuad>(), appendQuadsData); + scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped); + quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData); break; } case GL_TEXTURE_RECTANGLE_ARB: { IntSize textureSize(m_frame->width(), m_frame->height()); - scoped_ptr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQuad::Unflipped); - quadSink.append(ioSurfaceQuad.PassAs<CCDrawQuad>(), appendQuadsData); + scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), IOSurfaceDrawQuad::Unflipped); + quadSink.append(ioSurfaceQuad.PassAs<DrawQuad>(), appendQuadsData); break; } case GL_TEXTURE_EXTERNAL_OES: { // StreamTexture hardware decoder. - scoped_ptr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); - quadSink.append(streamVideoQuad.PassAs<CCDrawQuad>(), appendQuadsData); + scoped_ptr<StreamVideoDrawQuad> streamVideoQuad = StreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); + quadSink.append(streamVideoQuad.PassAs<DrawQuad>(), appendQuadsData); break; } default: @@ -215,10 +215,10 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe } } -void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) +void VideoLayerImpl::didDraw(ResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); - CCLayerImpl::didDraw(resourceProvider); + DCHECK(Proxy::isImplThread()); + LayerImpl::didDraw(resourceProvider); if (!m_frame) return; @@ -251,7 +251,7 @@ static bool hasPaddingBytes(const WebKit::WebVideoFrame& frame, unsigned plane) return frame.stride(plane) > videoFrameDimension(frame.width(), plane, frame.format()); } -IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, unsigned plane) +IntSize VideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, unsigned plane) { int visibleWidth = videoFrameDimension(frame.width(), plane, frame.format()); int originalWidth = visibleWidth; @@ -275,16 +275,16 @@ IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, return IntSize(visibleWidth, visibleHeight); } -bool CCVideoLayerImpl::FramePlane::allocateData(CCResourceProvider* resourceProvider) +bool VideoLayerImpl::FramePlane::allocateData(ResourceProvider* resourceProvider) { if (resourceId) return true; - resourceId = resourceProvider->createResource(CCRenderer::ImplPool, size, format, CCResourceProvider::TextureUsageAny); + resourceId = resourceProvider->createResource(Renderer::ImplPool, size, format, ResourceProvider::TextureUsageAny); return resourceId; } -void CCVideoLayerImpl::FramePlane::freeData(CCResourceProvider* resourceProvider) +void VideoLayerImpl::FramePlane::freeData(ResourceProvider* resourceProvider) { if (!resourceId) return; @@ -293,11 +293,11 @@ void CCVideoLayerImpl::FramePlane::freeData(CCResourceProvider* resourceProvider resourceId = 0; } -bool CCVideoLayerImpl::allocatePlaneData(CCResourceProvider* resourceProvider) +bool VideoLayerImpl::allocatePlaneData(ResourceProvider* resourceProvider) { int maxTextureSize = resourceProvider->maxTextureSize(); for (unsigned planeIndex = 0; planeIndex < m_frame->planes(); ++planeIndex) { - CCVideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; + VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; IntSize requiredTextureSize(m_frame->stride(planeIndex), videoFrameDimension(m_frame->height(), planeIndex, m_frame->format())); // FIXME: Remove the test against maxTextureSize when tiled layers are implemented. @@ -319,14 +319,14 @@ bool CCVideoLayerImpl::allocatePlaneData(CCResourceProvider* resourceProvider) return true; } -bool CCVideoLayerImpl::copyPlaneData(CCResourceProvider* resourceProvider) +bool VideoLayerImpl::copyPlaneData(ResourceProvider* resourceProvider) { size_t softwarePlaneCount = m_frame->planes(); if (!softwarePlaneCount) return true; for (size_t softwarePlaneIndex = 0; softwarePlaneIndex < softwarePlaneCount; ++softwarePlaneIndex) { - CCVideoLayerImpl::FramePlane& plane = m_framePlanes[softwarePlaneIndex]; + VideoLayerImpl::FramePlane& plane = m_framePlanes[softwarePlaneIndex]; const uint8_t* softwarePlanePixels = static_cast<const uint8_t*>(m_frame->data(softwarePlaneIndex)); IntRect planeRect(IntPoint(), plane.size); resourceProvider->upload(plane.resourceId, softwarePlanePixels, planeRect, planeRect, IntSize()); @@ -334,25 +334,25 @@ bool CCVideoLayerImpl::copyPlaneData(CCResourceProvider* resourceProvider) return true; } -void CCVideoLayerImpl::freePlaneData(CCResourceProvider* resourceProvider) +void VideoLayerImpl::freePlaneData(ResourceProvider* resourceProvider) { for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i) m_framePlanes[i].freeData(resourceProvider); } -void CCVideoLayerImpl::freeUnusedPlaneData(CCResourceProvider* resourceProvider) +void VideoLayerImpl::freeUnusedPlaneData(ResourceProvider* resourceProvider) { unsigned firstUnusedPlane = m_frame ? m_frame->planes() : 0; for (unsigned i = firstUnusedPlane; i < WebKit::WebVideoFrame::maxPlanes; ++i) m_framePlanes[i].freeData(resourceProvider); } -void CCVideoLayerImpl::didReceiveFrame() +void VideoLayerImpl::didReceiveFrame() { setNeedsRedraw(); } -void CCVideoLayerImpl::didUpdateMatrix(const float matrix[16]) +void VideoLayerImpl::didUpdateMatrix(const float matrix[16]) { m_streamTextureMatrix = WebKit::WebTransformationMatrix( matrix[0], matrix[1], matrix[2], matrix[3], @@ -362,24 +362,24 @@ void CCVideoLayerImpl::didUpdateMatrix(const float matrix[16]) setNeedsRedraw(); } -void CCVideoLayerImpl::didLoseContext() +void VideoLayerImpl::didLoseContext() { freePlaneData(layerTreeHostImpl()->resourceProvider()); } -void CCVideoLayerImpl::setNeedsRedraw() +void VideoLayerImpl::setNeedsRedraw() { layerTreeHostImpl()->setNeedsRedraw(); } -void CCVideoLayerImpl::dumpLayerProperties(std::string* str, int indent) const +void VideoLayerImpl::dumpLayerProperties(std::string* str, int indent) const { str->append(indentString(indent)); str->append("video layer\n"); - CCLayerImpl::dumpLayerProperties(str, indent); + LayerImpl::dumpLayerProperties(str, indent); } -const char* CCVideoLayerImpl::layerTypeAsString() const +const char* VideoLayerImpl::layerTypeAsString() const { return "VideoLayer"; } diff --git a/cc/video_layer_impl.h b/cc/video_layer_impl.h index 6b97643c..54b9273 100644 --- a/cc/video_layer_impl.h +++ b/cc/video_layer_impl.h @@ -19,21 +19,21 @@ class WebVideoFrame; namespace cc { -class CCLayerTreeHostImpl; -class CCVideoLayerImpl; +class LayerTreeHostImpl; +class VideoLayerImpl; -class CCVideoLayerImpl : public CCLayerImpl +class VideoLayerImpl : public LayerImpl , public WebKit::WebVideoFrameProvider::Client { public: - static scoped_ptr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider) + static scoped_ptr<VideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider) { - return make_scoped_ptr(new CCVideoLayerImpl(id, provider)); + return make_scoped_ptr(new VideoLayerImpl(id, provider)); } - virtual ~CCVideoLayerImpl(); + virtual ~VideoLayerImpl(); - virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; - virtual void didDraw(CCResourceProvider*) OVERRIDE; + virtual void willDraw(ResourceProvider*) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; + virtual void didDraw(ResourceProvider*) OVERRIDE; virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; @@ -47,28 +47,28 @@ public: void setNeedsRedraw(); struct FramePlane { - CCResourceProvider::ResourceId resourceId; + ResourceProvider::ResourceId resourceId; IntSize size; GLenum format; IntSize visibleSize; FramePlane() : resourceId(0) { } - bool allocateData(CCResourceProvider*); - void freeData(CCResourceProvider*); + bool allocateData(ResourceProvider*); + void freeData(ResourceProvider*); }; private: - CCVideoLayerImpl(int, WebKit::WebVideoFrameProvider*); + VideoLayerImpl(int, WebKit::WebVideoFrameProvider*); static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane); virtual const char* layerTypeAsString() const OVERRIDE; - void willDrawInternal(CCResourceProvider*); - bool allocatePlaneData(CCResourceProvider*); - bool copyPlaneData(CCResourceProvider*); - void freePlaneData(CCResourceProvider*); - void freeUnusedPlaneData(CCResourceProvider*); + void willDrawInternal(ResourceProvider*); + bool allocatePlaneData(ResourceProvider*); + bool copyPlaneData(ResourceProvider*); + void freePlaneData(ResourceProvider*); + void freeUnusedPlaneData(ResourceProvider*); // Guards the destruction of m_provider and the frame that it provides base::Lock m_providerLock; @@ -78,7 +78,7 @@ private: WebKit::WebVideoFrame* m_frame; GLenum m_format; - CCResourceProvider::ResourceId m_externalTextureResource; + ResourceProvider::ResourceId m_externalTextureResource; // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; diff --git a/cc/yuv_video_draw_quad.cc b/cc/yuv_video_draw_quad.cc index eec671b..53cf950 100644 --- a/cc/yuv_video_draw_quad.cc +++ b/cc/yuv_video_draw_quad.cc @@ -10,23 +10,23 @@ namespace cc { -scoped_ptr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) +scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, const VideoLayerImpl::FramePlane& yPlane, const VideoLayerImpl::FramePlane& uPlane, const VideoLayerImpl::FramePlane& vPlane) { - return make_scoped_ptr(new CCYUVVideoDrawQuad(sharedQuadState, quadRect, yPlane, uPlane, vPlane)); + return make_scoped_ptr(new YUVVideoDrawQuad(sharedQuadState, quadRect, yPlane, uPlane, vPlane)); } -CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) - : CCDrawQuad(sharedQuadState, CCDrawQuad::YUVVideoContent, quadRect) +YUVVideoDrawQuad::YUVVideoDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, const VideoLayerImpl::FramePlane& yPlane, const VideoLayerImpl::FramePlane& uPlane, const VideoLayerImpl::FramePlane& vPlane) + : DrawQuad(sharedQuadState, DrawQuad::YUVVideoContent, quadRect) , m_yPlane(yPlane) , m_uPlane(uPlane) , m_vPlane(vPlane) { } -const CCYUVVideoDrawQuad* CCYUVVideoDrawQuad::materialCast(const CCDrawQuad* quad) +const YUVVideoDrawQuad* YUVVideoDrawQuad::materialCast(const DrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::YUVVideoContent); - return static_cast<const CCYUVVideoDrawQuad*>(quad); + DCHECK(quad->material() == DrawQuad::YUVVideoContent); + return static_cast<const YUVVideoDrawQuad*>(quad); } } // namespace cc diff --git a/cc/yuv_video_draw_quad.h b/cc/yuv_video_draw_quad.h index 5d574b7b..19ed7ce 100644 --- a/cc/yuv_video_draw_quad.h +++ b/cc/yuv_video_draw_quad.h @@ -12,23 +12,23 @@ namespace cc { -class CCYUVVideoDrawQuad : public CCDrawQuad { +class YUVVideoDrawQuad : public DrawQuad { public: - static scoped_ptr<CCYUVVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); + static scoped_ptr<YUVVideoDrawQuad> create(const SharedQuadState*, const IntRect&, const VideoLayerImpl::FramePlane& yPlane, const VideoLayerImpl::FramePlane& uPlane, const VideoLayerImpl::FramePlane& vPlane); - const CCVideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; } - const CCVideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; } - const CCVideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; } + const VideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; } + const VideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; } + const VideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; } - static const CCYUVVideoDrawQuad* materialCast(const CCDrawQuad*); + static const YUVVideoDrawQuad* materialCast(const DrawQuad*); private: - CCYUVVideoDrawQuad(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); + YUVVideoDrawQuad(const SharedQuadState*, const IntRect&, const VideoLayerImpl::FramePlane& yPlane, const VideoLayerImpl::FramePlane& uPlane, const VideoLayerImpl::FramePlane& vPlane); - CCVideoLayerImpl::FramePlane m_yPlane; - CCVideoLayerImpl::FramePlane m_uPlane; - CCVideoLayerImpl::FramePlane m_vPlane; + VideoLayerImpl::FramePlane m_yPlane; + VideoLayerImpl::FramePlane m_uPlane; + VideoLayerImpl::FramePlane m_vPlane; - DISALLOW_COPY_AND_ASSIGN(CCYUVVideoDrawQuad); + DISALLOW_COPY_AND_ASSIGN(YUVVideoDrawQuad); }; } diff --git a/webkit/compositor_bindings/ccthread_impl.cc b/webkit/compositor_bindings/ccthread_impl.cc index bbda140..2df53518 100644 --- a/webkit/compositor_bindings/ccthread_impl.cc +++ b/webkit/compositor_bindings/ccthread_impl.cc @@ -9,8 +9,8 @@ #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebThread.h" -using cc::CCThread; -using cc::CCCompletionEvent; +using cc::Thread; +using cc::CompletionEvent; namespace WebKit { @@ -22,7 +22,7 @@ namespace WebKit { // PassOwnPtrs. class GetThreadIDTask : public WebThread::Task { public: - GetThreadIDTask(base::PlatformThreadId* result, CCCompletionEvent* completion) + GetThreadIDTask(base::PlatformThreadId* result, CompletionEvent* completion) : m_completion(completion) , m_result(result) { } @@ -35,16 +35,16 @@ public: } private: - CCCompletionEvent* m_completion; + CompletionEvent* m_completion; base::PlatformThreadId* m_result; }; -// General adapter from a CCThread::Task to a WebThread::Task. -class CCThreadTaskAdapter : public WebThread::Task { +// General adapter from a Thread::Task to a WebThread::Task. +class ThreadTaskAdapter : public WebThread::Task { public: - explicit CCThreadTaskAdapter(PassOwnPtr<CCThread::Task> task) : m_task(task) { } + explicit ThreadTaskAdapter(PassOwnPtr<Thread::Task> task) : m_task(task) { } - virtual ~CCThreadTaskAdapter() { } + virtual ~ThreadTaskAdapter() { } virtual void run() { @@ -52,31 +52,31 @@ public: } private: - OwnPtr<CCThread::Task> m_task; + OwnPtr<Thread::Task> m_task; }; -scoped_ptr<CCThread> CCThreadImpl::createForCurrentThread() +scoped_ptr<Thread> CCThreadImpl::createForCurrentThread() { - return scoped_ptr<CCThread>(new CCThreadImpl(Platform::current()->currentThread(), true)).Pass(); + return scoped_ptr<Thread>(new CCThreadImpl(Platform::current()->currentThread(), true)).Pass(); } -scoped_ptr<CCThread> CCThreadImpl::createForDifferentThread(WebThread* thread) +scoped_ptr<Thread> CCThreadImpl::createForDifferentThread(WebThread* thread) { - return scoped_ptr<CCThread>(new CCThreadImpl(thread, false)).Pass(); + return scoped_ptr<Thread>(new CCThreadImpl(thread, false)).Pass(); } CCThreadImpl::~CCThreadImpl() { } -void CCThreadImpl::postTask(PassOwnPtr<CCThread::Task> task) +void CCThreadImpl::postTask(PassOwnPtr<Thread::Task> task) { - m_thread->postTask(new CCThreadTaskAdapter(task)); + m_thread->postTask(new ThreadTaskAdapter(task)); } -void CCThreadImpl::postDelayedTask(PassOwnPtr<CCThread::Task> task, long long delayMs) +void CCThreadImpl::postDelayedTask(PassOwnPtr<Thread::Task> task, long long delayMs) { - m_thread->postDelayedTask(new CCThreadTaskAdapter(task), delayMs); + m_thread->postDelayedTask(new ThreadTaskAdapter(task), delayMs); } base::PlatformThreadId CCThreadImpl::threadID() const @@ -94,7 +94,7 @@ CCThreadImpl::CCThreadImpl(WebThread* thread, bool currentThread) // Get the threadId for the newly-created thread by running a task // on that thread, blocking on the result. - CCCompletionEvent completion; + CompletionEvent completion; m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion)); completion.wait(); } diff --git a/webkit/compositor_bindings/ccthread_impl.h b/webkit/compositor_bindings/ccthread_impl.h index bd598a9..259ca4a 100644 --- a/webkit/compositor_bindings/ccthread_impl.h +++ b/webkit/compositor_bindings/ccthread_impl.h @@ -15,18 +15,18 @@ namespace WebKit { class WebThread; -// Implements CCThread in terms of WebThread. -class CCThreadImpl : public cc::CCThread { +// Implements Thread in terms of WebThread. +class CCThreadImpl : public cc::Thread { public: // Creates a CCThreadImpl wrapping the current thread. - static scoped_ptr<cc::CCThread> createForCurrentThread(); + static scoped_ptr<cc::Thread> createForCurrentThread(); - // Creates a CCThread wrapping a non-current WebThread. - static scoped_ptr<cc::CCThread> createForDifferentThread(WebThread*); + // Creates a Thread wrapping a non-current WebThread. + static scoped_ptr<cc::Thread> createForDifferentThread(WebThread*); virtual ~CCThreadImpl(); - virtual void postTask(PassOwnPtr<cc::CCThread::Task>); - virtual void postDelayedTask(PassOwnPtr<cc::CCThread::Task>, long long delayMs); + virtual void postTask(PassOwnPtr<cc::Thread::Task>); + virtual void postDelayedTask(PassOwnPtr<cc::Thread::Task>, long long delayMs); base::PlatformThreadId threadID() const; private: diff --git a/webkit/compositor_bindings/web_animation_curve_common.cc b/webkit/compositor_bindings/web_animation_curve_common.cc index 211cc67..09092bd 100644 --- a/webkit/compositor_bindings/web_animation_curve_common.cc +++ b/webkit/compositor_bindings/web_animation_curve_common.cc @@ -10,21 +10,21 @@ namespace WebKit { -scoped_ptr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType type) +scoped_ptr<cc::TimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType type) { switch (type) { case WebAnimationCurve::TimingFunctionTypeEase: - return cc::CCEaseTimingFunction::create(); + return cc::EaseTimingFunction::create(); case WebAnimationCurve::TimingFunctionTypeEaseIn: - return cc::CCEaseInTimingFunction::create(); + return cc::EaseInTimingFunction::create(); case WebAnimationCurve::TimingFunctionTypeEaseOut: - return cc::CCEaseOutTimingFunction::create(); + return cc::EaseOutTimingFunction::create(); case WebAnimationCurve::TimingFunctionTypeEaseInOut: - return cc::CCEaseInOutTimingFunction::create(); + return cc::EaseInOutTimingFunction::create(); case WebAnimationCurve::TimingFunctionTypeLinear: - return scoped_ptr<cc::CCTimingFunction>(); + return scoped_ptr<cc::TimingFunction>(); } - return scoped_ptr<cc::CCTimingFunction>(); + return scoped_ptr<cc::TimingFunction>(); } } // namespace WebKit diff --git a/webkit/compositor_bindings/web_animation_curve_common.h b/webkit/compositor_bindings/web_animation_curve_common.h index 8a6726b..becfd02 100644 --- a/webkit/compositor_bindings/web_animation_curve_common.h +++ b/webkit/compositor_bindings/web_animation_curve_common.h @@ -9,11 +9,11 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationCurve.h" namespace cc { -class CCTimingFunction; +class TimingFunction; } namespace WebKit { -scoped_ptr<cc::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType); +scoped_ptr<cc::TimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType); } #endif // WebAnimationCurveCommon_h diff --git a/webkit/compositor_bindings/web_animation_impl.cc b/webkit/compositor_bindings/web_animation_impl.cc index 222b18e..4720199 100644 --- a/webkit/compositor_bindings/web_animation_impl.cc +++ b/webkit/compositor_bindings/web_animation_impl.cc @@ -13,7 +13,7 @@ #include "web_float_animation_curve_impl.h" #include "web_transform_animation_curve_impl.h" -using cc::CCActiveAnimation; +using cc::ActiveAnimation; namespace WebKit { @@ -32,20 +32,20 @@ WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp groupId = nextGroupId++; WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); - scoped_ptr<cc::CCAnimationCurve> curve; + scoped_ptr<cc::AnimationCurve> curve; switch (curveType) { case WebAnimationCurve::AnimationCurveTypeFloat: { const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const WebFloatAnimationCurveImpl*>(&webCurve); - curve = floatCurveImpl->cloneToCCAnimationCurve(); + curve = floatCurveImpl->cloneToAnimationCurve(); break; } case WebAnimationCurve::AnimationCurveTypeTransform: { const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<const WebTransformAnimationCurveImpl*>(&webCurve); - curve = transformCurveImpl->cloneToCCAnimationCurve(); + curve = transformCurveImpl->cloneToAnimationCurve(); break; } } - m_animation = CCActiveAnimation::create(curve.Pass(), animationId, groupId, static_cast<cc::CCActiveAnimation::TargetProperty>(targetProperty)); + m_animation = ActiveAnimation::create(curve.Pass(), animationId, groupId, static_cast<cc::ActiveAnimation::TargetProperty>(targetProperty)); } WebAnimationImpl::~WebAnimationImpl() @@ -102,9 +102,9 @@ void WebAnimationImpl::setAlternatesDirection(bool alternates) m_animation->setAlternatesDirection(alternates); } -scoped_ptr<cc::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() +scoped_ptr<cc::ActiveAnimation> WebAnimationImpl::cloneToAnimation() { - scoped_ptr<cc::CCActiveAnimation> toReturn(m_animation->clone(cc::CCActiveAnimation::NonControllingInstance)); + scoped_ptr<cc::ActiveAnimation> toReturn(m_animation->clone(cc::ActiveAnimation::NonControllingInstance)); toReturn->setNeedsSynchronizedStartTime(true); return toReturn.Pass(); } diff --git a/webkit/compositor_bindings/web_animation_impl.h b/webkit/compositor_bindings/web_animation_impl.h index d7312b1..25b054d 100644 --- a/webkit/compositor_bindings/web_animation_impl.h +++ b/webkit/compositor_bindings/web_animation_impl.h @@ -9,7 +9,7 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h" namespace cc { -class CCActiveAnimation; +class ActiveAnimation; } namespace WebKit { @@ -31,10 +31,10 @@ public: virtual bool alternatesDirection() const OVERRIDE; virtual void setAlternatesDirection(bool) OVERRIDE; - scoped_ptr<cc::CCActiveAnimation> cloneToCCAnimation(); + scoped_ptr<cc::ActiveAnimation> cloneToAnimation(); private: - scoped_ptr<cc::CCActiveAnimation> m_animation; + scoped_ptr<cc::ActiveAnimation> m_animation; }; } diff --git a/webkit/compositor_bindings/web_compositor_impl.cc b/webkit/compositor_bindings/web_compositor_impl.cc index fedf1bc..5d0a2e9 100644 --- a/webkit/compositor_bindings/web_compositor_impl.cc +++ b/webkit/compositor_bindings/web_compositor_impl.cc @@ -22,8 +22,8 @@ using namespace cc; namespace WebKit { bool WebCompositorImpl::s_initialized = false; -CCThread* WebCompositorImpl::s_mainThread = 0; -CCThread* WebCompositorImpl::s_implThread = 0; +Thread* WebCompositorImpl::s_mainThread = 0; +Thread* WebCompositorImpl::s_implThread = 0; void WebCompositor::initialize(WebThread* implThread) { @@ -46,12 +46,12 @@ void WebCompositorImpl::initialize(WebThread* implThread) s_initialized = true; s_mainThread = CCThreadImpl::createForCurrentThread().release(); - CCProxy::setMainThread(s_mainThread); + Proxy::setMainThread(s_mainThread); if (implThread) { s_implThread = CCThreadImpl::createForDifferentThread(implThread).release(); - CCProxy::setImplThread(s_implThread); + Proxy::setImplThread(s_implThread); } else - CCProxy::setImplThread(0); + Proxy::setImplThread(0); } bool WebCompositorImpl::isThreadingEnabled() @@ -67,7 +67,7 @@ bool WebCompositorImpl::initialized() void WebCompositorImpl::shutdown() { ASSERT(s_initialized); - ASSERT(!CCLayerTreeHost::anyLayerTreeHostInstanceExists()); + ASSERT(!LayerTreeHost::anyLayerTreeHostInstanceExists()); if (s_implThread) { delete s_implThread; @@ -75,8 +75,8 @@ void WebCompositorImpl::shutdown() } delete s_mainThread; s_mainThread = 0; - CCProxy::setImplThread(0); - CCProxy::setMainThread(0); + Proxy::setImplThread(0); + Proxy::setMainThread(0); s_initialized = false; } diff --git a/webkit/compositor_bindings/web_compositor_impl.h b/webkit/compositor_bindings/web_compositor_impl.h index f07871e..fe63b27 100644 --- a/webkit/compositor_bindings/web_compositor_impl.h +++ b/webkit/compositor_bindings/web_compositor_impl.h @@ -8,7 +8,7 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositor.h" namespace cc { -class CCThread; +class Thread; } namespace WebKit { @@ -25,8 +25,8 @@ public: private: static bool s_initialized; - static cc::CCThread* s_mainThread; - static cc::CCThread* s_implThread; + static cc::Thread* s_mainThread; + static cc::Thread* s_implThread; }; } diff --git a/webkit/compositor_bindings/web_content_layer_impl.cc b/webkit/compositor_bindings/web_content_layer_impl.cc index 09b2415..6ac5916 100644 --- a/webkit/compositor_bindings/web_content_layer_impl.cc +++ b/webkit/compositor_bindings/web_content_layer_impl.cc @@ -26,7 +26,7 @@ WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) } WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) - : m_layer(new WebLayerImpl(ContentLayerChromium::create(this))) + : m_layer(new WebLayerImpl(ContentLayer::create(this))) , m_client(client) { m_layer->layer()->setIsDrawable(true); @@ -34,7 +34,7 @@ WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) WebContentLayerImpl::~WebContentLayerImpl() { - static_cast<ContentLayerChromium*>(m_layer->layer())->clearClient(); + static_cast<ContentLayer*>(m_layer->layer())->clearClient(); } WebLayer* WebContentLayerImpl::layer() diff --git a/webkit/compositor_bindings/web_content_layer_impl.h b/webkit/compositor_bindings/web_content_layer_impl.h index c08a675..dc568d9 100644 --- a/webkit/compositor_bindings/web_content_layer_impl.h +++ b/webkit/compositor_bindings/web_content_layer_impl.h @@ -24,7 +24,7 @@ namespace WebKit { class WebContentLayerClient; class WebContentLayerImpl : public WebContentLayer, - public cc::ContentLayerChromiumClient { + public cc::ContentLayerClient { public: explicit WebContentLayerImpl(WebContentLayerClient*); @@ -39,7 +39,7 @@ public: protected: virtual ~WebContentLayerImpl(); - // ContentLayerChromiumClient implementation. + // ContentLayerClient implementation. virtual void paintContents(SkCanvas*, const cc::IntRect& clip, cc::FloatRect& opaque) OVERRIDE; scoped_ptr<WebLayerImpl> m_layer; diff --git a/webkit/compositor_bindings/web_delegated_renderer_layer_impl.cc b/webkit/compositor_bindings/web_delegated_renderer_layer_impl.cc index f3adf20..9a9f6a7 100644 --- a/webkit/compositor_bindings/web_delegated_renderer_layer_impl.cc +++ b/webkit/compositor_bindings/web_delegated_renderer_layer_impl.cc @@ -12,7 +12,7 @@ using namespace cc; namespace WebKit { WebDelegatedRendererLayerImpl::WebDelegatedRendererLayerImpl() - : m_layer(new WebLayerImpl(DelegatedRendererLayerChromium::create())) + : m_layer(new WebLayerImpl(DelegatedRendererLayer::create())) { } diff --git a/webkit/compositor_bindings/web_external_texture_layer_impl.cc b/webkit/compositor_bindings/web_external_texture_layer_impl.cc index 6fc1dcc..60fb4d2 100644 --- a/webkit/compositor_bindings/web_external_texture_layer_impl.cc +++ b/webkit/compositor_bindings/web_external_texture_layer_impl.cc @@ -25,18 +25,18 @@ WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayer WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client) : m_client(client) { - scoped_refptr<TextureLayerChromium> layer; + scoped_refptr<TextureLayer> layer; if (m_client) - layer = TextureLayerChromium::create(this); + layer = TextureLayer::create(this); else - layer = TextureLayerChromium::create(0); + layer = TextureLayer::create(0); layer->setIsDrawable(true); m_layer.reset(new WebLayerImpl(layer)); } WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { - static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient(); + static_cast<TextureLayer*>(m_layer->layer())->clearClient(); } WebLayer* WebExternalTextureLayerImpl::layer() @@ -46,42 +46,42 @@ WebLayer* WebExternalTextureLayerImpl::layer() void WebExternalTextureLayerImpl::setTextureId(unsigned id) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); + static_cast<TextureLayer*>(m_layer->layer())->setTextureId(id); } void WebExternalTextureLayerImpl::setFlipped(bool flipped) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); + static_cast<TextureLayer*>(m_layer->layer())->setFlipped(flipped); } void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(convert(rect)); + static_cast<TextureLayer*>(m_layer->layer())->setUVRect(convert(rect)); } void WebExternalTextureLayerImpl::setOpaque(bool opaque) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setContentsOpaque(opaque); + static_cast<TextureLayer*>(m_layer->layer())->setContentsOpaque(opaque); } void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha); + static_cast<TextureLayer*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha); } void WebExternalTextureLayerImpl::willModifyTexture() { - static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture(); + static_cast<TextureLayer*>(m_layer->layer())->willModifyTexture(); } void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit); + static_cast<TextureLayer*>(m_layer->layer())->setRateLimitContext(rateLimit); } class WebTextureUpdaterImpl : public WebTextureUpdater { public: - explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) + explicit WebTextureUpdaterImpl(TextureUpdateQueue& queue) : m_queue(queue) { } @@ -93,10 +93,10 @@ public: } private: - CCTextureUpdateQueue& m_queue; + TextureUpdateQueue& m_queue; }; -unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue) +unsigned WebExternalTextureLayerImpl::prepareTexture(TextureUpdateQueue& queue) { ASSERT(m_client); WebTextureUpdaterImpl updaterImpl(queue); diff --git a/webkit/compositor_bindings/web_external_texture_layer_impl.h b/webkit/compositor_bindings/web_external_texture_layer_impl.h index d631058..cf82629 100644 --- a/webkit/compositor_bindings/web_external_texture_layer_impl.h +++ b/webkit/compositor_bindings/web_external_texture_layer_impl.h @@ -14,7 +14,7 @@ namespace WebKit { class WebLayerImpl; class WebExternalTextureLayerImpl : public WebExternalTextureLayer, - public cc::TextureLayerChromiumClient { + public cc::TextureLayerClient { public: explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*); virtual ~WebExternalTextureLayerImpl(); @@ -29,8 +29,8 @@ public: virtual void willModifyTexture() OVERRIDE; virtual void setRateLimitContext(bool) OVERRIDE; - // TextureLayerChromiumClient implementation. - virtual unsigned prepareTexture(cc::CCTextureUpdateQueue&) OVERRIDE; + // TextureLayerClient implementation. + virtual unsigned prepareTexture(cc::TextureUpdateQueue&) OVERRIDE; virtual WebGraphicsContext3D* context() OVERRIDE; private: diff --git a/webkit/compositor_bindings/web_float_animation_curve_impl.cc b/webkit/compositor_bindings/web_float_animation_curve_impl.cc index a3d909e..cbd9a53 100644 --- a/webkit/compositor_bindings/web_float_animation_curve_impl.cc +++ b/webkit/compositor_bindings/web_float_animation_curve_impl.cc @@ -19,7 +19,7 @@ WebFloatAnimationCurve* WebFloatAnimationCurve::create() } WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() - : m_curve(cc::CCKeyframedFloatAnimationCurve::create()) + : m_curve(cc::KeyframedFloatAnimationCurve::create()) { } @@ -39,12 +39,12 @@ void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFunctionType type) { - m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); + m_curve->addKeyframe(cc::FloatKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); } 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::FloatKeyframe::create(keyframe.time, keyframe.value, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFunction>())); } float WebFloatAnimationCurveImpl::getValue(double time) const @@ -52,7 +52,7 @@ float WebFloatAnimationCurveImpl::getValue(double time) const return m_curve->getValue(time); } -scoped_ptr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationCurve() const +scoped_ptr<cc::AnimationCurve> WebFloatAnimationCurveImpl::cloneToAnimationCurve() const { return m_curve->clone(); } diff --git a/webkit/compositor_bindings/web_float_animation_curve_impl.h b/webkit/compositor_bindings/web_float_animation_curve_impl.h index 299190f..b33ca8b 100644 --- a/webkit/compositor_bindings/web_float_animation_curve_impl.h +++ b/webkit/compositor_bindings/web_float_animation_curve_impl.h @@ -9,8 +9,8 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatAnimationCurve.h" namespace cc { -class CCAnimationCurve; -class CCKeyframedFloatAnimationCurve; +class AnimationCurve; +class KeyframedFloatAnimationCurve; } namespace WebKit { @@ -30,10 +30,10 @@ public: virtual float getValue(double time) const OVERRIDE; - scoped_ptr<cc::CCAnimationCurve> cloneToCCAnimationCurve() const; + scoped_ptr<cc::AnimationCurve> cloneToAnimationCurve() const; private: - scoped_ptr<cc::CCKeyframedFloatAnimationCurve> m_curve; + scoped_ptr<cc::KeyframedFloatAnimationCurve> m_curve; }; } diff --git a/webkit/compositor_bindings/web_float_animation_curve_unittest.cc b/webkit/compositor_bindings/web_float_animation_curve_unittest.cc index 04ba715..449a892 100644 --- a/webkit/compositor_bindings/web_float_animation_curve_unittest.cc +++ b/webkit/compositor_bindings/web_float_animation_curve_unittest.cc @@ -116,7 +116,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -143,7 +143,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -157,7 +157,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -171,7 +171,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); @@ -189,7 +189,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)); + scoped_ptr<cc::TimingFunction> timingFunction(cc::CubicBezierTimingFunction::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)); @@ -203,7 +203,7 @@ TEST(WebFloatAnimationCurveTest, DefaultTimingFunction) curve->add(WebFloatKeyframe(0, 0)); curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::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/web_image_layer_impl.cc b/webkit/compositor_bindings/web_image_layer_impl.cc index f72168f..a40391f 100644 --- a/webkit/compositor_bindings/web_image_layer_impl.cc +++ b/webkit/compositor_bindings/web_image_layer_impl.cc @@ -8,7 +8,7 @@ #include "cc/image_layer.h" #include "web_layer_impl.h" -using cc::ImageLayerChromium; +using cc::ImageLayer; namespace WebKit { @@ -18,7 +18,7 @@ WebImageLayer* WebImageLayer::create() } WebImageLayerImpl::WebImageLayerImpl() - : m_layer(new WebLayerImpl(ImageLayerChromium::create())) + : m_layer(new WebLayerImpl(ImageLayer::create())) { } @@ -33,7 +33,7 @@ WebLayer* WebImageLayerImpl::layer() void WebImageLayerImpl::setBitmap(SkBitmap bitmap) { - static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap); + static_cast<ImageLayer*>(m_layer->layer())->setBitmap(bitmap); } } // namespace WebKit diff --git a/webkit/compositor_bindings/web_io_surface_layer_impl.cc b/webkit/compositor_bindings/web_io_surface_layer_impl.cc index 5e0fd9f..ee56546 100644 --- a/webkit/compositor_bindings/web_io_surface_layer_impl.cc +++ b/webkit/compositor_bindings/web_io_surface_layer_impl.cc @@ -9,7 +9,7 @@ #include "webcore_convert.h" #include "web_layer_impl.h" -using cc::IOSurfaceLayerChromium; +using cc::IOSurfaceLayer; namespace WebKit { @@ -19,7 +19,7 @@ WebIOSurfaceLayer* WebIOSurfaceLayer::create() } WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl() - : m_layer(new WebLayerImpl(IOSurfaceLayerChromium::create())) + : m_layer(new WebLayerImpl(IOSurfaceLayer::create())) { m_layer->layer()->setIsDrawable(true); } @@ -30,7 +30,7 @@ WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size) { - static_cast<IOSurfaceLayerChromium*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, convert(size)); + static_cast<IOSurfaceLayer*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, convert(size)); } WebLayer* WebIOSurfaceLayerImpl::layer() diff --git a/webkit/compositor_bindings/web_layer_impl.cc b/webkit/compositor_bindings/web_layer_impl.cc index e476598..a54ae74 100644 --- a/webkit/compositor_bindings/web_layer_impl.cc +++ b/webkit/compositor_bindings/web_layer_impl.cc @@ -19,8 +19,8 @@ #include "web_animation_impl.h" #include "webcore_convert.h" -using cc::CCActiveAnimation; -using cc::LayerChromium; +using cc::ActiveAnimation; +using cc::Layer; namespace WebKit { @@ -66,11 +66,11 @@ WebLayer* WebLayer::create() } WebLayerImpl::WebLayerImpl() - : m_layer(LayerChromium::create()) + : m_layer(Layer::create()) { } -WebLayerImpl::WebLayerImpl(scoped_refptr<LayerChromium> layer) +WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : m_layer(layer) { } @@ -294,7 +294,7 @@ void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate) bool WebLayerImpl::addAnimation(WebAnimation* animation) { - return m_layer->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation()); + return m_layer->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToAnimation()); } void WebLayerImpl::removeAnimation(int animationId) @@ -304,7 +304,7 @@ void WebLayerImpl::removeAnimation(int animationId) void WebLayerImpl::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty) { - m_layer->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty)); + m_layer->layerAnimationController()->removeAnimation(animationId, static_cast<ActiveAnimation::TargetProperty>(targetProperty)); } void WebLayerImpl::pauseAnimation(int animationId, double timeOffset) @@ -433,7 +433,7 @@ void WebLayerImpl::setScrollClient(WebLayerScrollClient* scrollClient) m_layer->setLayerScrollClient(scrollClient); } -LayerChromium* WebLayerImpl::layer() const +Layer* WebLayerImpl::layer() const { return m_layer.get(); } diff --git a/webkit/compositor_bindings/web_layer_impl.h b/webkit/compositor_bindings/web_layer_impl.h index 88a433f..01a7baf 100644 --- a/webkit/compositor_bindings/web_layer_impl.h +++ b/webkit/compositor_bindings/web_layer_impl.h @@ -9,7 +9,7 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" namespace cc { -class LayerChromium; +class Layer; } namespace WebKit { @@ -17,7 +17,7 @@ namespace WebKit { class WebLayerImpl : public WebLayer { public: WebLayerImpl(); - explicit WebLayerImpl(scoped_refptr<cc::LayerChromium>); + explicit WebLayerImpl(scoped_refptr<cc::Layer>); virtual ~WebLayerImpl(); // WebLayer implementation. @@ -90,10 +90,10 @@ public: virtual bool fixedToContainerLayer() const; virtual void setScrollClient(WebLayerScrollClient*) OVERRIDE; - cc::LayerChromium* layer() const; + cc::Layer* layer() const; protected: - scoped_refptr<cc::LayerChromium> m_layer; + scoped_refptr<cc::Layer> m_layer; }; } // namespace WebKit diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl.cc b/webkit/compositor_bindings/web_layer_tree_view_impl.cc index 0e27512..e61a166 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl.cc +++ b/webkit/compositor_bindings/web_layer_tree_view_impl.cc @@ -44,7 +44,7 @@ WebLayerTreeViewImpl::~WebLayerTreeViewImpl() bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSettings) { - CCLayerTreeSettings settings; + LayerTreeSettings settings; settings.acceleratePainting = webSettings.acceleratePainting; settings.showFPSCounter = webSettings.showFPSCounter; settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; @@ -53,7 +53,7 @@ bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti settings.refreshRate = webSettings.refreshRate; settings.defaultTileSize = convert(webSettings.defaultTileSize); settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize); - m_layerTreeHost = CCLayerTreeHost::create(this, settings); + m_layerTreeHost = LayerTreeHost::create(this, settings); if (!m_layerTreeHost.get()) return false; return true; @@ -71,7 +71,7 @@ void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) void WebLayerTreeViewImpl::clearRootLayer() { - m_layerTreeHost->setRootLayer(scoped_refptr<LayerChromium>()); + m_layerTreeHost->setRootLayer(scoped_refptr<Layer>()); } void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize) @@ -144,7 +144,7 @@ bool WebLayerTreeViewImpl::commitRequested() const void WebLayerTreeViewImpl::composite() { - if (CCProxy::hasImplThread()) + if (Proxy::hasImplThread()) m_layerTreeHost->setNeedsCommit(); else m_layerTreeHost->composite(); @@ -167,7 +167,7 @@ void WebLayerTreeViewImpl::finishAllRendering() void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const { - CCRenderingStats ccStats; + RenderingStats ccStats; m_layerTreeHost->renderingStats(&ccStats); stats.numAnimationFrames = ccStats.numAnimationFrames; @@ -186,7 +186,7 @@ void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT IntRect asciiToRectTable[128]; for (int i = 0; i < 128; ++i) asciiToRectTable[i] = convert(asciiToWebRectTable[i]); - scoped_ptr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable, fontHeight); + scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable, fontHeight); m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); } @@ -230,9 +230,9 @@ void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) m_client->didRecreateOutputSurface(success); } -scoped_ptr<CCInputHandler> WebLayerTreeViewImpl::createInputHandler() +scoped_ptr<InputHandler> WebLayerTreeViewImpl::createInputHandler() { - scoped_ptr<CCInputHandler> ret; + scoped_ptr<InputHandler> ret; scoped_ptr<WebInputHandler> handler(m_client->createInputHandler()); if (handler) ret = WebToCCInputHandlerAdapter::create(handler.Pass()); diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl.h b/webkit/compositor_bindings/web_layer_tree_view_impl.h index f9b9e11..9b0ecbf 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl.h +++ b/webkit/compositor_bindings/web_layer_tree_view_impl.h @@ -10,7 +10,7 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" namespace cc { -class CCLayerTreeHost; +class LayerTreeHost; } namespace WebKit { @@ -18,7 +18,7 @@ class WebLayer; class WebLayerTreeViewClient; class WebLayerTreeViewClientAdapter; -class WebLayerTreeViewImpl : public WebLayerTreeView, public cc::CCLayerTreeHostClient { +class WebLayerTreeViewImpl : public WebLayerTreeView, public cc::LayerTreeHostClient { public: explicit WebLayerTreeViewImpl(WebLayerTreeViewClient*); virtual ~WebLayerTreeViewImpl(); @@ -50,7 +50,7 @@ public: virtual void setFontAtlas(SkBitmap, WebRect asciiToRectTable[128], int fontHeight) OVERRIDE; virtual void loseCompositorContext(int numTimes) OVERRIDE; - // cc::CCLayerTreeHostClient implementation. + // cc::LayerTreeHostClient implementation. virtual void willBeginFrame() OVERRIDE; virtual void didBeginFrame() OVERRIDE; virtual void animate(double monotonicFrameBeginTime) OVERRIDE; @@ -58,7 +58,7 @@ public: virtual void applyScrollAndScale(const cc::IntSize& scrollDelta, float pageScale) OVERRIDE; virtual scoped_ptr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE; virtual void didRecreateOutputSurface(bool success) OVERRIDE; - virtual scoped_ptr<cc::CCInputHandler> createInputHandler() OVERRIDE; + virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; virtual void willCommit() OVERRIDE; virtual void didCommit() OVERRIDE; virtual void didCommitAndDrawFrame() OVERRIDE; @@ -67,7 +67,7 @@ public: private: WebLayerTreeViewClient* m_client; - scoped_ptr<cc::CCLayerTreeHost> m_layerTreeHost; + scoped_ptr<cc::LayerTreeHost> m_layerTreeHost; }; } // namespace WebKit diff --git a/webkit/compositor_bindings/web_scrollbar_layer_impl.cc b/webkit/compositor_bindings/web_scrollbar_layer_impl.cc index 0b80806..c9fffb6 100644 --- a/webkit/compositor_bindings/web_scrollbar_layer_impl.cc +++ b/webkit/compositor_bindings/web_scrollbar_layer_impl.cc @@ -8,7 +8,7 @@ #include "cc/scrollbar_layer.h" #include "web_layer_impl.h" -using cc::ScrollbarLayerChromium; +using cc::ScrollbarLayer; namespace WebKit { @@ -19,7 +19,7 @@ WebScrollbarLayer* WebScrollbarLayer::create(WebScrollbar* scrollbar, WebScrollb WebScrollbarLayerImpl::WebScrollbarLayerImpl(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) - : m_layer(new WebLayerImpl(ScrollbarLayerChromium::create(make_scoped_ptr(scrollbar), painter, make_scoped_ptr(geometry), 0))) + : m_layer(new WebLayerImpl(ScrollbarLayer::create(make_scoped_ptr(scrollbar), painter, make_scoped_ptr(geometry), 0))) { } @@ -35,7 +35,7 @@ WebLayer* WebScrollbarLayerImpl::layer() void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer) { int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; - static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id); + static_cast<ScrollbarLayer*>(m_layer->layer())->setScrollLayerId(id); } diff --git a/webkit/compositor_bindings/web_solid_color_layer_impl.cc b/webkit/compositor_bindings/web_solid_color_layer_impl.cc index 177d657..62f8c8d 100644 --- a/webkit/compositor_bindings/web_solid_color_layer_impl.cc +++ b/webkit/compositor_bindings/web_solid_color_layer_impl.cc @@ -8,7 +8,7 @@ #include "cc/solid_color_layer.h" #include "web_layer_impl.h" -using cc::SolidColorLayerChromium; +using cc::SolidColorLayer; namespace WebKit { @@ -18,7 +18,7 @@ WebSolidColorLayer* WebSolidColorLayer::create() } WebSolidColorLayerImpl::WebSolidColorLayerImpl() - : m_layer(new WebLayerImpl(SolidColorLayerChromium::create())) + : m_layer(new WebLayerImpl(SolidColorLayer::create())) { m_layer->layer()->setIsDrawable(true); } diff --git a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc index 31341de..3bb1b27 100644 --- a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc +++ b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc @@ -14,11 +14,11 @@ #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \ COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), mismatching_enums) -COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CCInputHandlerClient::ScrollOnMainThread); -COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInputHandlerClient::ScrollStarted); -COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInputHandlerClient::ScrollIgnored); -COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCInputHandlerClient::Gesture); -COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInputHandlerClient::Wheel); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, InputHandlerClient::ScrollOnMainThread); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, InputHandlerClient::ScrollStarted); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, InputHandlerClient::ScrollIgnored); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, InputHandlerClient::Gesture); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, InputHandlerClient::Wheel); namespace WebKit { @@ -38,7 +38,7 @@ WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient { public: - ClientAdapter(cc::CCInputHandlerClient* client) + ClientAdapter(cc::InputHandlerClient* client) : m_client(client) { } @@ -49,7 +49,7 @@ public: virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERRIDE { - return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(convert(point), static_cast<cc::CCInputHandlerClient::ScrollInputType>(type))); + return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(convert(point), static_cast<cc::InputHandlerClient::ScrollInputType>(type))); } virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE @@ -92,11 +92,11 @@ public: } private: - cc::CCInputHandlerClient* m_client; + cc::InputHandlerClient* m_client; }; -void WebToCCInputHandlerAdapter::bindToClient(cc::CCInputHandlerClient* client) +void WebToCCInputHandlerAdapter::bindToClient(cc::InputHandlerClient* client) { m_clientAdapter.reset(new ClientAdapter(client)); m_handler->bindToClient(m_clientAdapter.get()); diff --git a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.h b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.h index 7cbf3244..359b591 100644 --- a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.h +++ b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.h @@ -11,13 +11,13 @@ namespace WebKit { -class WebToCCInputHandlerAdapter : public cc::CCInputHandler { +class WebToCCInputHandlerAdapter : public cc::InputHandler { public: static scoped_ptr<WebToCCInputHandlerAdapter> create(scoped_ptr<WebInputHandler>); virtual ~WebToCCInputHandlerAdapter(); - // cc::CCInputHandler implementation. - virtual void bindToClient(cc::CCInputHandlerClient*) OVERRIDE; + // cc::InputHandler implementation. + virtual void bindToClient(cc::InputHandlerClient*) OVERRIDE; virtual void animate(double monotonicTime) OVERRIDE; private: diff --git a/webkit/compositor_bindings/web_transform_animation_curve_impl.cc b/webkit/compositor_bindings/web_transform_animation_curve_impl.cc index 139ae05..07c75f3 100644 --- a/webkit/compositor_bindings/web_transform_animation_curve_impl.cc +++ b/webkit/compositor_bindings/web_transform_animation_curve_impl.cc @@ -18,7 +18,7 @@ WebTransformAnimationCurve* WebTransformAnimationCurve::create() } WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() - : m_curve(cc::CCKeyframedTransformAnimationCurve::create()) + : m_curve(cc::KeyframedTransformAnimationCurve::create()) { } @@ -38,12 +38,12 @@ void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, TimingFunctionType type) { - m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); + m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); } 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::TransformKeyframe::create(keyframe.time, keyframe.value, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFunction>())); } WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) const @@ -51,7 +51,7 @@ WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co return m_curve->getValue(time); } -scoped_ptr<cc::CCAnimationCurve> WebTransformAnimationCurveImpl::cloneToCCAnimationCurve() const +scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationCurve() const { return m_curve->clone(); } diff --git a/webkit/compositor_bindings/web_transform_animation_curve_impl.h b/webkit/compositor_bindings/web_transform_animation_curve_impl.h index 51a8011..94ba09f 100644 --- a/webkit/compositor_bindings/web_transform_animation_curve_impl.h +++ b/webkit/compositor_bindings/web_transform_animation_curve_impl.h @@ -9,8 +9,8 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformAnimationCurve.h" namespace cc { -class CCAnimationCurve; -class CCKeyframedTransformAnimationCurve; +class AnimationCurve; +class KeyframedTransformAnimationCurve; } namespace WebKit { @@ -30,10 +30,10 @@ public: virtual WebTransformationMatrix getValue(double time) const OVERRIDE; - scoped_ptr<cc::CCAnimationCurve> cloneToCCAnimationCurve() const; + scoped_ptr<cc::AnimationCurve> cloneToAnimationCurve() const; private: - scoped_ptr<cc::CCKeyframedTransformAnimationCurve> m_curve; + scoped_ptr<cc::KeyframedTransformAnimationCurve> m_curve; }; } diff --git a/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc b/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc index f278b85..2ca4e48 100644 --- a/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc +++ b/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc @@ -153,7 +153,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -188,7 +188,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -206,7 +206,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -224,7 +224,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()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); @@ -246,7 +246,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)); + scoped_ptr<cc::TimingFunction> timingFunction(cc::CubicBezierTimingFunction::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()); @@ -264,7 +264,7 @@ TEST(WebTransformAnimationCurveTest, DefaultTimingFunction) curve->add(WebTransformKeyframe(0, operations1)); curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - scoped_ptr<cc::CCTimingFunction> timingFunction(cc::CCEaseTimingFunction::create()); + scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); diff --git a/webkit/compositor_bindings/web_video_layer_impl.cc b/webkit/compositor_bindings/web_video_layer_impl.cc index 34cb1f6..95f16c6 100644 --- a/webkit/compositor_bindings/web_video_layer_impl.cc +++ b/webkit/compositor_bindings/web_video_layer_impl.cc @@ -16,7 +16,7 @@ WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider) } WebVideoLayerImpl::WebVideoLayerImpl(WebVideoFrameProvider* provider) - : m_layer(new WebLayerImpl(cc::VideoLayerChromium::create(provider))) + : m_layer(new WebLayerImpl(cc::VideoLayer::create(provider))) { } |