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


#include "mozilla/dom/localstorage/SerializationHelpers.h"
#include "mozilla/dom/PBackgroundLSSnapshotParent.h"
#include "mozilla/dom/PBackgroundLSSnapshotChild.h"
#include "mozilla/dom/localstorage/SerializationHelpers.h"
#include "mozilla/dom/PBackgroundLSDatabase.h"
#include "mozilla/dom/PBackgroundLSDatabaseParent.h"
#include "mozilla/dom/PBackgroundLSDatabaseChild.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 {
namespace PBackgroundLSDatabase {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSDatabaseParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSDatabaseChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
nsresult
CreateEndpoints(
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSDatabaseParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSDatabaseChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_AllowToClose(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_AllowToClose__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_PBackgroundLSSnapshotConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_PBackgroundLSSnapshotConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::SYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_PBackgroundLSSnapshotConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_PBackgroundLSSnapshotConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::SYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_RequestAllowToClose(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_RequestAllowToClose__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}

} // namespace PBackgroundLSDatabase
} // namespace dom
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct LSSnapshotInitInfo|
//
namespace mozilla {
namespace dom {
auto LSSnapshotInitInfo::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(LSSnapshotInitInfo, peakUsage_) - offsetof(LSSnapshotInitInfo, usage_)) == 8,
        "Bad assumptions about field layout!");
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::LSSnapshotInitInfo>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).addKeyToUnknownItems());
    // Sentinel = 'addKeyToUnknownItems'
    (aWriter)->WriteSentinel(1384187912);
    IPC::WriteParam(aWriter, (aVar).itemInfos());
    // Sentinel = 'itemInfos'
    (aWriter)->WriteSentinel(307430319);
    IPC::WriteParam(aWriter, (aVar).loadState());
    // Sentinel = 'loadState'
    (aWriter)->WriteSentinel(304808866);
    IPC::WriteParam(aWriter, (aVar).hasOtherProcessDatabases());
    // Sentinel = 'hasOtherProcessDatabases'
    (aWriter)->WriteSentinel(2016676262);
    IPC::WriteParam(aWriter, (aVar).hasOtherProcessObservers());
    // Sentinel = 'hasOtherProcessObservers'
    (aWriter)->WriteSentinel(2034502105);
    (aWriter)->WriteBytes((&((aVar).usage())), 16);
    // Sentinel = 'usage | peakUsage'
    (aWriter)->WriteSentinel(966264424);
    (aWriter)->WriteBytes((&((aVar).totalLength())), 4);
    // Sentinel = 'totalLength'
    (aWriter)->WriteSentinel(459998343);
}

auto ParamTraits<::mozilla::dom::LSSnapshotInitInfo>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___addKeyToUnknownItems = IPC::ReadParam<bool>(aReader);
    if (!maybe___addKeyToUnknownItems) {
        aReader->FatalError("Error deserializing 'addKeyToUnknownItems' (bool) member of 'LSSnapshotInitInfo'");
        return {};

    }
    auto& _addKeyToUnknownItems = *maybe___addKeyToUnknownItems;
    // Sentinel = 'addKeyToUnknownItems'
    if ((!((aReader)->ReadSentinel(1384187912)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'addKeyToUnknownItems' (bool) member of 'LSSnapshotInitInfo'");
        return {};
    }
    auto maybe___itemInfos = IPC::ReadParam<nsTArray<::mozilla::dom::LSItemInfo>>(aReader);
    if (!maybe___itemInfos) {
        aReader->FatalError("Error deserializing 'itemInfos' (LSItemInfo[]) member of 'LSSnapshotInitInfo'");
        return {};

    }
    auto& _itemInfos = *maybe___itemInfos;
    // Sentinel = 'itemInfos'
    if ((!((aReader)->ReadSentinel(307430319)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'itemInfos' (LSItemInfo[]) member of 'LSSnapshotInitInfo'");
        return {};
    }
    auto maybe___loadState = IPC::ReadParam<::mozilla::dom::LSSnapshot::LoadState>(aReader);
    if (!maybe___loadState) {
        aReader->FatalError("Error deserializing 'loadState' (LoadState) member of 'LSSnapshotInitInfo'");
        return {};

    }
    auto& _loadState = *maybe___loadState;
    // Sentinel = 'loadState'
    if ((!((aReader)->ReadSentinel(304808866)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'loadState' (LoadState) member of 'LSSnapshotInitInfo'");
        return {};
    }
    auto maybe___hasOtherProcessDatabases = IPC::ReadParam<bool>(aReader);
    if (!maybe___hasOtherProcessDatabases) {
        aReader->FatalError("Error deserializing 'hasOtherProcessDatabases' (bool) member of 'LSSnapshotInitInfo'");
        return {};

    }
    auto& _hasOtherProcessDatabases = *maybe___hasOtherProcessDatabases;
    // Sentinel = 'hasOtherProcessDatabases'
    if ((!((aReader)->ReadSentinel(2016676262)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'hasOtherProcessDatabases' (bool) member of 'LSSnapshotInitInfo'");
        return {};
    }
    auto maybe___hasOtherProcessObservers = IPC::ReadParam<bool>(aReader);
    if (!maybe___hasOtherProcessObservers) {
        aReader->FatalError("Error deserializing 'hasOtherProcessObservers' (bool) member of 'LSSnapshotInitInfo'");
        return {};

    }
    auto& _hasOtherProcessObservers = *maybe___hasOtherProcessObservers;
    // Sentinel = 'hasOtherProcessObservers'
    if ((!((aReader)->ReadSentinel(2034502105)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'hasOtherProcessObservers' (bool) member of 'LSSnapshotInitInfo'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_addKeyToUnknownItems),
            std::move(_itemInfos),
            ::uint32_t{0},
            ::int64_t{0},
            ::int64_t{0},
            std::move(_loadState),
            std::move(_hasOtherProcessDatabases),
            std::move(_hasOtherProcessObservers)};
    if ((!((aReader)->ReadBytesInto((&((result__)->usage())), 16)))) {
        aReader->FatalError("Error bulk reading fields from int64_t");
        return {};
    }
    // Sentinel = 'usage | peakUsage'
    if ((!((aReader)->ReadSentinel(966264424)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from int64_t");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->totalLength())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'totalLength'
    if ((!((aReader)->ReadSentinel(459998343)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC
