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


#include "mozilla/layers/PAPZChild.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/layers/APZChild.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/RemoteContentController.h"
#include "mozilla/layers/RepaintRequest.h"
#include "mozilla/layers/ScrollableLayerGuid.h"
#include "nsRegion.h"

#include "mozilla/layers/PCompositorBridgeChild.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 {


MOZ_IMPLICIT PAPZChild::PAPZChild() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PAPZChild);
}

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

auto PAPZChild::ActorAlloc() -> void
{
    AddRef();
}

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

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

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

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

auto PAPZChild::Manager() const -> PCompositorBridgeChild*
{
    return static_cast<PCompositorBridgeChild*>(IProtocol::Manager());
}

auto PAPZChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
    return {};
}

auto PAPZChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
    switch (aProtocol) {
    default:
        return nullptr;
    }
}

auto PAPZChild::Send__delete__(PAPZChild* actor) -> bool
{
    if (!actor || !actor->CanSend()) {
        NS_WARNING("Attempt to __delete__ missing or closed actor");
        return false;
    }
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg___delete__((actor)->Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            actor};


    if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PAPZChild",
            actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PAPZ::Msg___delete__", OTHER);

    bool sendok__ = (actor)->ChannelSend(std::move(msg__));

    actor->ActorDisconnected(Deletion);
    return sendok__;
}

auto PAPZChild::SendDestroy() -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_Destroy(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

auto PAPZChild::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    FatalError("unreached");
    return;
}

auto PAPZChild::OnMessageReceived(const Message& msg__) -> PAPZChild::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PAPZChild",
                this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                "Ignored message for dead actor",
                (&(msg__))->type(),
                mozilla::ipc::MessageDirection::eSending);
        }
        return MsgProcessed;

    }
    switch (msg__.type()) {
    case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            return MsgProcessed;
        }
    case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            this->ActorDisconnected(ManagedEndpointDropped);
            return MsgProcessed;
        }
    case PAPZ::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    case PAPZ::Msg_RequestContentRepaint__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_RequestContentRepaint", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& request = *maybe__request;
            // Sentinel = 'request'
            if ((!(((&(reader__)))->ReadSentinel(202703626)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RepaintRequest'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZChild*>(this))->RecvRequestContentRepaint(std::move(request));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZ::Msg_NotifyMozMouseScrollEvent__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_NotifyMozMouseScrollEvent", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aScrollId = *maybe__aScrollId;
            // Sentinel = 'aScrollId'
            if ((!(((&(reader__)))->ReadSentinel(293602174)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ViewID'");
                return MsgValueError;
            }
            auto maybe__aEvent = IPC::ReadParam<nsString>((&(reader__)));
            if (!maybe__aEvent) {
                FatalError("Error deserializing 'nsString'");
                return MsgValueError;

            }
            auto& aEvent = *maybe__aEvent;
            // Sentinel = 'aEvent'
            if ((!(((&(reader__)))->ReadSentinel(133956196)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZChild*>(this))->RecvNotifyMozMouseScrollEvent(std::move(aScrollId), std::move(aEvent));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZ::Msg_NotifyAPZStateChange__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_NotifyAPZStateChange", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aGuid = *maybe__aGuid;
            // Sentinel = 'aGuid'
            if ((!(((&(reader__)))->ReadSentinel(94044651)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ScrollableLayerGuid'");
                return MsgValueError;
            }
            auto maybe__aChange = IPC::ReadParam<GeckoContentController_APZStateChange>((&(reader__)));
            if (!maybe__aChange) {
                FatalError("Error deserializing 'GeckoContentController_APZStateChange'");
                return MsgValueError;

            }
            auto& aChange = *maybe__aChange;
            // Sentinel = 'aChange'
            if ((!(((&(reader__)))->ReadSentinel(172556968)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'GeckoContentController_APZStateChange'");
                return MsgValueError;
            }
            auto maybe__aArg = IPC::ReadParam<int>((&(reader__)));
            if (!maybe__aArg) {
                FatalError("Error deserializing 'int'");
                return MsgValueError;

            }
            auto& aArg = *maybe__aArg;
            // Sentinel = 'aArg'
            if ((!(((&(reader__)))->ReadSentinel(60162428)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'int'");
                return MsgValueError;
            }
            auto maybe__aInputBlockId = IPC::ReadParam<mozilla::Maybe<uint64_t>>((&(reader__)));
            if (!maybe__aInputBlockId) {
                FatalError("Error deserializing 'uint64_t?'");
                return MsgValueError;

            }
            auto& aInputBlockId = *maybe__aInputBlockId;
            // Sentinel = 'aInputBlockId'
            if ((!(((&(reader__)))->ReadSentinel(595657994)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t?'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZChild*>(this))->RecvNotifyAPZStateChange(std::move(aGuid), std::move(aChange), std::move(aArg), std::move(aInputBlockId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZ::Msg_NotifyFlushComplete__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_NotifyFlushComplete", OTHER);

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

            return MsgProcessed;
        }
    case PAPZ::Msg_NotifyAsyncScrollbarDragInitiated__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_NotifyAsyncScrollbarDragInitiated", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aDragBlockId = *maybe__aDragBlockId;
            // Sentinel = 'aDragBlockId'
            if ((!(((&(reader__)))->ReadSentinel(484246648)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            auto maybe__aScrollId = IPC::ReadParam<ViewID>((&(reader__)));
            if (!maybe__aScrollId) {
                FatalError("Error deserializing 'ViewID'");
                return MsgValueError;

            }
            auto& aScrollId = *maybe__aScrollId;
            // Sentinel = 'aScrollId'
            if ((!(((&(reader__)))->ReadSentinel(293602174)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ViewID'");
                return MsgValueError;
            }
            auto maybe__aDirection = IPC::ReadParam<ScrollDirection>((&(reader__)));
            if (!maybe__aDirection) {
                FatalError("Error deserializing 'ScrollDirection'");
                return MsgValueError;

            }
            auto& aDirection = *maybe__aDirection;
            // Sentinel = 'aDirection'
            if ((!(((&(reader__)))->ReadSentinel(356647939)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ScrollDirection'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZChild*>(this))->RecvNotifyAsyncScrollbarDragInitiated(std::move(aDragBlockId), std::move(aScrollId), std::move(aDirection));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZ::Msg_NotifyAsyncScrollbarDragRejected__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_NotifyAsyncScrollbarDragRejected", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aScrollId = *maybe__aScrollId;
            // Sentinel = 'aScrollId'
            if ((!(((&(reader__)))->ReadSentinel(293602174)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ViewID'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZChild*>(this))->RecvNotifyAsyncScrollbarDragRejected(std::move(aScrollId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZ::Msg_NotifyAsyncAutoscrollRejected__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_NotifyAsyncAutoscrollRejected", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aScrollId = *maybe__aScrollId;
            // Sentinel = 'aScrollId'
            if ((!(((&(reader__)))->ReadSentinel(293602174)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ViewID'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZChild*>(this))->RecvNotifyAsyncAutoscrollRejected(std::move(aScrollId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZ::Msg_Destroy__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg_Destroy", OTHER);

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

            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

auto PAPZChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PAPZChild::Result
{
    if (!CanSend()) {
        return MsgDropped;

    }
    return MsgNotKnown;
}



} // namespace layers
} // namespace mozilla
