//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/layers/PImageBridgeParent.h"
#include "gfxipc/ShadowLayerUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/ImageBridgeParent.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/WebRenderMessageUtils.h"
#include "nsID.h"
#include "nsPoint.h"
#include "nsRect.h"

#include "mozilla/layers/PTextureParent.h"
#include "mozilla/media/PMediaSystemResourceManagerParent.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 layers {


auto PImageBridgeParent::RecvPTextureConstructor(
        PTextureParent* actor,
        const SurfaceDescriptor& aSharedData,
        ReadLockDescriptor&& aReadLock,
        const LayersBackend& aBackend,
        const TextureFlags& aTextureFlags,
        const uint64_t& aSerial,
        const MaybeExternalImageId& aExternalImageId) -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

auto PImageBridgeParent::RecvPMediaSystemResourceManagerConstructor(PMediaSystemResourceManagerParent* actor) -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

auto PImageBridgeParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PImageBridgeParent::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

MOZ_IMPLICIT PImageBridgeParent::PImageBridgeParent() :
    mozilla::ipc::IToplevelProtocol("PImageBridgeParent", kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PImageBridgeParent);
}

PImageBridgeParent::~PImageBridgeParent()
{
    MOZ_COUNT_DTOR(PImageBridgeParent);
}

auto PImageBridgeParent::ActorAlloc() -> void
{
    MOZ_RELEASE_ASSERT(XRE_IsParentProcess() || XRE_IsGPUProcess(), "Invalid process for `PImageBridgeParent'");
    AddRef();
}

auto PImageBridgeParent::ActorDealloc() -> void
{
    Release();
}

auto PImageBridgeParent::OtherPid() const -> ::base::ProcessId
{
    ::base::ProcessId pid =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
    MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
    return pid;
}

auto PImageBridgeParent::OtherChildID() const -> ::GeckoChildID
{
    ::GeckoChildID childID =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
    MOZ_RELEASE_ASSERT(childID != -1);
    return childID;
}

auto PImageBridgeParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
    return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}

auto PImageBridgeParent::ManagedPTextureParent(nsTArray<PTextureParent*>& aArr) const -> void
{
    mManagedPTextureParent.ToArray(aArr);
}

auto PImageBridgeParent::ManagedPTextureParent() const -> const ManagedContainer<PTextureParent>&
{
    return mManagedPTextureParent;
}

auto PImageBridgeParent::ManagedPMediaSystemResourceManagerParent(nsTArray<PMediaSystemResourceManagerParent*>& aArr) const -> void
{
    mManagedPMediaSystemResourceManagerParent.ToArray(aArr);
}

auto PImageBridgeParent::ManagedPMediaSystemResourceManagerParent() const -> const ManagedContainer<PMediaSystemResourceManagerParent>&
{
    return mManagedPMediaSystemResourceManagerParent;
}

auto PImageBridgeParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
    static constexpr ::mozilla::ipc::ProtocolId sIds[] = {
        PTextureMsgStart,
        PMediaSystemResourceManagerMsgStart
    };
    return sIds;
}

auto PImageBridgeParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
    switch (aProtocol) {
    case PTextureMsgStart:
        return (&(mManagedPTextureParent));
    case PMediaSystemResourceManagerMsgStart:
        return (&(mManagedPMediaSystemResourceManagerParent));
    default:
        return nullptr;
    }
}

