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

Unified Diff: media/cdm/ppapi/cdm_adapter.cc

Issue 253313004: CdmAdapter: Add UMA for output protection queries and results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 8 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: media/cdm/ppapi/cdm_adapter.cc
diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc
index 4d8f038cde575ee3b9d8c7e89e46d3b86be19d77..d4c62c33e4402df1d4cc82c9b96707b36922dbed 100644
--- a/media/cdm/ppapi/cdm_adapter.cc
+++ b/media/cdm/ppapi/cdm_adapter.cc
@@ -9,6 +9,7 @@
#include "media/cdm/ppapi/cdm_logging.h"
#include "media/cdm/ppapi/supported_cdm_versions.h"
#include "ppapi/c/ppb_console.h"
+#include "ppapi/cpp/private/uma_private.h"
#if defined(CHECK_DOCUMENT_URL)
#include "ppapi/cpp/dev/url_util_dev.h"
@@ -224,6 +225,8 @@ CdmAdapter::CdmAdapter(PP_Instance instance, pp::Module* module)
output_link_mask_(0),
output_protection_mask_(0),
query_output_protection_in_progress_(false),
+ uma_for_output_protection_query_reported_(false),
+ uma_for_output_protection_positive_result_reported_(false),
#endif
allocator_(this),
cdm_(NULL),
@@ -841,6 +844,11 @@ void CdmAdapter::QueryOutputProtectionStatus() {
&CdmAdapter::QueryOutputProtectionStatusDone));
if (result == PP_OK_COMPLETIONPENDING) {
query_output_protection_in_progress_ = true;
+ if (!uma_for_output_protection_query_reported_) {
ddorwin 2014/04/30 23:13:35 Why not handle this logic inside the Report functi
xhwang 2014/04/30 23:48:16 Added a helper function to do this.
+ ReportOutputProtectionStatus(OUTPUT_PROTECTION_QUERIED);
+ uma_for_output_protection_query_reported_ = true;
+ }
+
return;
}
@@ -883,6 +891,43 @@ cdm::FileIO* CdmAdapter::CreateFileIO(cdm::FileIOClient* client) {
}
#if defined(OS_CHROMEOS)
+void CdmAdapter::ReportOutputProtectionStatus(OutputProtectionStatus status) {
+ pp::UMAPrivate uma_interface_(this);
+ std::string uma_name = "Media.EME.OutputProtection";
+ uma_interface_.HistogramEnumeration(uma_name, status, OUTPUT_PROTECTION_MAX);
+}
+
+void CdmAdapter::ReportOutputProtectionQueryResult(int32_t result) {
+ if (uma_for_output_protection_positive_result_reported_)
+ return;
+
+ uma_for_output_protection_positive_result_reported_ = true;
ddorwin 2014/04/30 23:13:35 A bit weird, but okay. Hmm, maybe we can handle th
xhwang 2014/04/30 23:48:16 Done.
+
+ if (result != PP_OK) {
+ ReportOutputProtectionStatus(OUTPUT_PROTECTION_QUERY_ERROR);
+ return;
+ }
+
+ // Report UMAs for output protection query result.
+ uint32_t external_links = (output_link_mask_ & ~cdm::kLinkTypeInternal);
+
+ if (!external_links) {
+ ReportOutputProtectionStatus(OUTPUT_PROTECTION_NO_EXTERNAL_LINK);
+ return;
+ }
+
+ if ((output_protection_mask_ & external_links) == external_links) {
+ ReportOutputProtectionStatus(
+ OUTPUT_PROTECTION_ALL_EXTERNAL_LINKS_PROTECTED);
+ return;
+ }
+
+ // Do not report a negative result because it could be a false negative.
+ // Instead, we will calculate number of negatives using the totally number of
+ // queries and success results.
+ uma_for_output_protection_positive_result_reported_ = false;
+}
+
void CdmAdapter::SendPlatformChallengeDone(int32_t result) {
challenge_in_progress_ = false;
@@ -928,6 +973,8 @@ void CdmAdapter::QueryOutputProtectionStatusDone(int32_t result) {
if (result != PP_OK)
output_link_mask_ = output_protection_mask_ = 0;
+ ReportOutputProtectionQueryResult(result);
+
cdm_->OnQueryOutputProtectionStatus(output_link_mask_,
output_protection_mask_);
}

Powered by Google App Engine
This is Rietveld 408576698