Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/PRemoteDecoderManagerParent.h"
#include "gfxipc/ShadowLayerUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteDecoderManagerParent.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 "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 PRemoteDecoderManagerParent::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 PRemoteDecoderManagerParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PRemoteDecoderManagerParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PRemoteDecoderManagerParent::PRemoteDecoderManagerParent() :
mozilla::ipc::IToplevelProtocol("PRemoteDecoderManagerParent", kProtocolId, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PRemoteDecoderManagerParent);
}
PRemoteDecoderManagerParent::~PRemoteDecoderManagerParent()
{
MOZ_COUNT_DTOR(PRemoteDecoderManagerParent);
}
auto PRemoteDecoderManagerParent::ActorAlloc() -> void
{
AddRef();
}
auto PRemoteDecoderManagerParent::ActorDealloc() -> void
{
Release();
}
auto PRemoteDecoderManagerParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PRemoteDecoderManagerParent::OtherChildID() const -> ::GeckoChildID
{
::GeckoChildID childID =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
MOZ_RELEASE_ASSERT(childID != -1);
return childID;
}
auto PRemoteDecoderManagerParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}
auto PRemoteDecoderManagerParent::ManagedPRemoteDecoderParent(nsTArray<PRemoteDecoderParent*>& aArr) const -> void
{
mManagedPRemoteDecoderParent.ToArray(aArr);
}
auto PRemoteDecoderManagerParent::ManagedPRemoteDecoderParent() const -> const ManagedContainer<PRemoteDecoderParent>&
{
return mManagedPRemoteDecoderParent;
}
auto PRemoteDecoderManagerParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
static constexpr ::mozilla::ipc::ProtocolId sIds[] = {
PRemoteDecoderMsgStart
};
return sIds;
}
auto PRemoteDecoderManagerParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
case PRemoteDecoderMsgStart:
return (&(mManagedPRemoteDecoderParent));
default:
return nullptr;
}
}
auto PRemoteDecoderManagerParent::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 PRemoteDecoderManagerParent::BindPRemoteDecoderEndpoint(
ManagedEndpoint<PRemoteDecoderParent> aEndpoint,
PRemoteDecoderParent* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PRemoteDecoderManagerParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
case PRemoteDecoderMsgStart:
static_cast<RemoteDecoderManagerParent*>(this)->DeallocPRemoteDecoderParent(static_cast<PRemoteDecoderParent*>(aListener));
return;
default:
FatalError("unreached");
return;
}
}
auto PRemoteDecoderManagerParent::OnMessageReceived(const Message& msg__) -> PRemoteDecoderManagerParent::Result
{
int32_t route__ = msg__.routing_id();
if (MSG_ROUTING_CONTROL != route__) {
IProtocol* routed__ = Lookup(route__);
if (!routed__ || !routed__->GetLifecycleProxy()) {
if (mozilla::ipc::LoggingEnabledFor("PRemoteDecoderManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteDecoderManagerParent",
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 PRemoteDecoderManager::Msg_PRemoteDecoderConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteDecoderManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteDecoderManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteDecoderManager::Msg_PRemoteDecoderConstructor", 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__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<RemoteDecoderManagerParent*>(this))->AllocPRemoteDecoderParent(info, options, identifier, mediaEngineId, trackingId);
if (!actor) {
NS_WARNING("Cannot bind null PRemoteDecoderParent actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, (handle__).mId)) {
NS_WARNING("Failed to bind PRemoteDecoderParent actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<RemoteDecoderManagerParent*>(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 PRemoteDecoderManager::Msg_DeallocateSurfaceDescriptorGPUVideo__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteDecoderManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteDecoderManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteDecoderManager::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<RemoteDecoderManagerParent*>(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 PRemoteDecoderManagerParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PRemoteDecoderManagerParent::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__);
}
switch (msg__.type()) {
case PRemoteDecoderManager::Msg_Readback__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteDecoderManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteDecoderManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteDecoderManager::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();
int32_t id__ = MSG_ROUTING_CONTROL;
SurfaceDescriptor aResult{};
mozilla::ipc::IPCResult __ok = (static_cast<RemoteDecoderManagerParent*>(this))->RecvReadback(std::move(sd), (&(aResult)));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
reply__ = PRemoteDecoderManager::Reply_Readback(id__);
IPC::MessageWriter writer__{
(*(reply__)),
this};
IPC::WriteParam((&(writer__)), aResult);
// Sentinel = 'aResult'
((&(writer__)))->WriteSentinel(185205473);
if (mozilla::ipc::LoggingEnabledFor("PRemoteDecoderManager", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteDecoderManagerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::PRemoteDecoderManagerParent*>::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::PRemoteDecoderManagerParent*>::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, "PRemoteDecoderManager", PRemoteDecoderManagerMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::PRemoteDecoderManagerParent*>(actor.ref());
}
return {};
}
} // namespace IPC