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

Unified Diff: base/metrics/histogram.h

Issue 141393002: Return a NULL histogram pointer on construction error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move some impl to cc Created 6 years, 11 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/histogram.h
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 9845362d98aa31cad7557383e2fc1e039ad5f67e..f503b3f1ec6eeba9541bc4f00264075fd0fdc56d 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -676,6 +676,23 @@ class BASE_EXPORT CustomHistogram : public Histogram {
DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
};
+
+// DummyHistogram is an object that overrides Histogram's Add* functions
+// to provide no functionality. This can be returned in the case of mismatched
+// construction arguments to any of the other Histograms' FactoryGet calls.
+class BASE_EXPORT DummyHistogram : public Histogram {
Alexei Svitkine (slow) 2014/01/17 15:40:13 I would actually define this class in an anon name
elijahtaylor1 2014/01/17 20:04:16 Done.
+ public:
+ virtual void Add(Sample value) OVERRIDE {}
+ virtual void AddSamples(const HistogramSamples& samples) OVERRIDE {}
+ virtual bool AddSamplesFromPickle(PickleIterator* iter) OVERRIDE;
+
+ DummyHistogram();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DummyHistogram);
+};
+
+
} // namespace base
#endif // BASE_METRICS_HISTOGRAM_H_
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | chrome/browser/extensions/api/metrics_private/metrics_apitest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698