// // Automatically generated by ipdlc. // Edit at your own risk // #include "mozilla/gmp/PGMPContentChild.h" #include "GMPContentChild.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/gmp/PGMPVideoDecoderChild.h" #include "mozilla/gmp/PGMPVideoEncoderChild.h" #include "mozilla/gmp/PChromiumCDMChild.h" #include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtilsSpecializations.h" #include "nsIFile.h" #include "mozilla/ipc/Endpoint.h" #include "mozilla/ipc/ProtocolMessageUtils.h" #include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/ipc/ShmemMessageUtils.h" #include "mozilla/ipc/TaintingIPCUtils.h" namespace mozilla { namespace gmp { auto PGMPContentChild::RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* actor) -> mozilla::ipc::IPCResult { return IPC_OK(); } auto PGMPContentChild::RecvPGMPVideoEncoderConstructor(PGMPVideoEncoderChild* actor) -> mozilla::ipc::IPCResult { return IPC_OK(); } auto PGMPContentChild::RecvPChromiumCDMConstructor( PChromiumCDMChild* actor, const nsACString& aKeySystem) -> mozilla::ipc::IPCResult { return IPC_OK(); } auto PGMPContentChild::ProcessingError( Result aCode, const char* aReason) -> void { } auto PGMPContentChild::ShouldContinueFromReplyTimeout() -> bool { return true; } MOZ_IMPLICIT PGMPContentChild::PGMPContentChild() : mozilla::ipc::IToplevelProtocol("PGMPContentChild", kProtocolId, mozilla::ipc::ChildSide) { MOZ_COUNT_CTOR(PGMPContentChild); } PGMPContentChild::~PGMPContentChild() { MOZ_COUNT_DTOR(PGMPContentChild); } auto PGMPContentChild::ActorAlloc() -> void { MOZ_RELEASE_ASSERT(XRE_IsGMPluginProcess(), "Invalid process for `PGMPContentChild'"); AddRef(); } auto PGMPContentChild::ActorDealloc() -> void { Release(); } auto PGMPContentChild::OtherPid() const -> ::base::ProcessId { ::base::ProcessId pid = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid(); MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId); return pid; } auto PGMPContentChild::OtherChildID() const -> ::GeckoChildID { ::GeckoChildID childID = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid(); MOZ_RELEASE_ASSERT(childID != -1); return childID; } auto PGMPContentChild::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo { return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()}; } auto PGMPContentChild::ManagedPGMPVideoDecoderChild(nsTArray& aArr) const -> void { mManagedPGMPVideoDecoderChild.ToArray(aArr); } auto PGMPContentChild::ManagedPGMPVideoDecoderChild() const -> const ManagedContainer& { return mManagedPGMPVideoDecoderChild; } auto PGMPContentChild::ManagedPGMPVideoEncoderChild(nsTArray& aArr) const -> void { mManagedPGMPVideoEncoderChild.ToArray(aArr); } auto PGMPContentChild::ManagedPGMPVideoEncoderChild() const -> const ManagedContainer& { return mManagedPGMPVideoEncoderChild; } auto PGMPContentChild::ManagedPChromiumCDMChild(nsTArray& aArr) const -> void { mManagedPChromiumCDMChild.ToArray(aArr); } auto PGMPContentChild::ManagedPChromiumCDMChild() const -> const ManagedContainer& { return mManagedPChromiumCDMChild; } auto PGMPContentChild::ManagedProtocolIds() const -> mozilla::Span { static constexpr ::mozilla::ipc::ProtocolId sIds[] = { PGMPVideoDecoderMsgStart, PGMPVideoEncoderMsgStart, PChromiumCDMMsgStart }; return sIds; } auto PGMPContentChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer* { switch (aProtocol) { case PGMPVideoDecoderMsgStart: return (&(mManagedPGMPVideoDecoderChild)); case PGMPVideoEncoderMsgStart: return (&(mManagedPGMPVideoEncoderChild)); case PChromiumCDMMsgStart: return (&(mManagedPChromiumCDMChild)); default: return nullptr; } } auto PGMPContentChild::OpenPGMPVideoDecoderEndpoint(PGMPVideoDecoderChild* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PGMPVideoDecoderChild actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PGMPVideoDecoderChild actor"); return ManagedEndpoint(); } // Mark our actor as awaiting the other side to be bound. This will // be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is // received. aActor->mAwaitingManagedEndpointBind = true; return ManagedEndpoint(mozilla::ipc::PrivateIPDLInterface(), aActor); } auto PGMPContentChild::BindPGMPVideoDecoderEndpoint( ManagedEndpoint aEndpoint, PGMPVideoDecoderChild* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PGMPContentChild::OpenPGMPVideoEncoderEndpoint(PGMPVideoEncoderChild* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PGMPVideoEncoderChild actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PGMPVideoEncoderChild actor"); return ManagedEndpoint(); } // Mark our actor as awaiting the other side to be bound. This will // be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is // received. aActor->mAwaitingManagedEndpointBind = true; return ManagedEndpoint(mozilla::ipc::PrivateIPDLInterface(), aActor); } auto PGMPContentChild::BindPGMPVideoEncoderEndpoint( ManagedEndpoint aEndpoint, PGMPVideoEncoderChild* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PGMPContentChild::OpenPChromiumCDMEndpoint(PChromiumCDMChild* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PChromiumCDMChild actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PChromiumCDMChild actor"); return ManagedEndpoint(); } // Mark our actor as awaiting the other side to be bound. This will // be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is // received. aActor->mAwaitingManagedEndpointBind = true; return ManagedEndpoint(mozilla::ipc::PrivateIPDLInterface(), aActor); } auto PGMPContentChild::BindPChromiumCDMEndpoint( ManagedEndpoint aEndpoint, PChromiumCDMChild* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PGMPContentChild::DeallocManagee( mozilla::ipc::ProtocolId aProtocolId, IProtocol* aListener) -> void { switch (aProtocolId) { default: FatalError("unreached"); return; } } auto PGMPContentChild::OnMessageReceived(const Message& msg__) -> PGMPContentChild::Result { if (!CanSend()) { if (mozilla::ipc::LoggingEnabledFor("PGMPContent", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PGMPContentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } IPC::Message::routeid_t route__ = msg__.routing_id(); if (MSG_ROUTING_CONTROL != route__) { IProtocol* routed__ = Lookup(route__); if (!routed__ || !routed__->GetLifecycleProxy()) { if (mozilla::ipc::LoggingEnabledFor("PGMPContent", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PGMPContentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } RefPtr proxy__ = routed__->GetLifecycleProxy(); return proxy__->Get()->OnMessageReceived(msg__); } switch (msg__.type()) { case PGMPContent::Msg_PGMPVideoDecoderConstructor__ID: { if (mozilla::ipc::LoggingEnabledFor("PGMPContent", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PGMPContentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PGMPContent::Msg_PGMPVideoDecoderConstructor", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__actorid__ = IPC::ReadParam((&(reader__))); if (!maybe__actorid__) { FatalError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto& actorid__ = *maybe__actorid__; // Sentinel = 'actorid' if ((!(((&(reader__)))->ReadSentinel(193725159)))) { mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } reader__.EndRead(); // Ensure the ID which was sent to us is valid, and reserve a spot // in the table for the new actor before we bother to alloc it. if (!ToplevelProtocol()->TryReserve(actorid__)) { NS_WARNING("Failed to reserve ActorId for constructor"); return MsgValueError; } RefPtr actor = (static_cast<::mozilla::gmp::GMPContentChild*>(this))->AllocPGMPVideoDecoderChild(); if (!actor) { NS_WARNING("Alloc function returned null"); // Clean up the reservation taken above if this fails, to avoid // leaving zombie entries in the map. ToplevelProtocol()->ClearReservation(actorid__); return MsgValueError; } // NOTE: SetManagerAndRegister unconditionally consumes the // reservation taken by TryReserve, so we don't need to clear it on // failure. if (!actor->SetManagerAndRegister(this, actorid__)) { NS_WARNING("Failed to set manager for constructor"); return MsgValueError; } mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::gmp::GMPContentChild*>(this))->RecvPGMPVideoDecoderConstructor(actor); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PGMPContent::Msg_PGMPVideoEncoderConstructor__ID: { if (mozilla::ipc::LoggingEnabledFor("PGMPContent", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PGMPContentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PGMPContent::Msg_PGMPVideoEncoderConstructor", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__actorid__ = IPC::ReadParam((&(reader__))); if (!maybe__actorid__) { FatalError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto& actorid__ = *maybe__actorid__; // Sentinel = 'actorid' if ((!(((&(reader__)))->ReadSentinel(193725159)))) { mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } reader__.EndRead(); // Ensure the ID which was sent to us is valid, and reserve a spot // in the table for the new actor before we bother to alloc it. if (!ToplevelProtocol()->TryReserve(actorid__)) { NS_WARNING("Failed to reserve ActorId for constructor"); return MsgValueError; } RefPtr actor = (static_cast<::mozilla::gmp::GMPContentChild*>(this))->AllocPGMPVideoEncoderChild(); if (!actor) { NS_WARNING("Alloc function returned null"); // Clean up the reservation taken above if this fails, to avoid // leaving zombie entries in the map. ToplevelProtocol()->ClearReservation(actorid__); return MsgValueError; } // NOTE: SetManagerAndRegister unconditionally consumes the // reservation taken by TryReserve, so we don't need to clear it on // failure. if (!actor->SetManagerAndRegister(this, actorid__)) { NS_WARNING("Failed to set manager for constructor"); return MsgValueError; } mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::gmp::GMPContentChild*>(this))->RecvPGMPVideoEncoderConstructor(actor); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PGMPContent::Msg_PChromiumCDMConstructor__ID: { if (mozilla::ipc::LoggingEnabledFor("PGMPContent", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PGMPContentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PGMPContent::Msg_PChromiumCDMConstructor", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__actorid__ = IPC::ReadParam((&(reader__))); if (!maybe__actorid__) { FatalError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto& actorid__ = *maybe__actorid__; // Sentinel = 'actorid' if ((!(((&(reader__)))->ReadSentinel(193725159)))) { mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto maybe__aKeySystem = IPC::ReadParam((&(reader__))); if (!maybe__aKeySystem) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& aKeySystem = *maybe__aKeySystem; // Sentinel = 'aKeySystem' if ((!(((&(reader__)))->ReadSentinel(362546192)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } reader__.EndRead(); // Ensure the ID which was sent to us is valid, and reserve a spot // in the table for the new actor before we bother to alloc it. if (!ToplevelProtocol()->TryReserve(actorid__)) { NS_WARNING("Failed to reserve ActorId for constructor"); return MsgValueError; } RefPtr actor = (static_cast<::mozilla::gmp::GMPContentChild*>(this))->AllocPChromiumCDMChild(aKeySystem); if (!actor) { NS_WARNING("Alloc function returned null"); // Clean up the reservation taken above if this fails, to avoid // leaving zombie entries in the map. ToplevelProtocol()->ClearReservation(actorid__); return MsgValueError; } // NOTE: SetManagerAndRegister unconditionally consumes the // reservation taken by TryReserve, so we don't need to clear it on // failure. if (!actor->SetManagerAndRegister(this, actorid__)) { NS_WARNING("Failed to set manager for constructor"); return MsgValueError; } mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::gmp::GMPContentChild*>(this))->RecvPChromiumCDMConstructor(actor, std::move(aKeySystem)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } default: return MsgNotKnown; case SHMEM_CREATED_MESSAGE_TYPE: { if (!ShmemCreated(msg__)) { return MsgPayloadError; } return MsgProcessed; } case SHMEM_DESTROYED_MESSAGE_TYPE: { if (!ShmemDestroyed(msg__)) { return MsgPayloadError; } return MsgProcessed; } } } auto PGMPContentChild::OnMessageReceived( const Message& msg__, UniquePtr& reply__) -> PGMPContentChild::Result { if (!CanSend()) { return MsgDropped; } IPC::Message::routeid_t route__ = msg__.routing_id(); if (MSG_ROUTING_CONTROL != route__) { IProtocol* routed__ = Lookup(route__); if (!routed__ || !routed__->GetLifecycleProxy()) { return MsgDropped; } RefPtr proxy__ = routed__->GetLifecycleProxy(); return proxy__->Get()->OnMessageReceived(msg__, reply__); } return MsgNotKnown; } } // namespace gmp } // namespace mozilla