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

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

Issue 1997153002: libchrome: Several upstreamable fixes from libchrome Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 7 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
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 {
11 11
12 typedef HistogramBase::Count Count; 12 typedef HistogramBase::Count Count;
13 typedef HistogramBase::Sample Sample; 13 typedef HistogramBase::Sample Sample;
14 14
15 SampleVector::SampleVector(const BucketRanges* bucket_ranges) 15 SampleVector::SampleVector(const BucketRanges* bucket_ranges)
16 : SampleVector(0, bucket_ranges) {} 16 : SampleVector(0, bucket_ranges) {}
17 17
18 SampleVector::SampleVector(uint64_t id, const BucketRanges* bucket_ranges) 18 SampleVector::SampleVector(uint64_t id, const BucketRanges* bucket_ranges)
19 : HistogramSamples(id), 19 : HistogramSamples(id),
20 local_counts_(bucket_ranges->bucket_count()), 20 local_counts_(bucket_ranges->bucket_count()),
21 counts_(&local_counts_[0]), 21 counts_(&local_counts_[0]),
22 counts_size_(local_counts_.size()), 22 counts_size_(local_counts_.size()),
23 bucket_ranges_(bucket_ranges) { 23 bucket_ranges_(bucket_ranges) {
24 CHECK_GE(bucket_ranges_->bucket_count(), 1u); 24 CHECK_GE(bucket_ranges_->bucket_count(), 1u);
25 } 25 }
26 26
27 SampleVector::SampleVector(uint64_t id, 27 SampleVector::SampleVector(uint64_t id,
28 HistogramBase::AtomicCount* counts, 28 HistogramBase::AtomicCount* counts,
29 size_t counts_size, 29 size_t /*counts_size*/,
30 Metadata* meta, 30 Metadata* meta,
31 const BucketRanges* bucket_ranges) 31 const BucketRanges* bucket_ranges)
32 : HistogramSamples(id, meta), 32 : HistogramSamples(id, meta),
33 counts_(counts), 33 counts_(counts),
34 counts_size_(bucket_ranges->bucket_count()), 34 counts_size_(bucket_ranges->bucket_count()),
35 bucket_ranges_(bucket_ranges) { 35 bucket_ranges_(bucket_ranges) {
36 CHECK_LE(bucket_ranges_->bucket_count(), counts_size_); 36 CHECK_LE(bucket_ranges_->bucket_count(), counts_size_);
37 CHECK_GE(bucket_ranges_->bucket_count(), 1u); 37 CHECK_GE(bucket_ranges_->bucket_count(), 1u);
38 } 38 }
39 39
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return; 184 return;
185 185
186 while (index_ < counts_size_) { 186 while (index_ < counts_size_) {
187 if (subtle::NoBarrier_Load(&counts_[index_]) != 0) 187 if (subtle::NoBarrier_Load(&counts_[index_]) != 0)
188 return; 188 return;
189 index_++; 189 index_++;
190 } 190 }
191 } 191 }
192 192
193 } // namespace base 193 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698