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

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

Issue 13006014: remove redundant DCHECK that a size_t variable >= 0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | 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 using std::vector; 10 using std::vector;
(...skipping 25 matching lines...) Expand all
36 36
37 Count SampleVector::TotalCount() const { 37 Count SampleVector::TotalCount() const {
38 Count count = 0; 38 Count count = 0;
39 for (size_t i = 0; i < counts_.size(); i++) { 39 for (size_t i = 0; i < counts_.size(); i++) {
40 count += counts_[i]; 40 count += counts_[i];
41 } 41 }
42 return count; 42 return count;
43 } 43 }
44 44
45 Count SampleVector::GetCountAtIndex(size_t bucket_index) const { 45 Count SampleVector::GetCountAtIndex(size_t bucket_index) const {
46 DCHECK(bucket_index >= 0 && bucket_index < counts_.size()); 46 DCHECK(bucket_index < counts_.size());
47 return counts_[bucket_index]; 47 return counts_[bucket_index];
48 } 48 }
49 49
50 scoped_ptr<SampleCountIterator> SampleVector::Iterator() const { 50 scoped_ptr<SampleCountIterator> SampleVector::Iterator() const {
51 return scoped_ptr<SampleCountIterator>( 51 return scoped_ptr<SampleCountIterator>(
52 new SampleVectorIterator(&counts_, bucket_ranges_)); 52 new SampleVectorIterator(&counts_, bucket_ranges_));
53 } 53 }
54 54
55 bool SampleVector::AddSubtractImpl(SampleCountIterator* iter, 55 bool SampleVector::AddSubtractImpl(SampleCountIterator* iter,
56 HistogramSamples::Operator op) { 56 HistogramSamples::Operator op) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return; 152 return;
153 153
154 while (index_ < counts_->size()) { 154 while (index_ < counts_->size()) {
155 if ((*counts_)[index_] != 0) 155 if ((*counts_)[index_] != 0)
156 return; 156 return;
157 index_++; 157 index_++;
158 } 158 }
159 } 159 }
160 160
161 } // namespace base 161 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698