| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "cc/debug/lap_timer.h" | 12 #include "cc/debug/lap_timer.h" |
| 13 #include "cc/layers/layer_impl.h" | 13 #include "cc/layers/layer_impl.h" |
| 14 #include "cc/layers/picture_layer_impl.h" | 14 #include "cc/layers/picture_layer_impl.h" |
| 15 #include "cc/resources/tile_task_worker_pool.h" | 15 #include "cc/resources/tile_task_worker_pool.h" |
| 16 #include "cc/trees/layer_tree_host_common.h" | 16 #include "cc/trees/layer_tree_host_common.h" |
| 17 #include "cc/trees/layer_tree_host_impl.h" | 17 #include "cc/trees/layer_tree_host_impl.h" |
| 18 #include "cc/trees/layer_tree_impl.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 19 | 20 |
| 20 namespace cc { | 21 namespace cc { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const int kDefaultRasterizeRepeatCount = 100; | 25 const int kDefaultRasterizeRepeatCount = 100; |
| 25 | 26 |
| 26 class BenchmarkRasterTask : public Task { | 27 class BenchmarkRasterTask : public Task { |
| 27 public: | 28 public: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 115 |
| 115 PictureLayerTiling* GetRecycledTwinTiling( | 116 PictureLayerTiling* GetRecycledTwinTiling( |
| 116 const PictureLayerTiling* tiling) override { | 117 const PictureLayerTiling* tiling) override { |
| 117 return base_client_->GetRecycledTwinTiling(tiling); | 118 return base_client_->GetRecycledTwinTiling(tiling); |
| 118 } | 119 } |
| 119 | 120 |
| 120 TilePriority::PriorityBin GetMaxTilePriorityBin() const override { | 121 TilePriority::PriorityBin GetMaxTilePriorityBin() const override { |
| 121 return base_client_->GetMaxTilePriorityBin(); | 122 return base_client_->GetMaxTilePriorityBin(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 size_t GetMaxTilesForInterestArea() const override { | |
| 125 return base_client_->GetMaxTilesForInterestArea(); | |
| 126 } | |
| 127 | |
| 128 float GetSkewportTargetTimeInSeconds() const override { | |
| 129 return base_client_->GetSkewportTargetTimeInSeconds(); | |
| 130 } | |
| 131 | |
| 132 int GetSkewportExtrapolationLimitInContentPixels() const override { | |
| 133 return base_client_->GetSkewportExtrapolationLimitInContentPixels(); | |
| 134 } | |
| 135 | |
| 136 WhichTree GetTree() const override { return base_client_->GetTree(); } | 125 WhichTree GetTree() const override { return base_client_->GetTree(); } |
| 137 | 126 |
| 138 bool RequiresHighResToDraw() const override { | 127 bool RequiresHighResToDraw() const override { |
| 139 return base_client_->RequiresHighResToDraw(); | 128 return base_client_->RequiresHighResToDraw(); |
| 140 } | 129 } |
| 141 | 130 |
| 142 private: | 131 private: |
| 143 PictureLayerTilingClient* base_client_; | 132 PictureLayerTilingClient* base_client_; |
| 144 Region invalidation_; | 133 Region invalidation_; |
| 145 }; | 134 }; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 197 } |
| 209 | 198 |
| 210 TaskGraphRunner* task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner(); | 199 TaskGraphRunner* task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner(); |
| 211 DCHECK(task_graph_runner); | 200 DCHECK(task_graph_runner); |
| 212 | 201 |
| 213 if (!task_namespace_.IsValid()) | 202 if (!task_namespace_.IsValid()) |
| 214 task_namespace_ = task_graph_runner->GetNamespaceToken(); | 203 task_namespace_ = task_graph_runner->GetNamespaceToken(); |
| 215 | 204 |
| 216 FixedInvalidationPictureLayerTilingClient client( | 205 FixedInvalidationPictureLayerTilingClient client( |
| 217 layer, gfx::Rect(layer->content_bounds())); | 206 layer, gfx::Rect(layer->content_bounds())); |
| 218 auto tiling_set = PictureLayerTilingSet::Create(&client); | 207 |
| 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 |
| 210 // really matter. |
| 211 const LayerTreeSettings& settings = layer->layer_tree_impl()->settings(); |
| 212 auto tiling_set = PictureLayerTilingSet::Create( |
| 213 &client, settings.max_tiles_for_interest_area, |
| 214 settings.skewport_target_time_in_seconds, |
| 215 settings.skewport_extrapolation_limit_in_content_pixels); |
| 219 | 216 |
| 220 PictureLayerTiling* tiling = | 217 PictureLayerTiling* tiling = |
| 221 tiling_set->AddTiling(layer->contents_scale_x(), layer->bounds()); | 218 tiling_set->AddTiling(layer->contents_scale_x(), layer->bounds()); |
| 222 tiling->CreateAllTilesForTesting(); | 219 tiling->CreateAllTilesForTesting(); |
| 223 for (PictureLayerTiling::CoverageIterator it( | 220 for (PictureLayerTiling::CoverageIterator it( |
| 224 tiling, layer->contents_scale_x(), layer->visible_content_rect()); | 221 tiling, layer->contents_scale_x(), layer->visible_content_rect()); |
| 225 it; | 222 it; |
| 226 ++it) { | 223 ++it) { |
| 227 DCHECK(*it); | 224 DCHECK(*it); |
| 228 | 225 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 total_memory_usage(0), | 274 total_memory_usage(0), |
| 278 total_layers(0), | 275 total_layers(0), |
| 279 total_picture_layers(0), | 276 total_picture_layers(0), |
| 280 total_picture_layers_with_no_content(0), | 277 total_picture_layers_with_no_content(0), |
| 281 total_picture_layers_off_screen(0) { | 278 total_picture_layers_off_screen(0) { |
| 282 } | 279 } |
| 283 | 280 |
| 284 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 281 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
| 285 | 282 |
| 286 } // namespace cc | 283 } // namespace cc |
| OLD | NEW |