auto PImageBridgeParent::OpenPTextureEndpoint(PTextureParent* aActor) -> ManagedEndpoint<PTextureChild>
{
    if (!aActor) {
        NS_WARNING("Cannot bind null PTextureParent actor");
        return ManagedEndpoint<PTextureChild>();
    }

    if (!aActor->SetManagerAndRegister(this)) {
        NS_WARNING("Failed to bind PTextureParent actor");
        return ManagedEndpoint<PTextureChild>();
    }

    // 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<PTextureChild>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}

auto PImageBridgeParent::BindPTextureEndpoint(
        ManagedEndpoint<PTextureParent> aEndpoint,
        PTextureParent* aActor) -> bool
{
    return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}

auto PImageBridgeParent::OpenPMediaSystemResourceManagerEndpoint(PMediaSystemResourceManagerParent* aActor) -> ManagedEndpoint<PMediaSystemResourceManagerChild>
{
    if (!aActor) {
        NS_WARNING("Cannot bind null PMediaSystemResourceManagerParent actor");
        return ManagedEndpoint<PMediaSystemResourceManagerChild>();
    }

    if (!aActor->SetManagerAndRegister(this)) {
        NS_WARNING("Failed to bind PMediaSystemResourceManagerParent actor");
        return ManagedEndpoint<PMediaSystemResourceManagerChild>();
    }

    // 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<PMediaSystemResourceManagerChild>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}

auto PImageBridgeParent::BindPMediaSystemResourceManagerEndpoint(
        ManagedEndpoint<PMediaSystemResourceManagerParent> aEndpoint,
        PMediaSystemResourceManagerParent* aActor) -> bool
{
    return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}

auto PImageBridgeParent::SendParentAsyncMessages(mozilla::Span<AsyncParentMessageData const> aMessages) -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_ParentAsyncMessages(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aMessages);
    // Sentinel = 'aMessages'
    ((&(writer__)))->WriteSentinel(293864346);


    if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PImageBridgeParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PImageBridge::Msg_ParentAsyncMessages", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PImageBridgeParent::SendDidComposite(mozilla::Span<ImageCompositeNotification const> aNotifications) -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_DidComposite(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aNotifications);
    // Sentinel = 'aNotifications'
    ((&(writer__)))->WriteSentinel(704185788);


    if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PImageBridgeParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PImageBridge::Msg_DidComposite", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PImageBridgeParent::SendReportFramesDropped(
        const CompositableHandle& aHandle,
        const uint32_t& aFrames) -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_ReportFramesDropped(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aHandle);
    // Sentinel = 'aHandle'
    ((&(writer__)))->WriteSentinel(174326446);
    IPC::WriteParam((&(writer__)), aFrames);
    // Sentinel = 'aFrames'
    ((&(writer__)))->WriteSentinel(177472192);


    if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PImageBridgeParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PImageBridge::Msg_ReportFramesDropped", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PImageBridgeParent::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    switch (aProtocolId) {
    case PMediaSystemResourceManagerMsgStart:
        static_cast<::mozilla::layers::ImageBridgeParent*>(this)->DeallocPMediaSystemResourceManagerParent(static_cast<PMediaSystemResourceManagerParent*>(aListener));
        return;
    default:
        FatalError("unreached");
        return;
    }
}

