Add clang-tidy support for the CDM

Bug: 256230932
Change-Id: Id3fcf024cd7dcf95218876b81359d6418f5aa067
This commit is contained in:
Ian Benz
2023-04-11 20:46:08 +00:00
committed by Robert Shih
parent b7b423aca3
commit cebd90e300
37 changed files with 209 additions and 185 deletions

View File

@@ -88,7 +88,7 @@ class CdmEngine {
// request to.
virtual CdmResponseType GenerateKeyRequest(
const CdmSessionId& session_id, const CdmKeySetId& key_set_id,
const InitializationData& init_data, const CdmLicenseType license_type,
const InitializationData& init_data, CdmLicenseType license_type,
CdmAppParameterMap& app_parameters, CdmKeyRequest* key_request);
// This API may
// (a) accept license response, extract key info and load keys.

View File

@@ -157,24 +157,24 @@ class CdmUsageTable {
// will be deleted.
// Threading: Method takes exclusive use of |lock_|
// when required.
bool CreateNewTable(CryptoSession* const crypto_session);
bool CreateNewTable(CryptoSession* crypto_session);
// Attempts to restore the usage table from persistent storage, and
// loads the usage table header into OEMCrypto.
// Note: No other OEMCrypto session should be opened before calling.
// Threading: Method takes exclusive use of |lock_|
// when required.
bool RestoreTable(CryptoSession* const crypto_session);
bool RestoreTable(CryptoSession* crypto_session);
// Performs a check that there are no open OEMCrypto sessions for
// the current security level of the usage table.
// Threading: No special threading requirements.
bool OpenSessionCheck(CryptoSession* const crypto_session);
bool OpenSessionCheck(CryptoSession* crypto_session);
// Performs a check that the OEMCrypto table can support at least
// one more entry if the table is at or near the reported capacity.
// If this check fails, a new usage table SHOULD be created.
// Threading: Method requires caller to take exclusive use of
// |lock_|.
bool CapacityCheck(CryptoSession* const crypto_session);
bool CapacityCheck(CryptoSession* crypto_session);
// Attempts to determine the capacity of the OEMCrypto usage table.
// Sets the result to |potential_table_capacity_|.
@@ -189,7 +189,7 @@ class CdmUsageTable {
// Creates a new entry for the provided crypto session. If the
// entry is created successfully in OEMCrypto, then a new entry
// info is added to the table's vector of entry info.
CdmResponseType CreateEntry(CryptoSession* const crypto_session,
CdmResponseType CreateEntry(CryptoSession* crypto_session,
UsageEntryIndex* entry_index);
// Attempts to relocate a newly created usage entry associated with
@@ -198,27 +198,27 @@ class CdmUsageTable {
// |entry_index| is treated as both an input and output.
// Returns NO_ERROR so long as no internal operation fails,
// regardless of whether the entry was moved or not.
CdmResponseType RelocateNewEntry(CryptoSession* const crypto_session,
CdmResponseType RelocateNewEntry(CryptoSession* crypto_session,
UsageEntryIndex* entry_index);
// Checks if the specified |entry_index| is known to be
// unoccupied (released).
bool IsEntryUnoccupied(const UsageEntryIndex entry_index) const;
bool IsEntryUnoccupied(UsageEntryIndex entry_index) const;
// SetOfflineEntryInfo() and SetUsageInfoEntryInfo() populate the
// entry meta-data with the required information based on the type
// of entry.
void SetOfflineEntryInfo(const UsageEntryIndex entry_index,
void SetOfflineEntryInfo(UsageEntryIndex entry_index,
const std::string& key_set_id,
const CdmKeyResponse& license_message);
void SetUsageInfoEntryInfo(const UsageEntryIndex entry_index,
void SetUsageInfoEntryInfo(UsageEntryIndex entry_index,
const std::string& key_set_id,
const std::string& usage_info_file_name);
// Shrinks the table, removing all trailing unoccupied entries.
// |entry_info_list_| will be resized appropriately.
// Caller must store the table after a successful call.
CdmResponseType RefitTable(CryptoSession* const crypto_session);
CdmResponseType RefitTable(CryptoSession* crypto_session);
virtual CdmResponseType InvalidateEntryInternal(
UsageEntryIndex entry_index, bool defrag_table, DeviceFiles* device_files,

View File

@@ -275,7 +275,7 @@ class DeviceFiles {
const CdmUsageData& usage_data);
virtual bool StoreHlsAttributes(const std::string& key_set_id,
const CdmHlsMethod method,
CdmHlsMethod method,
const std::vector<uint8_t>& media_segment_iv);
virtual bool RetrieveHlsAttributes(const std::string& key_set_id,
CdmHlsMethod* method,

View File

@@ -143,7 +143,7 @@ class LicenseKeyStatus {
using ConstraintList =
::google::protobuf::RepeatedPtrField<VideoResolutionConstraint>;
LicenseKeyStatus(const KeyContainer& key, const CdmSecurityLevel level);
LicenseKeyStatus(const KeyContainer& key, CdmSecurityLevel level);
virtual ~LicenseKeyStatus() {}

View File

@@ -521,13 +521,11 @@ class CdmResponseType {
const char* crypto_session_method_ = nullptr;
};
static inline bool operator==(const CdmResponseEnum lhs,
const CdmResponseType& rhs) {
inline bool operator==(const CdmResponseEnum lhs, const CdmResponseType& rhs) {
return lhs == rhs.code();
}
static inline bool operator!=(const CdmResponseEnum lhs,
const CdmResponseType& rhs) {
inline bool operator!=(const CdmResponseEnum lhs, const CdmResponseType& rhs) {
return lhs != rhs.code();
}
@@ -708,17 +706,14 @@ class CdmKeyAllowedUsage {
}
bool Equals(const CdmKeyAllowedUsage& other) {
if (!valid_ || !other.Valid() ||
decrypt_to_clear_buffer != other.decrypt_to_clear_buffer ||
decrypt_to_secure_buffer != other.decrypt_to_secure_buffer ||
generic_encrypt != other.generic_encrypt ||
generic_decrypt != other.generic_decrypt ||
generic_sign != other.generic_sign ||
generic_verify != other.generic_verify ||
key_security_level_ != other.key_security_level_) {
return false;
}
return true;
return valid_ && other.Valid() &&
decrypt_to_clear_buffer == other.decrypt_to_clear_buffer &&
decrypt_to_secure_buffer == other.decrypt_to_secure_buffer &&
generic_encrypt == other.generic_encrypt &&
generic_decrypt == other.generic_decrypt &&
generic_sign == other.generic_sign &&
generic_verify == other.generic_verify &&
key_security_level_ == other.key_security_level_;
}
bool decrypt_to_clear_buffer;