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

Unified Diff: chrome/browser/extensions/api/metrics/metrics.cc

Issue 11342060: Histogram type support in HistogramBase and remove SetRangeDescription function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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: chrome/browser/extensions/api/metrics/metrics.cc
diff --git a/chrome/browser/extensions/api/metrics/metrics.cc b/chrome/browser/extensions/api/metrics/metrics.cc
index eb7c92446c1f8f5e8d5199d9af43cfcb31a92e75..8c4c4eb5420bfdba6f68874ae8762d1289170658 100644
--- a/chrome/browser/extensions/api/metrics/metrics.cc
+++ b/chrome/browser/extensions/api/metrics/metrics.cc
@@ -39,7 +39,7 @@ bool MetricsHistogramHelperFunction::GetNameAndSample(std::string* name,
bool MetricsHistogramHelperFunction::RecordValue(
const std::string& name,
- Histogram::ClassType type,
+ base::HistogramType type,
int min, int max, size_t buckets,
int sample) {
// Make sure toxic values don't get to internal code.
@@ -56,7 +56,7 @@ bool MetricsHistogramHelperFunction::RecordValue(
buckets = max - min + 2;
Histogram* counter;
- if (type == Histogram::LINEAR_HISTOGRAM) {
+ if (type == base::LINEAR_HISTOGRAM) {
counter = LinearHistogram::FactoryGet(name,
min, max, buckets,
Histogram::kUmaTargetedHistogramFlag);
@@ -89,8 +89,8 @@ bool MetricsRecordValueFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(metric_type->GetInteger("max", &max));
EXTENSION_FUNCTION_VALIDATE(metric_type->GetInteger("buckets", &buckets));
- Histogram::ClassType histogram_type(type == "histogram-linear" ?
- Histogram::LINEAR_HISTOGRAM : Histogram::HISTOGRAM);
+ base::HistogramType histogram_type(type == "histogram-linear" ?
+ base::LINEAR_HISTOGRAM : base::HISTOGRAM);
return RecordValue(name, histogram_type, min, max, buckets, sample);
}
@@ -98,31 +98,28 @@ bool MetricsRecordPercentageFunction::RunImpl() {
std::string name;
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
- return RecordValue(name,
- Histogram::LINEAR_HISTOGRAM,
- 1, 101, 102,
- sample);
+ return RecordValue(name, base::LINEAR_HISTOGRAM, 1, 101, 102, sample);
}
bool MetricsRecordCountFunction::RunImpl() {
std::string name;
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
- return RecordValue(name, Histogram::HISTOGRAM, 1, 1000000, 50, sample);
+ return RecordValue(name, base::HISTOGRAM, 1, 1000000, 50, sample);
}
bool MetricsRecordSmallCountFunction::RunImpl() {
std::string name;
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
- return RecordValue(name, Histogram::HISTOGRAM, 1, 100, 50, sample);
+ return RecordValue(name, base::HISTOGRAM, 1, 100, 50, sample);
}
bool MetricsRecordMediumCountFunction::RunImpl() {
std::string name;
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
- return RecordValue(name, Histogram::HISTOGRAM, 1, 10000, 50, sample);
+ return RecordValue(name, base::HISTOGRAM, 1, 10000, 50, sample);
}
bool MetricsRecordTimeFunction::RunImpl() {
@@ -130,7 +127,7 @@ bool MetricsRecordTimeFunction::RunImpl() {
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
static const int kTenSecMs = 10 * 1000;
- return RecordValue(name, Histogram::HISTOGRAM, 1, kTenSecMs, 50, sample);
+ return RecordValue(name, base::HISTOGRAM, 1, kTenSecMs, 50, sample);
}
bool MetricsRecordMediumTimeFunction::RunImpl() {
@@ -138,7 +135,7 @@ bool MetricsRecordMediumTimeFunction::RunImpl() {
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
static const int kThreeMinMs = 3 * 60 * 1000;
- return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample);
+ return RecordValue(name, base::HISTOGRAM, 1, kThreeMinMs, 50, sample);
}
bool MetricsRecordLongTimeFunction::RunImpl() {
@@ -146,7 +143,7 @@ bool MetricsRecordLongTimeFunction::RunImpl() {
int sample;
EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
static const int kOneHourMs = 60 * 60 * 1000;
- return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample);
+ return RecordValue(name, base::HISTOGRAM, 1, kOneHourMs, 50, sample);
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698