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

Unified Diff: chrome/browser/chromeos/external_metrics.cc

Issue 11231025: Histogram argument related change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missed namespace 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
« no previous file with comments | « base/metrics/sparse_histogram.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/external_metrics.cc
diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc
index 927761657e104b71458c209e9b2e2a4c682fb114..ccc12b5fb1823e5e97efa75fd239151270dd7dfc 100644
--- a/chrome/browser/chromeos/external_metrics.cc
+++ b/chrome/browser/chromeos/external_metrics.cc
@@ -32,28 +32,31 @@ using content::UserMetricsAction;
namespace chromeos {
+namespace {
+
+bool CheckValues(const std::string& name,
+ int minimum,
+ int maximum,
+ size_t bucket_count) {
+ if (!base::Histogram::InspectConstructionArguments(
+ name, &minimum, &maximum, &bucket_count))
+ return false;
+ base::HistogramBase* histogram =
+ base::StatisticsRecorder::FindHistogram(name);
+ if (!histogram)
+ return true;
+ return histogram->HasConstructionArguments(minimum, maximum, bucket_count);
+}
+
+bool CheckLinearValues(const std::string& name, int maximum) {
+ return CheckValues(name, 1, maximum, maximum + 1);
+}
+
+} // namespace
+
// The interval between external metrics collections in seconds
static const int kExternalMetricsCollectionIntervalSeconds = 30;
-class SystemHistogram : public base::Histogram {
- public:
- static bool CheckValues(const std::string& name,
- int minimum,
- int maximum,
- size_t bucket_count) {
- if (!base::Histogram::InspectConstructionArguments(
- name, &minimum, &maximum, &bucket_count))
- return false;
- Histogram* histogram = base::StatisticsRecorder::FindHistogram(name);
- if (!histogram)
- return true;
- return histogram->HasConstructionArguments(minimum, maximum, bucket_count);
- }
- static bool CheckLinearValues(const std::string& name, int maximum) {
- return CheckValues(name, 1, maximum, maximum + 1);
- }
-};
-
ExternalMetrics::ExternalMetrics()
: test_recorder_(NULL) {
}
@@ -110,7 +113,7 @@ void ExternalMetrics::RecordHistogram(const char* histogram_data) {
return;
}
- if (!SystemHistogram::CheckValues(name, min, max, nbuckets)) {
+ if (!CheckValues(name, min, max, nbuckets)) {
LOG(ERROR) << "Invalid histogram " << name
<< ", min=" << min
<< ", max=" << max
@@ -133,7 +136,7 @@ void ExternalMetrics::RecordLinearHistogram(const char* histogram_data) {
return;
}
- if (!SystemHistogram::CheckLinearValues(name, max)) {
+ if (!CheckLinearValues(name, max)) {
LOG(ERROR) << "Invalid linear histogram " << name
<< ", max=" << max;
return;
« no previous file with comments | « base/metrics/sparse_histogram.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698