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

Unified Diff: base/metrics/sample_vector.h

Issue 1471073007: Reorganize histograms for persistence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: extra parameter no longer necessary in some files Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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);
+ 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_;
Alexei Svitkine (slow) 2015/12/01 16:32:14 Can this be "const HistogramBase::AtomicCount* con
+ size_t counts_size_;
Alexei Svitkine (slow) 2015/12/01 16:32:14 Make this const
const BucketRanges* bucket_ranges_;
size_t index_;

Powered by Google App Engine
This is Rietveld 408576698