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

Unified Diff: base/metrics/histogram_base.h

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_base.h
diff --git a/base/metrics/histogram_base.h b/base/metrics/histogram_base.h
index 006395b1f2939707af6c52b8df935413cdf139b7..1bc1f6eb6fe78bf4a48576f60e3da694a74da932 100644
--- a/base/metrics/histogram_base.h
+++ b/base/metrics/histogram_base.h
@@ -31,7 +31,7 @@ class PickleIterator;
// processes into the browser. If you create another class that inherits from
// HistogramBase, add new histogram types and names below.
-enum BASE_EXPORT HistogramType {
+enum HistogramType {
HISTOGRAM,
LINEAR_HISTOGRAM,
BOOLEAN_HISTOGRAM,
@@ -74,6 +74,12 @@ class BASE_EXPORT HistogramBase {
// the source histogram!).
kIPCSerializationSourceFlag = 0x10,
+ // Indicates that a callback exists for when a new sample is recorded on
+ // this histogram. We store this as a flag with the histogram since
+ // histograms can be in performance critical code, and this allows us
+ // to shortcut looking up the callback if it doesn't exist.
+ kCallbackExists = 0x20,
+
// Only for Histogram and its sub classes: fancy bucket-naming support.
kHexRangePrintingFlag = 0x8000,
};
@@ -92,7 +98,7 @@ class BASE_EXPORT HistogramBase {
explicit HistogramBase(const std::string& name);
virtual ~HistogramBase();
- std::string histogram_name() const { return histogram_name_; }
+ const std::string& histogram_name() const { return histogram_name_; }
// Comapres |name| to the histogram name and triggers a DCHECK if they do not
// match. This is a helper function used by histogram macros, which results in
@@ -172,6 +178,10 @@ class BASE_EXPORT HistogramBase {
double scaled_sum,
std::string* output) const;
+ // Retrieves the callback for this histogram, if one exists, and runs it
+ // passing |sample| as the parameter.
+ void FindAndRunCallback(Sample sample) const;
+
private:
const std::string histogram_name_;
int32_t flags_;
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698