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


#include "mozilla/dom/PSessionStoreChild.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/SessionStoreChild.h"
#include "mozilla/dom/SessionStoreMessageUtils.h"
#include "nsPoint.h"

#include "mozilla/dom/PBrowserChild.h"
#include "mozilla/dom/PInProcessChild.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 {


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

MOZ_IMPLICIT PSessionStoreChild::PSessionStoreChild() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PSessionStoreChild);
}

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

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

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

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

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

auto PSessionStoreChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
    mAsyncCallbacks.RejectPendingResponses(aReason);
}

auto PSessionStoreChild::SendSessionStoreUpdate(
        const mozilla::Maybe<nsCString>& aDocShellCaps,
        const mozilla::Maybe<bool>& aPrivateMode,
        const MaybeSessionStoreZoom& aZoom,
        const bool& aNeedCollectSHistory,
        const uint32_t& aEpoch) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSessionStore::Msg_SessionStoreUpdate(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aDocShellCaps);
    // Sentinel = 'aDocShellCaps'
    ((&(writer__)))->WriteSentinel(568394999);
    IPC::WriteParam((&(writer__)), aPrivateMode);
    // Sentinel = 'aPrivateMode'
    ((&(writer__)))->WriteSentinel(518194370);
    IPC::WriteParam((&(writer__)), aZoom);
    // Sentinel = 'aZoom'
    ((&(writer__)))->WriteSentinel(99222023);
    IPC::WriteParam((&(writer__)), aNeedCollectSHistory);
    // Sentinel = 'aNeedCollectSHistory'
    ((&(writer__)))->WriteSentinel(1343490025);
    IPC::WriteParam((&(writer__)), aEpoch);
    // Sentinel = 'aEpoch'
    ((&(writer__)))->WriteSentinel(132121169);


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

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

auto PSessionStoreChild::SendIncrementalSessionStoreUpdate(
        const MaybeDiscardedBrowsingContext& aBrowsingContext,
        const mozilla::Maybe<FormData>& aFormData,
        const mozilla::Maybe<nsPoint>& aScrollPosition,
        const uint32_t& aEpoch) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSessionStore::Msg_IncrementalSessionStoreUpdate(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aBrowsingContext);
    // Sentinel = 'aBrowsingContext'
    ((&(writer__)))->WriteSentinel(915015314);
    IPC::WriteParam((&(writer__)), aFormData);
    // Sentinel = 'aFormData'
    ((&(writer__)))->WriteSentinel(284427120);
    IPC::WriteParam((&(writer__)), aScrollPosition);
    // Sentinel = 'aScrollPosition'
    ((&(writer__)))->WriteSentinel(806290982);
    IPC::WriteParam((&(writer__)), aEpoch);
    // Sentinel = 'aEpoch'
    ((&(writer__)))->WriteSentinel(132121169);


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

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

auto PSessionStoreChild::SendResetSessionStore(
        const MaybeDiscardedBrowsingContext& aBrowsingContext,
        const uint32_t& aEpoch) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSessionStore::Msg_ResetSessionStore(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aBrowsingContext);
    // Sentinel = 'aBrowsingContext'
    ((&(writer__)))->WriteSentinel(915015314);
    IPC::WriteParam((&(writer__)), aEpoch);
    // Sentinel = 'aEpoch'
    ((&(writer__)))->WriteSentinel(132121169);


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

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

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

auto PSessionStoreChild::OnMessageReceived(const Message& msg__) -> PSessionStoreChild::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PSessionStore", mozilla::ipc::ChildSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PSessionStoreChild",
                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 PSessionStore::Msg_FlushTabState__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSessionStore", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSessionStoreChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSessionStore::Msg_FlushTabState", OTHER);

            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PSessionStore::Reply_FlushTabState(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            FlushTabStateResolver resolver = [resolver__ = std::move(resolver__)](const bool& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'aHadContext'
                    ((&(writer__)))->WriteSentinel(411501652);

                    if (mozilla::ipc::LoggingEnabledFor("PSessionStore", mozilla::ipc::ChildSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PSessionStoreChild",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::SessionStoreChild*>(this))->RecvFlushTabState(std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

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

            DoomSubtree();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::SessionStoreChild*>(this))->Recv__delete__();
            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 PSessionStoreChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PSessionStoreChild::Result
{
    if (!CanSend()) {
        return MsgDropped;

    }
    return MsgNotKnown;
}



} // namespace dom
} // namespace mozilla