auto PImageBridgeParent::OnMessageReceived(const Message& msg__) -> PImageBridgeParent::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PImageBridgeParent",
                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("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    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 PImageBridge::Msg_Update__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_Update", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__ops = IPC::ReadParam<nsTArray<CompositableOperation>>((&(reader__)));
            if (!maybe__ops) {
                FatalError("Error deserializing 'CompositableOperation[]'");
                return MsgValueError;

            }
            auto& ops = *maybe__ops;
            // Sentinel = 'ops'
            if ((!(((&(reader__)))->ReadSentinel(44237139)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'CompositableOperation[]'");
                return MsgValueError;
            }
            auto maybe__toDestroy = IPC::ReadParam<nsTArray<OpDestroy>>((&(reader__)));
            if (!maybe__toDestroy) {
                FatalError("Error deserializing 'OpDestroy[]'");
                return MsgValueError;

            }
            auto& toDestroy = *maybe__toDestroy;
            // Sentinel = 'toDestroy'
            if ((!(((&(reader__)))->ReadSentinel(311100366)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'OpDestroy[]'");
                return MsgValueError;
            }
            auto maybe__fwdTransactionId = IPC::ReadParam<uint64_t>((&(reader__)));
            if (!maybe__fwdTransactionId) {
                FatalError("Error deserializing 'uint64_t'");
                return MsgValueError;

            }
            auto& fwdTransactionId = *maybe__fwdTransactionId;
            // Sentinel = 'fwdTransactionId'
            if ((!(((&(reader__)))->ReadSentinel(930940533)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::ImageBridgeParent*>(this))->RecvUpdate(std::move(ops), std::move(toDestroy), std::move(fwdTransactionId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Msg_WillClose__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_WillClose", OTHER);

            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::ImageBridgeParent*>(this))->RecvWillClose();
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Msg_PTextureConstructor__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_PTextureConstructor", 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__aSharedData = IPC::ReadParam<SurfaceDescriptor>((&(reader__)));
            if (!maybe__aSharedData) {
                FatalError("Error deserializing 'SurfaceDescriptor'");
                return MsgValueError;

            }
            auto& aSharedData = *maybe__aSharedData;
            // Sentinel = 'aSharedData'
            if ((!(((&(reader__)))->ReadSentinel(420480051)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'SurfaceDescriptor'");
                return MsgValueError;
            }
            auto maybe__aReadLock = IPC::ReadParam<ReadLockDescriptor>((&(reader__)));
            if (!maybe__aReadLock) {
                FatalError("Error deserializing 'ReadLockDescriptor'");
                return MsgValueError;

            }
            auto& aReadLock = *maybe__aReadLock;
            // Sentinel = 'aReadLock'
            if ((!(((&(reader__)))->ReadSentinel(279774055)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ReadLockDescriptor'");
                return MsgValueError;
            }
            auto maybe__aBackend = IPC::ReadParam<LayersBackend>((&(reader__)));
            if (!maybe__aBackend) {
                FatalError("Error deserializing 'LayersBackend'");
                return MsgValueError;

            }
            auto& aBackend = *maybe__aBackend;
            // Sentinel = 'aBackend'
            if ((!(((&(reader__)))->ReadSentinel(221119242)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'LayersBackend'");
                return MsgValueError;
            }
            auto maybe__aTextureFlags = IPC::ReadParam<TextureFlags>((&(reader__)));
            if (!maybe__aTextureFlags) {
                FatalError("Error deserializing 'TextureFlags'");
                return MsgValueError;

            }
            auto& aTextureFlags = *maybe__aTextureFlags;
            // Sentinel = 'aTextureFlags'
            if ((!(((&(reader__)))->ReadSentinel(614139200)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'TextureFlags'");
                return MsgValueError;
            }
            auto maybe__aSerial = IPC::ReadParam<uint64_t>((&(reader__)));
            if (!maybe__aSerial) {
                FatalError("Error deserializing 'uint64_t'");
                return MsgValueError;

            }
            auto& aSerial = *maybe__aSerial;
            // Sentinel = 'aSerial'
            if ((!(((&(reader__)))->ReadSentinel(181011138)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            auto maybe__aExternalImageId = IPC::ReadParam<MaybeExternalImageId>((&(reader__)));
            if (!maybe__aExternalImageId) {
                FatalError("Error deserializing 'MaybeExternalImageId'");
                return MsgValueError;

            }
            auto& aExternalImageId = *maybe__aExternalImageId;
            // Sentinel = 'aExternalImageId'
            if ((!(((&(reader__)))->ReadSentinel(898172469)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MaybeExternalImageId'");
                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<PTextureParent> actor = (static_cast<::mozilla::layers::ImageBridgeParent*>(this))->AllocPTextureParent(aSharedData, aReadLock, aBackend, aTextureFlags, aSerial, aExternalImageId);

            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::layers::ImageBridgeParent*>(this))->RecvPTextureConstructor(actor, std::move(aSharedData), std::move(aReadLock), std::move(aBackend), std::move(aTextureFlags), std::move(aSerial), std::move(aExternalImageId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Msg_PMediaSystemResourceManagerConstructor__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_PMediaSystemResourceManagerConstructor", 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;
            }
            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;
            }

            PMediaSystemResourceManagerParent* actor = (static_cast<::mozilla::layers::ImageBridgeParent*>(this))->AllocPMediaSystemResourceManagerParent();

            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::layers::ImageBridgeParent*>(this))->RecvPMediaSystemResourceManagerConstructor(std::move(actor));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Msg_ReleaseCompositable__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_ReleaseCompositable", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aHandle = IPC::ReadParam<CompositableHandle>((&(reader__)));
            if (!maybe__aHandle) {
                FatalError("Error deserializing 'CompositableHandle'");
                return MsgValueError;

            }
            auto& aHandle = *maybe__aHandle;
            // Sentinel = 'aHandle'
            if ((!(((&(reader__)))->ReadSentinel(174326446)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'CompositableHandle'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::ImageBridgeParent*>(this))->RecvReleaseCompositable(std::move(aHandle));
            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 PImageBridgeParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PImageBridgeParent::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<mozilla::ipc::ActorLifecycleProxy> proxy__ =
            routed__->GetLifecycleProxy();
        return proxy__->Get()->OnMessageReceived(msg__, reply__);
    }

    switch (msg__.type()) {
    case PImageBridge::Msg_NewCompositable__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_NewCompositable", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aHandle = IPC::ReadParam<CompositableHandle>((&(reader__)));
            if (!maybe__aHandle) {
                FatalError("Error deserializing 'CompositableHandle'");
                return MsgValueError;

            }
            auto& aHandle = *maybe__aHandle;
            // Sentinel = 'aHandle'
            if ((!(((&(reader__)))->ReadSentinel(174326446)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'CompositableHandle'");
                return MsgValueError;
            }
            auto maybe__aInfo = IPC::ReadParam<TextureInfo>((&(reader__)));
            if (!maybe__aInfo) {
                FatalError("Error deserializing 'TextureInfo'");
                return MsgValueError;

            }
            auto& aInfo = *maybe__aInfo;
            // Sentinel = 'aInfo'
            if ((!(((&(reader__)))->ReadSentinel(93520366)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'TextureInfo'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL;
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::ImageBridgeParent*>(this))->RecvNewCompositable(std::move(aHandle), std::move(aInfo));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            reply__ = PImageBridge::Reply_NewCompositable(id__);
            IPC::MessageWriter writer__{
                    (*(reply__)),
                    this};

            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Sending reply ",
                    reply__->type(),
                    mozilla::ipc::MessageDirection::eSending);
            }
            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}



} // namespace layers
} // namespace mozilla
