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

Unified Diff: base/metrics/sparse_histogram.h

Issue 1734033003: Add support for persistent sparse histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed more review comments by Alexei Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/metrics/sparse_histogram.h
diff --git a/base/metrics/sparse_histogram.h b/base/metrics/sparse_histogram.h
index 7f363133802a0219f6ca3f029d53e4ae8101b881..bbcabbfbbed512e6743aebced815397b222c8726 100644
--- a/base/metrics/sparse_histogram.h
+++ b/base/metrics/sparse_histogram.h
@@ -51,6 +51,7 @@ namespace base {
} while (0)
class HistogramSamples;
+class PersistentMemoryAllocator;
class BASE_EXPORT SparseHistogram : public HistogramBase {
public:
@@ -58,6 +59,12 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
// new one.
static HistogramBase* FactoryGet(const std::string& name, int32_t flags);
+ // Get a histogram using data in persistent storage.
+ static HistogramBase* PersistentGet(PersistentMemoryAllocator* allocator,
+ const std::string& name,
+ HistogramSamples::Metadata* meta,
+ HistogramSamples::Metadata* logged_meta);
+
~SparseHistogram() override;
// HistogramBase implementation:
@@ -83,6 +90,11 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
// Clients should always use FactoryGet to create SparseHistogram.
explicit SparseHistogram(const std::string& name);
+ SparseHistogram(PersistentMemoryAllocator* allocator,
+ const std::string& name,
+ HistogramSamples::Metadata* meta,
+ HistogramSamples::Metadata* logged_meta);
+
friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
base::PickleIterator* iter);
static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
@@ -107,8 +119,8 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
// Protects access to |samples_|.
mutable base::Lock lock_;
- SampleMap samples_;
- SampleMap logged_samples_;
+ scoped_ptr<HistogramSamples> samples_;
+ scoped_ptr<HistogramSamples> logged_samples_;
DISALLOW_COPY_AND_ASSIGN(SparseHistogram);
};

Powered by Google App Engine
This is Rietveld 408576698