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

Side by Side Diff: cc/trees/layer_tree_host_common_perftest.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_unittest.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 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"
6
7 #include <stddef.h> 5 #include <stddef.h>
8 6
9 #include <deque> 7 #include <deque>
8 #include <memory>
10 #include <sstream> 9 #include <sstream>
11 10
12 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/path_service.h" 13 #include "base/path_service.h"
16 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
17 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
18 #include "base/time/time.h" 16 #include "base/time/time.h"
19 #include "cc/debug/lap_timer.h" 17 #include "cc/debug/lap_timer.h"
20 #include "cc/layers/layer.h" 18 #include "cc/layers/layer.h"
21 #include "cc/output/bsp_tree.h" 19 #include "cc/output/bsp_tree.h"
22 #include "cc/quads/draw_polygon.h" 20 #include "cc/quads/draw_polygon.h"
23 #include "cc/quads/draw_quad.h" 21 #include "cc/quads/draw_quad.h"
24 #include "cc/test/fake_content_layer_client.h" 22 #include "cc/test/fake_content_layer_client.h"
25 #include "cc/test/fake_layer_tree_host_client.h" 23 #include "cc/test/fake_layer_tree_host_client.h"
26 #include "cc/test/layer_tree_json_parser.h" 24 #include "cc/test/layer_tree_json_parser.h"
27 #include "cc/test/layer_tree_test.h" 25 #include "cc/test/layer_tree_test.h"
28 #include "cc/test/paths.h" 26 #include "cc/test/paths.h"
27 #include "cc/trees/layer_tree_host_common.h"
29 #include "cc/trees/layer_tree_impl.h" 28 #include "cc/trees/layer_tree_impl.h"
30 #include "testing/perf/perf_test.h" 29 #include "testing/perf/perf_test.h"
31 30
32 namespace cc { 31 namespace cc {
33 namespace { 32 namespace {
34 33
35 static const int kTimeLimitMillis = 2000; 34 static const int kTimeLimitMillis = 2000;
36 static const int kWarmupRuns = 5; 35 static const int kWarmupRuns = 5;
37 static const int kTimeCheckInterval = 10; 36 static const int kTimeCheckInterval = 10;
38 37
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::vector<scoped_ptr<DrawPolygon>> polygon_list; 156 std::vector<std::unique_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 = new DrawPolygon( 159 DrawPolygon* draw_polygon = new DrawPolygon(
161 NULL, gfx::RectF(gfx::SizeF((*it)->bounds())), 160 NULL, gfx::RectF(gfx::SizeF((*it)->bounds())),
162 (*it)->draw_properties().target_space_transform, polygon_counter++); 161 (*it)->draw_properties().target_space_transform, polygon_counter++);
163 polygon_list.push_back(scoped_ptr<DrawPolygon>(draw_polygon)); 162 polygon_list.push_back(std::unique_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<std::unique_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();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 251
253 TEST_F(BspTreePerfTest, BspTreeCubes_4) { 252 TEST_F(BspTreePerfTest, BspTreeCubes_4) {
254 SetTestName("bsp_tree_cubes_4"); 253 SetTestName("bsp_tree_cubes_4");
255 SetNumberOfDuplicates(4); 254 SetNumberOfDuplicates(4);
256 ReadTestFile("layer_sort_cubes"); 255 ReadTestFile("layer_sort_cubes");
257 RunSortLayers(); 256 RunSortLayers();
258 } 257 }
259 258
260 } // namespace 259 } // namespace
261 } // namespace cc 260 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698