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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 8
9 // It supports calls to accumulate either time intervals (which are processed 9 // It supports calls to accumulate either time intervals (which are processed
10 // as integral number of milliseconds), or arbitrary integral units. 10 // as integral number of milliseconds), or arbitrary integral units.
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 PickleIterator* iter); 669 PickleIterator* iter);
670 static HistogramBase* DeserializeInfoImpl(PickleIterator* iter); 670 static HistogramBase* DeserializeInfoImpl(PickleIterator* iter);
671 671
672 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); 672 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges);
673 static BucketRanges* CreateBucketRangesFromCustomRanges( 673 static BucketRanges* CreateBucketRangesFromCustomRanges(
674 const std::vector<Sample>& custom_ranges); 674 const std::vector<Sample>& custom_ranges);
675 675
676 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); 676 DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
677 }; 677 };
678 678
679
680 // DummyHistogram is an object that overrides Histogram's Add* functions
681 // to provide no functionality. This can be returned in the case of mismatched
682 // construction arguments to any of the other Histograms' FactoryGet calls.
683 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.
684 public:
685 virtual void Add(Sample value) OVERRIDE {}
686 virtual void AddSamples(const HistogramSamples& samples) OVERRIDE {}
687 virtual bool AddSamplesFromPickle(PickleIterator* iter) OVERRIDE;
688
689 DummyHistogram();
690
691 private:
692 DISALLOW_COPY_AND_ASSIGN(DummyHistogram);
693 };
694
695
679 } // namespace base 696 } // namespace base
680 697
681 #endif // BASE_METRICS_HISTOGRAM_H_ 698 #endif // BASE_METRICS_HISTOGRAM_H_
OLDNEW
« 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