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/picture_record_benchmark.h" | 5 #include "cc/debug/picture_record_benchmark.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 PictureRecordBenchmark::PictureRecordBenchmark( | 27 PictureRecordBenchmark::PictureRecordBenchmark( |
28 scoped_ptr<base::Value> value, | 28 scoped_ptr<base::Value> value, |
29 const MicroBenchmark::DoneCallback& callback) | 29 const MicroBenchmark::DoneCallback& callback) |
30 : MicroBenchmark(callback) { | 30 : MicroBenchmark(callback) { |
31 if (!value) | 31 if (!value) |
32 return; | 32 return; |
33 | 33 |
34 base::ListValue* list = NULL; | 34 base::ListValue* list = nullptr; |
35 value->GetAsList(&list); | 35 value->GetAsList(&list); |
36 if (!list) | 36 if (!list) |
37 return; | 37 return; |
38 | 38 |
39 for (base::ListValue::iterator it = list->begin(); it != list->end(); ++it) { | 39 for (base::ListValue::iterator it = list->begin(); it != list->end(); ++it) { |
40 base::DictionaryValue* dictionary = NULL; | 40 base::DictionaryValue* dictionary = nullptr; |
41 (*it)->GetAsDictionary(&dictionary); | 41 (*it)->GetAsDictionary(&dictionary); |
42 if (!dictionary || | 42 if (!dictionary || |
43 !dictionary->HasKey("width") || | 43 !dictionary->HasKey("width") || |
44 !dictionary->HasKey("height")) | 44 !dictionary->HasKey("height")) |
45 continue; | 45 continue; |
46 | 46 |
47 int width, height; | 47 int width, height; |
48 dictionary->GetInteger("width", &width); | 48 dictionary->GetInteger("width", &width); |
49 dictionary->GetInteger("height", &height); | 49 dictionary->GetInteger("height", &height); |
50 | 50 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 base::TimeDelta duration = end - start; | 117 base::TimeDelta duration = end - start; |
118 TotalTime& total_time = times_[dimensions]; | 118 TotalTime& total_time = times_[dimensions]; |
119 total_time.first += duration; | 119 total_time.first += duration; |
120 total_time.second++; | 120 total_time.second++; |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 } // namespace cc | 126 } // namespace cc |
OLD | NEW |