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

Side by Side Diff: base/metrics/histogram_samples.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
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 #ifndef BASE_METRICS_HISTOGRAM_SAMPLES_H_ 5 #ifndef BASE_METRICS_HISTOGRAM_SAMPLES_H_
6 #define BASE_METRICS_HISTOGRAM_SAMPLES_H_ 6 #define BASE_METRICS_HISTOGRAM_SAMPLES_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
12
11 #include "base/atomicops.h" 13 #include "base/atomicops.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/histogram_base.h" 15 #include "base/metrics/histogram_base.h"
15 16
16 namespace base { 17 namespace base {
17 18
18 class Pickle; 19 class Pickle;
19 class PickleIterator; 20 class PickleIterator;
20 class SampleCountIterator; 21 class SampleCountIterator;
21 22
22 // HistogramSamples is a container storing all samples of a histogram. All 23 // HistogramSamples is a container storing all samples of a histogram. All
23 // elements must be of a fixed width to ensure 32/64-bit interoperability. 24 // elements must be of a fixed width to ensure 32/64-bit interoperability.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 virtual HistogramBase::Count GetCount(HistogramBase::Sample value) const = 0; 62 virtual HistogramBase::Count GetCount(HistogramBase::Sample value) const = 0;
62 virtual HistogramBase::Count TotalCount() const = 0; 63 virtual HistogramBase::Count TotalCount() const = 0;
63 64
64 virtual void Add(const HistogramSamples& other); 65 virtual void Add(const HistogramSamples& other);
65 66
66 // Add from serialized samples. 67 // Add from serialized samples.
67 virtual bool AddFromPickle(PickleIterator* iter); 68 virtual bool AddFromPickle(PickleIterator* iter);
68 69
69 virtual void Subtract(const HistogramSamples& other); 70 virtual void Subtract(const HistogramSamples& other);
70 71
71 virtual scoped_ptr<SampleCountIterator> Iterator() const = 0; 72 virtual std::unique_ptr<SampleCountIterator> Iterator() const = 0;
72 virtual bool Serialize(Pickle* pickle) const; 73 virtual bool Serialize(Pickle* pickle) const;
73 74
74 // Accessor fuctions. 75 // Accessor fuctions.
75 uint64_t id() const { return meta_->id; } 76 uint64_t id() const { return meta_->id; }
76 int64_t sum() const { return meta_->sum; } 77 int64_t sum() const { return meta_->sum; }
77 HistogramBase::Count redundant_count() const { 78 HistogramBase::Count redundant_count() const {
78 return subtle::NoBarrier_Load(&meta_->redundant_count); 79 return subtle::NoBarrier_Load(&meta_->redundant_count);
79 } 80 }
80 81
81 protected: 82 protected:
(...skipping 30 matching lines...) Expand all
112 113
113 // Get the index of current histogram bucket. 114 // Get the index of current histogram bucket.
114 // For histograms that don't use predefined buckets, it returns false. 115 // For histograms that don't use predefined buckets, it returns false.
115 // Requires: !Done(); 116 // Requires: !Done();
116 virtual bool GetBucketIndex(size_t* index) const; 117 virtual bool GetBucketIndex(size_t* index) const;
117 }; 118 };
118 119
119 } // namespace base 120 } // namespace base
120 121
121 #endif // BASE_METRICS_HISTOGRAM_SAMPLES_H_ 122 #endif // BASE_METRICS_HISTOGRAM_SAMPLES_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram_delta_serialization_unittest.cc ('k') | base/metrics/histogram_samples.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698