Chromium Code Reviews| 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..a867e8fc8fd0a88b04ee01df1b015000139888cd 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" |
|
ddorwin
2014/09/10 21:24:34
Is this allowed? crypto/ is not in src/content/ren
xhwang
2014/09/10 22:09:33
It seems this IS allowed.
|
| #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,14 @@ MediaKeys::Exception PpExceptionTypeToMediaException( |
| } |
| } |
| +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 +777,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 +858,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; |