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


#include "mozilla/dom/PFetchChild.h"
#include "ipc/ErrorIPCUtils.h"
#include "mozilla/AntiTrackingIPCUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteLazyInputStream.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/BindingIPCUtils.h"
#include "mozilla/dom/ClientIPCUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "mozilla/dom/FetchChild.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/NavigationAPIIPCUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/ServiceWorkerIPCUtils.h"
#include "mozilla/dom/SessionHistoryEntry.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/CacheInfoIPCTypes.h"
#include "mozilla/net/ClassOfService.h"
#include "nsDOMNavigationTiming.h"
#include "nsDocShellLoadState.h"
#include "nsHttp.h"
#include "nsHttpResponseHead.h"
#include "nsID.h"
#include "nsIPropertyBag2.h"
#include "nsITransportSecurityInfo.h"

#include "mozilla/ipc/PBackgroundChild.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 PFetchChild::PFetchChild() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PFetchChild);
}

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

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

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

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

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

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

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

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

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

auto PFetchChild::SendFetchOp(const FetchOpArgs& aArgs) -> bool
{
    UniquePtr<IPC::Message> msg__ = PFetch::Msg_FetchOp(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PFetchChild::SendAbortFetchOp(const bool& aForceAbort) -> bool
{
    UniquePtr<IPC::Message> msg__ = PFetch::Msg_AbortFetchOp(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

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

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

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aResponse = *maybe__aResponse;
            // Sentinel = 'aResponse'
            if ((!(((&(reader__)))->ReadSentinel(301466545)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ParentToChildInternalResponse'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(this))->RecvOnResponseAvailableInternal(std::move(aResponse));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PFetch::Msg_OnResponseEnd__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetch", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetch::Msg_OnResponseEnd", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aResponseEndArgs = *maybe__aResponseEndArgs;
            // Sentinel = 'aResponseEndArgs'
            if ((!(((&(reader__)))->ReadSentinel(903153237)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ResponseEndArgs'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(this))->RecvOnResponseEnd(std::move(aResponseEndArgs));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PFetch::Msg_OnDataAvailable__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetch", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetch::Msg_OnDataAvailable", OTHER);

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

            return MsgProcessed;
        }
    case PFetch::Msg_OnFlushConsoleReport__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetch", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetch::Msg_OnFlushConsoleReport", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aReports = *maybe__aReports;
            // Sentinel = 'aReports'
            if ((!(((&(reader__)))->ReadSentinel(239666001)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ConsoleReportCollected[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(this))->RecvOnFlushConsoleReport(std::move(aReports));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PFetch::Msg_OnCSPViolationEvent__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetch", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetch::Msg_OnCSPViolationEvent", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aJSON = *maybe__aJSON;
            // Sentinel = 'aJSON'
            if ((!(((&(reader__)))->ReadSentinel(83296668)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(this))->RecvOnCSPViolationEvent(std::move(aJSON));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PFetch::Msg_OnReportPerformanceTiming__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetch", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetch::Msg_OnReportPerformanceTiming", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aTiming = *maybe__aTiming;
            // Sentinel = 'aTiming'
            if ((!(((&(reader__)))->ReadSentinel(182780618)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ResponseTiming'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(this))->RecvOnReportPerformanceTiming(std::move(aTiming));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PFetch::Msg_OnNotifyNetworkMonitorAlternateStack__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PFetch", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PFetchChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PFetch::Msg_OnNotifyNetworkMonitorAlternateStack", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aChannelID = *maybe__aChannelID;
            // Sentinel = 'aChannelID'
            if ((!(((&(reader__)))->ReadSentinel(343802792)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(this))->RecvOnNotifyNetworkMonitorAlternateStack(std::move(aChannelID));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

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

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aResult = *maybe__aResult;
            // Sentinel = 'aResult'
            if ((!(((&(reader__)))->ReadSentinel(185205473)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<FetchChild*>(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 PFetchChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PFetchChild::Result
{
    return MsgNotKnown;
}



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

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

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

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

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

} // namespace IPC
