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


#include "mozilla/net/PBackgroundDataBridgeChild.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/BackgroundDataBridgeChild.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 PBackgroundDataBridgeChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

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

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

MOZ_IMPLICIT PBackgroundDataBridgeChild::PBackgroundDataBridgeChild() :
    mozilla::ipc::IToplevelProtocol("PBackgroundDataBridgeChild", kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PBackgroundDataBridgeChild);
}

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

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

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

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

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

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

auto PBackgroundDataBridgeChild::OnMessageReceived(const Message& msg__) -> PBackgroundDataBridgeChild::Result
{
    switch (msg__.type()) {
    case PBackgroundDataBridge::Msg_OnTransportAndData__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PBackgroundDataBridge", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PBackgroundDataBridgeChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PBackgroundDataBridge::Msg_OnTransportAndData", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& offset = *maybe__offset;
            // Sentinel = 'offset'
            if ((!(((&(reader__)))->ReadSentinel(147653256)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            auto maybe__count = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__count) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

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

            }
            auto& data = *maybe__data;
            // Sentinel = 'data'
            if ((!(((&(reader__)))->ReadSentinel(67109275)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto maybe__onDataAvailableStart = IPC::ReadParam<TimeStamp>((&(reader__)));
            if (!maybe__onDataAvailableStart) {
                FatalError("Error deserializing 'TimeStamp'");
                return MsgValueError;

            }
            auto& onDataAvailableStart = *maybe__onDataAvailableStart;
            // Sentinel = 'onDataAvailableStart'
            if ((!(((&(reader__)))->ReadSentinel(1369049063)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'TimeStamp'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<BackgroundDataBridgeChild*>(this))->RecvOnTransportAndData(std::move(offset), std::move(count), std::move(data), std::move(onDataAvailableStart));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PBackgroundDataBridge::Msg_OnStopRequest__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PBackgroundDataBridge", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PBackgroundDataBridgeChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PBackgroundDataBridge::Msg_OnStopRequest", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aStatus = *maybe__aStatus;
            // Sentinel = 'aStatus'
            if ((!(((&(reader__)))->ReadSentinel(186712806)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
                return MsgValueError;
            }
            auto maybe__timing = IPC::ReadParam<ResourceTimingStructArgs>((&(reader__)));
            if (!maybe__timing) {
                FatalError("Error deserializing 'ResourceTimingStructArgs'");
                return MsgValueError;

            }
            auto& timing = *maybe__timing;
            // Sentinel = 'timing'
            if ((!(((&(reader__)))->ReadSentinel(150798985)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ResourceTimingStructArgs'");
                return MsgValueError;
            }
            auto maybe__lastActiveTabOptimization = IPC::ReadParam<TimeStamp>((&(reader__)));
            if (!maybe__lastActiveTabOptimization) {
                FatalError("Error deserializing 'TimeStamp'");
                return MsgValueError;

            }
            auto& lastActiveTabOptimization = *maybe__lastActiveTabOptimization;
            // Sentinel = 'lastActiveTabOptimization'
            if ((!(((&(reader__)))->ReadSentinel(2190412335)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'TimeStamp'");
                return MsgValueError;
            }
            auto maybe__responseTrailers = IPC::ReadParam<nsHttpHeaderArray>((&(reader__)));
            if (!maybe__responseTrailers) {
                FatalError("Error deserializing 'nsHttpHeaderArray'");
                return MsgValueError;

            }
            auto& responseTrailers = *maybe__responseTrailers;
            // Sentinel = 'responseTrailers'
            if ((!(((&(reader__)))->ReadSentinel(961873590)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsHttpHeaderArray'");
                return MsgValueError;
            }
            auto maybe__onStopRequestStart = IPC::ReadParam<TimeStamp>((&(reader__)));
            if (!maybe__onStopRequestStart) {
                FatalError("Error deserializing 'TimeStamp'");
                return MsgValueError;

            }
            auto& onStopRequestStart = *maybe__onStopRequestStart;
            // Sentinel = 'onStopRequestStart'
            if ((!(((&(reader__)))->ReadSentinel(1183909755)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'TimeStamp'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<BackgroundDataBridgeChild*>(this))->RecvOnStopRequest(std::move(aStatus), std::move(timing), std::move(lastActiveTabOptimization), std::move(responseTrailers), std::move(onStopRequestStart));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    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 PBackgroundDataBridgeChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PBackgroundDataBridgeChild::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PBackgroundDataBridgeChild*>::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::PBackgroundDataBridgeChild*>::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::PBackgroundDataBridgeChild*>(actor);
}

} // namespace IPC
