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

Side by Side Diff: cc/debug/rasterize_and_record_benchmark_impl.cc

Issue 1837263005: cc: Rename DisplayListRasterSource to just RasterSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/cc_tests.gyp ('k') | cc/layers/picture_image_layer_impl_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/debug/rasterize_and_record_benchmark_impl.h" 5 #include "cc/debug/rasterize_and_record_benchmark_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
11 11
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "cc/debug/lap_timer.h" 13 #include "cc/debug/lap_timer.h"
14 #include "cc/layers/layer_impl.h" 14 #include "cc/layers/layer_impl.h"
15 #include "cc/layers/picture_layer_impl.h" 15 #include "cc/layers/picture_layer_impl.h"
16 #include "cc/raster/tile_task_worker_pool.h" 16 #include "cc/raster/tile_task_worker_pool.h"
17 #include "cc/trees/layer_tree_host_common.h" 17 #include "cc/trees/layer_tree_host_common.h"
18 #include "cc/trees/layer_tree_host_impl.h" 18 #include "cc/trees/layer_tree_host_impl.h"
19 #include "cc/trees/layer_tree_impl.h" 19 #include "cc/trees/layer_tree_impl.h"
20 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
21 21
22 namespace cc { 22 namespace cc {
23 23
24 namespace { 24 namespace {
25 25
26 const int kDefaultRasterizeRepeatCount = 100; 26 const int kDefaultRasterizeRepeatCount = 100;
27 27
28 void RunBenchmark(DisplayListRasterSource* raster_source, 28 void RunBenchmark(RasterSource* raster_source,
29 const gfx::Rect& content_rect, 29 const gfx::Rect& content_rect,
30 float contents_scale, 30 float contents_scale,
31 size_t repeat_count, 31 size_t repeat_count,
32 base::TimeDelta* min_time, 32 base::TimeDelta* min_time,
33 bool* is_solid_color) { 33 bool* is_solid_color) {
34 // Parameters for LapTimer. 34 // Parameters for LapTimer.
35 const int kTimeLimitMillis = 1; 35 const int kTimeLimitMillis = 1;
36 const int kWarmupRuns = 0; 36 const int kWarmupRuns = 0;
37 const int kTimeCheckInterval = 1; 37 const int kTimeCheckInterval = 1;
38 38
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings(); 172 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings();
173 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( 173 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create(
174 layer->GetTree(), &client, settings.tiling_interest_area_padding, 174 layer->GetTree(), &client, settings.tiling_interest_area_padding,
175 settings.skewport_target_time_in_seconds, 175 settings.skewport_target_time_in_seconds,
176 settings.skewport_extrapolation_limit_in_content_pixels); 176 settings.skewport_extrapolation_limit_in_content_pixels);
177 177
178 PictureLayerTiling* tiling = 178 PictureLayerTiling* tiling =
179 tiling_set->AddTiling(1.f, layer->GetRasterSource()); 179 tiling_set->AddTiling(1.f, layer->GetRasterSource());
180 tiling->set_resolution(HIGH_RESOLUTION); 180 tiling->set_resolution(HIGH_RESOLUTION);
181 tiling->CreateAllTilesForTesting(); 181 tiling->CreateAllTilesForTesting();
182 DisplayListRasterSource* raster_source = tiling->raster_source().get(); 182 RasterSource* raster_source = tiling->raster_source().get();
183 for (PictureLayerTiling::CoverageIterator it(tiling, 1.f, 183 for (PictureLayerTiling::CoverageIterator it(tiling, 1.f,
184 layer->visible_layer_rect()); 184 layer->visible_layer_rect());
185 it; ++it) { 185 it; ++it) {
186 DCHECK(*it); 186 DCHECK(*it);
187 187
188 gfx::Rect content_rect = (*it)->content_rect(); 188 gfx::Rect content_rect = (*it)->content_rect();
189 float contents_scale = (*it)->contents_scale(); 189 float contents_scale = (*it)->contents_scale();
190 190
191 base::TimeDelta min_time; 191 base::TimeDelta min_time;
192 bool is_solid_color = false; 192 bool is_solid_color = false;
193 RunBenchmark(raster_source, content_rect, contents_scale, 193 RunBenchmark(raster_source, content_rect, contents_scale,
194 rasterize_repeat_count_, &min_time, &is_solid_color); 194 rasterize_repeat_count_, &min_time, &is_solid_color);
195 195
196 int tile_size = content_rect.width() * content_rect.height(); 196 int tile_size = content_rect.width() * content_rect.height();
197 if (layer->contents_opaque()) 197 if (layer->contents_opaque())
198 rasterize_results_.pixels_rasterized_as_opaque += tile_size; 198 rasterize_results_.pixels_rasterized_as_opaque += tile_size;
199 199
200 if (!is_solid_color) 200 if (!is_solid_color)
201 rasterize_results_.pixels_rasterized_with_non_solid_color += tile_size; 201 rasterize_results_.pixels_rasterized_with_non_solid_color += tile_size;
202 202
203 rasterize_results_.pixels_rasterized += tile_size; 203 rasterize_results_.pixels_rasterized += tile_size;
204 rasterize_results_.total_best_time += min_time; 204 rasterize_results_.total_best_time += min_time;
205 } 205 }
206 206
207 const DisplayListRasterSource* layer_raster_source = layer->GetRasterSource(); 207 const RasterSource* layer_raster_source = layer->GetRasterSource();
208 rasterize_results_.total_memory_usage += 208 rasterize_results_.total_memory_usage +=
209 layer_raster_source->GetPictureMemoryUsage(); 209 layer_raster_source->GetPictureMemoryUsage();
210 } 210 }
211 211
212 RasterizeAndRecordBenchmarkImpl::RasterizeResults::RasterizeResults() 212 RasterizeAndRecordBenchmarkImpl::RasterizeResults::RasterizeResults()
213 : pixels_rasterized(0), 213 : pixels_rasterized(0),
214 pixels_rasterized_with_non_solid_color(0), 214 pixels_rasterized_with_non_solid_color(0),
215 pixels_rasterized_as_opaque(0), 215 pixels_rasterized_as_opaque(0),
216 total_memory_usage(0), 216 total_memory_usage(0),
217 total_layers(0), 217 total_layers(0),
218 total_picture_layers(0), 218 total_picture_layers(0),
219 total_picture_layers_with_no_content(0), 219 total_picture_layers_with_no_content(0),
220 total_picture_layers_off_screen(0) { 220 total_picture_layers_off_screen(0) {
221 } 221 }
222 222
223 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} 223 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {}
224 224
225 } // namespace cc 225 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/layers/picture_image_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698