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


#include "mozilla/dom/PFetchEventOpProxyParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteLazyInputStream.h"
#include "mozilla/dom/FetchEventOpProxyParent.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/ServiceWorkerIPCUtils.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "nsID.h"
#include "nsITransportSecurityInfo.h"

#include "mozilla/dom/PRemoteWorkerParent.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 dom {


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

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

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

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

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

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

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

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

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

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

auto PFetchEventOpProxyParent::SendPreloadResponse(const ParentToChildInternalResponse& aResponse) -> bool
{
    UniquePtr<IPC::Message> msg__ = PFetchEventOpProxy::Msg_PreloadResponse(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PFetchEventOpProxyParent::SendPreloadResponseTiming(const ResponseTiming& aTiming) -> bool
{
    UniquePtr<IPC::Message> msg__ = PFetchEventOpProxy::Msg_PreloadResponseTiming(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PFetchEventOpProxyParent::SendPreloadResponseEnd(const ResponseEndArgs& aArgs) -> bool
{
    UniquePtr<IPC::Message> msg__ = PFetchEventOpProxy::Msg_PreloadResponseEnd(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

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

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

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aScriptSpec = *maybe__aScriptSpec;
            // Sentinel = 'aScriptSpec'
            if ((!(((&(reader__)))->ReadSentinel(436929634)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto maybe__aLineNumber = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aLineNumber) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aLineNumber = *maybe__aLineNumber;
            // Sentinel = 'aLineNumber'
            if ((!(((&(reader__)))->ReadSentinel(423953491)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            auto maybe__aColumnNumber = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aColumnNumber) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aColumnNumber = *maybe__aColumnNumber;
            // Sentinel = 'aColumnNumber'
            if ((!(((&(reader__)))->ReadSentinel(601163065)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            auto maybe__aMessageName = IPC::ReadParam<nsCString>((&(reader__)));
            if (!maybe__aMessageName) {
                FatalError("Error deserializing 'nsCString'");
                return MsgValueError;

            }
            auto& aMessageName = *maybe__aMessageName;
            // Sentinel = 'aMessageName'
            if ((!(((&(reader__)))->ReadSentinel(505414824)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto maybe__aParams = IPC::ReadParam<nsTArray<nsString>>((&(reader__)));
            if (!maybe__aParams) {
                FatalError("Error deserializing 'nsString[]'");
                return MsgValueError;

            }
            auto& aParams = *maybe__aParams;
            // Sentinel = 'aParams'
            if ((!(((&(reader__)))->ReadSentinel(178979526)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchEventOpProxyParent*>(this))->RecvAsyncLog(std::move(aScriptSpec), std::move(aLineNumber), std::move(aColumnNumber), std::move(aMessageName), std::move(aParams));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PFetchEventOpProxy::Msg_RespondWith__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetchEventOpProxy", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchEventOpProxyParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetchEventOpProxy::Msg_RespondWith", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aResult = *maybe__aResult;
            // Sentinel = 'aResult'
            if ((!(((&(reader__)))->ReadSentinel(185205473)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ChildToParentFetchEventRespondWithResult'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchEventOpProxyParent*>(this))->RecvRespondWith(std::move(aResult));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

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

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aResult = *maybe__aResult;
            // Sentinel = 'aResult'
            if ((!(((&(reader__)))->ReadSentinel(185205473)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ServiceWorkerFetchEventOpResult'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchEventOpProxyParent*>(this))->Recv__delete__(std::move(aResult));
            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 PFetchEventOpProxyParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PFetchEventOpProxyParent::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



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

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

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

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

        return {};
    }
    return static_cast<::mozilla::dom::PFetchEventOpProxyParent*>(actor);
}

} // namespace IPC
