| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 RasterizeAndRecordBenchmark::RasterizeAndRecordBenchmark( | 33 RasterizeAndRecordBenchmark::RasterizeAndRecordBenchmark( |
| 34 scoped_ptr<base::Value> value, | 34 scoped_ptr<base::Value> value, |
| 35 const MicroBenchmark::DoneCallback& callback) | 35 const MicroBenchmark::DoneCallback& callback) |
| 36 : MicroBenchmark(callback), | 36 : MicroBenchmark(callback), |
| 37 record_repeat_count_(kDefaultRecordRepeatCount), | 37 record_repeat_count_(kDefaultRecordRepeatCount), |
| 38 settings_(value.Pass()), | 38 settings_(value.Pass()), |
| 39 main_thread_benchmark_done_(false), | 39 main_thread_benchmark_done_(false), |
| 40 host_(NULL), | 40 host_(nullptr), |
| 41 weak_ptr_factory_(this) { | 41 weak_ptr_factory_(this) { |
| 42 base::DictionaryValue* settings = NULL; | 42 base::DictionaryValue* settings = nullptr; |
| 43 settings_->GetAsDictionary(&settings); | 43 settings_->GetAsDictionary(&settings); |
| 44 if (!settings) | 44 if (!settings) |
| 45 return; | 45 return; |
| 46 | 46 |
| 47 if (settings->HasKey("record_repeat_count")) | 47 if (settings->HasKey("record_repeat_count")) |
| 48 settings->GetInteger("record_repeat_count", &record_repeat_count_); | 48 settings->GetInteger("record_repeat_count", &record_repeat_count_); |
| 49 } | 49 } |
| 50 | 50 |
| 51 RasterizeAndRecordBenchmark::~RasterizeAndRecordBenchmark() { | 51 RasterizeAndRecordBenchmark::~RasterizeAndRecordBenchmark() { |
| 52 weak_ptr_factory_.InvalidateWeakPtrs(); | 52 weak_ptr_factory_.InvalidateWeakPtrs(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 results_->SetDouble(name, | 67 results_->SetDouble(name, |
| 68 record_results_.total_best_time[i].InMillisecondsF()); | 68 record_results_.total_best_time[i].InMillisecondsF()); |
| 69 } | 69 } |
| 70 main_thread_benchmark_done_ = true; | 70 main_thread_benchmark_done_ = true; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void RasterizeAndRecordBenchmark::RecordRasterResults( | 73 void RasterizeAndRecordBenchmark::RecordRasterResults( |
| 74 scoped_ptr<base::Value> results_value) { | 74 scoped_ptr<base::Value> results_value) { |
| 75 DCHECK(main_thread_benchmark_done_); | 75 DCHECK(main_thread_benchmark_done_); |
| 76 | 76 |
| 77 base::DictionaryValue* results = NULL; | 77 base::DictionaryValue* results = nullptr; |
| 78 results_value->GetAsDictionary(&results); | 78 results_value->GetAsDictionary(&results); |
| 79 DCHECK(results); | 79 DCHECK(results); |
| 80 | 80 |
| 81 results_->MergeDictionary(results); | 81 results_->MergeDictionary(results); |
| 82 | 82 |
| 83 NotifyDone(results_.Pass()); | 83 NotifyDone(results_.Pass()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 scoped_ptr<MicroBenchmarkImpl> RasterizeAndRecordBenchmark::CreateBenchmarkImpl( | 86 scoped_ptr<MicroBenchmarkImpl> RasterizeAndRecordBenchmark::CreateBenchmarkImpl( |
| 87 scoped_refptr<base::MessageLoopProxy> origin_loop) { | 87 scoped_refptr<base::MessageLoopProxy> origin_loop) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 record_results_.total_best_time[mode_index] += min_time; | 146 record_results_.total_best_time[mode_index] += min_time; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 150 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
| 151 : pixels_recorded(0) {} | 151 : pixels_recorded(0) {} |
| 152 | 152 |
| 153 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 153 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
| 154 | 154 |
| 155 } // namespace cc | 155 } // namespace cc |
| OLD | NEW |