| 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.h" | 5 #include "cc/debug/rasterize_and_record_benchmark.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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // quantization when the layer is very small. | 154 // quantization when the layer is very small. |
| 155 LapTimer timer(kWarmupRuns, | 155 LapTimer timer(kWarmupRuns, |
| 156 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 156 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 157 kTimeCheckInterval); | 157 kTimeCheckInterval); |
| 158 | 158 |
| 159 do { | 159 do { |
| 160 display_list = painter->PaintContentsToDisplayList(painting_control); | 160 display_list = painter->PaintContentsToDisplayList(painting_control); |
| 161 if (display_list->ShouldBeAnalyzedForSolidColor()) { | 161 if (display_list->ShouldBeAnalyzedForSolidColor()) { |
| 162 gfx::Size layer_size = layer->paint_properties().bounds; | 162 gfx::Size layer_size = layer->paint_properties().bounds; |
| 163 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); | 163 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); |
| 164 display_list->Raster(&canvas, nullptr, gfx::Rect(), 1.f); | 164 display_list->Raster(&canvas, nullptr, gfx::Rect(layer_size), 1.f); |
| 165 } | 165 } |
| 166 | 166 |
| 167 if (memory_used) { | 167 if (memory_used) { |
| 168 // Verify we are recording the same thing each time. | 168 // Verify we are recording the same thing each time. |
| 169 DCHECK_EQ(memory_used, display_list->ApproximateMemoryUsage()); | 169 DCHECK_EQ(memory_used, display_list->ApproximateMemoryUsage()); |
| 170 } else { | 170 } else { |
| 171 memory_used = display_list->ApproximateMemoryUsage(); | 171 memory_used = display_list->ApproximateMemoryUsage(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 timer.NextLap(); | 174 timer.NextLap(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 192 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
| 193 : pixels_recorded(0), bytes_used(0) { | 193 : pixels_recorded(0), bytes_used(0) { |
| 194 } | 194 } |
| 195 | 195 |
| 196 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 196 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
| 197 | 197 |
| 198 } // namespace cc | 198 } // namespace cc |
| OLD | NEW |