Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: media/cast/logging/stats_event_subscriber.cc

Issue 582253002: Cast: Reduce the size of stats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nothing Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/logging/stats_event_subscriber.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « media/cast/logging/stats_event_subscriber.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698