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

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: addressed review comments by Alexei Created 5 years 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
« no previous file with comments | « base/metrics/sample_map_unittest.cc ('k') | base/metrics/sample_vector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/sample_vector.h
diff --git a/base/metrics/sample_vector.h b/base/metrics/sample_vector.h
index 8cb2ab9e0a6db364937c5ea5de7171d741715513..51803b05288ef075982e299462545982cea7c972 100644
--- a/base/metrics/sample_vector.h
+++ b/base/metrics/sample_vector.h
@@ -8,6 +8,7 @@
#ifndef BASE_METRICS_SAMPLE_VECTOR_H_
#define BASE_METRICS_SAMPLE_VECTOR_H_
+#include <stdint.h>
#include <vector>
#include "base/compiler_specific.h"
@@ -23,6 +24,12 @@ class BucketRanges;
class BASE_EXPORT SampleVector : public HistogramSamples {
public:
explicit SampleVector(const BucketRanges* bucket_ranges);
+ SampleVector(uint64_t id, const BucketRanges* bucket_ranges);
+ SampleVector(uint64_t id,
+ HistogramBase::AtomicCount* counts,
+ size_t counts_size,
+ Metadata* meta,
+ const BucketRanges* bucket_ranges);
~SampleVector() override;
// HistogramSamples implementation:
@@ -45,7 +52,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 +71,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 +89,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_;
« 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