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

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

Issue 10857025: Add more code for debugging. We will revert this change when we find out the reason of corruption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | base/metrics/histogram.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/bucket_ranges.h" 5 #include "base/metrics/bucket_ranges.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 BucketRanges::BucketRanges(size_t num_ranges) 98 BucketRanges::BucketRanges(size_t num_ranges)
99 : ranges_(num_ranges, 0), 99 : ranges_(num_ranges, 0),
100 checksum_(0) {} 100 checksum_(0) {}
101 101
102 BucketRanges::~BucketRanges() {} 102 BucketRanges::~BucketRanges() {}
103 103
104 void BucketRanges::set_range(size_t i, HistogramBase::Sample value) { 104 void BucketRanges::set_range(size_t i, HistogramBase::Sample value) {
105 DCHECK_LT(i, ranges_.size()); 105 DCHECK_LT(i, ranges_.size());
106 DCHECK_GE(value, 0); 106 CHECK_GE(value, 0);
107 ranges_[i] = value; 107 ranges_[i] = value;
108 } 108 }
109 109
110 uint32 BucketRanges::CalculateChecksum() const { 110 uint32 BucketRanges::CalculateChecksum() const {
111 // Seed checksum. 111 // Seed checksum.
112 uint32 checksum = static_cast<uint32>(ranges_.size()); 112 uint32 checksum = static_cast<uint32>(ranges_.size());
113 113
114 for (size_t index = 0; index < ranges_.size(); ++index) 114 for (size_t index = 0; index < ranges_.size(); ++index)
115 checksum = Crc32(checksum, ranges_[index]); 115 checksum = Crc32(checksum, ranges_[index]);
116 return checksum; 116 return checksum;
(...skipping 13 matching lines...) Expand all
130 if (ranges_.size() != other->ranges_.size()) 130 if (ranges_.size() != other->ranges_.size())
131 return false; 131 return false;
132 for (size_t index = 0; index < ranges_.size(); ++index) { 132 for (size_t index = 0; index < ranges_.size(); ++index) {
133 if (ranges_[index] != other->ranges_[index]) 133 if (ranges_[index] != other->ranges_[index])
134 return false; 134 return false;
135 } 135 }
136 return true; 136 return true;
137 } 137 }
138 138
139 } // namespace base 139 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698