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


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

#include "mozilla/layers/PTextureChild.h"
#include "mozilla/media/PMediaSystemResourceManagerChild.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 PImageBridgeChild::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

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

MOZ_IMPLICIT PImageBridgeChild::PImageBridgeChild() :
    mozilla::ipc::IToplevelProtocol("PImageBridgeChild", kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PImageBridgeChild);
}

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

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

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

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

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

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

auto PImageBridgeChild::ManagedPTextureChild(nsTArray<PTextureChild*>& aArr) const -> void
{
    mManagedPTextureChild.ToArray(aArr);
}

auto PImageBridgeChild::ManagedPTextureChild() const -> const ManagedContainer<PTextureChild>&
{
    return mManagedPTextureChild;
}

auto PImageBridgeChild::ManagedPMediaSystemResourceManagerChild(nsTArray<PMediaSystemResourceManagerChild*>& aArr) const -> void
{
    mManagedPMediaSystemResourceManagerChild.ToArray(aArr);
}

auto PImageBridgeChild::ManagedPMediaSystemResourceManagerChild() const -> const ManagedContainer<PMediaSystemResourceManagerChild>&
{
    return mManagedPMediaSystemResourceManagerChild;
}

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

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

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

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

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

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

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

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

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

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

auto PImageBridgeChild::SendUpdate(
        mozilla::Span<CompositableOperation const> ops,
        mozilla::Span<OpDestroy const> toDestroy,
        const uint64_t& fwdTransactionId) -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_Update(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), ops);
    // Sentinel = 'ops'
    ((&(writer__)))->WriteSentinel(44237139);
    IPC::WriteParam((&(writer__)), toDestroy);
    // Sentinel = 'toDestroy'
    ((&(writer__)))->WriteSentinel(311100366);
    IPC::WriteParam((&(writer__)), fwdTransactionId);
    // Sentinel = 'fwdTransactionId'
    ((&(writer__)))->WriteSentinel(930940533);


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

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

auto PImageBridgeChild::SendWillClose() -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_WillClose(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

auto PImageBridgeChild::SendPTextureConstructor(
        const SurfaceDescriptor& aSharedData,
        ReadLockDescriptor&& aReadLock,
        const LayersBackend& aBackend,
        const TextureFlags& aTextureFlags,
        const uint64_t& aSerial,
        const MaybeExternalImageId& aExternalImageId) -> PTextureChild*
{
    PTextureChild* actor = (static_cast<ImageBridgeChild*>(this))->AllocPTextureChild(aSharedData, aReadLock, aBackend, aTextureFlags, aSerial, aExternalImageId);
    return SendPTextureConstructor(std::move(actor), std::move(aSharedData), std::move(aReadLock), std::move(aBackend), std::move(aTextureFlags), std::move(aSerial), std::move(aExternalImageId));
}

auto PImageBridgeChild::SendPTextureConstructor(
        PTextureChild* actor,
        const SurfaceDescriptor& aSharedData,
        ReadLockDescriptor&& aReadLock,
        const LayersBackend& aBackend,
        const TextureFlags& aTextureFlags,
        const uint64_t& aSerial,
        const MaybeExternalImageId& aExternalImageId) -> PTextureChild*
{
    if (!actor) {
        NS_WARNING("Cannot bind null PTextureChild actor");
        return nullptr;
    }

    if (!actor->SetManagerAndRegister(this)) {
        NS_WARNING("Failed to bind PTextureChild actor");
        return nullptr;
    }


    // Build our constructor message.
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_PTextureConstructor(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), (actor)->Id());
    // Sentinel = 'actorid'
    ((&(writer__)))->WriteSentinel(193725159);
    IPC::WriteParam((&(writer__)), aSharedData);
    // Sentinel = 'aSharedData'
    ((&(writer__)))->WriteSentinel(420480051);
    IPC::WriteParam((&(writer__)), std::move(aReadLock));
    // Sentinel = 'aReadLock'
    ((&(writer__)))->WriteSentinel(279774055);
    IPC::WriteParam((&(writer__)), aBackend);
    // Sentinel = 'aBackend'
    ((&(writer__)))->WriteSentinel(221119242);
    IPC::WriteParam((&(writer__)), aTextureFlags);
    // Sentinel = 'aTextureFlags'
    ((&(writer__)))->WriteSentinel(614139200);
    IPC::WriteParam((&(writer__)), aSerial);
    // Sentinel = 'aSerial'
    ((&(writer__)))->WriteSentinel(181011138);
    IPC::WriteParam((&(writer__)), aExternalImageId);
    // Sentinel = 'aExternalImageId'
    ((&(writer__)))->WriteSentinel(898172469);


    // Notify the other side about the newly created actor. This can
    // fail if our manager has already been destroyed.
    //
    // NOTE: If the send call fails due to toplevel channel teardown,
    // the `IProtocol::ChannelSend` wrapper absorbs the error for us,
    // so we don't tear down actors unexpectedly.

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

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


    // Warn, destroy the actor, and return null if the message failed to
    // send. Otherwise, return the successfully created actor reference.
    if (!sendok__) {
        NS_WARNING("Error sending PTextureChild constructor");
        actor->ActorDisconnected(FailedConstructor);

        return nullptr;
    }
    return actor;
}

