Index: base/metrics/sample_map.cc |
diff --git a/base/metrics/sample_map.cc b/base/metrics/sample_map.cc |
index e276b91643b6a4fa567b2e4f84eb09b94a92a38c..4253d54f8103c2dfca598bb003681c1f522a3a52 100644 |
--- a/base/metrics/sample_map.cc |
+++ b/base/metrics/sample_map.cc |
@@ -5,6 +5,7 @@ |
#include "base/metrics/sample_map.h" |
#include "base/logging.h" |
+#include "base/stl_util.h" |
namespace base { |
@@ -32,18 +33,16 @@ Count SampleMap::GetCount(Sample value) const { |
Count SampleMap::TotalCount() const { |
Count count = 0; |
- for (const auto& entry : sample_counts_) { |
+ for (const auto& entry : sample_counts_) |
count += entry.second; |
- } |
return count; |
} |
scoped_ptr<SampleCountIterator> SampleMap::Iterator() const { |
- return scoped_ptr<SampleCountIterator>(new SampleMapIterator(sample_counts_)); |
+ return make_scoped_ptr(new SampleMapIterator(sample_counts_)); |
} |
-bool SampleMap::AddSubtractImpl(SampleCountIterator* iter, |
- HistogramSamples::Operator op) { |
+bool SampleMap::AddSubtractImpl(SampleCountIterator* iter, Operator op) { |
Sample min; |
Sample max; |
Count count; |
@@ -77,18 +76,17 @@ void SampleMapIterator::Next() { |
void SampleMapIterator::Get(Sample* min, Sample* max, Count* count) const { |
DCHECK(!Done()); |
- if (min != NULL) |
+ if (min) |
*min = iter_->first; |
- if (max != NULL) |
+ if (max) |
*max = iter_->first + 1; |
- if (count != NULL) |
+ if (count) |
*count = iter_->second; |
} |
void SampleMapIterator::SkipEmptyBuckets() { |
- while (!Done() && iter_->second == 0) { |
+ while (!Done() && iter_->second == 0) |
++iter_; |
- } |
} |
} // namespace base |