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


#include "mozilla/layers/PAPZParent.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.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/PCompositorBridgeParent.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 PAPZParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

MOZ_IMPLICIT PAPZParent::PAPZParent() :
    mozilla::ipc::IProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PAPZParent);
}

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

auto PAPZParent::ActorAlloc() -> void
{
}

auto PAPZParent::ActorDealloc() -> void
{
    if (Manager()) {
        Manager()->DeallocManagee(kProtocolId, this);
    }
}

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

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

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

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

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

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

auto PAPZParent::SendLayerTransforms(mozilla::Span<MatrixMessage const> aTransforms) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_LayerTransforms(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PAPZParent::SendRequestContentRepaint(const RepaintRequest& request) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_RequestContentRepaint(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PAPZParent::SendUpdateOverscrollVelocity(
        const ScrollableLayerGuid& aGuid,
        const float& aX,
        const float& aY,
        const bool& aIsRootContent) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_UpdateOverscrollVelocity(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aGuid);
    // Sentinel = 'aGuid'
    ((&(writer__)))->WriteSentinel(94044651);
    IPC::WriteParam((&(writer__)), aX);
    // Sentinel = 'aX'
    ((&(writer__)))->WriteSentinel(18612410);
    IPC::WriteParam((&(writer__)), aY);
    // Sentinel = 'aY'
    ((&(writer__)))->WriteSentinel(18677947);
    IPC::WriteParam((&(writer__)), aIsRootContent);
    // Sentinel = 'aIsRootContent'
    ((&(writer__)))->WriteSentinel(683410845);


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

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

auto PAPZParent::SendUpdateOverscrollOffset(
        const ScrollableLayerGuid& aGuid,
        const float& aX,
        const float& aY,
        const bool& aIsRootContent) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_UpdateOverscrollOffset(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aGuid);
    // Sentinel = 'aGuid'
    ((&(writer__)))->WriteSentinel(94044651);
    IPC::WriteParam((&(writer__)), aX);
    // Sentinel = 'aX'
    ((&(writer__)))->WriteSentinel(18612410);
    IPC::WriteParam((&(writer__)), aY);
    // Sentinel = 'aY'
    ((&(writer__)))->WriteSentinel(18677947);
    IPC::WriteParam((&(writer__)), aIsRootContent);
    // Sentinel = 'aIsRootContent'
    ((&(writer__)))->WriteSentinel(683410845);


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

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

auto PAPZParent::SendHideDynamicToolbar() -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_HideDynamicToolbar(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

auto PAPZParent::SendNotifyMozMouseScrollEvent(
        const ViewID& aScrollId,
        const nsAString& aEvent) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_NotifyMozMouseScrollEvent(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aScrollId);
    // Sentinel = 'aScrollId'
    ((&(writer__)))->WriteSentinel(293602174);
    IPC::WriteParam((&(writer__)), aEvent);
    // Sentinel = 'aEvent'
    ((&(writer__)))->WriteSentinel(133956196);


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

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

auto PAPZParent::SendNotifyAPZStateChange(
        const ScrollableLayerGuid& aGuid,
        const GeckoContentController_APZStateChange& aChange,
        const int& aArg,
        const mozilla::Maybe<uint64_t>& aInputBlockId) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_NotifyAPZStateChange(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aGuid);
    // Sentinel = 'aGuid'
    ((&(writer__)))->WriteSentinel(94044651);
    IPC::WriteParam((&(writer__)), aChange);
    // Sentinel = 'aChange'
    ((&(writer__)))->WriteSentinel(172556968);
    IPC::WriteParam((&(writer__)), aArg);
    // Sentinel = 'aArg'
    ((&(writer__)))->WriteSentinel(60162428);
    IPC::WriteParam((&(writer__)), aInputBlockId);
    // Sentinel = 'aInputBlockId'
    ((&(writer__)))->WriteSentinel(595657994);


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

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

auto PAPZParent::SendNotifyFlushComplete() -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_NotifyFlushComplete(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

auto PAPZParent::SendNotifyAsyncScrollbarDragInitiated(
        const uint64_t& aDragBlockId,
        const ViewID& aScrollId,
        const ScrollDirection& aDirection) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_NotifyAsyncScrollbarDragInitiated(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aDragBlockId);
    // Sentinel = 'aDragBlockId'
    ((&(writer__)))->WriteSentinel(484246648);
    IPC::WriteParam((&(writer__)), aScrollId);
    // Sentinel = 'aScrollId'
    ((&(writer__)))->WriteSentinel(293602174);
    IPC::WriteParam((&(writer__)), aDirection);
    // Sentinel = 'aDirection'
    ((&(writer__)))->WriteSentinel(356647939);


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

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

auto PAPZParent::SendNotifyAsyncScrollbarDragRejected(const ViewID& aScrollId) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_NotifyAsyncScrollbarDragRejected(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PAPZParent::SendNotifyAsyncAutoscrollRejected(const ViewID& aScrollId) -> bool
{
    UniquePtr<IPC::Message> msg__ = PAPZ::Msg_NotifyAsyncAutoscrollRejected(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

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



    if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PAPZParent",
            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 PAPZParent::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    FatalError("unreached");
    return;
}

auto PAPZParent::OnMessageReceived(const Message& msg__) -> PAPZParent::Result
{
    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::Msg___delete____ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZ", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZ::Msg___delete__", OTHER);

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


            this->ActorDisconnected(Deletion);

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

            mozilla::ipc::IPCResult __ok = (static_cast<RemoteContentController*>(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 PAPZParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PAPZParent::Result
{
    return MsgNotKnown;
}



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

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

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

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

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

} // namespace IPC
