Remove the deprecated static metrics APIs.
Review URL: http://codereview.chromium.org/2037011
diff --git a/metrics/README b/metrics/README
index d8f17c4..6d011db 100644
--- a/metrics/README
+++ b/metrics/README
@@ -42,14 +42,9 @@
int max)
sends a sample for an enumeration (linear) histogram.
- Currently, the API also includes two deprecated static methods:
-
- bool MetricsLibrary::SendToChrome(const std::string& name, int sample,
- int min, int max, int nbuckets)
- bool MetricsLibrary::SendEnumToChrome(const std::string& name, int sample,
- int max)
-
- See the API documentation in metrics_library.h under
+ Before using these methods, a MetricsLibrary object needs to be
+ constructed and initialized through its Init method. See the
+ complete API documentation in metrics_library.h under
src/platform/metrics/.
- On the target platform, shortly after the sample is sent it should
diff --git a/metrics/metrics_client.cc b/metrics/metrics_client.cc
index ad137be..e85c4d4 100644
--- a/metrics/metrics_client.cc
+++ b/metrics/metrics_client.cc
@@ -78,14 +78,16 @@
}
if (send_to_chrome) {
+ MetricsLibrary metrics_lib;
+ metrics_lib.Init();
if (send_enum) {
int max = atoi(argv[name_index + 2]);
- MetricsLibrary::SendEnumToChrome(name, sample, max);
+ metrics_lib.SendEnumToUMA(name, sample, max);
} else {
int min = atoi(argv[name_index + 2]);
int max = atoi(argv[name_index + 3]);
int nbuckets = atoi(argv[name_index + 4]);
- MetricsLibrary::SendToChrome(name, sample, min, max, nbuckets);
+ metrics_lib.SendToUMA(name, sample, min, max, nbuckets);
}
}
return 0;
diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc
index 2accb1a..98415a8 100644
--- a/metrics/metrics_library.cc
+++ b/metrics/metrics_library.cc
@@ -2,13 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/*
- * metrics_library.cc
- *
- * Created on: Dec 1, 2009
- * Author: sosa
- */
-
#include "metrics_library.h"
#include <errno.h>
@@ -137,9 +130,8 @@
return true;
}
-// static
-bool MetricsLibrary::SendToChrome(const string& name, int sample,
- int min, int max, int nbuckets) {
+bool MetricsLibrary::SendToUMA(const string& name, int sample,
+ int min, int max, int nbuckets) {
// Format the message.
char message[kBufferSize];
int32_t message_length =
@@ -154,14 +146,8 @@
return SendMessageToChrome(message_length, message);
}
-bool MetricsLibrary::SendToUMA(const string& name, int sample,
- int min, int max, int nbuckets) {
- return SendToChrome(name, sample, min, max, nbuckets);
-}
-
-//static
-bool MetricsLibrary::SendEnumToChrome(const std::string& name, int sample,
- int max) {
+bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample,
+ int max) {
// Format the message.
char message[kBufferSize];
int32_t message_length =
@@ -175,8 +161,3 @@
// Send the message.
return SendMessageToChrome(message_length, message);
}
-
-bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample,
- int max) {
- return SendEnumToChrome(name, sample, max);
-}
diff --git a/metrics/metrics_library.h b/metrics/metrics_library.h
index e5e9024..2a6412c 100644
--- a/metrics/metrics_library.h
+++ b/metrics/metrics_library.h
@@ -2,13 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/*
- * metrics_library.h
- *
- * Created on: Dec 1, 2009
- * Author: sosa
- */
-
#ifndef METRICS_LIBRARY_H_
#define METRICS_LIBRARY_H_
@@ -45,10 +38,6 @@
bool SendToUMA(const std::string& name, int sample,
int min, int max, int nbuckets);
- // Deprecated.
- static bool SendToChrome(const std::string& name, int sample,
- int min, int max, int nbuckets);
-
// Sends linear histogram data to Chrome for transport to UMA and
// returns true on success. This method results in the equivalent of
// an asynchronous non-blocking RPC to UMA_HISTOGRAM_ENUMERATION
@@ -60,9 +49,6 @@
// [|max|,infinity) is the implicit overflow bucket.
bool SendEnumToUMA(const std::string& name, int sample, int max);
- // Deprecated.
- static bool SendEnumToChrome(const std::string& name, int sample, int max);
-
// Sends to Autotest and returns true on success.
static bool SendToAutotest(const std::string& name, int value);
};