diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 07:22:45 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 07:22:45 +0000 |
commit | ead39c5d73da35d0e0e4e9c1a02c53ec3727cb53 (patch) | |
tree | b42ce1909161c94b5e72eae7bd4a6ec878d5c6b7 /cc | |
parent | 46ad823d93a1223e34ea3160284d45163ab7a2d0 (diff) | |
download | chromium_src-ead39c5d73da35d0e0e4e9c1a02c53ec3727cb53.zip chromium_src-ead39c5d73da35d0e0e4e9c1a02c53ec3727cb53.tar.gz chromium_src-ead39c5d73da35d0e0e4e9c1a02c53ec3727cb53.tar.bz2 |
cc: Make the ScopedPtrVector and ScopedPtrDeque containers act like STL vector and deque.
These classes used methods to match the webcore classes and ease
migration. Now they are at odds with the STL versions of these containers.
Rename the methods, and change arguments from indexes to iterators, to
match the STL containers.
isEmpty() => empty()
last() => back()
first() => front()
Peek() => at()
append() => push_back()
insert(index, value) => insert(iterator, value)
remove(index) => erase(iterator) and erase(iterator, iterator)
take(index) => take(iterator)
takeFront() => take_front()
takeBack() => take_back()
Review URL: https://chromiumcodereview.appspot.com/11418108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175722 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
29 files changed, 293 insertions, 174 deletions
@@ -203,6 +203,7 @@ 'scheduler.h', 'scheduler_state_machine.cc', 'scheduler_state_machine.h', + 'scoped_ptr_algorithm.h', 'scoped_ptr_deque.h', 'scoped_ptr_hash_map.h', 'scoped_ptr_vector.h', diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc index bedf550..46edccf 100644 --- a/cc/delegated_renderer_layer_impl.cc +++ b/cc/delegated_renderer_layer_impl.cc @@ -24,7 +24,7 @@ DelegatedRendererLayerImpl::~DelegatedRendererLayerImpl() bool DelegatedRendererLayerImpl::hasDelegatedContent() const { - return !m_renderPassesInDrawOrder.isEmpty(); + return !m_renderPassesInDrawOrder.empty(); } bool DelegatedRendererLayerImpl::hasContributingDelegatedRenderPasses() const @@ -38,19 +38,19 @@ bool DelegatedRendererLayerImpl::hasContributingDelegatedRenderPasses() const void DelegatedRendererLayerImpl::setRenderPasses(ScopedPtrVector<RenderPass>& renderPassesInDrawOrder) { gfx::RectF oldRootDamage; - if (!m_renderPassesInDrawOrder.isEmpty()) - oldRootDamage = m_renderPassesInDrawOrder.last()->damage_rect; + if (!m_renderPassesInDrawOrder.empty()) + oldRootDamage = m_renderPassesInDrawOrder.back()->damage_rect; clearRenderPasses(); for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { m_renderPassesIndexById.insert(std::pair<RenderPass::Id, int>(renderPassesInDrawOrder[i]->id, i)); - m_renderPassesInDrawOrder.append(renderPassesInDrawOrder.take(i)); + m_renderPassesInDrawOrder.push_back(renderPassesInDrawOrder.take(renderPassesInDrawOrder.begin() + i)); } renderPassesInDrawOrder.clear(); - if (!m_renderPassesInDrawOrder.isEmpty()) - m_renderPassesInDrawOrder.last()->damage_rect.Union(oldRootDamage); + if (!m_renderPassesInDrawOrder.empty()) + m_renderPassesInDrawOrder.back()->damage_rect.Union(oldRootDamage); } void DelegatedRendererLayerImpl::clearRenderPasses() @@ -102,7 +102,7 @@ void DelegatedRendererLayerImpl::appendContributingRenderPasses(RenderPassSink& void DelegatedRendererLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { - if (m_renderPassesInDrawOrder.isEmpty()) + if (m_renderPassesInDrawOrder.empty()) return; RenderPass::Id targetRenderPassId = appendQuadsData.renderPassId; @@ -116,7 +116,7 @@ void DelegatedRendererLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData // Verify that the renderPass we are appending to is created our renderTarget. DCHECK(targetRenderPassId.layer_id == renderTarget()->id()); - const RenderPass* rootDelegatedRenderPass = m_renderPassesInDrawOrder.last(); + const RenderPass* rootDelegatedRenderPass = m_renderPassesInDrawOrder.back(); appendRenderPassQuads(quadSink, appendQuadsData, rootDelegatedRenderPass); } else { // Verify that the renderPass we are appending to was created by us. @@ -141,7 +141,7 @@ void DelegatedRendererLayerImpl::appendRenderPassQuads(QuadSink& quadSink, Appen bool targetIsFromDelegatedRendererLayer = appendQuadsData.renderPassId.layer_id == id(); if (!targetIsFromDelegatedRendererLayer) { // Should be the root render pass. - DCHECK(delegatedRenderPass == m_renderPassesInDrawOrder.last()); + DCHECK(delegatedRenderPass == m_renderPassesInDrawOrder.back()); // This layer must be drawing to a renderTarget other than itself. DCHECK(renderTarget() != this); diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc index e96cc41..027b09a 100644 --- a/cc/direct_renderer.cc +++ b/cc/direct_renderer.cc @@ -162,7 +162,7 @@ void DirectRenderer::drawFrame(RenderPassList& renderPassesInDrawOrder) TRACE_EVENT0("cc", "DirectRenderer::drawFrame"); HISTOGRAM_COUNTS("Renderer4.renderPassCount", renderPassesInDrawOrder.size()); - const RenderPass* rootRenderPass = renderPassesInDrawOrder.last(); + const RenderPass* rootRenderPass = renderPassesInDrawOrder.back(); DCHECK(rootRenderPass); DrawingFrame frame; diff --git a/cc/gl_renderer_pixeltest.cc b/cc/gl_renderer_pixeltest.cc index d1d7334..1c63777 100644 --- a/cc/gl_renderer_pixeltest.cc +++ b/cc/gl_renderer_pixeltest.cc @@ -139,10 +139,10 @@ TEST_F(GLRendererPixelTest, simpleGreenRect) { scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); color_quad->SetNew(shared_state.get(), rect, SK_ColorGREEN); - pass->quad_list.append(color_quad.PassAs<DrawQuad>()); + pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); RenderPassList pass_list; - pass_list.append(pass.Pass()); + pass_list.push_back(pass.Pass()); renderer_->drawFrame(pass_list); @@ -171,19 +171,19 @@ TEST_F(GLRendererPixelTest, RenderPassChangesSize) { scoped_ptr<SolidColorDrawQuad> yellow = SolidColorDrawQuad::Create(); yellow->SetNew(shared_state.get(), gfx::Rect(100, 0, 100, 200), SK_ColorYELLOW); - child_pass->quad_list.append(blue.PassAs<DrawQuad>()); - child_pass->quad_list.append(yellow.PassAs<DrawQuad>()); + child_pass->quad_list.push_back(blue.PassAs<DrawQuad>()); + child_pass->quad_list.push_back(yellow.PassAs<DrawQuad>()); scoped_ptr<SharedQuadState> pass_shared_state = CreateTestSharedQuadState(gfx::Transform(), pass_rect); - root_pass->quad_list.append( + root_pass->quad_list.push_back( CreateTestRenderPassDrawQuad(pass_shared_state.get(), pass_rect, child_pass_id)); RenderPassList pass_list; - pass_list.append(child_pass.Pass()); - pass_list.append(root_pass.Pass()); + pass_list.push_back(child_pass.Pass()); + pass_list.push_back(root_pass.Pass()); renderer_->setEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75)); renderer_->decideRenderPassAllocationsForFrame(pass_list); diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index 5a355dd..34f9972 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -72,7 +72,7 @@ public: RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId(); scoped_ptr<RenderPass> rootRenderPass = RenderPass::Create(); rootRenderPass->SetNew(renderPassId, gfx::Rect(), gfx::Rect(), gfx::Transform()); - m_renderPassesInDrawOrder.append(rootRenderPass.Pass()); + m_renderPassesInDrawOrder.push_back(rootRenderPass.Pass()); } // RendererClient methods. @@ -92,7 +92,7 @@ public: int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; } void setLastCallWasSetVisibilityPointer(bool* lastCallWasSetVisibility) { m_lastCallWasSetVisibility = lastCallWasSetVisibility; } - RenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.last(); } + RenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.back(); } RenderPassList& renderPassesInDrawOrder() { return m_renderPassesInDrawOrder; } size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } diff --git a/cc/keyframed_animation_curve.cc b/cc/keyframed_animation_curve.cc index 9cf0ef3..ef03357 100644 --- a/cc/keyframed_animation_curve.cc +++ b/cc/keyframed_animation_curve.cc @@ -15,16 +15,16 @@ void insertKeyframe(scoped_ptr<Keyframe> keyframe, ScopedPtrVector<Keyframe>& ke { // Usually, the keyframes will be added in order, so this loop would be unnecessary and // we should skip it if possible. - if (!keyframes.isEmpty() && keyframe->time() < keyframes.last()->time()) { + if (!keyframes.empty() && keyframe->time() < keyframes.back()->time()) { for (size_t i = 0; i < keyframes.size(); ++i) { if (keyframe->time() < keyframes[i]->time()) { - keyframes.insert(i, keyframe.Pass()); + keyframes.insert(keyframes.begin() + i, keyframe.Pass()); return; } } } - keyframes.append(keyframe.Pass()); + keyframes.push_back(keyframe.Pass()); } scoped_ptr<TimingFunction> cloneTimingFunction(const TimingFunction* timingFunction) @@ -132,7 +132,7 @@ void KeyframedFloatAnimationCurve::addKeyframe(scoped_ptr<FloatKeyframe> keyfram double KeyframedFloatAnimationCurve::duration() const { - return m_keyframes.last()->time() - m_keyframes.first()->time(); + return m_keyframes.back()->time() - m_keyframes.front()->time(); } scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::clone() const @@ -145,11 +145,11 @@ scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::clone() const float KeyframedFloatAnimationCurve::getValue(double t) const { - if (t <= m_keyframes.first()->time()) - return m_keyframes.first()->value(); + if (t <= m_keyframes.front()->time()) + return m_keyframes.front()->value(); - if (t >= m_keyframes.last()->time()) - return m_keyframes.last()->value(); + if (t >= m_keyframes.back()->time()) + return m_keyframes.back()->value(); size_t i = 0; for (; i < m_keyframes.size() - 1; ++i) { @@ -185,7 +185,7 @@ void KeyframedTransformAnimationCurve::addKeyframe(scoped_ptr<TransformKeyframe> double KeyframedTransformAnimationCurve::duration() const { - return m_keyframes.last()->time() - m_keyframes.first()->time(); + return m_keyframes.back()->time() - m_keyframes.front()->time(); } scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::clone() const @@ -198,11 +198,11 @@ scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::clone() const WebTransformationMatrix KeyframedTransformAnimationCurve::getValue(double t) const { - if (t <= m_keyframes.first()->time()) - return m_keyframes.first()->value().apply(); + if (t <= m_keyframes.front()->time()) + return m_keyframes.front()->value().apply(); - if (t >= m_keyframes.last()->time()) - return m_keyframes.last()->value().apply(); + if (t >= m_keyframes.back()->time()) + return m_keyframes.back()->value().apply(); size_t i = 0; for (; i < m_keyframes.size() - 1; ++i) { diff --git a/cc/layer_animation_controller.cc b/cc/layer_animation_controller.cc index 1e7d1c1..d5ed278 100644 --- a/cc/layer_animation_controller.cc +++ b/cc/layer_animation_controller.cc @@ -4,10 +4,13 @@ #include "cc/layer_animation_controller.h" +#include <algorithm> + #include "cc/animation.h" #include "cc/animation_registrar.h" #include "cc/keyframed_animation_curve.h" #include "cc/layer_animation_value_observer.h" +#include "cc/scoped_ptr_algorithm.h" #include "ui/gfx/transform.h" namespace { @@ -63,25 +66,32 @@ void LayerAnimationController::pauseAnimation(int animationId, double timeOffset } } +struct HasAnimationId { + HasAnimationId(int id) : m_id(id) { } + bool operator()(Animation* animation) const { return animation->id() == m_id; } +private: + int m_id; +}; + void LayerAnimationController::removeAnimation(int animationId) { - for (size_t i = 0; i < m_activeAnimations.size();) { - if (m_activeAnimations[i]->id() == animationId) - m_activeAnimations.remove(i); - else - i++; - } + ScopedPtrVector<Animation>& animations = m_activeAnimations; + animations.erase(cc::remove_if(animations, animations.begin(), animations.end(), HasAnimationId(animationId)), animations.end()); updateActivation(); } +struct HasAnimationIdAndProperty { + HasAnimationIdAndProperty(int id, Animation::TargetProperty targetProperty) : m_id(id), m_targetProperty(targetProperty) { } + bool operator()(Animation* animation) const { return animation->id() == m_id && animation->targetProperty() == m_targetProperty; } +private: + int m_id; + Animation::TargetProperty m_targetProperty; +}; + void LayerAnimationController::removeAnimation(int animationId, Animation::TargetProperty targetProperty) { - for (size_t i = 0; i < m_activeAnimations.size();) { - if (m_activeAnimations[i]->id() == animationId && m_activeAnimations[i]->targetProperty() == targetProperty) - m_activeAnimations.remove(i); - else - i++; - } + ScopedPtrVector<Animation>& animations = m_activeAnimations; + animations.erase(cc::remove_if(animations, animations.begin(), animations.end(), HasAnimationIdAndProperty(animationId, targetProperty)), animations.end()); updateActivation(); } @@ -143,7 +153,7 @@ void LayerAnimationController::animate(double monotonicTime, AnimationEventsVect void LayerAnimationController::addAnimation(scoped_ptr<Animation> animation) { - m_activeAnimations.append(animation.Pass()); + m_activeAnimations.push_back(animation.Pass()); updateActivation(); } @@ -245,18 +255,20 @@ void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr } } +struct IsCompleted { + IsCompleted(const LayerAnimationController& mainThreadController) : m_mainThreadController(mainThreadController) { } + bool operator()(Animation* animation) const { return !m_mainThreadController.getAnimation(animation->group(), animation->targetProperty()); } +private: + const LayerAnimationController& m_mainThreadController; +}; + 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();) { - Animation* current = getAnimation(controllerImpl->m_activeAnimations[i]->group(), controllerImpl->m_activeAnimations[i]->targetProperty()); - if (!current) - controllerImpl->m_activeAnimations.remove(i); - else - i++; - } + ScopedPtrVector<Animation>& animations = controllerImpl->m_activeAnimations; + animations.erase(cc::remove_if(animations, animations.begin(), animations.end(), IsCompleted(*this)), animations.end()); } void LayerAnimationController::pushPropertiesToImplThread(LayerAnimationController* controllerImpl) const @@ -390,14 +402,12 @@ void LayerAnimationController::markAnimationsForDeletion(double monotonicTime, A } } +static bool isWaitingForDeletion(Animation* animation) { return animation->runState() == Animation::WaitingForDeletion; } + void LayerAnimationController::purgeAnimationsMarkedForDeletion() { - for (size_t i = 0; i < m_activeAnimations.size();) { - if (m_activeAnimations[i]->runState() == Animation::WaitingForDeletion) - m_activeAnimations.remove(i); - else - i++; - } + ScopedPtrVector<Animation>& animations = m_activeAnimations; + animations.erase(cc::remove_if(animations, animations.begin(), animations.end(), isWaitingForDeletion), animations.end()); } void LayerAnimationController::replaceImplThreadAnimations(LayerAnimationController* controllerImpl) const @@ -462,11 +472,11 @@ void LayerAnimationController::tickAnimations(double monotonicTime) void LayerAnimationController::updateActivation(bool force) { if (m_registrar) { - if (!m_activeAnimations.isEmpty() && (!m_isActive || force)) + if (!m_activeAnimations.empty() && (!m_isActive || force)) m_registrar->DidActivateAnimationController(this); - else if (m_activeAnimations.isEmpty() && (m_isActive || force)) + else if (m_activeAnimations.empty() && (m_isActive || force)) m_registrar->DidDeactivateAnimationController(this); - m_isActive = !m_activeAnimations.isEmpty(); + m_isActive = !m_activeAnimations.empty(); } } diff --git a/cc/layer_animation_controller.h b/cc/layer_animation_controller.h index f083218..786887b 100644 --- a/cc/layer_animation_controller.h +++ b/cc/layer_animation_controller.h @@ -62,7 +62,7 @@ public: bool hasActiveAnimation() const; // Returns true if there are any animations at all to process. - bool hasAnyAnimation() const { return !m_activeAnimations.isEmpty(); } + bool hasAnyAnimation() const { return !m_activeAnimations.empty(); } // 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. diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index 9840eff..16f685c 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -74,16 +74,16 @@ void LayerImpl::addChild(scoped_ptr<LayerImpl> child) { child->setParent(this); DCHECK_EQ(layerTreeImpl(), child->layerTreeImpl()); - m_children.append(child.Pass()); + m_children.push_back(child.Pass()); layerTreeImpl()->SetNeedsUpdateDrawProperties(); } scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child) { - for (size_t i = 0; i < m_children.size(); ++i) { - if (m_children[i] == child) { - scoped_ptr<LayerImpl> ret = m_children.take(i); - m_children.remove(i); + for (ScopedPtrVector<LayerImpl>::iterator it = m_children.begin(); it != m_children.end(); ++it) { + if (*it == child) { + scoped_ptr<LayerImpl> ret = m_children.take(it); + m_children.erase(it); layerTreeImpl()->SetNeedsUpdateDrawProperties(); return ret.Pass(); } @@ -99,7 +99,7 @@ void LayerImpl::removeAllChildren() void LayerImpl::clearChildList() { - if (m_children.isEmpty()) + if (m_children.empty()) return; m_children.clear(); diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index 9c217b0..e07ca93 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -429,7 +429,7 @@ void LayerTreeHostImpl::updateDrawProperties() void LayerTreeHostImpl::FrameData::appendRenderPass(scoped_ptr<RenderPass> renderPass) { renderPassesById[renderPass->id] = renderPass.get(); - renderPasses.append(renderPass.Pass()); + renderPasses.push_back(renderPass.Pass()); } static void appendQuadsForLayer(RenderPass* targetRenderPass, LayerImpl* layer, OcclusionTrackerImpl& occlusionTracker, AppendQuadsData& appendQuadsData) @@ -520,7 +520,7 @@ static void appendQuadsToFillScreen(RenderPass* targetRenderPass, LayerImpl* roo bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame) { - DCHECK(frame.renderPasses.isEmpty()); + DCHECK(frame.renderPasses.empty()); if (!canDraw() || !rootLayer()) return false; @@ -616,8 +616,8 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame) #endif if (!activeTree()->has_transparent_background()) { - frame.renderPasses.last()->has_transparent_background = false; - appendQuadsToFillScreen(frame.renderPasses.last(), rootLayer(), activeTree()->background_color(), occlusionTracker); + frame.renderPasses.back()->has_transparent_background = false; + appendQuadsToFillScreen(frame.renderPasses.back(), rootLayer(), activeTree()->background_color(), occlusionTracker); } if (drawFrame) @@ -661,9 +661,8 @@ static void removeRenderPassesRecursive(RenderPass::Id removeRenderPassId, Layer DCHECK(toRemove != renderPasses.end()); - size_t index = toRemove - renderPasses.begin(); - scoped_ptr<RenderPass> removedPass = renderPasses.take(index); - frame.renderPasses.remove(index); + scoped_ptr<RenderPass> removedPass = renderPasses.take(toRemove); + frame.renderPasses.erase(toRemove); frame.renderPassesById.erase(removeRenderPassId); // Now follow up for all RenderPass quads and remove their RenderPasses recursively. @@ -880,7 +879,7 @@ void LayerTreeHostImpl::drawLayers(FrameData& frame) { TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); DCHECK(canDraw()); - DCHECK(!frame.renderPasses.isEmpty()); + DCHECK(!frame.renderPasses.empty()); // FIXME: use the frame begin time from the overall compositor scheduler. // This value is currently inaccessible because it is up in Chromium's @@ -897,7 +896,7 @@ void LayerTreeHostImpl::drawLayers(FrameData& frame) m_renderer->drawFrame(frame.renderPasses); // The render passes should be consumed by the renderer. - DCHECK(frame.renderPasses.isEmpty()); + DCHECK(frame.renderPasses.empty()); frame.renderPassesById.clear(); // The next frame should start by assuming nothing has changed, and changes are noted as they occur. diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 4bc8be7..60ef892 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -3797,7 +3797,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova } } testData.renderPassesById[renderPassId] = renderPass.get(); - testData.renderPasses.insert(0, renderPass.PassAs<RenderPass>()); + testData.renderPasses.insert(testData.renderPasses.begin(), renderPass.PassAs<RenderPass>()); if (*currentChar) currentChar++; } @@ -4389,7 +4389,7 @@ protected: ASSERT_EQ(1u, frame.renderPasses.size()); // Verify the damage rect for the root render pass. - const RenderPass* rootRenderPass = frame.renderPasses.last(); + const RenderPass* rootRenderPass = frame.renderPasses.back(); EXPECT_RECT_EQ(expectedDamage, rootRenderPass->damage_rect); // Verify the root layer's quad is generated and not being culled. diff --git a/cc/layer_tree_host_unittest_context.cc b/cc/layer_tree_host_unittest_context.cc index 4e93ca8..cbd2dd3 100644 --- a/cc/layer_tree_host_unittest_context.cc +++ b/cc/layer_tree_host_unittest_context.cc @@ -693,15 +693,15 @@ class LayerTreeHostContextTestDontUseLostResources : pass->AppendOneOfEveryQuadType(resource_provider); ScopedPtrVector<RenderPass> pass_list; - pass_list.append(pass_for_quad.PassAs<RenderPass>()); - pass_list.append(pass.PassAs<RenderPass>()); + pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); + pass_list.push_back(pass.PassAs<RenderPass>()); // First child is the delegated layer. DelegatedRendererLayerImpl* delegated_impl = static_cast<DelegatedRendererLayerImpl*>( host_impl->rootLayer()->children()[0]); delegated_impl->setRenderPasses(pass_list); - EXPECT_TRUE(pass_list.isEmpty()); + EXPECT_TRUE(pass_list.empty()); color_video_frame_ = VideoFrame::CreateColorFrame( gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc index e07fa03..ca0c926 100644 --- a/cc/layer_tree_impl.cc +++ b/cc/layer_tree_impl.cc @@ -157,7 +157,7 @@ const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { gfx::Size LayerTreeImpl::ContentSize() const { // TODO(aelias): Hardcoding the first child here is weird. Think of // a cleaner way to get the contentBounds on the Impl side. - if (!root_scroll_layer() || root_scroll_layer()->children().isEmpty()) + if (!root_scroll_layer() || root_scroll_layer()->children().empty()) return gfx::Size(); return root_scroll_layer()->children()[0]->contentBounds(); } diff --git a/cc/picture_layer_tiling_set.cc b/cc/picture_layer_tiling_set.cc index 9edf847..e4bbd57 100644 --- a/cc/picture_layer_tiling_set.cc +++ b/cc/picture_layer_tiling_set.cc @@ -20,10 +20,10 @@ void PictureLayerTilingSet::CloneAll( tilings_.clear(); tilings_.reserve(other.tilings_.size()); for (size_t i = 0; i < other.tilings_.size(); ++i) { - tilings_.append(other.tilings_[i]->Clone()); - tilings_.last()->SetLayerBounds(LayerBounds()); - tilings_.last()->SetClient(client_); - tilings_.last()->Invalidate(invalidation); + tilings_.push_back(other.tilings_[i]->Clone()); + tilings_.back()->SetLayerBounds(LayerBounds()); + tilings_.back()->SetClient(client_); + tilings_.back()->Invalidate(invalidation); } } @@ -34,9 +34,9 @@ void PictureLayerTilingSet::Clone( for (size_t i = 0; i < tilings_.size(); ++i) DCHECK_NE(tilings_[i]->contents_scale(), tiling->contents_scale()); - tilings_.append(tiling->Clone()); - tilings_.last()->SetClient(client_); - tilings_.last()->Invalidate(invalidation); + tilings_.push_back(tiling->Clone()); + tilings_.back()->SetClient(client_); + tilings_.back()->Invalidate(invalidation); } void PictureLayerTilingSet::SetLayerBounds(gfx::Size layer_bounds) { @@ -54,10 +54,10 @@ gfx::Size PictureLayerTilingSet::LayerBounds() const { const PictureLayerTiling* PictureLayerTilingSet::AddTiling( float contents_scale, gfx::Size tile_size) { - tilings_.append(PictureLayerTiling::Create(contents_scale, tile_size)); - tilings_.last()->SetClient(client_); - tilings_.last()->SetLayerBounds(layer_bounds_); - return tilings_.last(); + tilings_.push_back(PictureLayerTiling::Create(contents_scale, tile_size)); + tilings_.back()->SetClient(client_); + tilings_.back()->SetLayerBounds(layer_bounds_); + return tilings_.back(); } void PictureLayerTilingSet::Reset() { diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc index a0358b7..416d481 100644 --- a/cc/quad_culler.cc +++ b/cc/quad_culler.cc @@ -31,7 +31,7 @@ SharedQuadState* QuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> shar { // FIXME: If all quads are culled for the sharedQuadState, we can drop it from the list. m_currentSharedQuadState = sharedQuadState.get(); - m_sharedQuadStateList.append(sharedQuadState.Pass()); + m_sharedQuadStateList.push_back(sharedQuadState.Pass()); return m_currentSharedQuadState; } @@ -51,11 +51,11 @@ static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: float width = DebugColors::CulledTileBorderWidth(layer ? layer->layerTreeImpl() : NULL); scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQuad::Create(); debugBorderQuad->SetNew(drawQuad->shared_quad_state, drawQuad->visible_rect, color, width); - quadList.append(debugBorderQuad.PassAs<DrawQuad>()); + quadList.push_back(debugBorderQuad.PassAs<DrawQuad>()); } // Pass the quad after we're done using it. - quadList.append(drawQuad.Pass()); + quadList.push_back(drawQuad.Pass()); } return keepQuad; } @@ -63,8 +63,8 @@ static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQuadsData) { DCHECK(drawQuad->shared_quad_state == m_currentSharedQuadState); - DCHECK(!m_sharedQuadStateList.isEmpty()); - DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState); + DCHECK(!m_sharedQuadStateList.empty()); + DCHECK(m_sharedQuadStateList.back() == m_currentSharedQuadState); gfx::Rect culledRect; bool hasOcclusionFromOutsideTargetSurface; diff --git a/cc/render_pass.cc b/cc/render_pass.cc index b3c1ede..24f1cd5 100644 --- a/cc/render_pass.cc +++ b/cc/render_pass.cc @@ -44,8 +44,8 @@ void RenderPass::SetNew(Id id, this->damage_rect = damage_rect; this->transform_to_root_target = transform_to_root_target; - DCHECK(quad_list.isEmpty()); - DCHECK(shared_quad_state_list.isEmpty()); + DCHECK(quad_list.empty()); + DCHECK(shared_quad_state_list.empty()); } void RenderPass::SetAll(Id id, @@ -65,8 +65,8 @@ void RenderPass::SetAll(Id id, this->has_occlusion_from_outside_target_surface = has_occlusion_from_outside_target_surface; - DCHECK(quad_list.isEmpty()); - DCHECK(shared_quad_state_list.isEmpty()); + DCHECK(quad_list.empty()); + DCHECK(shared_quad_state_list.empty()); } } // namespace cc diff --git a/cc/render_pass_unittest.cc b/cc/render_pass_unittest.cc index f769483..52b0064 100644 --- a/cc/render_pass_unittest.cc +++ b/cc/render_pass_unittest.cc @@ -53,8 +53,8 @@ TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) pass->AppendSharedQuadState(sharedState.Pass()); scoped_ptr<CheckerboardDrawQuad> checkerboardQuad = CheckerboardDrawQuad::Create(); - checkerboardQuad->SetNew(pass->shared_quad_state_list.last(), gfx::Rect(), SkColor()); - pass->quad_list.append(checkerboardQuad.PassAs<DrawQuad>()); + checkerboardQuad->SetNew(pass->shared_quad_state_list.back(), gfx::Rect(), SkColor()); + pass->quad_list.push_back(checkerboardQuad.PassAs<DrawQuad>()); RenderPass::Id newId(63, 4); diff --git a/cc/render_surface_unittest.cc b/cc/render_surface_unittest.cc index 7728e4b..2cfcd43 100644 --- a/cc/render_surface_unittest.cc +++ b/cc/render_surface_unittest.cc @@ -115,7 +115,7 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) class TestRenderPassSink : public RenderPassSink { public: - virtual void appendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.append(renderPass.Pass()); } + virtual void appendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.push_back(renderPass.Pass()); } const ScopedPtrVector<RenderPass>& renderPasses() const { return m_renderPasses; } diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc index 869c518..400cb2f 100644 --- a/cc/resource_provider_unittest.cc +++ b/cc/resource_provider_unittest.cc @@ -196,7 +196,7 @@ public: memcpy(pending->mailbox, mailbox, sizeof(pending->mailbox)); pending->texture = m_textures.take(m_currentTexture); m_textures.set(m_currentTexture, scoped_ptr<Texture>()); - m_pendingProduceTextures.append(pending.Pass()); + m_pendingProduceTextures.push_back(pending.Pass()); } virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) diff --git a/cc/scoped_ptr_algorithm.h b/cc/scoped_ptr_algorithm.h new file mode 100644 index 0000000..2972b00 --- /dev/null +++ b/cc/scoped_ptr_algorithm.h @@ -0,0 +1,30 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_SCOPED_PTR_ALGORITHM_H_ +#define CC_SCOPED_PTR_ALGORITHM_H_ + +namespace cc { + +// ScopedContainers need to implement a swap() method since they do not allow +// assignment to their iterators. +template <class ForwardIterator, class Predicate, class ScopedContainer> +ForwardIterator remove_if( + ScopedContainer& container, + ForwardIterator first, + ForwardIterator last, + Predicate predicate) { + ForwardIterator result = first; + for (; first != last; ++first) { + if (!predicate(*first)) { + container.swap(first, result); + ++result; + } + } + return result; +} + +} // namespace cc + +#endif // CC_SCOPED_PTR_ALGORITHM_H_ diff --git a/cc/scoped_ptr_deque.h b/cc/scoped_ptr_deque.h index 64f09a8..f5eddea 100644 --- a/cc/scoped_ptr_deque.h +++ b/cc/scoped_ptr_deque.h @@ -18,10 +18,24 @@ namespace cc { template <typename T> class ScopedPtrDeque { public: - typedef typename std::deque<T*>::iterator iterator; typedef typename std::deque<T*>::const_iterator const_iterator; typedef typename std::deque<T*>::reverse_iterator reverse_iterator; - typedef typename std::deque<T*>::const_reverse_iterator const_reverse_iterator; + typedef typename std::deque<T*>::const_reverse_iterator + const_reverse_iterator; + +#if defined(OS_ANDROID) + // On Android the iterator is not a class, so we can't block assignment. + typedef typename std::deque<T*>::iterator iterator; +#else + // Ban setting values on the iterator directly. New pointers must be passed + // to methods on the ScopedPtrDeque class to appear in the deque. + class iterator : public std::deque<T*>::iterator { + public: + iterator(const typename std::deque<T*>::iterator& other) + : std::deque<T*>::iterator(other) {} + T* const& operator*() { return std::deque<T*>::iterator::operator*(); } + }; +#endif ScopedPtrDeque() {} @@ -31,37 +45,37 @@ class ScopedPtrDeque { return data_.size(); } - T* Peek(size_t index) const { + T* at(size_t index) const { DCHECK(index < size()); return data_[index]; } T* operator[](size_t index) const { - return Peek(index); + return at(index); } - T* first() const { - DCHECK(!isEmpty()); - return Peek(0); + T* front() const { + DCHECK(!empty()); + return at(0); } - T* last() const { - DCHECK(!isEmpty()); - return Peek(size() - 1); + T* back() const { + DCHECK(!empty()); + return at(size() - 1); } - bool isEmpty() const { - return size() == 0; + bool empty() const { + return data_.empty(); } - scoped_ptr<T> takeFirst() { - scoped_ptr<T> ret(first()); + scoped_ptr<T> take_front() { + scoped_ptr<T> ret(front()); data_.pop_front(); return ret.Pass(); } - scoped_ptr<T> takeLast() { - scoped_ptr<T> ret(last()); + scoped_ptr<T> take_back() { + scoped_ptr<T> ret(back()); data_.pop_back(); return ret.Pass(); } @@ -70,18 +84,32 @@ class ScopedPtrDeque { STLDeleteElements(&data_); } - void append(scoped_ptr<T> item) { + void push_front(scoped_ptr<T> item) { + data_.push_front(item.release()); + } + + void push_back(scoped_ptr<T> item) { data_.push_back(item.release()); } - void insert(size_t index, scoped_ptr<T> item) { - DCHECK(index < size()); - data_.insert(data_.begin() + index, item.release()); + void insert(iterator position, scoped_ptr<T> item) { + DCHECK(position <= end()); + data_.insert(position, item.release()); + } + + void swap(iterator a, iterator b) { + DCHECK(a < end()); + DCHECK(b < end()); + if (a == end() || b == end() || a == b) + return; + typename std::deque<T*>::iterator writable_a = a; + typename std::deque<T*>::iterator writable_b = b; + std::swap(*writable_a, *writable_b); } - iterator begin() { return data_.begin(); } + iterator begin() { return static_cast<iterator>(data_.begin()); } const_iterator begin() const { return data_.begin(); } - iterator end() { return data_.end(); } + iterator end() { return static_cast<iterator>(data_.end()); } const_iterator end() const { return data_.end(); } reverse_iterator rbegin() { return data_.rbegin(); } diff --git a/cc/scoped_ptr_vector.h b/cc/scoped_ptr_vector.h index 80f4496..2a8d9610 100644 --- a/cc/scoped_ptr_vector.h +++ b/cc/scoped_ptr_vector.h @@ -17,12 +17,25 @@ namespace cc { template <typename T> class ScopedPtrVector { public: - typedef typename std::vector<T*>::iterator iterator; typedef typename std::vector<T*>::const_iterator const_iterator; typedef typename std::vector<T*>::reverse_iterator reverse_iterator; typedef typename std::vector<T*>::const_reverse_iterator const_reverse_iterator; +#if defined(OS_ANDROID) + // On Android the iterator is not a class, so we can't block assignment. + typedef typename std::vector<T*>::iterator iterator; +#else + // Ban setting values on the iterator directly. New pointers must be passed + // to methods on the ScopedPtrVector class to appear in the vector. + class iterator : public std::vector<T*>::iterator { + public: + iterator(const typename std::vector<T*>::iterator& other) + : std::vector<T*>::iterator(other) {} + T* const& operator*() { return std::vector<T*>::iterator::operator*(); } + }; +#endif + ScopedPtrVector() {} ~ScopedPtrVector() { clear(); } @@ -31,40 +44,64 @@ class ScopedPtrVector { return data_.size(); } - T* Peek(size_t index) const { + T* at(size_t index) const { DCHECK(index < size()); return data_[index]; } T* operator[](size_t index) const { - return Peek(index); + return at(index); } - T* first() const { - DCHECK(!isEmpty()); - return Peek(0); + T* front() const { + DCHECK(!empty()); + return at(0); } - T* last() const { - DCHECK(!isEmpty()); - return Peek(size() - 1); + T* back() const { + DCHECK(!empty()); + return at(size() - 1); } - bool isEmpty() const { - return size() == 0; + bool empty() const { + return data_.empty(); } - scoped_ptr<T> take(size_t index) { - DCHECK(index < size()); - scoped_ptr<T> ret(data_[index]); - data_[index] = NULL; + scoped_ptr<T> take(iterator position) { + if (position == end()) + return scoped_ptr<T>(NULL); + DCHECK(position < end()); + + typename std::vector<T*>::iterator writable_position = position; + scoped_ptr<T> ret(*writable_position); + *writable_position = NULL; return ret.Pass(); } - void remove(size_t index) { - DCHECK(index < size()); - delete data_[index]; - data_.erase(data_.begin() + index); + scoped_ptr<T> take_back() { + DCHECK(!empty()); + if (empty()) + return scoped_ptr<T>(NULL); + return take(end() - 1); + } + + void erase(iterator position) { + if (position == end()) + return; + typename std::vector<T*>::iterator writable_position = position; + delete *writable_position; + data_.erase(position); + } + + void erase(iterator first, iterator last) { + DCHECK(first <= last); + for (iterator it = first; it != last; ++it) { + DCHECK(it < end()); + + typename std::vector<T*>::iterator writable_it = it; + delete *writable_it; + } + data_.erase(first, last); } void reserve(size_t size) { @@ -75,22 +112,36 @@ class ScopedPtrVector { STLDeleteElements(&data_); } - void append(scoped_ptr<T> item) { + void push_back(scoped_ptr<T> item) { data_.push_back(item.release()); } - void insert(size_t index, scoped_ptr<T> item) { - DCHECK(index <= size()); - data_.insert(data_.begin() + index, item.release()); + void pop_back() { + data_.pop_back(); + } + + void insert(iterator position, scoped_ptr<T> item) { + DCHECK(position <= end()); + data_.insert(position, item.release()); } void swap(ScopedPtrVector<T>& other) { data_.swap(other.data_); } - iterator begin() { return data_.begin(); } + void swap(iterator a, iterator b) { + DCHECK(a < end()); + DCHECK(b < end()); + if (a == end() || b == end() || a == b) + return; + typename std::vector<T*>::iterator writable_a = a; + typename std::vector<T*>::iterator writable_b = b; + std::swap(*writable_a, *writable_b); + } + + iterator begin() { return static_cast<iterator>(data_.begin()); } const_iterator begin() const { return data_.begin(); } - iterator end() { return data_.end(); } + iterator end() { return static_cast<iterator>(data_.end()); } const_iterator end() const { return data_.end(); } reverse_iterator rbegin() { return data_.rbegin(); } diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc index bde9225..eb3838e 100644 --- a/cc/software_renderer_unittest.cc +++ b/cc/software_renderer_unittest.cc @@ -90,7 +90,7 @@ TEST_F(SoftwareRendererTest, solidColorQuad) rootRenderPass->AppendQuad(outerQuad.PassAs<DrawQuad>()); RenderPassList list; - list.append(rootRenderPass.PassAs<RenderPass>()); + list.push_back(rootRenderPass.PassAs<RenderPass>()); renderer()->drawFrame(list); scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * deviceViewportSize().height()]); @@ -149,7 +149,7 @@ TEST_F(SoftwareRendererTest, tileQuad) rootRenderPass->AppendQuad(outerQuad.PassAs<DrawQuad>()); RenderPassList list; - list.append(rootRenderPass.PassAs<RenderPass>()); + list.push_back(rootRenderPass.PassAs<RenderPass>()); renderer()->drawFrame(list); scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * deviceViewportSize().height()]); diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc index 8f109dd..b4f8cdf 100644 --- a/cc/test/mock_quad_culler.cc +++ b/cc/test/mock_quad_culler.cc @@ -25,7 +25,7 @@ MockQuadCuller::~MockQuadCuller() bool MockQuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData&) { if (!drawQuad->rect.IsEmpty()) { - m_activeQuadList.append(drawQuad.Pass()); + m_activeQuadList.push_back(drawQuad.Pass()); return true; } return false; @@ -34,7 +34,7 @@ bool MockQuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData&) SharedQuadState* MockQuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> sharedQuadState) { SharedQuadState* rawPtr = sharedQuadState.get(); - m_activeSharedQuadStateList.append(sharedQuadState.Pass()); + m_activeSharedQuadStateList.push_back(sharedQuadState.Pass()); return rawPtr; } diff --git a/cc/test/render_pass_test_common.h b/cc/test/render_pass_test_common.h index c565df0..199a618 100644 --- a/cc/test/render_pass_test_common.h +++ b/cc/test/render_pass_test_common.h @@ -20,10 +20,10 @@ class TestRenderPass : public cc::RenderPass { } void AppendQuad(scoped_ptr<cc::DrawQuad> quad) { - quad_list.append(quad.Pass()); + quad_list.push_back(quad.Pass()); } void AppendSharedQuadState(scoped_ptr<cc::SharedQuadState> state) { - shared_quad_state_list.append(state.Pass()); + shared_quad_state_list.push_back(state.Pass()); } void AppendOneOfEveryQuadType(cc::ResourceProvider*); diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index aa0cc034..a793505 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -22,7 +22,7 @@ TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); pass->SetNew(id, outputRect, outputRect, rootTransform); TestRenderPass* saved = pass.get(); - passList.append(pass.PassAs<RenderPass>()); + passList.push_back(pass.PassAs<RenderPass>()); return saved; } diff --git a/cc/texture_uploader.cc b/cc/texture_uploader.cc index 0dbeb7c..6928cab 100644 --- a/cc/texture_uploader.cc +++ b/cc/texture_uploader.cc @@ -142,16 +142,16 @@ double TextureUploader::estimatedTexturesPerSecond() void TextureUploader::beginQuery() { - if (m_availableQueries.isEmpty()) - m_availableQueries.append(Query::create(m_context)); + if (m_availableQueries.empty()) + m_availableQueries.push_back(Query::create(m_context)); - m_availableQueries.first()->begin(); + m_availableQueries.front()->begin(); } void TextureUploader::endQuery() { - m_availableQueries.first()->end(); - m_pendingQueries.append(m_availableQueries.takeFirst()); + m_availableQueries.front()->end(); + m_pendingQueries.push_back(m_availableQueries.take_front()); m_numBlockingTextureUploads++; } @@ -342,18 +342,18 @@ void TextureUploader::uploadWithMapTexSubImage(const uint8* image, void TextureUploader::processQueries() { - while (!m_pendingQueries.isEmpty()) { - if (m_pendingQueries.first()->isPending()) + while (!m_pendingQueries.empty()) { + if (m_pendingQueries.front()->isPending()) break; - unsigned usElapsed = m_pendingQueries.first()->value(); + unsigned usElapsed = m_pendingQueries.front()->value(); HISTOGRAM_CUSTOM_COUNTS("Renderer4.TextureGpuUploadTimeUS", usElapsed, 0, 100000, 50); // Clamp the queries to saner values in case the queries fail. usElapsed = std::max(1u, usElapsed); usElapsed = std::min(15000u, usElapsed); - if (!m_pendingQueries.first()->isNonBlocking()) + if (!m_pendingQueries.front()->isNonBlocking()) m_numBlockingTextureUploads--; // Remove the min and max value from our history and insert the new one. @@ -364,7 +364,7 @@ void TextureUploader::processQueries() } m_texturesPerSecondHistory.insert(texturesPerSecond); - m_availableQueries.append(m_pendingQueries.takeFirst()); + m_availableQueries.push_back(m_pendingQueries.take_front()); } } diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc index 7054429..929bb67 100644 --- a/cc/tile_manager.cc +++ b/cc/tile_manager.cc @@ -184,7 +184,7 @@ TileManager::TileManager( scoped_ptr<RasterThread> thread = make_scoped_ptr( new RasterThread(thread_name_prefix + StringPrintf("Worker%d", thread_number).c_str())); - raster_threads_.append(thread.Pass()); + raster_threads_.push_back(thread.Pass()); } ResetBinCounts(); diff --git a/cc/tree_synchronizer.cc b/cc/tree_synchronizer.cc index ea3cb1d..4adbe45 100644 --- a/cc/tree_synchronizer.cc +++ b/cc/tree_synchronizer.cc @@ -36,8 +36,8 @@ void TreeSynchronizer::collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& return; ScopedPtrVector<LayerImpl>& children = layerImpl->m_children; - for (size_t i = 0; i < children.size(); ++i) - collectExistingLayerImplRecursive(oldLayers, children.take(i)); + for (ScopedPtrVector<LayerImpl>::iterator it = children.begin(); it != children.end(); ++it) + collectExistingLayerImplRecursive(oldLayers, children.take(it)); collectExistingLayerImplRecursive(oldLayers, layerImpl->takeMaskLayer()); collectExistingLayerImplRecursive(oldLayers, layerImpl->takeReplicaLayer()); |