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

Unified Diff: base/metrics/statistics_recorder.h

Issue 1471073007: Reorganize histograms for persistence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: addressed some 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
Index: base/metrics/statistics_recorder.h
diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h
index 0e5168f4137006080542cc4b15038e4931e387b7..3396829b43de14389839bb6185090656209f5137 100644
--- a/base/metrics/statistics_recorder.h
+++ b/base/metrics/statistics_recorder.h
@@ -28,6 +28,9 @@ class BucketRanges;
class Lock;
class BASE_EXPORT StatisticsRecorder {
+ // We keep all registered histograms in a map, from name to histogram.
+ typedef std::map<uint64_t, HistogramBase*> HistogramMap;
Alexei Svitkine (slow) 2015/12/04 18:21:00 This should be in the private: section below. Also
bcwhite 2015/12/04 19:34:47 Done. It actually has to be up top so as to be pr
+
public:
typedef std::vector<HistogramBase*> Histograms;
@@ -95,25 +98,6 @@ class BASE_EXPORT StatisticsRecorder {
static OnSampleCallback FindCallback(const std::string& histogram_name);
private:
- // HistogramNameRef holds a weak const ref to the name field of the associated
- // Histogram object, allowing re-use of the underlying string storage for the
- // map keys. The wrapper is required as using "const std::string&" as the key
- // results in compile errors.
- struct HistogramNameRef {
- explicit HistogramNameRef(const std::string& name) : name_(name) {};
-
- // Operator < is necessary to use this type as a std::map key.
- bool operator<(const HistogramNameRef& other) const {
- return name_ < other.name_;
- }
-
- // Weak, owned by the associated Histogram object.
- const std::string& name_;
- };
-
- // We keep all registered histograms in a map, from name to histogram.
- typedef std::map<HistogramNameRef, HistogramBase*> HistogramMap;
-
// We keep a map of callbacks to histograms, so that as histograms are
// created, we can set the callback properly.
typedef std::map<std::string, OnSampleCallback> CallbackMap;

Powered by Google App Engine
This is Rietveld 408576698