Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: cc/layer_impl.cc

Issue 11418108: cc: Make the ScopedPtrVector and ScopedPtrDeque containers act like STL vector and deque. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECK Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layer_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 4927e7484d5040e6064261f47d6d179104a7c6c5..237d20cdc5a7979872537442d69d5d6c0ccae409 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -4,6 +4,8 @@
#include "cc/layer_impl.h"
+#include <algorithm>
+
#include "base/debug/trace_event.h"
#include "base/stringprintf.h"
#include "cc/debug_border_draw_quad.h"
@@ -76,7 +78,7 @@ LayerImpl::~LayerImpl()
void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
{
child->setParent(this);
- m_children.append(child.Pass());
+ m_children.push_back(child.Pass());
}
void LayerImpl::removeFromParent()
@@ -87,18 +89,13 @@ void LayerImpl::removeFromParent()
LayerImpl* parent = m_parent;
m_parent = 0;
- for (size_t i = 0; i < parent->m_children.size(); ++i) {
- if (parent->m_children[i] == this) {
- parent->m_children.remove(i);
- return;
- }
- }
+ parent->m_children.erase(std::find(parent->m_children.begin(), parent->m_children.end(), this));
}
void LayerImpl::removeAllChildren()
{
while (m_children.size())
- m_children[0]->removeFromParent();
+ m_children.front()->removeFromParent();
}
void LayerImpl::clearChildList()

Powered by Google App Engine
This is Rietveld 408576698