| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/layer_iterator.h" | 5 #include "cc/layers/layer_iterator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual ~TestLayer() {} | 43 virtual ~TestLayer() {} |
| 44 | 44 |
| 45 bool draws_content_; | 45 bool draws_content_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 #define EXPECT_COUNT(layer, target, contrib, itself) \ | 48 #define EXPECT_COUNT(layer, target, contrib, itself) \ |
| 49 EXPECT_EQ(target, layer->count_representing_target_surface_); \ | 49 EXPECT_EQ(target, layer->count_representing_target_surface_); \ |
| 50 EXPECT_EQ(contrib, layer->count_representing_contributing_surface_); \ | 50 EXPECT_EQ(contrib, layer->count_representing_contributing_surface_); \ |
| 51 EXPECT_EQ(itself, layer->count_representing_itself_); | 51 EXPECT_EQ(itself, layer->count_representing_itself_); |
| 52 | 52 |
| 53 typedef LayerIterator<Layer> FrontToBack; | 53 typedef LayerIterator<Layer, |
| 54 RenderSurfaceLayerList, |
| 55 RenderSurface, |
| 56 LayerIteratorActions::FrontToBack> FrontToBack; |
| 54 | 57 |
| 55 void ResetCounts(RenderSurfaceLayerList* render_surface_layer_list) { | 58 void ResetCounts(RenderSurfaceLayerList* render_surface_layer_list) { |
| 56 for (unsigned surface_index = 0; | 59 for (unsigned surface_index = 0; |
| 57 surface_index < render_surface_layer_list->size(); | 60 surface_index < render_surface_layer_list->size(); |
| 58 ++surface_index) { | 61 ++surface_index) { |
| 59 TestLayer* render_surface_layer = static_cast<TestLayer*>( | 62 TestLayer* render_surface_layer = static_cast<TestLayer*>( |
| 60 render_surface_layer_list->at(surface_index)); | 63 render_surface_layer_list->at(surface_index)); |
| 61 RenderSurface* render_surface = render_surface_layer->render_surface(); | 64 RenderSurface* render_surface = render_surface_layer->render_surface(); |
| 62 | 65 |
| 63 render_surface_layer->count_representing_target_surface_ = -1; | 66 render_surface_layer->count_representing_target_surface_ = -1; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 EXPECT_COUNT(root21, -1, -1, 9); | 211 EXPECT_COUNT(root21, -1, -1, 9); |
| 209 EXPECT_COUNT(root22, 7, 8, 6); | 212 EXPECT_COUNT(root22, 7, 8, 6); |
| 210 EXPECT_COUNT(root221, -1, -1, 5); | 213 EXPECT_COUNT(root221, -1, -1, 5); |
| 211 EXPECT_COUNT(root23, 3, 4, 2); | 214 EXPECT_COUNT(root23, 3, 4, 2); |
| 212 EXPECT_COUNT(root231, -1, -1, 1); | 215 EXPECT_COUNT(root231, -1, -1, 1); |
| 213 EXPECT_COUNT(root3, -1, -1, 0); | 216 EXPECT_COUNT(root3, -1, -1, 0); |
| 214 } | 217 } |
| 215 | 218 |
| 216 } // namespace | 219 } // namespace |
| 217 } // namespace cc | 220 } // namespace cc |
| OLD | NEW |