| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/metrics/sample_vector.h" | 5 #include "base/metrics/sample_vector.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/bucket_ranges.h" | 8 #include "base/metrics/bucket_ranges.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 count += subtle::NoBarrier_Load(&counts_[i]); | 58 count += subtle::NoBarrier_Load(&counts_[i]); |
| 59 } | 59 } |
| 60 return count; | 60 return count; |
| 61 } | 61 } |
| 62 | 62 |
| 63 Count SampleVector::GetCountAtIndex(size_t bucket_index) const { | 63 Count SampleVector::GetCountAtIndex(size_t bucket_index) const { |
| 64 DCHECK(bucket_index < counts_size_); | 64 DCHECK(bucket_index < counts_size_); |
| 65 return subtle::NoBarrier_Load(&counts_[bucket_index]); | 65 return subtle::NoBarrier_Load(&counts_[bucket_index]); |
| 66 } | 66 } |
| 67 | 67 |
| 68 scoped_ptr<SampleCountIterator> SampleVector::Iterator() const { | 68 std::unique_ptr<SampleCountIterator> SampleVector::Iterator() const { |
| 69 return scoped_ptr<SampleCountIterator>( | 69 return std::unique_ptr<SampleCountIterator>( |
| 70 new SampleVectorIterator(counts_, counts_size_, bucket_ranges_)); | 70 new SampleVectorIterator(counts_, counts_size_, bucket_ranges_)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool SampleVector::AddSubtractImpl(SampleCountIterator* iter, | 73 bool SampleVector::AddSubtractImpl(SampleCountIterator* iter, |
| 74 HistogramSamples::Operator op) { | 74 HistogramSamples::Operator op) { |
| 75 HistogramBase::Sample min; | 75 HistogramBase::Sample min; |
| 76 HistogramBase::Sample max; | 76 HistogramBase::Sample max; |
| 77 HistogramBase::Count count; | 77 HistogramBase::Count count; |
| 78 | 78 |
| 79 // Go through the iterator and add the counts into correct bucket. | 79 // Go through the iterator and add the counts into correct bucket. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return; | 187 return; |
| 188 | 188 |
| 189 while (index_ < counts_size_) { | 189 while (index_ < counts_size_) { |
| 190 if (subtle::NoBarrier_Load(&counts_[index_]) != 0) | 190 if (subtle::NoBarrier_Load(&counts_[index_]) != 0) |
| 191 return; | 191 return; |
| 192 index_++; | 192 index_++; |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace base | 196 } // namespace base |
| OLD | NEW |