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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 }; | 88 }; |
89 | 89 |
90 class FixedInvalidationPictureLayerTilingClient | 90 class FixedInvalidationPictureLayerTilingClient |
91 : public PictureLayerTilingClient { | 91 : public PictureLayerTilingClient { |
92 public: | 92 public: |
93 FixedInvalidationPictureLayerTilingClient( | 93 FixedInvalidationPictureLayerTilingClient( |
94 PictureLayerTilingClient* base_client, | 94 PictureLayerTilingClient* base_client, |
95 const Region invalidation) | 95 const Region invalidation) |
96 : base_client_(base_client), invalidation_(invalidation) {} | 96 : base_client_(base_client), invalidation_(invalidation) {} |
97 | 97 |
98 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, | 98 scoped_refptr<Tile> CreateTile(float contents_scale, |
99 const gfx::Rect& content_rect) override { | 99 const gfx::Rect& content_rect) override { |
100 return base_client_->CreateTile(tiling, content_rect); | 100 return base_client_->CreateTile(contents_scale, content_rect); |
101 } | 101 } |
102 | 102 |
103 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override { | 103 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override { |
104 return base_client_->CalculateTileSize(content_bounds); | 104 return base_client_->CalculateTileSize(content_bounds); |
105 } | 105 } |
106 | 106 |
107 // This is the only function that returns something different from the base | 107 // This is the only function that returns something different from the base |
108 // client. Avoids sharing tiles in this area. | 108 // client. Avoids sharing tiles in this area. |
109 const Region* GetPendingInvalidation() override { return &invalidation_; } | 109 const Region* GetPendingInvalidation() override { return &invalidation_; } |
110 | 110 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 // In this benchmark, we will create a local tiling set and measure how long | 208 // In this benchmark, we will create a local tiling set and measure how long |
209 // it takes to rasterize content. As such, the actual settings used here don't | 209 // it takes to rasterize content. As such, the actual settings used here don't |
210 // really matter. | 210 // really matter. |
211 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings(); | 211 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings(); |
212 auto tiling_set = PictureLayerTilingSet::Create( | 212 auto tiling_set = PictureLayerTilingSet::Create( |
213 &client, settings.max_tiles_for_interest_area, | 213 &client, settings.max_tiles_for_interest_area, |
214 settings.skewport_target_time_in_seconds, | 214 settings.skewport_target_time_in_seconds, |
215 settings.skewport_extrapolation_limit_in_content_pixels); | 215 settings.skewport_extrapolation_limit_in_content_pixels); |
216 | 216 |
217 PictureLayerTiling* tiling = | 217 PictureLayerTiling* tiling = tiling_set->AddTiling(layer->contents_scale_x(), |
218 tiling_set->AddTiling(layer->contents_scale_x(), layer->bounds()); | 218 layer->GetRasterSource()); |
219 tiling->CreateAllTilesForTesting(); | 219 tiling->CreateAllTilesForTesting(); |
220 for (PictureLayerTiling::CoverageIterator it( | 220 for (PictureLayerTiling::CoverageIterator it( |
221 tiling, layer->contents_scale_x(), layer->visible_content_rect()); | 221 tiling, layer->contents_scale_x(), layer->visible_content_rect()); |
222 it; | 222 it; |
223 ++it) { | 223 ++it) { |
224 DCHECK(*it); | 224 DCHECK(*it); |
225 | 225 |
226 RasterSource* raster_source = (*it)->raster_source(); | 226 RasterSource* raster_source = (*it)->raster_source(); |
227 gfx::Rect content_rect = (*it)->content_rect(); | 227 gfx::Rect content_rect = (*it)->content_rect(); |
228 float contents_scale = (*it)->contents_scale(); | 228 float contents_scale = (*it)->contents_scale(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 total_memory_usage(0), | 274 total_memory_usage(0), |
275 total_layers(0), | 275 total_layers(0), |
276 total_picture_layers(0), | 276 total_picture_layers(0), |
277 total_picture_layers_with_no_content(0), | 277 total_picture_layers_with_no_content(0), |
278 total_picture_layers_off_screen(0) { | 278 total_picture_layers_off_screen(0) { |
279 } | 279 } |
280 | 280 |
281 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 281 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
282 | 282 |
283 } // namespace cc | 283 } // namespace cc |
OLD | NEW |