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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void RasterizeAndRecordBenchmarkImpl::DidCompleteCommit( | 126 void RasterizeAndRecordBenchmarkImpl::DidCompleteCommit( |
127 LayerTreeHostImpl* host) { | 127 LayerTreeHostImpl* host) { |
128 LayerTreeHostCommon::CallFunctionForEveryLayer( | 128 LayerTreeHostCommon::CallFunctionForEveryLayer( |
129 host->active_tree(), | 129 host->active_tree(), |
130 [this](LayerImpl* layer) { | 130 [this](LayerImpl* layer) { |
131 rasterize_results_.total_layers++; | 131 rasterize_results_.total_layers++; |
132 layer->RunMicroBenchmark(this); | 132 layer->RunMicroBenchmark(this); |
133 }, | 133 }, |
134 CallFunctionLayerType::ALL_LAYERS); | 134 CallFunctionLayerType::ALL_LAYERS); |
135 | 135 |
136 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 136 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
137 result->SetDouble("rasterize_time_ms", | 137 result->SetDouble("rasterize_time_ms", |
138 rasterize_results_.total_best_time.InMillisecondsF()); | 138 rasterize_results_.total_best_time.InMillisecondsF()); |
139 result->SetDouble("total_pictures_in_pile_size", | 139 result->SetDouble("total_pictures_in_pile_size", |
140 static_cast<int>(rasterize_results_.total_memory_usage)); | 140 static_cast<int>(rasterize_results_.total_memory_usage)); |
141 result->SetInteger("pixels_rasterized", rasterize_results_.pixels_rasterized); | 141 result->SetInteger("pixels_rasterized", rasterize_results_.pixels_rasterized); |
142 result->SetInteger("pixels_rasterized_with_non_solid_color", | 142 result->SetInteger("pixels_rasterized_with_non_solid_color", |
143 rasterize_results_.pixels_rasterized_with_non_solid_color); | 143 rasterize_results_.pixels_rasterized_with_non_solid_color); |
144 result->SetInteger("pixels_rasterized_as_opaque", | 144 result->SetInteger("pixels_rasterized_as_opaque", |
145 rasterize_results_.pixels_rasterized_as_opaque); | 145 rasterize_results_.pixels_rasterized_as_opaque); |
146 result->SetInteger("total_layers", rasterize_results_.total_layers); | 146 result->SetInteger("total_layers", rasterize_results_.total_layers); |
(...skipping 18 matching lines...) Expand all Loading... |
165 return; | 165 return; |
166 } | 166 } |
167 | 167 |
168 FixedInvalidationPictureLayerTilingClient client(layer, | 168 FixedInvalidationPictureLayerTilingClient client(layer, |
169 gfx::Rect(layer->bounds())); | 169 gfx::Rect(layer->bounds())); |
170 | 170 |
171 // In this benchmark, we will create a local tiling set and measure how long | 171 // In this benchmark, we will create a local tiling set and measure how long |
172 // it takes to rasterize content. As such, the actual settings used here don't | 172 // it takes to rasterize content. As such, the actual settings used here don't |
173 // really matter. | 173 // really matter. |
174 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings(); | 174 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings(); |
175 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( | 175 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
176 layer->GetTree(), &client, settings.tiling_interest_area_padding, | 176 PictureLayerTilingSet::Create( |
177 settings.skewport_target_time_in_seconds, | 177 layer->GetTree(), &client, settings.tiling_interest_area_padding, |
178 settings.skewport_extrapolation_limit_in_content_pixels); | 178 settings.skewport_target_time_in_seconds, |
| 179 settings.skewport_extrapolation_limit_in_content_pixels); |
179 | 180 |
180 PictureLayerTiling* tiling = | 181 PictureLayerTiling* tiling = |
181 tiling_set->AddTiling(1.f, layer->GetRasterSource()); | 182 tiling_set->AddTiling(1.f, layer->GetRasterSource()); |
182 tiling->set_resolution(HIGH_RESOLUTION); | 183 tiling->set_resolution(HIGH_RESOLUTION); |
183 tiling->CreateAllTilesForTesting(); | 184 tiling->CreateAllTilesForTesting(); |
184 RasterSource* raster_source = tiling->raster_source().get(); | 185 RasterSource* raster_source = tiling->raster_source().get(); |
185 for (PictureLayerTiling::CoverageIterator it(tiling, 1.f, | 186 for (PictureLayerTiling::CoverageIterator it(tiling, 1.f, |
186 layer->visible_layer_rect()); | 187 layer->visible_layer_rect()); |
187 it; ++it) { | 188 it; ++it) { |
188 DCHECK(*it); | 189 DCHECK(*it); |
(...skipping 29 matching lines...) Expand all Loading... |
218 total_memory_usage(0), | 219 total_memory_usage(0), |
219 total_layers(0), | 220 total_layers(0), |
220 total_picture_layers(0), | 221 total_picture_layers(0), |
221 total_picture_layers_with_no_content(0), | 222 total_picture_layers_with_no_content(0), |
222 total_picture_layers_off_screen(0) { | 223 total_picture_layers_off_screen(0) { |
223 } | 224 } |
224 | 225 |
225 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 226 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
226 | 227 |
227 } // namespace cc | 228 } // namespace cc |
OLD | NEW |