1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "cc/layers/layer_lists.h" 6 7 #include "cc/layers/layer.h" 8 9 namespace cc { 10 11 RenderSurfaceLayerList::RenderSurfaceLayerList() {} 12 13 RenderSurfaceLayerList::~RenderSurfaceLayerList() { 14 for (size_t i = 0; i < size(); ++i) 15 at(size() - 1 - i)->ClearRenderSurface(); 16 } 17 18 Layer* RenderSurfaceLayerList::at(size_t i) const { 19 return list_.at(i); 20 } 21 22 void RenderSurfaceLayerList::pop_back() { 23 list_.pop_back(); 24 } 25 26 void RenderSurfaceLayerList::push_back(const scoped_refptr<Layer>& layer) { 27 list_.push_back(layer); 28 } 29 30 Layer* RenderSurfaceLayerList::back() { 31 return list_.back(); 32 } 33 34 size_t RenderSurfaceLayerList::size() const { 35 return list_.size(); 36 } 37 38 LayerList::iterator RenderSurfaceLayerList::begin() { 39 return list_.begin(); 40 } 41 42 LayerList::iterator RenderSurfaceLayerList::end() { 43 return list_.end(); 44 } 45 46 LayerList::const_iterator RenderSurfaceLayerList::begin() const { 47 return list_.begin(); 48 } 49 50 LayerList::const_iterator RenderSurfaceLayerList::end() const { 51 return list_.end(); 52 } 53 54 void RenderSurfaceLayerList::clear() { 55 for (size_t i = 0; i < list_.size(); ++i) 56 DCHECK(!list_[i]->render_surface()); 57 list_.clear(); 58 } 59 60 } // namespace cc 61