| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 LapTimer timer(kWarmupRuns, | 49 LapTimer timer(kWarmupRuns, |
| 50 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 50 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 51 kTimeCheckInterval); | 51 kTimeCheckInterval); |
| 52 do { | 52 do { |
| 53 SkBitmap bitmap; | 53 SkBitmap bitmap; |
| 54 bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect_.width(), | 54 bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect_.width(), |
| 55 content_rect_.height())); | 55 content_rect_.height())); |
| 56 SkCanvas canvas(bitmap); | 56 SkCanvas canvas(bitmap); |
| 57 RasterSource::SolidColorAnalysis analysis; | 57 RasterSource::SolidColorAnalysis analysis; |
| 58 | 58 |
| 59 raster_source_->PerformSolidColorAnalysis( | 59 raster_source_->PerformSolidColorAnalysis(content_rect_, |
| 60 content_rect_, contents_scale_, &analysis, nullptr); | 60 contents_scale_, &analysis); |
| 61 raster_source_->PlaybackToCanvas( | 61 raster_source_->PlaybackToCanvas(&canvas, content_rect_, |
| 62 &canvas, content_rect_, contents_scale_, nullptr); | 62 contents_scale_); |
| 63 | 63 |
| 64 is_solid_color_ = analysis.is_solid_color; | 64 is_solid_color_ = analysis.is_solid_color; |
| 65 | 65 |
| 66 timer.NextLap(); | 66 timer.NextLap(); |
| 67 } while (!timer.HasTimeLimitExpired()); | 67 } while (!timer.HasTimeLimitExpired()); |
| 68 base::TimeDelta duration = | 68 base::TimeDelta duration = |
| 69 base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); | 69 base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); |
| 70 if (duration < best_time_) | 70 if (duration < best_time_) |
| 71 best_time_ = duration; | 71 best_time_ = duration; |
| 72 } | 72 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 pixels_rasterized_with_non_solid_color(0), | 270 pixels_rasterized_with_non_solid_color(0), |
| 271 pixels_rasterized_as_opaque(0), | 271 pixels_rasterized_as_opaque(0), |
| 272 total_layers(0), | 272 total_layers(0), |
| 273 total_picture_layers(0), | 273 total_picture_layers(0), |
| 274 total_picture_layers_with_no_content(0), | 274 total_picture_layers_with_no_content(0), |
| 275 total_picture_layers_off_screen(0) {} | 275 total_picture_layers_off_screen(0) {} |
| 276 | 276 |
| 277 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 277 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
| 278 | 278 |
| 279 } // namespace cc | 279 } // namespace cc |
| OLD | NEW |