Adding a logging class to cast.
[chromium-blink-merge.git] / cc / layers / layer_lists.cc
blobfda1a1cf9f80856d9645cddb84f89f02d81f088b
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.
5 #include "cc/layers/layer_lists.h"
7 #include "cc/layers/layer.h"
9 namespace cc {
11 RenderSurfaceLayerList::RenderSurfaceLayerList() {}
13 RenderSurfaceLayerList::~RenderSurfaceLayerList() {
14 for (size_t i = 0; i < size(); ++i)
15 at(size() - 1 - i)->ClearRenderSurface();
18 Layer* RenderSurfaceLayerList::at(size_t i) const {
19 return list_.at(i);
22 void RenderSurfaceLayerList::pop_back() {
23 list_.pop_back();
26 void RenderSurfaceLayerList::push_back(const scoped_refptr<Layer>& layer) {
27 list_.push_back(layer);
30 Layer* RenderSurfaceLayerList::back() {
31 return list_.back();
34 size_t RenderSurfaceLayerList::size() const {
35 return list_.size();
38 scoped_refptr<Layer>& RenderSurfaceLayerList::operator[](size_t i) {
39 return list_[i];
41 const scoped_refptr<Layer>& RenderSurfaceLayerList::operator[](size_t i) const {
42 return list_[i];
45 LayerList::iterator RenderSurfaceLayerList::begin() {
46 return list_.begin();
49 LayerList::iterator RenderSurfaceLayerList::end() {
50 return list_.end();
53 LayerList::const_iterator RenderSurfaceLayerList::begin() const {
54 return list_.begin();
57 LayerList::const_iterator RenderSurfaceLayerList::end() const {
58 return list_.end();
61 void RenderSurfaceLayerList::clear() {
62 for (size_t i = 0; i < list_.size(); ++i)
63 DCHECK(!list_[i]->render_surface());
64 list_.clear();
67 } // namespace cc