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


#include "mozilla/dom/FilePickerMessageUtils.h"
#include "mozilla/dom/PBrowserParent.h"
#include "mozilla/dom/PBrowserChild.h"
#include "mozilla/dom/PFilePicker.h"
#include "mozilla/dom/PFilePickerParent.h"
#include "mozilla/dom/PFilePickerChild.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 PFilePicker {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PFilePickerParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PFilePickerChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_Open(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Open__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___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg___delete____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>
Reply___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply___delete____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::REPLY));
}

} // namespace PFilePicker
} // namespace dom
} // namespace mozilla

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

namespace IPC {
auto ParamTraits<::mozilla::dom::InputBlobs>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).blobs());
    // Sentinel = 'blobs'
    (aWriter)->WriteSentinel(102957587);
}

auto ParamTraits<::mozilla::dom::InputBlobs>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___blobs = IPC::ReadParam<nsTArray<::mozilla::dom::IPCBlob>>(aReader);
    if (!maybe___blobs) {
        aReader->FatalError("Error deserializing 'blobs' (IPCBlob[]) member of 'InputBlobs'");
        return {};

    }
    auto& _blobs = *maybe___blobs;
    // Sentinel = 'blobs'
    if ((!((aReader)->ReadSentinel(102957587)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'blobs' (IPCBlob[]) member of 'InputBlobs'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_blobs)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::InputDirectory>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).directoryPath());
    // Sentinel = 'directoryPath'
    (aWriter)->WriteSentinel(633668963);
    IPC::WriteParam(aWriter, (aVar).blobsInWebKitDirectory());
    // Sentinel = 'blobsInWebKitDirectory'
    (aWriter)->WriteSentinel(1658325189);
}

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

    }
    auto& _directoryPath = *maybe___directoryPath;
    // Sentinel = 'directoryPath'
    if ((!((aReader)->ReadSentinel(633668963)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'directoryPath' (nsString) member of 'InputDirectory'");
        return {};
    }
    auto maybe___blobsInWebKitDirectory = IPC::ReadParam<nsTArray<::mozilla::dom::IPCBlob>>(aReader);
    if (!maybe___blobsInWebKitDirectory) {
        aReader->FatalError("Error deserializing 'blobsInWebKitDirectory' (IPCBlob[]) member of 'InputDirectory'");
        return {};

    }
    auto& _blobsInWebKitDirectory = *maybe___blobsInWebKitDirectory;
    // Sentinel = 'blobsInWebKitDirectory'
    if ((!((aReader)->ReadSentinel(1658325189)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'blobsInWebKitDirectory' (IPCBlob[]) member of 'InputDirectory'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_directoryPath),
            std::move(_blobsInWebKitDirectory)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union MaybeInputData|
//
namespace mozilla {
namespace dom {
auto MaybeInputData::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TInputBlobs:
        {
            (ptr_InputBlobs())->~InputBlobs__tdef();
            break;
        }
    case TInputDirectory:
        {
            (ptr_InputDirectory())->~InputDirectory__tdef();
            break;
        }
    case Tvoid_t:
        {
            (ptr_void_t())->~void_t__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(const InputBlobs& aOther)
{
    new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs(aOther);
    mType = TInputBlobs;
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(InputBlobs&& aOther)
{
    new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs(std::move(aOther));
    mType = TInputBlobs;
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(const InputDirectory& aOther)
{
    new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory(aOther);
    mType = TInputDirectory;
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(InputDirectory&& aOther)
{
    new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory(std::move(aOther));
    mType = TInputDirectory;
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(const void_t& aOther)
{
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(aOther);
    mType = Tvoid_t;
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(void_t&& aOther)
{
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move(aOther));
    mType = Tvoid_t;
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(const MaybeInputData& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TInputBlobs:
        {
            new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs((aOther).get_InputBlobs());
            break;
        }
    case TInputDirectory:
        {
            new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory((aOther).get_InputDirectory());
            break;
        }
    case Tvoid_t:
        {
            new (mozilla::KnownNotNull, ptr_void_t()) void_t((aOther).get_void_t());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT MaybeInputData::MaybeInputData(MaybeInputData&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TInputBlobs:
        {
            new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs(std::move((aOther).get_InputBlobs()));
            (aOther).MaybeDestroy();
            break;
        }
    case TInputDirectory:
        {
            new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory(std::move((aOther).get_InputDirectory()));
            (aOther).MaybeDestroy();
            break;
        }
    case Tvoid_t:
        {
            new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move((aOther).get_void_t()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

MaybeInputData::~MaybeInputData()
{
    MaybeDestroy();
}

auto MaybeInputData::operator=(const InputBlobs& aRhs) -> MaybeInputData&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs(aRhs);
    mType = TInputBlobs;
    return (*(this));
}

auto MaybeInputData::operator=(InputBlobs&& aRhs) -> MaybeInputData&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs(std::move(aRhs));
    mType = TInputBlobs;
    return (*(this));
}

auto MaybeInputData::operator=(const InputDirectory& aRhs) -> MaybeInputData&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory(aRhs);
    mType = TInputDirectory;
    return (*(this));
}

auto MaybeInputData::operator=(InputDirectory&& aRhs) -> MaybeInputData&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory(std::move(aRhs));
    mType = TInputDirectory;
    return (*(this));
}

auto MaybeInputData::operator=(const void_t& aRhs) -> MaybeInputData&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(aRhs);
    mType = Tvoid_t;
    return (*(this));
}

auto MaybeInputData::operator=(void_t&& aRhs) -> MaybeInputData&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move(aRhs));
    mType = Tvoid_t;
    return (*(this));
}

auto MaybeInputData::operator=(const MaybeInputData& aRhs) -> MaybeInputData&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TInputBlobs:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs((aRhs).get_InputBlobs());
            break;
        }
    case TInputDirectory:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory((aRhs).get_InputDirectory());
            break;
        }
    case Tvoid_t:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_void_t()) void_t((aRhs).get_void_t());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto MaybeInputData::operator=(MaybeInputData&& aRhs) -> MaybeInputData&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TInputBlobs:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_InputBlobs()) InputBlobs(std::move((aRhs).get_InputBlobs()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TInputDirectory:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_InputDirectory()) InputDirectory(std::move((aRhs).get_InputDirectory()));
            (aRhs).MaybeDestroy();
            break;
        }
    case Tvoid_t:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move((aRhs).get_void_t()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::MaybeInputData>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::MaybeInputData union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'MaybeInputData'
    (aWriter)->WriteSentinel(680789369);

    switch (type) {
    case union__::TInputBlobs:
        {
            IPC::WriteParam(aWriter, (aVar).get_InputBlobs());
            // Sentinel = 'TInputBlobs'
            (aWriter)->WriteSentinel(424150103);
            return;
        }
    case union__::TInputDirectory:
        {
            IPC::WriteParam(aWriter, (aVar).get_InputDirectory());
            // Sentinel = 'TInputDirectory'
            (aWriter)->WriteSentinel(787416602);
            return;
        }
    case union__::Tvoid_t:
        {
            IPC::WriteParam(aWriter, (aVar).get_void_t());
            // Sentinel = 'Tvoid_t'
            (aWriter)->WriteSentinel(189006554);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union MaybeInputData");
            return;
        }
    }
}

auto ParamTraits<::mozilla::dom::MaybeInputData>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::dom::MaybeInputData union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union MaybeInputData");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'MaybeInputData'
    if ((!((aReader)->ReadSentinel(680789369)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union MaybeInputData");
        return {};
    }

    switch (type) {
    case union__::TInputBlobs:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::InputBlobs>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TInputBlobs of union MaybeInputData");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TInputBlobs'
            if ((!((aReader)->ReadSentinel(424150103)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TInputBlobs of union MaybeInputData");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TInputDirectory:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::InputDirectory>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TInputDirectory of union MaybeInputData");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TInputDirectory'
            if ((!((aReader)->ReadSentinel(787416602)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TInputDirectory of union MaybeInputData");
                return {};
            }
            return std::move(tmp);
        }
    case union__::Tvoid_t:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::void_t>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tvoid_t of union MaybeInputData");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tvoid_t'
            if ((!((aReader)->ReadSentinel(189006554)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tvoid_t of union MaybeInputData");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union MaybeInputData");
            return {};
        }
    }
}

} // namespace IPC
