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


#include "mozilla/ProfilerTypes.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 ProfilerInitParams|
//
namespace mozilla {
auto ProfilerInitParams::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(ProfilerInitParams, activeTabID_) - offsetof(ProfilerInitParams, interval_)) == 8,
        "Bad assumptions about field layout!");
    static_assert(
        (offsetof(ProfilerInitParams, features_) - offsetof(ProfilerInitParams, entries_)) == 4,
        "Bad assumptions about field layout!");
}

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::ProfilerInitParams>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).enabled());
    // Sentinel = 'enabled'
    (aWriter)->WriteSentinel(188547788);
    IPC::WriteParam(aWriter, (aVar).duration());
    // Sentinel = 'duration'
    (aWriter)->WriteSentinel(256050023);
    IPC::WriteParam(aWriter, (aVar).filters());
    // Sentinel = 'filters'
    (aWriter)->WriteSentinel(196674298);
    (aWriter)->WriteBytes((&((aVar).interval())), 16);
    // Sentinel = 'interval | activeTabID'
    (aWriter)->WriteSentinel(1654392898);
    (aWriter)->WriteBytes((&((aVar).entries())), 8);
    // Sentinel = 'entries | features'
    (aWriter)->WriteSentinel(1122436886);
}

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

    }
    auto& _enabled = *maybe___enabled;
    // Sentinel = 'enabled'
    if ((!((aReader)->ReadSentinel(188547788)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'enabled' (bool) member of 'ProfilerInitParams'");
        return {};
    }
    auto maybe___duration = IPC::ReadParam<mozilla::Maybe<double>>(aReader);
    if (!maybe___duration) {
        aReader->FatalError("Error deserializing 'duration' (double?) member of 'ProfilerInitParams'");
        return {};

    }
    auto& _duration = *maybe___duration;
    // Sentinel = 'duration'
    if ((!((aReader)->ReadSentinel(256050023)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'duration' (double?) member of 'ProfilerInitParams'");
        return {};
    }
    auto maybe___filters = IPC::ReadParam<nsTArray<::nsCString>>(aReader);
    if (!maybe___filters) {
        aReader->FatalError("Error deserializing 'filters' (nsCString[]) member of 'ProfilerInitParams'");
        return {};

    }
    auto& _filters = *maybe___filters;
    // Sentinel = 'filters'
    if ((!((aReader)->ReadSentinel(196674298)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'filters' (nsCString[]) member of 'ProfilerInitParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_enabled),
            ::uint32_t{0},
            std::move(_duration),
            double{0},
            ::uint32_t{0},
            ::uint64_t{0},
            std::move(_filters)};
    if ((!((aReader)->ReadBytesInto((&((result__)->interval())), 16)))) {
        aReader->FatalError("Error bulk reading fields from double");
        return {};
    }
    // Sentinel = 'interval | activeTabID'
    if ((!((aReader)->ReadSentinel(1654392898)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from double");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->entries())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'entries | features'
    if ((!((aReader)->ReadSentinel(1122436886)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct ProfileBufferChunkMetadata|
//
namespace mozilla {
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::ProfileBufferChunkMetadata>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).doneTimeStamp());
    // Sentinel = 'doneTimeStamp'
    (aWriter)->WriteSentinel(611452219);
    (aWriter)->WriteBytes((&((aVar).bufferBytes())), 4);
    // Sentinel = 'bufferBytes'
    (aWriter)->WriteSentinel(449774722);
}

auto ParamTraits<::mozilla::ProfileBufferChunkMetadata>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___doneTimeStamp = IPC::ReadParam<::mozilla::TimeStamp>(aReader);
    if (!maybe___doneTimeStamp) {
        aReader->FatalError("Error deserializing 'doneTimeStamp' (TimeStamp) member of 'ProfileBufferChunkMetadata'");
        return {};

    }
    auto& _doneTimeStamp = *maybe___doneTimeStamp;
    // Sentinel = 'doneTimeStamp'
    if ((!((aReader)->ReadSentinel(611452219)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'doneTimeStamp' (TimeStamp) member of 'ProfileBufferChunkMetadata'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_doneTimeStamp),
            ::uint32_t{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->bufferBytes())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'bufferBytes'
    if ((!((aReader)->ReadSentinel(449774722)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::ProfileBufferChunkManagerUpdate>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).oldestDoneTimeStamp());
    // Sentinel = 'oldestDoneTimeStamp'
    (aWriter)->WriteSentinel(1286997926);
    IPC::WriteParam(aWriter, (aVar).newlyReleasedChunks());
    // Sentinel = 'newlyReleasedChunks'
    (aWriter)->WriteSentinel(1305675713);
    (aWriter)->WriteBytes((&((aVar).unreleasedBytes())), 16);
    // Sentinel = 'unreleasedBytes | releasedBytes'
    (aWriter)->WriteSentinel(3304066104);
}

auto ParamTraits<::mozilla::ProfileBufferChunkManagerUpdate>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___oldestDoneTimeStamp = IPC::ReadParam<::mozilla::TimeStamp>(aReader);
    if (!maybe___oldestDoneTimeStamp) {
        aReader->FatalError("Error deserializing 'oldestDoneTimeStamp' (TimeStamp) member of 'ProfileBufferChunkManagerUpdate'");
        return {};

    }
    auto& _oldestDoneTimeStamp = *maybe___oldestDoneTimeStamp;
    // Sentinel = 'oldestDoneTimeStamp'
    if ((!((aReader)->ReadSentinel(1286997926)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'oldestDoneTimeStamp' (TimeStamp) member of 'ProfileBufferChunkManagerUpdate'");
        return {};
    }
    auto maybe___newlyReleasedChunks = IPC::ReadParam<nsTArray<::mozilla::ProfileBufferChunkMetadata>>(aReader);
    if (!maybe___newlyReleasedChunks) {
        aReader->FatalError("Error deserializing 'newlyReleasedChunks' (ProfileBufferChunkMetadata[]) member of 'ProfileBufferChunkManagerUpdate'");
        return {};

    }
    auto& _newlyReleasedChunks = *maybe___newlyReleasedChunks;
    // Sentinel = 'newlyReleasedChunks'
    if ((!((aReader)->ReadSentinel(1305675713)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'newlyReleasedChunks' (ProfileBufferChunkMetadata[]) member of 'ProfileBufferChunkManagerUpdate'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            ::uint64_t{0},
            std::move(_oldestDoneTimeStamp),
            std::move(_newlyReleasedChunks)};
    if ((!((aReader)->ReadBytesInto((&((result__)->unreleasedBytes())), 16)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'unreleasedBytes | releasedBytes'
    if ((!((aReader)->ReadSentinel(3304066104)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct GatherProfileProgress|
//
namespace mozilla {
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::GatherProfileProgress>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).progressLocation());
    // Sentinel = 'progressLocation'
    (aWriter)->WriteSentinel(960104111);
    (aWriter)->WriteBytes((&((aVar).progressProportionValueUnderlyingType())), 4);
    // Sentinel = 'progressProportionValueUnderlyingType'
    (aWriter)->WriteSentinel(665128818);
}

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

    }
    auto& _progressLocation = *maybe___progressLocation;
    // Sentinel = 'progressLocation'
    if ((!((aReader)->ReadSentinel(960104111)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'progressLocation' (nsCString) member of 'GatherProfileProgress'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint32_t{0},
            std::move(_progressLocation)};
    if ((!((aReader)->ReadBytesInto((&((result__)->progressProportionValueUnderlyingType())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'progressProportionValueUnderlyingType'
    if ((!((aReader)->ReadSentinel(665128818)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct IPCProfileAndAdditionalInformation|
//
namespace mozilla {
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::IPCProfileAndAdditionalInformation>::Write(
        IPC::MessageWriter* aWriter,
        paramType&& aVar) -> void
{
    IPC::WriteParam(aWriter, std::move((aVar).profileShmem()));
    // Sentinel = 'profileShmem'
    (aWriter)->WriteSentinel(544539884);
    IPC::WriteParam(aWriter, std::move((aVar).additionalInformation()));
    // Sentinel = 'additionalInformation'
    (aWriter)->WriteSentinel(1574111392);
}

auto ParamTraits<::mozilla::IPCProfileAndAdditionalInformation>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___profileShmem = IPC::ReadParam<::mozilla::ipc::Shmem>(aReader);
    if (!maybe___profileShmem) {
        aReader->FatalError("Error deserializing 'profileShmem' (Shmem) member of 'IPCProfileAndAdditionalInformation'");
        return {};

    }
    auto& _profileShmem = *maybe___profileShmem;
    // Sentinel = 'profileShmem'
    if ((!((aReader)->ReadSentinel(544539884)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'profileShmem' (Shmem) member of 'IPCProfileAndAdditionalInformation'");
        return {};
    }
    auto maybe___additionalInformation = IPC::ReadParam<mozilla::Maybe<::mozilla::ProfileGenerationAdditionalInformation>>(aReader);
    if (!maybe___additionalInformation) {
        aReader->FatalError("Error deserializing 'additionalInformation' (ProfileGenerationAdditionalInformation?) member of 'IPCProfileAndAdditionalInformation'");
        return {};

    }
    auto& _additionalInformation = *maybe___additionalInformation;
    // Sentinel = 'additionalInformation'
    if ((!((aReader)->ReadSentinel(1574111392)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'additionalInformation' (ProfileGenerationAdditionalInformation?) member of 'IPCProfileAndAdditionalInformation'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_profileShmem),
            std::move(_additionalInformation)};
    return result__;
}

} // namespace IPC
