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

Unified Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 561643002: Encrypted Media: Add UMA for system code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years, 3 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/content_decryptor_delegate.cc
diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc
index 8aac3ba2d30152888c373d64e56ca19902a95db2..64aa297ff5726d9f28c44d0c76c76cee5515a207 100644
--- a/content/renderer/pepper/content_decryptor_delegate.cc
+++ b/content/renderer/pepper/content_decryptor_delegate.cc
@@ -7,7 +7,9 @@
#include "base/callback_helpers.h"
#include "base/debug/trace_event.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/numerics/safe_conversions.h"
+#include "content/renderer/media/crypto/key_systems.h"
#include "content/renderer/pepper/ppb_buffer_impl.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_decoder_config.h"
@@ -94,7 +96,7 @@ bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) {
//
// Returns true if |block_info| is successfully filled. Returns false
// otherwise.
-static bool MakeEncryptedBlockInfo(
+bool MakeEncryptedBlockInfo(
const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
uint32_t request_id,
PP_EncryptedBlockInfo* block_info) {
@@ -288,6 +290,16 @@ MediaKeys::Exception PpExceptionTypeToMediaException(
}
}
+// TODO(xhwang): Unify EME UMA reporting code when prefixed EME is deprecated.
+// See http://crbug.com/412987 for details.
+void ReportSystemCodeUMA(const std::string& key_system, uint32 system_code) {
+ // Sparse histogram macro does not cache the histogram, so it's safe to use
+ // macro with non-static histogram name here.
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "Media.EME." + KeySystemNameForUMA(key_system) + ".SystemCode",
+ system_code);
+}
+
} // namespace
ContentDecryptorDelegate::ContentDecryptorDelegate(
@@ -767,6 +779,8 @@ void ContentDecryptorDelegate::OnPromiseRejected(
PP_CdmExceptionCode exception_code,
uint32 system_code,
PP_Var error_description) {
+ ReportSystemCodeUMA(key_system_, system_code);
+
StringVar* error_description_string = StringVar::FromPPVar(error_description);
DCHECK(error_description_string);
@@ -846,6 +860,8 @@ void ContentDecryptorDelegate::OnSessionError(
PP_CdmExceptionCode exception_code,
uint32 system_code,
PP_Var error_description) {
+ ReportSystemCodeUMA(key_system_, system_code);
+
if (session_error_cb_.is_null())
return;
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698