| 6 | #define BASE_METRICS_DUMMY_HISTOGRAM_H_ |
| 7 |
| 8 | #include <stdint.h> |
| 9 |
| 10 | #include <memory> |
| 11 | #include <string> |
| 12 |
| 13 | #include "base/base_export.h" |
| 14 | #include "base/metrics/histogram_base.h" |
| 15 | #include "base/no_destructor.h" |
| 16 |
| 17 | namespace base { |
| 18 |
| 19 | // DummyHistogram is used for mocking histogram objects for histograms that |
| 20 | // shouldn't be recorded. It doesn't do any actual processing. |
| 21 | class BASE_EXPORT DummyHistogram : public HistogramBase { |
| 22 | public: |
| 23 | static DummyHistogram* GetInstance(); |
| 24 |
| 25 | // HistogramBase: |
| 26 | void CheckName(const StringPiece& name) const override {} |
| 27 | uint64_t name_hash() const override; |
| 28 | HistogramType GetHistogramType() const override; |
| 29 | bool HasConstructionArguments(Sample expected_minimum, |
| 30 | Sample expected_maximum, |
| 31 | uint32_t expected_bucket_count) const override; |
| 32 | void Add(Sample value) override {} |
| 33 | void AddCount(Sample value, int count) override {} |
| 34 | void AddSamples(const HistogramSamples& samples) override {} |
| 35 | bool AddSamplesFromPickle(PickleIterator* iter) override; |
| 36 | std::unique_ptr<HistogramSamples> SnapshotSamples() const override; |
| 37 | std::unique_ptr<HistogramSamples> SnapshotDelta() override; |
| 38 | std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const override; |
| 39 | void WriteHTMLGraph(std::string* output) const override {} |
| 40 | void WriteAscii(std::string* output) const override {} |
| 41 |
| 42 | protected: |
| 43 | // HistogramBase: |
| 44 | void SerializeInfoImpl(Pickle* pickle) const override {} |
| 45 | void GetParameters(DictionaryValue* params) const override {} |
| 46 | void GetCountAndBucketData(Count* count, |
| 47 | int64_t* sum, |
| 48 | ListValue* buckets) const override {} |
| 49 |
| 50 | private: |
| 51 | friend class NoDestructor<DummyHistogram>; |
| 52 |
| 53 | DummyHistogram() : HistogramBase("dummy_histogram") {} |
| 54 | ~DummyHistogram() override {} |
| 55 |
| 56 | DISALLOW_COPY_AND_ASSIGN(DummyHistogram); |
| 57 | }; |
| 58 |
| 59 | } // namespace base |
| 60 |
| 61 | #endif // BASE_METRICS_DUMMY_HISTOGRAM_H_ |
| 62 |