Apply recommended type and name changes to metrics.

Bug: 36220619
BUG: 64071905

Test: Re-ran existing unit tests. Ran GTS tests. Tested with Google Play.
Change-Id: I79ddc8ed3290e6d74364cf96305054e55243c5ff
This commit is contained in:
Adam Stone
2017-08-14 19:21:22 -07:00
parent c0133bf3a4
commit 5d2693536c
13 changed files with 346 additions and 595 deletions

View File

@@ -44,8 +44,8 @@ CdmSession::CdmSession(FileSystem* file_system,
usage_entry_number_(0),
mock_license_parser_in_use_(false),
mock_policy_engine_in_use_(false) {
// If metrics was not provided, then use a NULL CryptoMetrics instance, too.
crypto_metrics_ = metrics_ == NULL ? NULL : metrics_->GetCryptoMetrics();
assert(metrics_); // metrics_ must not be null.
crypto_metrics_ = metrics_->GetCryptoMetrics();
crypto_session_.reset(new CryptoSession(crypto_metrics_));
life_span_.Start();
}
@@ -90,11 +90,10 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
sts,
requested_security_level_);
if (NO_ERROR != sts) return sts;
M_TIME(
security_level_ = crypto_session_->GetSecurityLevel(),
crypto_metrics_,
crypto_session_get_security_level_,
security_level_);
security_level_ = crypto_session_->GetSecurityLevel();
crypto_metrics_->crypto_session_security_level_.Record(security_level_);
if (!file_handle_->Init(security_level_)) {
LOGE("CdmSession::Init: Unable to initialize file handle");
return SESSION_FILE_HANDLE_INIT_ERROR;
@@ -122,13 +121,9 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
LOGW("CdmSession::Init: Properties::use_certificates_as_identification() "
"is not set - using Keybox for license requests (not recommended).");
bool get_client_token_sts;
M_TIME(
get_client_token_sts = crypto_session_->GetClientToken(
&client_token),
crypto_metrics_,
crypto_session_get_token_,
get_client_token_sts);
bool get_client_token_sts = crypto_session_->GetClientToken(&client_token);
crypto_metrics_->crypto_session_get_token_.Increment(
get_client_token_sts);
if (!get_client_token_sts) {
return SESSION_INIT_ERROR_1;
}
@@ -871,13 +866,10 @@ void CdmSession::GetApplicationId(std::string* app_id) {
CdmResponseType CdmSession::DeleteMultipleUsageInformation(
const std::vector<std::string>& provider_session_tokens) {
CdmResponseType sts;
M_TIME(
sts = crypto_session_->DeleteMultipleUsageInformation(
provider_session_tokens),
crypto_metrics_,
crypto_session_delete_multiple_usage_information_,
sts);
CdmResponseType sts = crypto_session_->DeleteMultipleUsageInformation(
provider_session_tokens);
crypto_metrics_->crypto_session_delete_multiple_usage_information_
.Increment(sts);
return sts;
}