//
// 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/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/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 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__)), 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
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PBackgroundDataBridge", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PBackgroundDataBridgeParent",
                this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                "Ignored message for dead actor",
                (&(msg__))->type(),
                mozilla::ipc::MessageDirection::eSending);
        }
        return MsgProcessed;

    }
    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
{
    if (!CanSend()) {
        return MsgDropped;

    }
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



} // namespace net
} // namespace mozilla
