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/debug/rasterize_and_record_benchmark_impl.h" | 5 #include "cc/debug/rasterize_and_record_benchmark_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 NotifyDone(result.Pass()); | 152 NotifyDone(result.Pass()); |
153 } | 153 } |
154 | 154 |
155 void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) { | 155 void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) { |
156 rasterize_results_.total_picture_layers++; | 156 rasterize_results_.total_picture_layers++; |
157 if (!layer->CanHaveTilings()) { | 157 if (!layer->CanHaveTilings()) { |
158 rasterize_results_.total_picture_layers_with_no_content++; | 158 rasterize_results_.total_picture_layers_with_no_content++; |
159 return; | 159 return; |
160 } | 160 } |
161 if (layer->visible_content_rect().IsEmpty()) { | 161 if (layer->visible_layer_rect().IsEmpty()) { |
162 rasterize_results_.total_picture_layers_off_screen++; | 162 rasterize_results_.total_picture_layers_off_screen++; |
163 return; | 163 return; |
164 } | 164 } |
165 | 165 |
166 FixedInvalidationPictureLayerTilingClient client(layer, | 166 FixedInvalidationPictureLayerTilingClient client(layer, |
167 gfx::Rect(layer->bounds())); | 167 gfx::Rect(layer->bounds())); |
168 | 168 |
169 // In this benchmark, we will create a local tiling set and measure how long | 169 // In this benchmark, we will create a local tiling set and measure how long |
170 // it takes to rasterize content. As such, the actual settings used here don't | 170 // it takes to rasterize content. As such, the actual settings used here don't |
171 // really matter. | 171 // really matter. |
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, | 174 layer->GetTree(), &client, |
175 settings.tiling_interest_area_viewport_multiplier, | 175 settings.tiling_interest_area_viewport_multiplier, |
176 settings.skewport_target_time_in_seconds, | 176 settings.skewport_target_time_in_seconds, |
177 settings.skewport_extrapolation_limit_in_content_pixels); | 177 settings.skewport_extrapolation_limit_in_content_pixels); |
178 | 178 |
179 PictureLayerTiling* tiling = | 179 PictureLayerTiling* tiling = |
180 tiling_set->AddTiling(1.f, layer->GetRasterSource()); | 180 tiling_set->AddTiling(1.f, layer->GetRasterSource()); |
181 tiling->CreateAllTilesForTesting(); | 181 tiling->CreateAllTilesForTesting(); |
182 RasterSource* raster_source = tiling->raster_source(); | 182 RasterSource* raster_source = tiling->raster_source(); |
183 for (PictureLayerTiling::CoverageIterator it(tiling, 1.f, | 183 for (PictureLayerTiling::CoverageIterator it(tiling, 1.f, |
184 layer->visible_content_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); |
(...skipping 21 matching lines...) Expand all Loading... |
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 |
OLD | NEW |