#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "media/mojo/mojom/content_decryption_module.mojom.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/features.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "media/mojo/mojom/content_decryption_module.mojom-params-data.h"
#include "media/mojo/mojom/content_decryption_module.mojom-shared-message-ids.h"
#include "media/mojo/mojom/content_decryption_module.mojom-import-headers.h"
#include "media/mojo/mojom/content_decryption_module.mojom-test-utils.h"
namespace media::mojom {
CdmPromiseResult::CdmPromiseResult()
: … { … }
CdmPromiseResult::CdmPromiseResult(
bool success_in,
::media::CdmPromise::Exception exception_in,
uint32_t system_code_in,
const std::string& error_message_in)
: … { … }
CdmPromiseResult::~CdmPromiseResult() = default;
void CdmPromiseResult::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool CdmPromiseResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
CdmKeyInformation::CdmKeyInformation()
: … { … }
CdmKeyInformation::CdmKeyInformation(
std::vector<uint8_t> key_id_in,
::media::CdmKeyInformation::KeyStatus status_in,
uint32_t system_code_in)
: … { … }
CdmKeyInformation::~CdmKeyInformation() = default;
void CdmKeyInformation::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool CdmKeyInformation::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
CdmContext::CdmContext()
: … { … }
CdmContext::CdmContext(
const ::base::UnguessableToken& cdm_id_in,
::mojo::PendingRemote<::media::mojom::Decryptor> decryptor_in)
: … { … }
CdmContext::~CdmContext() = default;
void CdmContext::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool CdmContext::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char ContentDecryptionModule::Name_[] = …;
ContentDecryptionModule::IPCStableHashFunction ContentDecryptionModule::MessageToMethodInfo_(mojo::Message& message) { … }
const char* ContentDecryptionModule::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t ContentDecryptionModule::SetClient_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::SetServerCertificate_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::GetStatusForPolicy_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::CreateSessionAndGenerateRequest_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::LoadSession_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::UpdateSession_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::CloseSession_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModule::RemoveSession_Sym::IPCStableHash() { … }
# endif
class ContentDecryptionModule_SetServerCertificate_ForwardToCallback
: public mojo::MessageReceiver { … };
class ContentDecryptionModule_GetStatusForPolicy_ForwardToCallback
: public mojo::MessageReceiver { … };
class ContentDecryptionModule_CreateSessionAndGenerateRequest_ForwardToCallback
: public mojo::MessageReceiver { … };
class ContentDecryptionModule_LoadSession_ForwardToCallback
: public mojo::MessageReceiver { … };
class ContentDecryptionModule_UpdateSession_ForwardToCallback
: public mojo::MessageReceiver { … };
class ContentDecryptionModule_CloseSession_ForwardToCallback
: public mojo::MessageReceiver { … };
class ContentDecryptionModule_RemoveSession_ForwardToCallback
: public mojo::MessageReceiver { … };
ContentDecryptionModuleProxy::ContentDecryptionModuleProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void ContentDecryptionModuleProxy::SetClient(
::mojo::PendingAssociatedRemote<ContentDecryptionModuleClient> in_client) { … }
void ContentDecryptionModuleProxy::SetServerCertificate(
const std::vector<uint8_t>& in_certificate_data, SetServerCertificateCallback callback) { … }
void ContentDecryptionModuleProxy::GetStatusForPolicy(
::media::HdcpVersion in_min_hdcp_version, GetStatusForPolicyCallback callback) { … }
void ContentDecryptionModuleProxy::CreateSessionAndGenerateRequest(
::media::CdmSessionType in_session_type, ::media::EmeInitDataType in_init_data_type, const std::vector<uint8_t>& in_init_data, CreateSessionAndGenerateRequestCallback callback) { … }
void ContentDecryptionModuleProxy::LoadSession(
::media::CdmSessionType in_session_type, const std::string& in_session_id, LoadSessionCallback callback) { … }
void ContentDecryptionModuleProxy::UpdateSession(
const std::string& in_session_id, const std::vector<uint8_t>& in_response, UpdateSessionCallback callback) { … }
void ContentDecryptionModuleProxy::CloseSession(
const std::string& in_session_id, CloseSessionCallback callback) { … }
void ContentDecryptionModuleProxy::RemoveSession(
const std::string& in_session_id, RemoveSessionCallback callback) { … }
class ContentDecryptionModule_SetServerCertificate_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_SetServerCertificate_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_SetServerCertificate_ProxyToResponder::Run(
CdmPromiseResultPtr in_result) { … }
class ContentDecryptionModule_GetStatusForPolicy_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_GetStatusForPolicy_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_GetStatusForPolicy_ProxyToResponder::Run(
CdmPromiseResultPtr in_result, ::media::CdmKeyInformation::KeyStatus in_key_status) { … }
class ContentDecryptionModule_CreateSessionAndGenerateRequest_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_CreateSessionAndGenerateRequest_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_CreateSessionAndGenerateRequest_ProxyToResponder::Run(
CdmPromiseResultPtr in_result, const std::string& in_session_id) { … }
class ContentDecryptionModule_LoadSession_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_LoadSession_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_LoadSession_ProxyToResponder::Run(
CdmPromiseResultPtr in_result, const std::string& in_session_id) { … }
class ContentDecryptionModule_UpdateSession_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_UpdateSession_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_UpdateSession_ProxyToResponder::Run(
CdmPromiseResultPtr in_result) { … }
class ContentDecryptionModule_CloseSession_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_CloseSession_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_CloseSession_ProxyToResponder::Run(
CdmPromiseResultPtr in_result) { … }
class ContentDecryptionModule_RemoveSession_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ContentDecryptionModule_RemoveSession_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ContentDecryptionModule_RemoveSession_ProxyToResponder::Run(
CdmPromiseResultPtr in_result) { … }
bool ContentDecryptionModuleStubDispatch::Accept(
ContentDecryptionModule* impl,
mojo::Message* message) { … }
bool ContentDecryptionModuleStubDispatch::AcceptWithResponder(
ContentDecryptionModule* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kContentDecryptionModuleValidationInfo[] = …;
bool ContentDecryptionModuleRequestValidator::Accept(mojo::Message* message) { … }
bool ContentDecryptionModuleResponseValidator::Accept(mojo::Message* message) { … }
const char ContentDecryptionModuleClient::Name_[] = …;
ContentDecryptionModuleClient::IPCStableHashFunction ContentDecryptionModuleClient::MessageToMethodInfo_(mojo::Message& message) { … }
const char* ContentDecryptionModuleClient::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t ContentDecryptionModuleClient::OnSessionMessage_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModuleClient::OnSessionClosed_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModuleClient::OnSessionKeysChange_Sym::IPCStableHash() { … }
uint32_t ContentDecryptionModuleClient::OnSessionExpirationUpdate_Sym::IPCStableHash() { … }
# endif
ContentDecryptionModuleClientProxy::ContentDecryptionModuleClientProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void ContentDecryptionModuleClientProxy::OnSessionMessage(
const std::string& in_session_id, ::media::CdmMessageType in_message_type, const std::vector<uint8_t>& in_message) { … }
void ContentDecryptionModuleClientProxy::OnSessionClosed(
const std::string& in_session_id, ::media::CdmSessionClosedReason in_reason) { … }
void ContentDecryptionModuleClientProxy::OnSessionKeysChange(
const std::string& in_session_id, bool in_has_additional_usable_key, std::vector<::std::unique_ptr<::media::CdmKeyInformation>> in_keys_info) { … }
void ContentDecryptionModuleClientProxy::OnSessionExpirationUpdate(
const std::string& in_session_id, double in_new_expiry_time_sec) { … }
bool ContentDecryptionModuleClientStubDispatch::Accept(
ContentDecryptionModuleClient* impl,
mojo::Message* message) { … }
bool ContentDecryptionModuleClientStubDispatch::AcceptWithResponder(
ContentDecryptionModuleClient* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kContentDecryptionModuleClientValidationInfo[] = …;
bool ContentDecryptionModuleClientRequestValidator::Accept(mojo::Message* message) { … }
const char CdmFactory::Name_[] = …;
CdmFactory::IPCStableHashFunction CdmFactory::MessageToMethodInfo_(mojo::Message& message) { … }
const char* CdmFactory::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t CdmFactory::CreateCdm_Sym::IPCStableHash() { … }
# endif
class CdmFactory_CreateCdm_ForwardToCallback
: public mojo::MessageReceiver { … };
CdmFactoryProxy::CdmFactoryProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void CdmFactoryProxy::CreateCdm(
const ::media::CdmConfig& in_cdm_config, CreateCdmCallback callback) { … }
class CdmFactory_CreateCdm_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool CdmFactory_CreateCdm_ForwardToCallback::Accept(
mojo::Message* message) { … }
void CdmFactory_CreateCdm_ProxyToResponder::Run(
::mojo::PendingRemote<ContentDecryptionModule> in_cdm, CdmContextPtr in_cdm_context, ::media::CreateCdmStatus in_status) { … }
bool CdmFactoryStubDispatch::Accept(
CdmFactory* impl,
mojo::Message* message) { … }
bool CdmFactoryStubDispatch::AcceptWithResponder(
CdmFactory* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kCdmFactoryValidationInfo[] = …;
bool CdmFactoryRequestValidator::Accept(mojo::Message* message) { … }
bool CdmFactoryResponseValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::media::mojom::CdmPromiseResult::DataView, ::media::mojom::CdmPromiseResultPtr>::Read(
::media::mojom::CdmPromiseResult::DataView input,
::media::mojom::CdmPromiseResultPtr* output) { … }
bool StructTraits<::media::mojom::CdmKeyInformation::DataView, ::media::mojom::CdmKeyInformationPtr>::Read(
::media::mojom::CdmKeyInformation::DataView input,
::media::mojom::CdmKeyInformationPtr* output) { … }
bool StructTraits<::media::mojom::CdmContext::DataView, ::media::mojom::CdmContextPtr>::Read(
::media::mojom::CdmContext::DataView input,
::media::mojom::CdmContextPtr* output) { … }
}
namespace media::mojom {
void ContentDecryptionModuleInterceptorForTesting::SetClient(::mojo::PendingAssociatedRemote<ContentDecryptionModuleClient> client) { … }
void ContentDecryptionModuleInterceptorForTesting::SetServerCertificate(const std::vector<uint8_t>& certificate_data, SetServerCertificateCallback callback) { … }
void ContentDecryptionModuleInterceptorForTesting::GetStatusForPolicy(::media::HdcpVersion min_hdcp_version, GetStatusForPolicyCallback callback) { … }
void ContentDecryptionModuleInterceptorForTesting::CreateSessionAndGenerateRequest(::media::CdmSessionType session_type, ::media::EmeInitDataType init_data_type, const std::vector<uint8_t>& init_data, CreateSessionAndGenerateRequestCallback callback) { … }
void ContentDecryptionModuleInterceptorForTesting::LoadSession(::media::CdmSessionType session_type, const std::string& session_id, LoadSessionCallback callback) { … }
void ContentDecryptionModuleInterceptorForTesting::UpdateSession(const std::string& session_id, const std::vector<uint8_t>& response, UpdateSessionCallback callback) { … }
void ContentDecryptionModuleInterceptorForTesting::CloseSession(const std::string& session_id, CloseSessionCallback callback) { … }
void ContentDecryptionModuleInterceptorForTesting::RemoveSession(const std::string& session_id, RemoveSessionCallback callback) { … }
ContentDecryptionModuleAsyncWaiter::ContentDecryptionModuleAsyncWaiter(
ContentDecryptionModule* proxy) : … { … }
ContentDecryptionModuleAsyncWaiter::~ContentDecryptionModuleAsyncWaiter() = default;
void ContentDecryptionModuleAsyncWaiter::SetServerCertificate(
const std::vector<uint8_t>& certificate_data, CdmPromiseResultPtr* out_result) { … }
CdmPromiseResultPtr ContentDecryptionModuleAsyncWaiter::SetServerCertificate(
const std::vector<uint8_t>& certificate_data) { … }
void ContentDecryptionModuleAsyncWaiter::GetStatusForPolicy(
::media::HdcpVersion min_hdcp_version, CdmPromiseResultPtr* out_result, ::media::CdmKeyInformation::KeyStatus* out_key_status) { … }
void ContentDecryptionModuleAsyncWaiter::CreateSessionAndGenerateRequest(
::media::CdmSessionType session_type, ::media::EmeInitDataType init_data_type, const std::vector<uint8_t>& init_data, CdmPromiseResultPtr* out_result, std::string* out_session_id) { … }
void ContentDecryptionModuleAsyncWaiter::LoadSession(
::media::CdmSessionType session_type, const std::string& session_id, CdmPromiseResultPtr* out_result, std::string* out_session_id) { … }
void ContentDecryptionModuleAsyncWaiter::UpdateSession(
const std::string& session_id, const std::vector<uint8_t>& response, CdmPromiseResultPtr* out_result) { … }
CdmPromiseResultPtr ContentDecryptionModuleAsyncWaiter::UpdateSession(
const std::string& session_id, const std::vector<uint8_t>& response) { … }
void ContentDecryptionModuleAsyncWaiter::CloseSession(
const std::string& session_id, CdmPromiseResultPtr* out_result) { … }
CdmPromiseResultPtr ContentDecryptionModuleAsyncWaiter::CloseSession(
const std::string& session_id) { … }
void ContentDecryptionModuleAsyncWaiter::RemoveSession(
const std::string& session_id, CdmPromiseResultPtr* out_result) { … }
CdmPromiseResultPtr ContentDecryptionModuleAsyncWaiter::RemoveSession(
const std::string& session_id) { … }
void ContentDecryptionModuleClientInterceptorForTesting::OnSessionMessage(const std::string& session_id, ::media::CdmMessageType message_type, const std::vector<uint8_t>& message) { … }
void ContentDecryptionModuleClientInterceptorForTesting::OnSessionClosed(const std::string& session_id, ::media::CdmSessionClosedReason reason) { … }
void ContentDecryptionModuleClientInterceptorForTesting::OnSessionKeysChange(const std::string& session_id, bool has_additional_usable_key, std::vector<::std::unique_ptr<::media::CdmKeyInformation>> keys_info) { … }
void ContentDecryptionModuleClientInterceptorForTesting::OnSessionExpirationUpdate(const std::string& session_id, double new_expiry_time_sec) { … }
ContentDecryptionModuleClientAsyncWaiter::ContentDecryptionModuleClientAsyncWaiter(
ContentDecryptionModuleClient* proxy) : … { … }
ContentDecryptionModuleClientAsyncWaiter::~ContentDecryptionModuleClientAsyncWaiter() = default;
void CdmFactoryInterceptorForTesting::CreateCdm(const ::media::CdmConfig& cdm_config, CreateCdmCallback callback) { … }
CdmFactoryAsyncWaiter::CdmFactoryAsyncWaiter(
CdmFactory* proxy) : … { … }
CdmFactoryAsyncWaiter::~CdmFactoryAsyncWaiter() = default;
void CdmFactoryAsyncWaiter::CreateCdm(
const ::media::CdmConfig& cdm_config, ::mojo::PendingRemote<ContentDecryptionModule>* out_cdm, CdmContextPtr* out_cdm_context, ::media::CreateCdmStatus* out_status) { … }
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif