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


#include "mozilla/net/PBackgroundDataBridgeParent.h"
#include "mozilla/AntiTrackingIPCUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/NavigationAPIIPCUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/SessionHistoryEntry.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/BackgroundDataBridgeParent.h"
#include "mozilla/net/CacheInfoIPCTypes.h"
#include "mozilla/net/ClassOfService.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 "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 {


auto PBackgroundDataBridgeParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

auto PBackgroundDataBridgeParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PBackgroundDataBridgeParent::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

MOZ_IMPLICIT PBackgroundDataBridgeParent::PBackgroundDataBridgeParent() :
    mozilla::ipc::IToplevelProtocol("PBackgroundDataBridgeParent", kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PBackgroundDataBridgeParent);
}

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

auto PBackgroundDataBridgeParent::ActorAlloc() -> void
{
    MOZ_RELEASE_ASSERT(XRE_IsSocketProcess(), "Invalid process for `PBackgroundDataBridgeParent'");
    AddRef();
}

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

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

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

auto PBackgroundDataBridgeParent::SendOnTransportAndData(
        const uint64_t& offset,
        const uint32_t& count,
        const nsACString& data,
        const TimeStamp& onDataAvailableStart) -> bool
{
    UniquePtr<IPC::Message> msg__ = PBackgroundDataBridge::Msg_OnTransportAndData(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), offset);
    // Sentinel = 'offset'
    ((&(writer__)))->WriteSentinel(147653256);
    IPC::WriteParam((&(writer__)), count);
    // Sentinel = 'count'
    ((&(writer__)))->WriteSentinel(106889770);
    IPC::WriteParam((&(writer__)), data);
    // Sentinel = 'data'
    ((&(writer__)))->WriteSentinel(67109275);
    IPC::WriteParam((&(writer__)), onDataAvailableStart);
    // Sentinel = 'onDataAvailableStart'
    ((&(writer__)))->WriteSentinel(1369049063);


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

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

auto PBackgroundDataBridgeParent::SendOnStopRequest(
        const nsresult& aStatus,
        const ResourceTimingStructArgs& timing,
        const TimeStamp& lastActiveTabOptimization,
        const nsHttpHeaderArray& responseTrailers,
        const TimeStamp& onStopRequestStart) -> bool
{
    UniquePtr<IPC::Message> msg__ = PBackgroundDataBridge::Msg_OnStopRequest(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aStatus);
    // Sentinel = 'aStatus'
    ((&(writer__)))->WriteSentinel(186712806);
    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__)), onStopRequestStart);
    // Sentinel = 'onStopRequestStart'
    ((&(writer__)))->WriteSentinel(1183909755);


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

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

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

auto PBackgroundDataBridgeParent::OnMessageReceived(const Message& msg__) -> PBackgroundDataBridgeParent::Result
{
    switch (msg__.type()) {
    case PBackgroundDataBridge::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    case SHMEM_CREATED_MESSAGE_TYPE:
        {
            if (!ShmemCreated(msg__)) {
                return MsgPayloadError;
            }
            return MsgProcessed;
        }
    case SHMEM_DESTROYED_MESSAGE_TYPE:
        {
            if (!ShmemDestroyed(msg__)) {
                return MsgPayloadError;
            }
            return MsgProcessed;
        }
    }
}

auto PBackgroundDataBridgeParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PBackgroundDataBridgeParent::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



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

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

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

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

        return {};
    }
    return static_cast<::mozilla::net::PBackgroundDataBridgeParent*>(actor);
}

} // namespace IPC
