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


#include "mozilla/dom/MemoryReportTypes.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"


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

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::MemoryReport>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).process());
    // Sentinel = 'process'
    (aWriter)->WriteSentinel(201458432);
    IPC::WriteParam(aWriter, (aVar).path());
    // Sentinel = 'path'
    (aWriter)->WriteSentinel(70713774);
    IPC::WriteParam(aWriter, (aVar).desc());
    // Sentinel = 'desc'
    (aWriter)->WriteSentinel(67895712);
    (aWriter)->WriteBytes((&((aVar).amount())), 8);
    // Sentinel = 'amount'
    (aWriter)->WriteSentinel(148374165);
    (aWriter)->WriteBytes((&((aVar).kind())), 12);
    // Sentinel = 'kind | units | generation'
    (aWriter)->WriteSentinel(2017069438);
}

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

    }
    auto& _process = *maybe___process;
    // Sentinel = 'process'
    if ((!((aReader)->ReadSentinel(201458432)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'process' (nsCString) member of 'MemoryReport'");
        return {};
    }
    auto maybe___path = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___path) {
        aReader->FatalError("Error deserializing 'path' (nsCString) member of 'MemoryReport'");
        return {};

    }
    auto& _path = *maybe___path;
    // Sentinel = 'path'
    if ((!((aReader)->ReadSentinel(70713774)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'path' (nsCString) member of 'MemoryReport'");
        return {};
    }
    auto maybe___desc = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___desc) {
        aReader->FatalError("Error deserializing 'desc' (nsCString) member of 'MemoryReport'");
        return {};

    }
    auto& _desc = *maybe___desc;
    // Sentinel = 'desc'
    if ((!((aReader)->ReadSentinel(67895712)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'desc' (nsCString) member of 'MemoryReport'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_process),
            std::move(_path),
            ::int32_t{0},
            ::int32_t{0},
            ::int64_t{0},
            ::uint32_t{0},
            std::move(_desc)};
    if ((!((aReader)->ReadBytesInto((&((result__)->amount())), 8)))) {
        aReader->FatalError("Error bulk reading fields from int64_t");
        return {};
    }
    // Sentinel = 'amount'
    if ((!((aReader)->ReadSentinel(148374165)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from int64_t");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->kind())), 12)))) {
        aReader->FatalError("Error bulk reading fields from int32_t");
        return {};
    }
    // Sentinel = 'kind | units | generation'
    if ((!((aReader)->ReadSentinel(2017069438)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from int32_t");
        return {};
    }
    return result__;
}

} // namespace IPC
