Commit 0fad24ee authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Use UmaHistogramEnumeration() where applicable

Prefer UmaHistogram* function to using the histogram directly.

Change-Id: I9eb38bf856c76fe50ff094a7728ef1f7aebe239a
Reviewed-on: https://chromium-review.googlesource.com/804697Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521501}
parent 8e123abb
......@@ -5,7 +5,7 @@
#include "media/blink/cdm_result_promise_helper.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_functions.h"
namespace media {
......@@ -69,12 +69,7 @@ void ReportCdmResultUMA(const std::string& uma_name, CdmResultForUMA result) {
if (uma_name.empty())
return;
base::LinearHistogram::FactoryGet(
uma_name,
1,
NUM_RESULT_CODES,
NUM_RESULT_CODES + 1,
base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result);
base::UmaHistogramEnumeration(uma_name, result, NUM_RESULT_CODES);
}
} // namespace media
......@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "media/base/key_systems.h"
......@@ -72,12 +72,8 @@ class WebEncryptedMediaClientImpl::Reporter {
private:
void Report(KeySystemSupportStatus status) {
// Not using UMA_HISTOGRAM_ENUMERATION directly because UMA_* macros
// require the names to be constant throughout the process' lifetime.
base::LinearHistogram::FactoryGet(
uma_name_, 1, KEY_SYSTEM_SUPPORT_STATUS_COUNT,
KEY_SYSTEM_SUPPORT_STATUS_COUNT + 1,
base::Histogram::kUmaTargetedHistogramFlag)->Add(status);
base::UmaHistogramEnumeration(uma_name_, status,
KEY_SYSTEM_SUPPORT_STATUS_COUNT);
}
const std::string uma_name_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment