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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 }; | 143 }; |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 RasterizeAndRecordBenchmarkImpl::RasterizeAndRecordBenchmarkImpl( | 147 RasterizeAndRecordBenchmarkImpl::RasterizeAndRecordBenchmarkImpl( |
148 scoped_refptr<base::MessageLoopProxy> origin_loop, | 148 scoped_refptr<base::MessageLoopProxy> origin_loop, |
149 base::Value* value, | 149 base::Value* value, |
150 const MicroBenchmarkImpl::DoneCallback& callback) | 150 const MicroBenchmarkImpl::DoneCallback& callback) |
151 : MicroBenchmarkImpl(callback, origin_loop), | 151 : MicroBenchmarkImpl(callback, origin_loop), |
152 rasterize_repeat_count_(kDefaultRasterizeRepeatCount) { | 152 rasterize_repeat_count_(kDefaultRasterizeRepeatCount) { |
153 base::DictionaryValue* settings = NULL; | 153 base::DictionaryValue* settings = nullptr; |
154 value->GetAsDictionary(&settings); | 154 value->GetAsDictionary(&settings); |
155 if (!settings) | 155 if (!settings) |
156 return; | 156 return; |
157 | 157 |
158 if (settings->HasKey("rasterize_repeat_count")) | 158 if (settings->HasKey("rasterize_repeat_count")) |
159 settings->GetInteger("rasterize_repeat_count", &rasterize_repeat_count_); | 159 settings->GetInteger("rasterize_repeat_count", &rasterize_repeat_count_); |
160 } | 160 } |
161 | 161 |
162 RasterizeAndRecordBenchmarkImpl::~RasterizeAndRecordBenchmarkImpl() {} | 162 RasterizeAndRecordBenchmarkImpl::~RasterizeAndRecordBenchmarkImpl() {} |
163 | 163 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 pixels_rasterized_with_non_solid_color(0), | 267 pixels_rasterized_with_non_solid_color(0), |
268 pixels_rasterized_as_opaque(0), | 268 pixels_rasterized_as_opaque(0), |
269 total_layers(0), | 269 total_layers(0), |
270 total_picture_layers(0), | 270 total_picture_layers(0), |
271 total_picture_layers_with_no_content(0), | 271 total_picture_layers_with_no_content(0), |
272 total_picture_layers_off_screen(0) {} | 272 total_picture_layers_off_screen(0) {} |
273 | 273 |
274 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 274 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
275 | 275 |
276 } // namespace cc | 276 } // namespace cc |
OLD | NEW |