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

Unified Diff: base/metrics/sparse_histogram.cc

Issue 11022002: Add SampleMap and use it in SparseHistogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add destructors to avoid compiler warning on clang Created 8 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
Index: base/metrics/sparse_histogram.cc
diff --git a/base/metrics/sparse_histogram.cc b/base/metrics/sparse_histogram.cc
index 05a68b53540a1f5daf23c62c8ac6b6faa94e4006..b8f097fd14a1e49dcd0d359e04542ea31ebcbfb9 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -22,13 +22,13 @@ HistogramBase* SparseHistogram::FactoryGet(const string& name,
SparseHistogram::~SparseHistogram() {}
void SparseHistogram::Add(Sample value) {
- base::AutoLock auto_lock(lock_);
- samples_[value]++;
+ samples_.Accumulate(value, 1);
}
-void SparseHistogram::SnapshotSample(std::map<Sample, Count>* samples) const {
- base::AutoLock auto_lock(lock_);
- *samples = samples_;
+scoped_ptr<SampleMap> SparseHistogram::SnapshotSamples() const {
+ scoped_ptr<SampleMap> snapshot(new SampleMap());
+ snapshot->Add(samples_);
+ return snapshot.Pass();
}
void SparseHistogram::WriteHTMLGraph(string* output) const {

Powered by Google App Engine
This is Rietveld 408576698