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

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

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_map_unittest.cc ('k') | base/metrics/sample_vector.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 // SampleVector implements HistogramSamples interface. It is used by all 5 // SampleVector implements HistogramSamples interface. It is used by all
6 // Histogram based classes to store samples. 6 // Histogram based classes to store samples.
7 7
8 #ifndef BASE_METRICS_SAMPLE_VECTOR_H_ 8 #ifndef BASE_METRICS_SAMPLE_VECTOR_H_
9 #define BASE_METRICS_SAMPLE_VECTOR_H_ 9 #define BASE_METRICS_SAMPLE_VECTOR_H_
10 10
11 #include <stddef.h> 11 #include <stddef.h>
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include <memory>
14 #include <vector> 15 #include <vector>
15 16
16 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
17 #include "base/gtest_prod_util.h" 18 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/memory/scoped_ptr.h"
20 #include "base/metrics/histogram_base.h" 20 #include "base/metrics/histogram_base.h"
21 #include "base/metrics/histogram_samples.h" 21 #include "base/metrics/histogram_samples.h"
22 22
23 namespace base { 23 namespace base {
24 24
25 class BucketRanges; 25 class BucketRanges;
26 26
27 class BASE_EXPORT SampleVector : public HistogramSamples { 27 class BASE_EXPORT SampleVector : public HistogramSamples {
28 public: 28 public:
29 explicit SampleVector(const BucketRanges* bucket_ranges); 29 explicit SampleVector(const BucketRanges* bucket_ranges);
30 SampleVector(uint64_t id, const BucketRanges* bucket_ranges); 30 SampleVector(uint64_t id, const BucketRanges* bucket_ranges);
31 SampleVector(uint64_t id, 31 SampleVector(uint64_t id,
32 HistogramBase::AtomicCount* counts, 32 HistogramBase::AtomicCount* counts,
33 size_t counts_size, 33 size_t counts_size,
34 Metadata* meta, 34 Metadata* meta,
35 const BucketRanges* bucket_ranges); 35 const BucketRanges* bucket_ranges);
36 ~SampleVector() override; 36 ~SampleVector() override;
37 37
38 // HistogramSamples implementation: 38 // HistogramSamples implementation:
39 void Accumulate(HistogramBase::Sample value, 39 void Accumulate(HistogramBase::Sample value,
40 HistogramBase::Count count) override; 40 HistogramBase::Count count) override;
41 HistogramBase::Count GetCount(HistogramBase::Sample value) const override; 41 HistogramBase::Count GetCount(HistogramBase::Sample value) const override;
42 HistogramBase::Count TotalCount() const override; 42 HistogramBase::Count TotalCount() const override;
43 scoped_ptr<SampleCountIterator> Iterator() const override; 43 std::unique_ptr<SampleCountIterator> Iterator() const override;
44 44
45 // Get count of a specific bucket. 45 // Get count of a specific bucket.
46 HistogramBase::Count GetCountAtIndex(size_t bucket_index) const; 46 HistogramBase::Count GetCountAtIndex(size_t bucket_index) const;
47 47
48 protected: 48 protected:
49 bool AddSubtractImpl( 49 bool AddSubtractImpl(
50 SampleCountIterator* iter, 50 SampleCountIterator* iter,
51 HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT. 51 HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT.
52 52
53 virtual size_t GetBucketIndex(HistogramBase::Sample value) const; 53 virtual size_t GetBucketIndex(HistogramBase::Sample value) const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const HistogramBase::AtomicCount* counts_; 96 const HistogramBase::AtomicCount* counts_;
97 size_t counts_size_; 97 size_t counts_size_;
98 const BucketRanges* bucket_ranges_; 98 const BucketRanges* bucket_ranges_;
99 99
100 size_t index_; 100 size_t index_;
101 }; 101 };
102 102
103 } // namespace base 103 } // namespace base
104 104
105 #endif // BASE_METRICS_SAMPLE_VECTOR_H_ 105 #endif // BASE_METRICS_SAMPLE_VECTOR_H_
OLDNEW
« no previous file with comments | « base/metrics/sample_map_unittest.cc ('k') | base/metrics/sample_vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698