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


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

MOZ_IMPLICIT PAPZCTreeManagerParent::PAPZCTreeManagerParent() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PAPZCTreeManagerParent);
}

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

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

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

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

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

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

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

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

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

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

auto PAPZCTreeManagerParent::OnMessageReceived(const Message& msg__) -> PAPZCTreeManagerParent::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PAPZCTreeManagerParent",
                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 PAPZCTreeManager::Msg_ZoomToRect__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_ZoomToRect", 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__aZoomTarget = IPC::ReadParam<ZoomTarget>((&(reader__)));
            if (!maybe__aZoomTarget) {
                FatalError("Error deserializing 'ZoomTarget'");
                return MsgValueError;

            }
            auto& aZoomTarget = *maybe__aZoomTarget;
            // Sentinel = 'aZoomTarget'
            if ((!(((&(reader__)))->ReadSentinel(439092334)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ZoomTarget'");
                return MsgValueError;
            }
            auto maybe__Flags = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__Flags) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& Flags = *maybe__Flags;
            // Sentinel = 'Flags'
            if ((!(((&(reader__)))->ReadSentinel(91685358)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvZoomToRect(std::move(aGuid), std::move(aZoomTarget), std::move(Flags));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg_ContentReceivedInputBlock__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_ContentReceivedInputBlock", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aInputBlockId = IPC::ReadParam<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;
            }
            auto maybe__PreventDefault = IPC::ReadParam<bool>((&(reader__)));
            if (!maybe__PreventDefault) {
                FatalError("Error deserializing 'bool'");
                return MsgValueError;

            }
            auto& PreventDefault = *maybe__PreventDefault;
            // Sentinel = 'PreventDefault'
            if ((!(((&(reader__)))->ReadSentinel(702350762)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvContentReceivedInputBlock(std::move(aInputBlockId), std::move(PreventDefault));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg_SetTargetAPZC__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_SetTargetAPZC", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aInputBlockId = IPC::ReadParam<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;
            }
            auto maybe__Targets = IPC::ReadParam<nsTArray<ScrollableLayerGuid>>((&(reader__)));
            if (!maybe__Targets) {
                FatalError("Error deserializing 'ScrollableLayerGuid[]'");
                return MsgValueError;

            }
            auto& Targets = *maybe__Targets;
            // Sentinel = 'Targets'
            if ((!(((&(reader__)))->ReadSentinel(184091355)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ScrollableLayerGuid[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvSetTargetAPZC(std::move(aInputBlockId), std::move(Targets));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg_UpdateZoomConstraints__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_UpdateZoomConstraints", 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__aConstraints = IPC::ReadParam<mozilla::Maybe<ZoomConstraints>>((&(reader__)));
            if (!maybe__aConstraints) {
                FatalError("Error deserializing 'ZoomConstraints?'");
                return MsgValueError;

            }
            auto& aConstraints = *maybe__aConstraints;
            // Sentinel = 'aConstraints'
            if ((!(((&(reader__)))->ReadSentinel(525010170)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ZoomConstraints?'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvUpdateZoomConstraints(std::move(aGuid), std::move(aConstraints));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg_SetAllowedTouchBehavior__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_SetAllowedTouchBehavior", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aInputBlockId = IPC::ReadParam<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;
            }
            auto maybe__aValues = IPC::ReadParam<nsTArray<TouchBehaviorFlags>>((&(reader__)));
            if (!maybe__aValues) {
                FatalError("Error deserializing 'TouchBehaviorFlags[]'");
                return MsgValueError;

            }
            auto& aValues = *maybe__aValues;
            // Sentinel = 'aValues'
            if ((!(((&(reader__)))->ReadSentinel(182649554)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'TouchBehaviorFlags[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvSetAllowedTouchBehavior(std::move(aInputBlockId), std::move(aValues));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg_StartScrollbarDrag__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_StartScrollbarDrag", 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__aDragMetrics = IPC::ReadParam<AsyncDragMetrics>((&(reader__)));
            if (!maybe__aDragMetrics) {
                FatalError("Error deserializing 'AsyncDragMetrics'");
                return MsgValueError;

            }
            auto& aDragMetrics = *maybe__aDragMetrics;
            // Sentinel = 'aDragMetrics'
            if ((!(((&(reader__)))->ReadSentinel(496108727)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'AsyncDragMetrics'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvStartScrollbarDrag(std::move(aGuid), std::move(aDragMetrics));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg_NotifyApzAwareListenerAdded__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg_NotifyApzAwareListenerAdded", 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;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(this))->RecvNotifyApzAwareListenerAdded(std::move(aGuid));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PAPZCTreeManager::Msg___delete____ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PAPZCTreeManager", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PAPZCTreeManagerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PAPZCTreeManager::Msg___delete__", OTHER);

            DoomSubtree();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::APZCTreeManagerParent*>(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;
        }
    default:
        return MsgNotKnown;
    }
}

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

    }
    return MsgNotKnown;
}



} // namespace layers
} // namespace mozilla
