OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "cc/base/scoped_ptr_vector.h" | |
18 #include "cc/debug/lap_timer.h" | 17 #include "cc/debug/lap_timer.h" |
19 #include "cc/layers/layer.h" | 18 #include "cc/layers/layer.h" |
20 #include "cc/output/bsp_tree.h" | 19 #include "cc/output/bsp_tree.h" |
21 #include "cc/quads/draw_polygon.h" | 20 #include "cc/quads/draw_polygon.h" |
22 #include "cc/quads/draw_quad.h" | 21 #include "cc/quads/draw_quad.h" |
23 #include "cc/test/fake_content_layer_client.h" | 22 #include "cc/test/fake_content_layer_client.h" |
24 #include "cc/test/fake_layer_tree_host_client.h" | 23 #include "cc/test/fake_layer_tree_host_client.h" |
25 #include "cc/test/layer_tree_json_parser.h" | 24 #include "cc/test/layer_tree_json_parser.h" |
26 #include "cc/test/layer_tree_test.h" | 25 #include "cc/test/layer_tree_test.h" |
27 #include "cc/test/paths.h" | 26 #include "cc/test/paths.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 int max_texture_size = 8096; | 146 int max_texture_size = 8096; |
148 DoCalcDrawPropertiesImpl(can_render_to_separate_surface, | 147 DoCalcDrawPropertiesImpl(can_render_to_separate_surface, |
149 max_texture_size, | 148 max_texture_size, |
150 active_tree, | 149 active_tree, |
151 host_impl); | 150 host_impl); |
152 | 151 |
153 LayerImplList base_list; | 152 LayerImplList base_list; |
154 BuildLayerImplList(active_tree->root_layer(), &base_list); | 153 BuildLayerImplList(active_tree->root_layer(), &base_list); |
155 | 154 |
156 int polygon_counter = 0; | 155 int polygon_counter = 0; |
157 ScopedPtrVector<DrawPolygon> polygon_list; | 156 std::vector<scoped_ptr<DrawPolygon>> polygon_list; |
158 for (LayerImplList::iterator it = base_list.begin(); it != base_list.end(); | 157 for (LayerImplList::iterator it = base_list.begin(); it != base_list.end(); |
159 ++it) { | 158 ++it) { |
160 DrawPolygon* draw_polygon = | 159 DrawPolygon* draw_polygon = |
161 new DrawPolygon(NULL, gfx::RectF(gfx::SizeF((*it)->bounds())), | 160 new DrawPolygon(NULL, gfx::RectF(gfx::SizeF((*it)->bounds())), |
162 (*it)->draw_transform(), polygon_counter++); | 161 (*it)->draw_transform(), polygon_counter++); |
163 polygon_list.push_back(scoped_ptr<DrawPolygon>(draw_polygon)); | 162 polygon_list.push_back(scoped_ptr<DrawPolygon>(draw_polygon)); |
164 } | 163 } |
165 | 164 |
166 timer_.Reset(); | 165 timer_.Reset(); |
167 do { | 166 do { |
168 std::deque<scoped_ptr<DrawPolygon>> test_list; | 167 std::deque<scoped_ptr<DrawPolygon>> test_list; |
169 for (int i = 0; i < num_duplicates_; i++) { | 168 for (int i = 0; i < num_duplicates_; i++) { |
170 for (size_t i = 0; i < polygon_list.size(); i++) { | 169 for (size_t i = 0; i < polygon_list.size(); i++) { |
171 test_list.push_back(polygon_list[i]->CreateCopy()); | 170 test_list.push_back(polygon_list[i]->CreateCopy()); |
172 } | 171 } |
173 } | 172 } |
174 BspTree bsp_tree(&test_list); | 173 BspTree bsp_tree(&test_list); |
175 timer_.NextLap(); | 174 timer_.NextLap(); |
176 } while (!timer_.HasTimeLimitExpired()); | 175 } while (!timer_.HasTimeLimitExpired()); |
177 | 176 |
178 EndTest(); | 177 EndTest(); |
179 } | 178 } |
180 | 179 |
181 void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) { | 180 void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) { |
182 if (layer->Is3dSorted()) { | 181 if (layer->Is3dSorted()) { |
183 list->push_back(layer); | 182 list->push_back(layer); |
184 } | 183 } |
185 | 184 |
186 for (size_t i = 0; i < layer->children().size(); i++) { | 185 for (size_t i = 0; i < layer->children().size(); i++) { |
187 BuildLayerImplList(layer->children()[i], list); | 186 BuildLayerImplList(layer->children()[i].get(), list); |
188 } | 187 } |
189 } | 188 } |
190 | 189 |
191 private: | 190 private: |
192 LayerImplList base_list_; | 191 LayerImplList base_list_; |
193 int num_duplicates_; | 192 int num_duplicates_; |
194 }; | 193 }; |
195 | 194 |
196 TEST_F(CalcDrawPropsTest, TenTen) { | 195 TEST_F(CalcDrawPropsTest, TenTen) { |
197 SetTestName("10_10"); | 196 SetTestName("10_10"); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 261 |
263 TEST_F(BspTreePerfTest, BspTreeCubes_4) { | 262 TEST_F(BspTreePerfTest, BspTreeCubes_4) { |
264 SetTestName("bsp_tree_cubes_4"); | 263 SetTestName("bsp_tree_cubes_4"); |
265 SetNumberOfDuplicates(4); | 264 SetNumberOfDuplicates(4); |
266 ReadTestFile("layer_sort_cubes"); | 265 ReadTestFile("layer_sort_cubes"); |
267 RunSortLayers(); | 266 RunSortLayers(); |
268 } | 267 } |
269 | 268 |
270 } // namespace | 269 } // namespace |
271 } // namespace cc | 270 } // namespace cc |
OLD | NEW |