| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 break; | 140 break; |
| 141 case DisplayListRecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED: | 141 case DisplayListRecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED: |
| 142 painting_control = | 142 painting_control = |
| 143 ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED; | 143 ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED; |
| 144 break; | 144 break; |
| 145 default: | 145 default: |
| 146 NOTREACHED(); | 146 NOTREACHED(); |
| 147 } | 147 } |
| 148 base::TimeDelta min_time = base::TimeDelta::Max(); | 148 base::TimeDelta min_time = base::TimeDelta::Max(); |
| 149 size_t memory_used = 0; | 149 size_t memory_used = 0; |
| 150 | 150 gfx::Rect recording_viewport = visible_layer_rect; |
| 151 scoped_refptr<DisplayItemList> display_list; | 151 scoped_refptr<DisplayItemList> display_list; |
| 152 for (int i = 0; i < record_repeat_count_; ++i) { | 152 for (int i = 0; i < record_repeat_count_; ++i) { |
| 153 // Run for a minimum amount of time to avoid problems with timer | 153 // Run for a minimum amount of time to avoid problems with timer |
| 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(visible_layer_rect, | 160 display_list = painter->PaintContentsToDisplayList(painting_control, |
| 161 painting_control); | 161 &recording_viewport); |
| 162 if (display_list->ShouldBeAnalyzedForSolidColor()) { | 162 if (display_list->ShouldBeAnalyzedForSolidColor()) { |
| 163 gfx::Size layer_size = layer->paint_properties().bounds; | 163 gfx::Size layer_size = layer->paint_properties().bounds; |
| 164 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); | 164 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); |
| 165 display_list->Raster(&canvas, nullptr, gfx::Rect(), 1.f); | 165 display_list->Raster(&canvas, nullptr, gfx::Rect(), 1.f); |
| 166 } | 166 } |
| 167 | 167 |
| 168 if (memory_used) { | 168 if (memory_used) { |
| 169 // Verify we are recording the same thing each time. | 169 // Verify we are recording the same thing each time. |
| 170 DCHECK_EQ(memory_used, display_list->ApproximateMemoryUsage()); | 170 DCHECK_EQ(memory_used, display_list->ApproximateMemoryUsage()); |
| 171 } else { | 171 } else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 193 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
| 194 : pixels_recorded(0), bytes_used(0) { | 194 : pixels_recorded(0), bytes_used(0) { |
| 195 } | 195 } |
| 196 | 196 |
| 197 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 197 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
| 198 | 198 |
| 199 } // namespace cc | 199 } // namespace cc |
| OLD | NEW |