Chromium Code Reviews| Index: base/metrics/sample_vector.h |
| diff --git a/base/metrics/sample_vector.h b/base/metrics/sample_vector.h |
| index 8cb2ab9e0a6db364937c5ea5de7171d741715513..00b476f532cb63312f6dcb39b9492b97049303e4 100644 |
| --- a/base/metrics/sample_vector.h |
| +++ b/base/metrics/sample_vector.h |
| @@ -23,6 +23,12 @@ class BucketRanges; |
| class BASE_EXPORT SampleVector : public HistogramSamples { |
| public: |
| explicit SampleVector(const BucketRanges* bucket_ranges); |
| + SampleVector(uint64 id, const BucketRanges* bucket_ranges); |
|
Alexei Svitkine (slow)
2015/12/04 18:21:00
uint64_t, fix throughout
bcwhite
2015/12/04 19:34:47
Done.
|
| + SampleVector(uint64 id, |
| + HistogramBase::AtomicCount* counts, |
| + size_t counts_size, |
| + Metadata* meta, |
| + const BucketRanges* bucket_ranges); |
| ~SampleVector() override; |
| // HistogramSamples implementation: |
| @@ -45,7 +51,14 @@ class BASE_EXPORT SampleVector : public HistogramSamples { |
| private: |
| FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts); |
| - std::vector<HistogramBase::AtomicCount> counts_; |
| + // In the case where this class manages the memory, here it is. |
| + std::vector<HistogramBase::AtomicCount> local_counts_; |
| + |
| + // These are raw pointers rather than objects for flexibility. The actual |
| + // memory is either managed by local_counts_ above or by an external object |
| + // and passed in directly. |
| + HistogramBase::AtomicCount* counts_; |
| + size_t counts_size_; |
| // Shares the same BucketRanges with Histogram object. |
| const BucketRanges* const bucket_ranges_; |
| @@ -57,6 +70,9 @@ class BASE_EXPORT SampleVectorIterator : public SampleCountIterator { |
| public: |
| SampleVectorIterator(const std::vector<HistogramBase::AtomicCount>* counts, |
| const BucketRanges* bucket_ranges); |
| + SampleVectorIterator(const HistogramBase::AtomicCount* counts, |
| + size_t counts_size, |
| + const BucketRanges* bucket_ranges); |
| ~SampleVectorIterator() override; |
| // SampleCountIterator implementation: |
| @@ -72,7 +88,8 @@ class BASE_EXPORT SampleVectorIterator : public SampleCountIterator { |
| private: |
| void SkipEmptyBuckets(); |
| - const std::vector<HistogramBase::AtomicCount>* counts_; |
| + const HistogramBase::AtomicCount* counts_; |
| + size_t counts_size_; |
| const BucketRanges* bucket_ranges_; |
| size_t index_; |