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


#include "mozilla/net/PHttpBackgroundChannelParent.h"
#include "mozilla/AntiTrackingIPCUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/ConsoleReportIPCUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/NavigationAPIIPCUtils.h"
#include "mozilla/dom/PermissionsPolicyUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/RemoteType.h"
#include "mozilla/dom/SessionHistoryEntry.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/CacheInfoIPCTypes.h"
#include "mozilla/net/ClassOfService.h"
#include "mozilla/net/HttpBackgroundChannelParent.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "nsDOMNavigationTiming.h"
#include "nsDocShellLoadState.h"
#include "nsHttp.h"
#include "nsHttpHeaderArray.h"
#include "nsHttpResponseHead.h"
#include "nsIPropertyBag2.h"
#include "nsIReferrerInfo.h"
#include "nsITransportSecurityInfo.h"
#include "nsIURI.h"

#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/extensions/PStreamFilterParent.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 net {


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

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

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

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

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

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

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

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

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

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

auto PHttpBackgroundChannelParent::SendOnStartRequest(
        nsHttpResponseHead&& responseHead,
        const bool& useResponseHead,
        const nsHttpHeaderArray& requestHeaders,
        const HttpChannelOnStartRequestArgs& args,
        const HttpChannelAltDataStream& altData,
        const TimeStamp& onStartRequestStart) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnStartRequest(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), std::move(responseHead));
    // Sentinel = 'responseHead'
    ((&(writer__)))->WriteSentinel(549651682);
    IPC::WriteParam((&(writer__)), useResponseHead);
    // Sentinel = 'useResponseHead'
    ((&(writer__)))->WriteSentinel(831260175);
    IPC::WriteParam((&(writer__)), requestHeaders);
    // Sentinel = 'requestHeaders'
    ((&(writer__)))->WriteSentinel(732693958);
    IPC::WriteParam((&(writer__)), args);
    // Sentinel = 'args'
    ((&(writer__)))->WriteSentinel(69140910);
    IPC::WriteParam((&(writer__)), altData);
    // Sentinel = 'altData'
    ((&(writer__)))->WriteSentinel(183894716);
    IPC::WriteParam((&(writer__)), onStartRequestStart);
    // Sentinel = 'onStartRequestStart'
    ((&(writer__)))->WriteSentinel(1313015779);


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

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

auto PHttpBackgroundChannelParent::SendOnTransportAndData(
        const nsresult& channelStatus,
        const nsresult& transportStatus,
        const uint64_t& offset,
        const nsACString& data,
        const bool& dataFromSocketProcess,
        const TimeStamp& onDataAvailableStart) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnTransportAndData(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), channelStatus);
    // Sentinel = 'channelStatus'
    ((&(writer__)))->WriteSentinel(618136926);
    IPC::WriteParam((&(writer__)), transportStatus);
    // Sentinel = 'transportStatus'
    ((&(writer__)))->WriteSentinel(865273458);
    IPC::WriteParam((&(writer__)), offset);
    // Sentinel = 'offset'
    ((&(writer__)))->WriteSentinel(147653256);
    IPC::WriteParam((&(writer__)), data);
    // Sentinel = 'data'
    ((&(writer__)))->WriteSentinel(67109275);
    IPC::WriteParam((&(writer__)), dataFromSocketProcess);
    // Sentinel = 'dataFromSocketProcess'
    ((&(writer__)))->WriteSentinel(1537869943);
    IPC::WriteParam((&(writer__)), onDataAvailableStart);
    // Sentinel = 'onDataAvailableStart'
    ((&(writer__)))->WriteSentinel(1369049063);


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

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

auto PHttpBackgroundChannelParent::SendOnStopRequest(
        const nsresult& channelStatus,
        const ResourceTimingStructArgs& timing,
        const TimeStamp& lastActiveTabOptimization,
        const nsHttpHeaderArray& responseTrailers,
        mozilla::Span<ConsoleReportCollected const> consoleReport,
        const bool& fromSocketProcess,
        const TimeStamp& onStopRequestStart) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnStopRequest(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), channelStatus);
    // Sentinel = 'channelStatus'
    ((&(writer__)))->WriteSentinel(618136926);
    IPC::WriteParam((&(writer__)), timing);
    // Sentinel = 'timing'
    ((&(writer__)))->WriteSentinel(150798985);
    IPC::WriteParam((&(writer__)), lastActiveTabOptimization);
    // Sentinel = 'lastActiveTabOptimization'
    ((&(writer__)))->WriteSentinel(2190412335);
    IPC::WriteParam((&(writer__)), responseTrailers);
    // Sentinel = 'responseTrailers'
    ((&(writer__)))->WriteSentinel(961873590);
    IPC::WriteParam((&(writer__)), consoleReport);
    // Sentinel = 'consoleReport'
    ((&(writer__)))->WriteSentinel(634652016);
    IPC::WriteParam((&(writer__)), fromSocketProcess);
    // Sentinel = 'fromSocketProcess'
    ((&(writer__)))->WriteSentinel(1049626365);
    IPC::WriteParam((&(writer__)), onStopRequestStart);
    // Sentinel = 'onStopRequestStart'
    ((&(writer__)))->WriteSentinel(1183909755);


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

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

auto PHttpBackgroundChannelParent::SendOnConsoleReport(mozilla::Span<ConsoleReportCollected const> consoleReport) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnConsoleReport(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpBackgroundChannelParent::SendOnProgress(
        const int64_t& progress,
        const int64_t& progressMax) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnProgress(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), progress);
    // Sentinel = 'progress'
    ((&(writer__)))->WriteSentinel(261292918);
    IPC::WriteParam((&(writer__)), progressMax);
    // Sentinel = 'progressMax'
    ((&(writer__)))->WriteSentinel(471205020);


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

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

auto PHttpBackgroundChannelParent::SendOnStatus(const nsresult& status) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnStatus(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpBackgroundChannelParent::SendOnAfterLastPart(const nsresult& aStatus) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_OnAfterLastPart(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpBackgroundChannelParent::SendNotifyClassificationFlags(
        const uint32_t& aClassificationFlags,
        const bool& aIsThirdParty) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_NotifyClassificationFlags(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aClassificationFlags);
    // Sentinel = 'aClassificationFlags'
    ((&(writer__)))->WriteSentinel(1390741499);
    IPC::WriteParam((&(writer__)), aIsThirdParty);
    // Sentinel = 'aIsThirdParty'
    ((&(writer__)))->WriteSentinel(584058153);


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

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

auto PHttpBackgroundChannelParent::SendSetClassifierMatchedInfo(const ClassifierInfo& info) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_SetClassifierMatchedInfo(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpBackgroundChannelParent::SendSetClassifierMatchedTrackingInfo(const ClassifierInfo& info) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_SetClassifierMatchedTrackingInfo(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpBackgroundChannelParent::SendAttachStreamFilter(Endpoint<::mozilla::extensions::PStreamFilterParent>&& aEndpoint) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_AttachStreamFilter(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), std::move(aEndpoint));
    // Sentinel = 'aEndpoint'
    ((&(writer__)))->WriteSentinel(292225955);


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

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

auto PHttpBackgroundChannelParent::SendDetachStreamFilters() -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpBackgroundChannel::Msg_DetachStreamFilters(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

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


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

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

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

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

auto PHttpBackgroundChannelParent::OnMessageReceived(const Message& msg__) -> PHttpBackgroundChannelParent::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PHttpBackgroundChannel", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PHttpBackgroundChannelParent",
                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 PHttpBackgroundChannel::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

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

    }
    return MsgNotKnown;
}



} // namespace net
} // namespace mozilla
