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

Side by Side 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: android!! Created 7 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_animation_controller.cc ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_impl.h" 5 #include "cc/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/animation_registrar.h" 10 #include "cc/animation_registrar.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DCHECK(!m_betweenWillDrawAndDidDraw); 67 DCHECK(!m_betweenWillDrawAndDidDraw);
68 #endif 68 #endif
69 m_layerTreeImpl->UnregisterLayer(this); 69 m_layerTreeImpl->UnregisterLayer(this);
70 m_layerAnimationController->removeObserver(this); 70 m_layerAnimationController->removeObserver(this);
71 } 71 }
72 72
73 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) 73 void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
74 { 74 {
75 child->setParent(this); 75 child->setParent(this);
76 DCHECK_EQ(layerTreeImpl(), child->layerTreeImpl()); 76 DCHECK_EQ(layerTreeImpl(), child->layerTreeImpl());
77 m_children.append(child.Pass()); 77 m_children.push_back(child.Pass());
78 layerTreeImpl()->SetNeedsUpdateDrawProperties(); 78 layerTreeImpl()->SetNeedsUpdateDrawProperties();
79 } 79 }
80 80
81 scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child) 81 scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child)
82 { 82 {
83 for (size_t i = 0; i < m_children.size(); ++i) { 83 for (ScopedPtrVector<LayerImpl>::iterator it = m_children.begin(); it != m_c hildren.end(); ++it) {
84 if (m_children[i] == child) { 84 if (*it == child) {
85 scoped_ptr<LayerImpl> ret = m_children.take(i); 85 scoped_ptr<LayerImpl> ret = m_children.take(it);
86 m_children.remove(i); 86 m_children.erase(it);
87 layerTreeImpl()->SetNeedsUpdateDrawProperties(); 87 layerTreeImpl()->SetNeedsUpdateDrawProperties();
88 return ret.Pass(); 88 return ret.Pass();
89 } 89 }
90 } 90 }
91 return scoped_ptr<LayerImpl>(); 91 return scoped_ptr<LayerImpl>();
92 } 92 }
93 93
94 void LayerImpl::removeAllChildren() 94 void LayerImpl::removeAllChildren()
95 { 95 {
96 m_children.clear(); 96 m_children.clear();
97 layerTreeImpl()->SetNeedsUpdateDrawProperties(); 97 layerTreeImpl()->SetNeedsUpdateDrawProperties();
98 } 98 }
99 99
100 void LayerImpl::clearChildList() 100 void LayerImpl::clearChildList()
101 { 101 {
102 if (m_children.isEmpty()) 102 if (m_children.empty())
103 return; 103 return;
104 104
105 m_children.clear(); 105 m_children.clear();
106 layerTreeImpl()->SetNeedsUpdateDrawProperties(); 106 layerTreeImpl()->SetNeedsUpdateDrawProperties();
107 } 107 }
108 108
109 void LayerImpl::createRenderSurface() 109 void LayerImpl::createRenderSurface()
110 { 110 {
111 DCHECK(!m_drawProperties.render_surface); 111 DCHECK(!m_drawProperties.render_surface);
112 m_drawProperties.render_surface = make_scoped_ptr(new RenderSurfaceImpl(this )); 112 m_drawProperties.render_surface = make_scoped_ptr(new RenderSurfaceImpl(this ));
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 if (m_layerTreeImpl->settings().useLinearFadeScrollbarAnimator) 847 if (m_layerTreeImpl->settings().useLinearFadeScrollbarAnimator)
848 m_scrollbarAnimationController = createScrollbarAnimationControllerW ithFade(this); 848 m_scrollbarAnimationController = createScrollbarAnimationControllerW ithFade(this);
849 else 849 else
850 m_scrollbarAnimationController = ScrollbarAnimationController::creat e(this); 850 m_scrollbarAnimationController = ScrollbarAnimationController::creat e(this);
851 } 851 }
852 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 852 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
853 m_scrollbarAnimationController->updateScrollOffset(this); 853 m_scrollbarAnimationController->updateScrollOffset(this);
854 } 854 }
855 855
856 } // namespace cc 856 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_animation_controller.cc ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698