Copy as Markdown
Other Tools
//
// 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 "mozilla/PSandboxTestingChild.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<PGMPVideoDecoderChild*>& aArr) const -> void
{
mManagedPGMPVideoDecoderChild.ToArray(aArr);
}
auto PGMPContentChild::ManagedPGMPVideoDecoderChild() const -> const ManagedContainer<PGMPVideoDecoderChild>&
{
return mManagedPGMPVideoDecoderChild;
}
auto PGMPContentChild::ManagedPGMPVideoEncoderChild(nsTArray<PGMPVideoEncoderChild*>& aArr) const -> void
{
mManagedPGMPVideoEncoderChild.ToArray(aArr);
}
auto PGMPContentChild::ManagedPGMPVideoEncoderChild() const -> const ManagedContainer<PGMPVideoEncoderChild>&
{
return mManagedPGMPVideoEncoderChild;
}
auto PGMPContentChild::ManagedPChromiumCDMChild(nsTArray<PChromiumCDMChild*>& aArr) const -> void
{
mManagedPChromiumCDMChild.ToArray(aArr);
}
auto PGMPContentChild::ManagedPChromiumCDMChild() const -> const ManagedContainer<PChromiumCDMChild>&
{
return mManagedPChromiumCDMChild;
}
auto PGMPContentChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
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<PGMPVideoDecoderParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PGMPVideoDecoderChild actor");
return ManagedEndpoint<PGMPVideoDecoderParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PGMPVideoDecoderChild actor");
return ManagedEndpoint<PGMPVideoDecoderParent>();
}
// 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<PGMPVideoDecoderParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PGMPContentChild::BindPGMPVideoDecoderEndpoint(
ManagedEndpoint<PGMPVideoDecoderChild> aEndpoint,
PGMPVideoDecoderChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PGMPContentChild::OpenPGMPVideoEncoderEndpoint(PGMPVideoEncoderChild* aActor) -> ManagedEndpoint<PGMPVideoEncoderParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PGMPVideoEncoderChild actor");
return ManagedEndpoint<PGMPVideoEncoderParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PGMPVideoEncoderChild actor");
return ManagedEndpoint<PGMPVideoEncoderParent>();
}
// 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<PGMPVideoEncoderParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PGMPContentChild::BindPGMPVideoEncoderEndpoint(
ManagedEndpoint<PGMPVideoEncoderChild> aEndpoint,
PGMPVideoEncoderChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PGMPContentChild::OpenPChromiumCDMEndpoint(PChromiumCDMChild* aActor) -> ManagedEndpoint<PChromiumCDMParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PChromiumCDMChild actor");
return ManagedEndpoint<PChromiumCDMParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PChromiumCDMChild actor");
return ManagedEndpoint<PChromiumCDMParent>();
}
// 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<PChromiumCDMParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PGMPContentChild::BindPChromiumCDMEndpoint(
ManagedEndpoint<PChromiumCDMChild> aEndpoint,
PChromiumCDMChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PGMPContentChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
default:
FatalError("unreached");
return;
}
}
auto PGMPContentChild::OnMessageReceived(const Message& msg__) -> PGMPContentChild::Result
{
int32_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<mozilla::ipc::ActorLifecycleProxy> 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__handle__ = IPC::ReadParam<ActorHandle>((&(reader__)));
if (!maybe__handle__) {
FatalError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
auto& handle__ = *maybe__handle__;
// Sentinel = 'actor'
if ((!(((&(reader__)))->ReadSentinel(102892058)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
reader__.EndRead();
RefPtr<PGMPVideoDecoderChild> actor = (static_cast<GMPContentChild*>(this))->AllocPGMPVideoDecoderChild();
if (!actor) {
NS_WARNING("Cannot bind null PGMPVideoDecoderChild actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, (handle__).mId)) {
NS_WARNING("Failed to bind PGMPVideoDecoderChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<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__handle__ = IPC::ReadParam<ActorHandle>((&(reader__)));
if (!maybe__handle__) {
FatalError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
auto& handle__ = *maybe__handle__;
// Sentinel = 'actor'
if ((!(((&(reader__)))->ReadSentinel(102892058)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
reader__.EndRead();
RefPtr<PGMPVideoEncoderChild> actor = (static_cast<GMPContentChild*>(this))->AllocPGMPVideoEncoderChild();
if (!actor) {
NS_WARNING("Cannot bind null PGMPVideoEncoderChild actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, (handle__).mId)) {
NS_WARNING("Failed to bind PGMPVideoEncoderChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<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__handle__ = IPC::ReadParam<ActorHandle>((&(reader__)));
if (!maybe__handle__) {
FatalError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
auto& handle__ = *maybe__handle__;
// Sentinel = 'actor'
if ((!(((&(reader__)))->ReadSentinel(102892058)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
auto maybe__aKeySystem = IPC::ReadParam<nsCString>((&(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();
RefPtr<PChromiumCDMChild> actor = (static_cast<GMPContentChild*>(this))->AllocPChromiumCDMChild(aKeySystem);
if (!actor) {
NS_WARNING("Cannot bind null PChromiumCDMChild actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, (handle__).mId)) {
NS_WARNING("Failed to bind PChromiumCDMChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<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;
}
case PGMPContent::Msg_InitSandboxTesting__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_InitSandboxTesting", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aEndpoint = IPC::ReadParam<Endpoint<::mozilla::PSandboxTestingChild>>((&(reader__)));
if (!maybe__aEndpoint) {
FatalError("Error deserializing 'Endpoint<::mozilla::PSandboxTestingChild>'");
return MsgValueError;
}
auto& aEndpoint = *maybe__aEndpoint;
// Sentinel = 'aEndpoint'
if ((!(((&(reader__)))->ReadSentinel(292225955)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::PSandboxTestingChild>'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<GMPContentChild*>(this))->RecvInitSandboxTesting(std::move(aEndpoint));
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<Message>& reply__) -> PGMPContentChild::Result
{
int32_t route__ = msg__.routing_id();
if (MSG_ROUTING_CONTROL != route__) {
IProtocol* routed__ = Lookup(route__);
if (!routed__ || !routed__->GetLifecycleProxy()) {
return MsgRouteError;
}
RefPtr<mozilla::ipc::ActorLifecycleProxy> proxy__ =
routed__->GetLifecycleProxy();
return proxy__->Get()->OnMessageReceived(msg__, reply__);
}
return MsgNotKnown;
}
} // namespace gmp
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::gmp::PGMPContentChild*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
MOZ_RELEASE_ASSERT(
aWriter->GetActor(),
"Cannot serialize managed actors without an actor");
int32_t id;
if (!aVar) {
id = 0; // kNullActorId
} else {
id = aVar->Id();
if (id == 1) { // kFreedActorId
aVar->FatalError("Actor has been |delete|d");
}
MOZ_RELEASE_ASSERT(
aWriter->GetActor()->GetIPCChannel() == aVar->GetIPCChannel(),
"Actor must be from the same channel as the"
" actor it's being sent over");
MOZ_RELEASE_ASSERT(
aVar->CanSend(),
"Actor must still be open when sending");
}
IPC::WriteParam(aWriter, id);
}
auto ParamTraits<::mozilla::gmp::PGMPContentChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
MOZ_RELEASE_ASSERT(
aReader->GetActor(),
"Cannot deserialize managed actors without an actor");
mozilla::Maybe<mozilla::ipc::IProtocol*> actor = aReader->GetActor()
->ReadActor(aReader, true, "PGMPContent", PGMPContentMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::gmp::PGMPContentChild*>(actor.ref());
}
return {};
}
} // namespace IPC