Chromium Code Reviews| Index: media/cast/logging/stats_event_subscriber.cc |
| diff --git a/media/cast/logging/stats_event_subscriber.cc b/media/cast/logging/stats_event_subscriber.cc |
| index b9cf26532f24e89b4e82f64e7c12e3e4e87069d5..b639e04cd448fc26fb3957e8f582f0eff4cd5a18 100644 |
| --- a/media/cast/logging/stats_event_subscriber.cc |
| +++ b/media/cast/logging/stats_event_subscriber.cc |
| @@ -59,33 +59,20 @@ void StatsEventSubscriber::SimpleHistogram::Reset() { |
| buckets_.assign(buckets_.size(), 0); |
| } |
| -scoped_ptr<base::ListValue> |
| +scoped_ptr<base::DictionaryValue> |
|
imcheng
2014/09/18 22:06:20
The problem with this approach is that the buckets
|
| StatsEventSubscriber::SimpleHistogram::GetHistogram() const { |
| - scoped_ptr<base::ListValue> histo(new base::ListValue); |
| - |
| - scoped_ptr<base::DictionaryValue> bucket(new base::DictionaryValue); |
| - |
| - bucket->SetString("bucket", base::StringPrintf("< %" PRId64, min_)); |
| - bucket->SetInteger("count", buckets_.front()); |
| - histo->Append(bucket.release()); |
| + scoped_ptr<base::DictionaryValue> histo(new base::DictionaryValue); |
| + histo->SetInteger(base::StringPrintf("< %" PRId64, min_), buckets_.front()); |
| for (size_t i = 1; i < buckets_.size() - 1; i++) { |
| - bucket.reset(new base::DictionaryValue); |
| - |
| int64 lower = min_ + (i - 1) * width_; |
| int64 upper = lower + width_ - 1; |
| - bucket->SetString( |
| - "bucket", base::StringPrintf("%" PRId64 " - %" PRId64, lower, upper)); |
| - bucket->SetInteger("count", buckets_[i]); |
| - histo->Append(bucket.release()); |
| + histo->SetInteger( |
| + base::StringPrintf("%" PRId64 " - %" PRId64, lower, upper), |
| + buckets_[i]); |
| } |
| - bucket.reset(new base::DictionaryValue); |
| - |
| - bucket->SetString("bucket", base::StringPrintf(">= %" PRId64, max_)); |
| - bucket->SetInteger("count", buckets_.back()); |
| - histo->Append(bucket.release()); |
| - |
| + histo->SetInteger(base::StringPrintf(">= %" PRId64, max_), buckets_.back()); |
| return histo.Pass(); |
| } |