Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/PRemoteMediaManagerParent.h"
#include "gfxipc/ShadowLayerUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteMediaManagerParent.h"
#include "mozilla/dom/MediaIPCUtils.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/WebRenderMessageUtils.h"
#include "mozilla/layers/PTextureParent.h"
#include "mozilla/PRemoteDecoderParent.h"
#include "mozilla/PRemoteEncoderParent.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 {
auto PRemoteMediaManagerParent::RecvPRemoteDecoderConstructor(
PRemoteDecoderParent* actor,
const RemoteDecoderInfoIPDL& info,
const OptionSet& options,
const mozilla::Maybe<TextureFactoryIdentifier>& identifier,
const mozilla::Maybe<uint64_t>& mediaEngineId,
const mozilla::Maybe<TrackingId>& trackingId) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PRemoteMediaManagerParent::RecvPRemoteEncoderConstructor(
PRemoteEncoderParent* actor,
const EncoderConfig& config) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PRemoteMediaManagerParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PRemoteMediaManagerParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PRemoteMediaManagerParent::PRemoteMediaManagerParent() :
mozilla::ipc::IToplevelProtocol("PRemoteMediaManagerParent", kProtocolId, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PRemoteMediaManagerParent);
}
PRemoteMediaManagerParent::~PRemoteMediaManagerParent()
{
MOZ_COUNT_DTOR(PRemoteMediaManagerParent);
}
auto PRemoteMediaManagerParent::ActorAlloc() -> void
{
AddRef();
}
auto PRemoteMediaManagerParent::ActorDealloc() -> void
{
Release();
}
auto PRemoteMediaManagerParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PRemoteMediaManagerParent::OtherChildID() const -> ::GeckoChildID
{
::GeckoChildID childID =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
MOZ_RELEASE_ASSERT(childID != -1);
return childID;
}
auto PRemoteMediaManagerParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}
auto PRemoteMediaManagerParent::ManagedPRemoteDecoderParent(nsTArray<PRemoteDecoderParent*>& aArr) const -> void
{
mManagedPRemoteDecoderParent.ToArray(aArr);
}
auto PRemoteMediaManagerParent::ManagedPRemoteDecoderParent() const -> const ManagedContainer<PRemoteDecoderParent>&
{
return mManagedPRemoteDecoderParent;
}
auto PRemoteMediaManagerParent::ManagedPRemoteEncoderParent(nsTArray<PRemoteEncoderParent*>& aArr) const -> void
{
mManagedPRemoteEncoderParent.ToArray(aArr);
}
auto PRemoteMediaManagerParent::ManagedPRemoteEncoderParent() const -> const ManagedContainer<PRemoteEncoderParent>&
{
return mManagedPRemoteEncoderParent;
}
auto PRemoteMediaManagerParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
static constexpr ::mozilla::ipc::ProtocolId sIds[] = {
PRemoteDecoderMsgStart,
PRemoteEncoderMsgStart
};
return sIds;
}
auto PRemoteMediaManagerParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
case PRemoteDecoderMsgStart:
return (&(mManagedPRemoteDecoderParent));
case PRemoteEncoderMsgStart:
return (&(mManagedPRemoteEncoderParent));
default:
return nullptr;
}
}
auto PRemoteMediaManagerParent::OpenPRemoteDecoderEndpoint(PRemoteDecoderParent* aActor) -> ManagedEndpoint<PRemoteDecoderChild>
{
if (!aActor) {
NS_WARNING("Cannot bind null PRemoteDecoderParent actor");
return ManagedEndpoint<PRemoteDecoderChild>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PRemoteDecoderParent actor");
return ManagedEndpoint<PRemoteDecoderChild>();
}
// 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<PRemoteDecoderChild>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PRemoteMediaManagerParent::BindPRemoteDecoderEndpoint(
ManagedEndpoint<PRemoteDecoderParent> aEndpoint,
PRemoteDecoderParent* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PRemoteMediaManagerParent::OpenPRemoteEncoderEndpoint(PRemoteEncoderParent* aActor) -> ManagedEndpoint<PRemoteEncoderChild>
{
if (!aActor) {
NS_WARNING("Cannot bind null PRemoteEncoderParent actor");
return ManagedEndpoint<PRemoteEncoderChild>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PRemoteEncoderParent actor");
return ManagedEndpoint<PRemoteEncoderChild>();
}
// 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<PRemoteEncoderChild>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PRemoteMediaManagerParent::BindPRemoteEncoderEndpoint(
ManagedEndpoint<PRemoteEncoderParent> aEndpoint,
PRemoteEncoderParent* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PRemoteMediaManagerParent::DeallocManagee(
mozilla::ipc::ProtocolId aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
case PRemoteDecoderMsgStart:
static_cast<RemoteMediaManagerParent*>(this)->DeallocPRemoteDecoderParent(static_cast<PRemoteDecoderParent*>(aListener));
return;
default:
FatalError("unreached");
return;
}
}
auto PRemoteMediaManagerParent::OnMessageReceived(const Message& msg__) -> PRemoteMediaManagerParent::Result
{
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("PRemoteMediaManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteMediaManagerParent",
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 PRemoteMediaManager::Msg_PRemoteDecoderConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteMediaManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteMediaManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteMediaManager::Msg_PRemoteDecoderConstructor", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__actorid__ = IPC::ReadParam<mozilla::ipc::ActorId>((&(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__info = IPC::ReadParam<RemoteDecoderInfoIPDL>((&(reader__)));
if (!maybe__info) {
FatalError("Error deserializing 'RemoteDecoderInfoIPDL'");
return MsgValueError;
}
auto& info = *maybe__info;
// Sentinel = 'info'
if ((!(((&(reader__)))->ReadSentinel(70058413)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'RemoteDecoderInfoIPDL'");
return MsgValueError;
}
auto maybe__options = IPC::ReadParam<OptionSet>((&(reader__)));
if (!maybe__options) {
FatalError("Error deserializing 'OptionSet'");
return MsgValueError;
}
auto& options = *maybe__options;
// Sentinel = 'options'
if ((!(((&(reader__)))->ReadSentinel(204735245)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'OptionSet'");
return MsgValueError;
}
auto maybe__identifier = IPC::ReadParam<mozilla::Maybe<TextureFactoryIdentifier>>((&(reader__)));
if (!maybe__identifier) {
FatalError("Error deserializing 'TextureFactoryIdentifier?'");
return MsgValueError;
}
auto& identifier = *maybe__identifier;
// Sentinel = 'identifier'
if ((!(((&(reader__)))->ReadSentinel(379978788)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'TextureFactoryIdentifier?'");
return MsgValueError;
}
auto maybe__mediaEngineId = IPC::ReadParam<mozilla::Maybe<uint64_t>>((&(reader__)));
if (!maybe__mediaEngineId) {
FatalError("Error deserializing 'uint64_t?'");
return MsgValueError;
}
auto& mediaEngineId = *maybe__mediaEngineId;
// Sentinel = 'mediaEngineId'
if ((!(((&(reader__)))->ReadSentinel(597624068)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t?'");
return MsgValueError;
}
auto maybe__trackingId = IPC::ReadParam<mozilla::Maybe<TrackingId>>((&(reader__)));
if (!maybe__trackingId) {
FatalError("Error deserializing 'TrackingId?'");
return MsgValueError;
}
auto& trackingId = *maybe__trackingId;
// Sentinel = 'trackingId'
if ((!(((&(reader__)))->ReadSentinel(381879297)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'TrackingId?'");
return MsgValueError;
}
reader__.EndRead();
PRemoteDecoderParent* actor = (static_cast<RemoteMediaManagerParent*>(this))->AllocPRemoteDecoderParent(info, options, identifier, mediaEngineId, trackingId);
if (!actor) {
NS_WARNING("Cannot bind null PRemoteDecoderParent actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, actorid__)) {
NS_WARNING("Failed to bind PRemoteDecoderParent actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<RemoteMediaManagerParent*>(this))->RecvPRemoteDecoderConstructor(std::move(actor), std::move(info), std::move(options), std::move(identifier), std::move(mediaEngineId), std::move(trackingId));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PRemoteMediaManager::Msg_PRemoteEncoderConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteMediaManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteMediaManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteMediaManager::Msg_PRemoteEncoderConstructor", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__actorid__ = IPC::ReadParam<mozilla::ipc::ActorId>((&(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__config = IPC::ReadParam<EncoderConfig>((&(reader__)));
if (!maybe__config) {
FatalError("Error deserializing 'EncoderConfig'");
return MsgValueError;
}
auto& config = *maybe__config;
// Sentinel = 'config'
if ((!(((&(reader__)))->ReadSentinel(145097335)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'EncoderConfig'");
return MsgValueError;
}
reader__.EndRead();
RefPtr<PRemoteEncoderParent> actor = (static_cast<RemoteMediaManagerParent*>(this))->AllocPRemoteEncoderParent(config);
if (!actor) {
NS_WARNING("Cannot bind null PRemoteEncoderParent actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, actorid__)) {
NS_WARNING("Failed to bind PRemoteEncoderParent actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<RemoteMediaManagerParent*>(this))->RecvPRemoteEncoderConstructor(actor, std::move(config));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PRemoteMediaManager::Msg_DeallocateSurfaceDescriptorGPUVideo__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteMediaManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteMediaManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteMediaManager::Msg_DeallocateSurfaceDescriptorGPUVideo", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__sd = IPC::ReadParam<SurfaceDescriptorGPUVideo>((&(reader__)));
if (!maybe__sd) {
FatalError("Error deserializing 'SurfaceDescriptorGPUVideo'");
return MsgValueError;
}
auto& sd = *maybe__sd;
// Sentinel = 'sd'
if ((!(((&(reader__)))->ReadSentinel(21758168)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'SurfaceDescriptorGPUVideo'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<RemoteMediaManagerParent*>(this))->RecvDeallocateSurfaceDescriptorGPUVideo(std::move(sd));
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 PRemoteMediaManagerParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PRemoteMediaManagerParent::Result
{
IPC::Message::routeid_t route__ = msg__.routing_id();
if (MSG_ROUTING_CONTROL != route__) {
IProtocol* routed__ = Lookup(route__);
if (!routed__ || !routed__->GetLifecycleProxy()) {
return MsgDropped;
}
RefPtr<mozilla::ipc::ActorLifecycleProxy> proxy__ =
routed__->GetLifecycleProxy();
return proxy__->Get()->OnMessageReceived(msg__, reply__);
}
switch (msg__.type()) {
case PRemoteMediaManager::Msg_Readback__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteMediaManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteMediaManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteMediaManager::Msg_Readback", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__sd = IPC::ReadParam<SurfaceDescriptorGPUVideo>((&(reader__)));
if (!maybe__sd) {
FatalError("Error deserializing 'SurfaceDescriptorGPUVideo'");
return MsgValueError;
}
auto& sd = *maybe__sd;
// Sentinel = 'sd'
if ((!(((&(reader__)))->ReadSentinel(21758168)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'SurfaceDescriptorGPUVideo'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL;
SurfaceDescriptor aResult{};
mozilla::ipc::IPCResult __ok = (static_cast<RemoteMediaManagerParent*>(this))->RecvReadback(std::move(sd), (&(aResult)));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
reply__ = PRemoteMediaManager::Reply_Readback(id__);
IPC::MessageWriter writer__{
(*(reply__)),
this};
IPC::WriteParam((&(writer__)), aResult);
// Sentinel = 'aResult'
((&(writer__)))->WriteSentinel(185205473);
if (mozilla::ipc::LoggingEnabledFor("PRemoteMediaManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteMediaManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::PRemoteMediaManagerParent*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
// Sentinel = 'PRemoteMediaManager'
(aWriter)->WriteSentinel(1213597528);
}
auto ParamTraits<::mozilla::PRemoteMediaManagerParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
if (!maybe__actor) {
aReader->FatalError("Error deserializing managed PRemoteMediaManager actor");
return {};
}
auto& actor = *maybe__actor;
// Sentinel = 'PRemoteMediaManager'
if ((!((aReader)->ReadSentinel(1213597528)))) {
mozilla::ipc::SentinelReadError("Error deserializing managed PRemoteMediaManager actor");
return {};
}
if (actor && actor->GetProtocolId() != PRemoteMediaManagerMsgStart) {
aReader->FatalError("Unexpected actor type (expected PRemoteMediaManager)");
return {};
}
return static_cast<::mozilla::PRemoteMediaManagerParent*>(actor);
}
} // namespace IPC