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

Side by Side Diff: base/metrics/sample_vector.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « base/metrics/sample_vector.h ('k') | base/metrics/sample_vector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/metrics/sample_vector.h ('k') | base/metrics/sample_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698