diff options
Diffstat (limited to 'chromium/media/cdm/cdm_module.cc')
-rw-r--r-- | chromium/media/cdm/cdm_module.cc | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/chromium/media/cdm/cdm_module.cc b/chromium/media/cdm/cdm_module.cc index 051fdc29363..83bd26b0937 100644 --- a/chromium/media/cdm/cdm_module.cc +++ b/chromium/media/cdm/cdm_module.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,12 +7,13 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/notreached.h" #include "base/time/time.h" +#include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "components/crash/core/common/crash_key.h" +#include "load_cdm_uma_helper.h" #if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) #include "base/feature_list.h" @@ -32,6 +33,9 @@ namespace { static CdmModule* g_cdm_module = nullptr; +// UMA report prefix +const char kUmaPrefix[] = "Media.EME.Cdm"; + #if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) void InitCdmHostVerification( base::NativeLibrary cdm_library, @@ -49,34 +53,6 @@ void InitCdmHostVerification( } #endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) -// These enums are reported to UMA so values should not be renumbered or reused. -enum class LoadResult { - kLoadSuccess, - kFileMissing, // The CDM does not exist. - kLoadFailed, // CDM exists but LoadNativeLibrary() failed. - kEntryPointMissing, // CDM loaded but somce required entry point missing. - // NOTE: Add new values only immediately above this line. - kLoadResultCount // Boundary value for UMA_HISTOGRAM_ENUMERATION. -}; - -void ReportLoadResult(LoadResult load_result) { - DCHECK_LT(load_result, LoadResult::kLoadResultCount); - UMA_HISTOGRAM_ENUMERATION("Media.EME.CdmLoadResult", load_result, - LoadResult::kLoadResultCount); -} - -void ReportLoadErrorCode(const base::NativeLibraryLoadError* error) { -// Only report load error code on Windows because that's the only platform that -// has a numerical error value. -#if BUILDFLAG(IS_WIN) - base::UmaHistogramSparse("Media.EME.CdmLoadErrorCode", error->code); -#endif -} - -void ReportLoadTime(const base::TimeDelta load_time) { - UMA_HISTOGRAM_TIMES("Media.EME.CdmLoadTime", load_time); -} - } // namespace // static @@ -137,14 +113,15 @@ bool CdmModule::Initialize(const base::FilePath& cdm_path) { if (!library_.is_valid()) { LOG(ERROR) << "CDM at " << cdm_path.value() << " could not be loaded."; LOG(ERROR) << "Error: " << library_.GetError()->ToString(); - ReportLoadResult(base::PathExists(cdm_path) ? LoadResult::kLoadFailed - : LoadResult::kFileMissing); - ReportLoadErrorCode(library_.GetError()); + ReportLoadResult(kUmaPrefix, base::PathExists(cdm_path) + ? CdmLoadResult::kLoadFailed + : CdmLoadResult::kFileMissing); + ReportLoadErrorCode(kUmaPrefix, library_.GetError()); return false; } // Only report load time for success loads. - ReportLoadTime(load_time); + ReportLoadTime(kUmaPrefix, load_time); // Get function pointers. // TODO(xhwang): Define function names in macros to avoid typo errors. @@ -165,13 +142,14 @@ bool CdmModule::Initialize(const base::FilePath& cdm_path) { create_cdm_func_ = nullptr; get_cdm_version_func_ = nullptr; library_.reset(); - ReportLoadResult(LoadResult::kEntryPointMissing); + ReportLoadResult(kUmaPrefix, CdmLoadResult::kEntryPointMissing); return false; } // In case of crashes, provide CDM version to facilitate investigation. std::string cdm_version = get_cdm_version_func_(); DVLOG(2) << __func__ << ": cdm_version = " << cdm_version; + TRACE_EVENT1("media", "CdmModule::Initialize", "cdm_version", cdm_version); static crash_reporter::CrashKeyString<32> cdm_version_key("cdm-version"); cdm_version_key.Set(cdm_version); @@ -187,7 +165,7 @@ bool CdmModule::Initialize(const base::FilePath& cdm_path) { InitCdmHostVerification(library_.get(), cdm_path_, cdm_host_file_paths); #endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) - ReportLoadResult(LoadResult::kLoadSuccess); + ReportLoadResult(kUmaPrefix, CdmLoadResult::kLoadSuccess); return true; } |