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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 PicturePileImpl::Analysis analysis; | 57 PicturePileImpl::Analysis analysis; |
58 | 58 |
59 picture_pile_->AnalyzeInRect( | 59 picture_pile_->AnalyzeInRect( |
60 content_rect_, contents_scale_, &analysis, NULL); | 60 content_rect_, contents_scale_, &analysis, nullptr); |
61 picture_pile_->RasterToBitmap( | 61 picture_pile_->RasterToBitmap( |
62 &canvas, content_rect_, contents_scale_, NULL); | 62 &canvas, content_rect_, contents_scale_, nullptr); |
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 }; | 147 }; |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
151 RasterizeAndRecordBenchmarkImpl::RasterizeAndRecordBenchmarkImpl( | 151 RasterizeAndRecordBenchmarkImpl::RasterizeAndRecordBenchmarkImpl( |
152 scoped_refptr<base::MessageLoopProxy> origin_loop, | 152 scoped_refptr<base::MessageLoopProxy> origin_loop, |
153 base::Value* value, | 153 base::Value* value, |
154 const MicroBenchmarkImpl::DoneCallback& callback) | 154 const MicroBenchmarkImpl::DoneCallback& callback) |
155 : MicroBenchmarkImpl(callback, origin_loop), | 155 : MicroBenchmarkImpl(callback, origin_loop), |
156 rasterize_repeat_count_(kDefaultRasterizeRepeatCount) { | 156 rasterize_repeat_count_(kDefaultRasterizeRepeatCount) { |
157 base::DictionaryValue* settings = NULL; | 157 base::DictionaryValue* settings = nullptr; |
158 value->GetAsDictionary(&settings); | 158 value->GetAsDictionary(&settings); |
159 if (!settings) | 159 if (!settings) |
160 return; | 160 return; |
161 | 161 |
162 if (settings->HasKey("rasterize_repeat_count")) | 162 if (settings->HasKey("rasterize_repeat_count")) |
163 settings->GetInteger("rasterize_repeat_count", &rasterize_repeat_count_); | 163 settings->GetInteger("rasterize_repeat_count", &rasterize_repeat_count_); |
164 } | 164 } |
165 | 165 |
166 RasterizeAndRecordBenchmarkImpl::~RasterizeAndRecordBenchmarkImpl() {} | 166 RasterizeAndRecordBenchmarkImpl::~RasterizeAndRecordBenchmarkImpl() {} |
167 | 167 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 pixels_rasterized_with_non_solid_color(0), | 271 pixels_rasterized_with_non_solid_color(0), |
272 pixels_rasterized_as_opaque(0), | 272 pixels_rasterized_as_opaque(0), |
273 total_layers(0), | 273 total_layers(0), |
274 total_picture_layers(0), | 274 total_picture_layers(0), |
275 total_picture_layers_with_no_content(0), | 275 total_picture_layers_with_no_content(0), |
276 total_picture_layers_off_screen(0) {} | 276 total_picture_layers_off_screen(0) {} |
277 | 277 |
278 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 278 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
279 | 279 |
280 } // namespace cc | 280 } // namespace cc |
OLD | NEW |