| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 scoped_refptr<DisplayItemList> display_list; | 200 scoped_refptr<DisplayItemList> display_list; |
| 201 for (int i = 0; i < record_repeat_count_; ++i) { | 201 for (int i = 0; i < record_repeat_count_; ++i) { |
| 202 // Run for a minimum amount of time to avoid problems with timer | 202 // Run for a minimum amount of time to avoid problems with timer |
| 203 // quantization when the layer is very small. | 203 // quantization when the layer is very small. |
| 204 LapTimer timer(kWarmupRuns, | 204 LapTimer timer(kWarmupRuns, |
| 205 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 205 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 206 kTimeCheckInterval); | 206 kTimeCheckInterval); |
| 207 | 207 |
| 208 do { | 208 do { |
| 209 const bool use_cached_picture = true; | 209 display_list = painter->PaintContentsToDisplayList(visible_layer_rect, |
| 210 display_list = | 210 painting_control); |
| 211 DisplayItemList::Create(visible_layer_rect, use_cached_picture); | |
| 212 painter->PaintContentsToDisplayList( | |
| 213 display_list.get(), visible_layer_rect, painting_control); | |
| 214 display_list->CreateAndCacheSkPicture(); | 211 display_list->CreateAndCacheSkPicture(); |
| 215 | 212 |
| 216 if (memory_used) { | 213 if (memory_used) { |
| 217 // Verify we are recording the same thing each time. | 214 // Verify we are recording the same thing each time. |
| 218 DCHECK(memory_used == display_list->PictureMemoryUsage()); | 215 DCHECK(memory_used == display_list->PictureMemoryUsage()); |
| 219 } else { | 216 } else { |
| 220 memory_used = display_list->PictureMemoryUsage(); | 217 memory_used = display_list->PictureMemoryUsage(); |
| 221 } | 218 } |
| 222 | 219 |
| 223 timer.NextLap(); | 220 timer.NextLap(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 237 } | 234 } |
| 238 } | 235 } |
| 239 | 236 |
| 240 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 237 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
| 241 : pixels_recorded(0), bytes_used(0) { | 238 : pixels_recorded(0), bytes_used(0) { |
| 242 } | 239 } |
| 243 | 240 |
| 244 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 241 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
| 245 | 242 |
| 246 } // namespace cc | 243 } // namespace cc |
| OLD | NEW |