| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 FixedInvalidationPictureLayerTilingClient( | 92 FixedInvalidationPictureLayerTilingClient( |
| 93 PictureLayerTilingClient* base_client, | 93 PictureLayerTilingClient* base_client, |
| 94 const Region invalidation) | 94 const Region invalidation) |
| 95 : base_client_(base_client), invalidation_(invalidation) {} | 95 : base_client_(base_client), invalidation_(invalidation) {} |
| 96 | 96 |
| 97 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, | 97 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, |
| 98 const gfx::Rect& content_rect) override { | 98 const gfx::Rect& content_rect) override { |
| 99 return base_client_->CreateTile(tiling, content_rect); | 99 return base_client_->CreateTile(tiling, content_rect); |
| 100 } | 100 } |
| 101 | 101 |
| 102 RasterSource* GetRasterSource() override { | |
| 103 return base_client_->GetRasterSource(); | |
| 104 } | |
| 105 | |
| 106 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override { | 102 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override { |
| 107 return base_client_->CalculateTileSize(content_bounds); | 103 return base_client_->CalculateTileSize(content_bounds); |
| 108 } | 104 } |
| 109 | 105 |
| 110 // This is the only function that returns something different from the base | 106 // This is the only function that returns something different from the base |
| 111 // client. Avoids sharing tiles in this area. | 107 // client. Avoids sharing tiles in this area. |
| 112 const Region* GetPendingInvalidation() override { return &invalidation_; } | 108 const Region* GetPendingInvalidation() override { return &invalidation_; } |
| 113 | 109 |
| 114 const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 110 const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
| 115 const PictureLayerTiling* tiling) const override { | 111 const PictureLayerTiling* tiling) const override { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 206 } |
| 211 | 207 |
| 212 TaskGraphRunner* task_graph_runner = RasterWorkerPool::GetTaskGraphRunner(); | 208 TaskGraphRunner* task_graph_runner = RasterWorkerPool::GetTaskGraphRunner(); |
| 213 DCHECK(task_graph_runner); | 209 DCHECK(task_graph_runner); |
| 214 | 210 |
| 215 if (!task_namespace_.IsValid()) | 211 if (!task_namespace_.IsValid()) |
| 216 task_namespace_ = task_graph_runner->GetNamespaceToken(); | 212 task_namespace_ = task_graph_runner->GetNamespaceToken(); |
| 217 | 213 |
| 218 FixedInvalidationPictureLayerTilingClient client( | 214 FixedInvalidationPictureLayerTilingClient client( |
| 219 layer, gfx::Rect(layer->content_bounds())); | 215 layer, gfx::Rect(layer->content_bounds())); |
| 220 PictureLayerTilingSet tiling_set(&client); | 216 auto tiling_set = |
| 217 PictureLayerTilingSet::Create(&client, layer->GetRasterSource()); |
| 221 | 218 |
| 222 PictureLayerTiling* tiling = | 219 PictureLayerTiling* tiling = |
| 223 tiling_set.AddTiling(layer->contents_scale_x(), layer->bounds()); | 220 tiling_set->AddTiling(layer->contents_scale_x(), layer->bounds()); |
| 224 tiling->CreateAllTilesForTesting(); | 221 tiling->CreateAllTilesForTesting(); |
| 225 for (PictureLayerTiling::CoverageIterator it( | 222 for (PictureLayerTiling::CoverageIterator it( |
| 226 tiling, layer->contents_scale_x(), layer->visible_content_rect()); | 223 tiling, layer->contents_scale_x(), layer->visible_content_rect()); |
| 227 it; | 224 it; |
| 228 ++it) { | 225 ++it) { |
| 229 DCHECK(*it); | 226 DCHECK(*it); |
| 230 | 227 |
| 231 RasterSource* raster_source = (*it)->raster_source(); | 228 RasterSource* raster_source = (*it)->raster_source(); |
| 232 gfx::Rect content_rect = (*it)->content_rect(); | 229 gfx::Rect content_rect = (*it)->content_rect(); |
| 233 float contents_scale = (*it)->contents_scale(); | 230 float contents_scale = (*it)->contents_scale(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 pixels_rasterized_with_non_solid_color(0), | 271 pixels_rasterized_with_non_solid_color(0), |
| 275 pixels_rasterized_as_opaque(0), | 272 pixels_rasterized_as_opaque(0), |
| 276 total_layers(0), | 273 total_layers(0), |
| 277 total_picture_layers(0), | 274 total_picture_layers(0), |
| 278 total_picture_layers_with_no_content(0), | 275 total_picture_layers_with_no_content(0), |
| 279 total_picture_layers_off_screen(0) {} | 276 total_picture_layers_off_screen(0) {} |
| 280 | 277 |
| 281 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 278 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
| 282 | 279 |
| 283 } // namespace cc | 280 } // namespace cc |
| OLD | NEW |