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

Side by Side Diff: base/metrics/sample_vector.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, 2 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 | Annotate | Revision Log
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 using std::vector; 10 using std::vector;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 SampleVectorIterator::SampleVectorIterator(const vector<Count>* counts, 111 SampleVectorIterator::SampleVectorIterator(const vector<Count>* counts,
112 const BucketRanges* bucket_ranges) 112 const BucketRanges* bucket_ranges)
113 : counts_(counts), 113 : counts_(counts),
114 bucket_ranges_(bucket_ranges), 114 bucket_ranges_(bucket_ranges),
115 index_(0) { 115 index_(0) {
116 CHECK_GT(bucket_ranges_->size(), counts_->size()); 116 CHECK_GT(bucket_ranges_->size(), counts_->size());
117 SkipEmptyBuckets(); 117 SkipEmptyBuckets();
118 } 118 }
119 119
120 SampleVectorIterator::~SampleVectorIterator() {}
121
120 bool SampleVectorIterator::Done() const { 122 bool SampleVectorIterator::Done() const {
121 return index_ >= counts_->size(); 123 return index_ >= counts_->size();
122 } 124 }
123 125
124 void SampleVectorIterator::Next() { 126 void SampleVectorIterator::Next() {
125 DCHECK(!Done()); 127 DCHECK(!Done());
126 index_++; 128 index_++;
127 SkipEmptyBuckets(); 129 SkipEmptyBuckets();
128 } 130 }
129 131
(...skipping 21 matching lines...) Expand all
151 return; 153 return;
152 154
153 while (index_ < counts_->size()) { 155 while (index_ < counts_->size()) {
154 if ((*counts_)[index_] != 0) 156 if ((*counts_)[index_] != 0)
155 return; 157 return;
156 index_++; 158 index_++;
157 } 159 }
158 } 160 }
159 161
160 } // namespace base 162 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698