auto PImageBridgeChild::SendPMediaSystemResourceManagerConstructor() -> PMediaSystemResourceManagerChild*
{
    PMediaSystemResourceManagerChild* actor = (static_cast<ImageBridgeChild*>(this))->AllocPMediaSystemResourceManagerChild();
    return SendPMediaSystemResourceManagerConstructor(std::move(actor));
}

auto PImageBridgeChild::SendPMediaSystemResourceManagerConstructor(PMediaSystemResourceManagerChild* actor) -> PMediaSystemResourceManagerChild*
{
    if (!actor) {
        NS_WARNING("Cannot bind null PMediaSystemResourceManagerChild actor");
        return nullptr;
    }

    if (!actor->SetManagerAndRegister(this)) {
        NS_WARNING("Failed to bind PMediaSystemResourceManagerChild actor");
        return nullptr;
    }


    // Build our constructor message.
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_PMediaSystemResourceManagerConstructor(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), (actor)->Id());
    // Sentinel = 'actorid'
    ((&(writer__)))->WriteSentinel(193725159);


    // Notify the other side about the newly created actor. This can
    // fail if our manager has already been destroyed.
    //
    // NOTE: If the send call fails due to toplevel channel teardown,
    // the `IProtocol::ChannelSend` wrapper absorbs the error for us,
    // so we don't tear down actors unexpectedly.

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

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


    // Warn, destroy the actor, and return null if the message failed to
    // send. Otherwise, return the successfully created actor reference.
    if (!sendok__) {
        NS_WARNING("Error sending PMediaSystemResourceManagerChild constructor");
        actor->ActorDisconnected(FailedConstructor);

        return nullptr;
    }
    return actor;
}

auto PImageBridgeChild::SendNewCompositable(
        const CompositableHandle& aHandle,
        const TextureInfo& aInfo) -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_NewCompositable(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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

    UniquePtr<Message> reply__;

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

    bool sendok__ = false;
    {
        AUTO_PROFILER_MARKER("PImageBridge::Msg_NewCompositable", IPC);
        sendok__ = ChannelSend(std::move(msg__), (&(reply__)));
    }
    if ((!(sendok__))) {
        return false;
    }

    if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PImageBridgeChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Received reply ",
            reply__->type(),
            mozilla::ipc::MessageDirection::eReceiving);
    }

    return true;
}

auto PImageBridgeChild::SendReleaseCompositable(const CompositableHandle& aHandle) -> bool
{
    UniquePtr<IPC::Message> msg__ = PImageBridge::Msg_ReleaseCompositable(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PImageBridgeChild::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    switch (aProtocolId) {
    case PTextureMsgStart:
        static_cast<ImageBridgeChild*>(this)->DeallocPTextureChild(static_cast<PTextureChild*>(aListener));
        return;
    case PMediaSystemResourceManagerMsgStart:
        static_cast<ImageBridgeChild*>(this)->DeallocPMediaSystemResourceManagerChild(static_cast<PMediaSystemResourceManagerChild*>(aListener));
        return;
    default:
        FatalError("unreached");
        return;
    }
}

auto PImageBridgeChild::OnMessageReceived(const Message& msg__) -> PImageBridgeChild::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("PImageBridge", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeChild",
                    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_ParentAsyncMessages__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_ParentAsyncMessages", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aMessages = *maybe__aMessages;
            // Sentinel = 'aMessages'
            if ((!(((&(reader__)))->ReadSentinel(293864346)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'AsyncParentMessageData[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<ImageBridgeChild*>(this))->RecvParentAsyncMessages(std::move(aMessages));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Msg_DidComposite__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_DidComposite", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aNotifications = *maybe__aNotifications;
            // Sentinel = 'aNotifications'
            if ((!(((&(reader__)))->ReadSentinel(704185788)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ImageCompositeNotification[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<ImageBridgeChild*>(this))->RecvDidComposite(std::move(aNotifications));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Msg_ReportFramesDropped__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PImageBridge", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PImageBridgeChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PImageBridge::Msg_ReportFramesDropped", 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__aFrames = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aFrames) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aFrames = *maybe__aFrames;
            // Sentinel = 'aFrames'
            if ((!(((&(reader__)))->ReadSentinel(177472192)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<ImageBridgeChild*>(this))->RecvReportFramesDropped(std::move(aHandle), std::move(aFrames));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PImageBridge::Reply_PTextureConstructor__ID:
        {
            return MsgProcessed;
        }
    case PImageBridge::Reply_PMediaSystemResourceManagerConstructor__ID:
        {
            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 PImageBridgeChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PImageBridgeChild::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__);
    }

    return MsgNotKnown;
}



} // namespace layers
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::layers::PImageBridgeChild*>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
    // Sentinel = 'PImageBridge'
    (aWriter)->WriteSentinel(475923585);
}

auto ParamTraits<::mozilla::layers::PImageBridgeChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
    if (!maybe__actor) {
        aReader->FatalError("Error deserializing managed PImageBridge actor");
        return {};

    }
    auto& actor = *maybe__actor;
    // Sentinel = 'PImageBridge'
    if ((!((aReader)->ReadSentinel(475923585)))) {
        mozilla::ipc::SentinelReadError("Error deserializing managed PImageBridge actor");
        return {};
    }

    if (actor && actor->GetProtocolId() != PImageBridgeMsgStart) {
        aReader->FatalError("Unexpected actor type (expected PImageBridge)");

        return {};
    }
    return static_cast<::mozilla::layers::PImageBridgeChild*>(actor);
}

} // namespace IPC
