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

Unified Diff: chrome/browser/extensions/api/metrics_private/metrics_private_api.cc

Issue 213433003: Add Sparse Histogram Support to metricsPrivate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR Feedback Created 6 years, 9 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_private/metrics_private_api.cc
diff --git a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
index 3265bb45674e5576a22b244c86df0f33357aafa3..13252e41e74148dde50ba15fdd71ddfb2fe186d1 100644
--- a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
@@ -8,6 +8,7 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/common/extensions/api/metrics_private.h"
#include "components/variations/variations_associated_data.h"
@@ -22,6 +23,7 @@ namespace GetVariationParams = api::metrics_private::GetVariationParams;
namespace GetFieldTrial = api::metrics_private::GetFieldTrial;
namespace RecordUserAction = api::metrics_private::RecordUserAction;
namespace RecordValue = api::metrics_private::RecordValue;
+namespace RecordSparseValue = api::metrics_private::RecordSparseValue;
namespace RecordPercentage = api::metrics_private::RecordPercentage;
namespace RecordCount = api::metrics_private::RecordCount;
namespace RecordSmallCount = api::metrics_private::RecordSmallCount;
@@ -127,6 +129,15 @@ bool MetricsPrivateRecordValueFunction::RunImpl() {
params->metric.buckets, params->value);
}
+bool MetricsPrivateRecordSparseValueFunction::RunImpl() {
+ scoped_ptr<RecordSparseValue::Params> params(
+ RecordSparseValue::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+ // This particular UMA_HISTOGRAM_ macro is okay for runtime strings.
Ilya Sherman 2014/03/27 00:08:16 nit: "runtime strings" -> "non-runtime-constant st
robliao 2014/03/27 00:21:53 Done.
+ UMA_HISTOGRAM_SPARSE_SLOWLY(params->metric_name, params->value);
+ return true;
+}
+
bool MetricsPrivateRecordPercentageFunction::RunImpl() {
scoped_ptr<RecordPercentage::Params> params(
RecordPercentage::Params::Create(*args_));

Powered by Google App Engine
This is Rietveld 408576698