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


#include "mozilla/devtools/PHeapSnapshotTempFileHelper.h"

namespace mozilla {
namespace devtools {
namespace PHeapSnapshotTempFileHelper {

nsresult
CreateEndpoints(
        base::ProcessId aParentDestPid,
        base::ProcessId aChildDestPid,
        mozilla::ipc::Endpoint<mozilla::devtools::PHeapSnapshotTempFileHelperParent>* aParent,
        mozilla::ipc::Endpoint<mozilla::devtools::PHeapSnapshotTempFileHelperChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(mozilla::ipc::PrivateIPDLInterface(), aParentDestPid, aChildDestPid, PHeapSnapshotTempFileHelperMsgStart, PHeapSnapshotTempFileHelperMsgStartChild, aParent, aChild);
}
bool
Transition(
        mozilla::ipc::Trigger trigger,
        State* next)
{
    State from = (*(next));
    switch (from) {
    case __Null:
    case __Error:
        if ((Msg___delete____ID) == ((trigger).mMessage)) {
            (*(next)) = __Dead;
            return true;
        }
        return (__Null) == (from);
    case __Dead:
        mozilla::ipc::LogicError("__delete__()d actor");
        return false;
    case __Dying:
        mozilla::ipc::LogicError("__delete__()d (and unexpectedly dying) actor");
        return false;
    default:
        mozilla::ipc::LogicError("corrupted actor state");
        return false;
    }
}
IPC::Message*
Msg_OpenHeapSnapshotTempFile(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_OpenHeapSnapshotTempFile__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PHeapSnapshotTempFileHelper::Msg_OpenHeapSnapshotTempFile");
}
IPC::Message*
Reply_OpenHeapSnapshotTempFile(int32_t routingId)
{
    return new IPC::Message(routingId, Reply_OpenHeapSnapshotTempFile__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PHeapSnapshotTempFileHelper::Reply_OpenHeapSnapshotTempFile");
}
IPC::Message*
Msg___delete__(int32_t routingId)
{
    return new IPC::Message(routingId, Msg___delete____ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PHeapSnapshotTempFileHelper::Msg___delete__");
}
IPC::Message*
Reply___delete__(int32_t routingId)
{
    return new IPC::Message(routingId, Reply___delete____ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PHeapSnapshotTempFileHelper::Reply___delete__");
}

} // namespace PHeapSnapshotTempFileHelper
} // namespace devtools
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct OpenedFile|
//
namespace mozilla {
namespace devtools {
MOZ_IMPLICIT OpenedFile::OpenedFile() :
    path_()
{
    Init();
}

OpenedFile::~OpenedFile()
{
}

auto OpenedFile::operator==(const OpenedFile& _o) const -> bool
{
    if ((!((path()) == ((_o).path())))) {
        return false;
    }
    if ((!((descriptor()) == ((_o).descriptor())))) {
        return false;
    }
    return true;
}

auto OpenedFile::Init() -> void
{
}

auto OpenedFile::Assign(
        const nsString& _path,
        const FileDescriptor& _descriptor) -> void
{
    path_ = _path;
    descriptor_ = _descriptor;
}

} // namespace devtools
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union OpenHeapSnapshotTempFileResponse|
//
namespace mozilla {
namespace devtools {
auto OpenHeapSnapshotTempFileResponse::MaybeDestroy(Type aNewType) -> bool
{
    if ((mType) == (T__None)) {
        return true;
    }
    if ((mType) == (aNewType)) {
        return false;
    }
    switch (mType) {
    case Tnsresult:
        {
            (ptr_nsresult())->~nsresult__tdef();
            break;
        }
    case TOpenedFile:
        {
            (ptr_OpenedFile())->~OpenedFile__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
    return true;
}

MOZ_IMPLICIT OpenHeapSnapshotTempFileResponse::OpenHeapSnapshotTempFileResponse(const nsresult& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aOther);
    mType = Tnsresult;
}

MOZ_IMPLICIT OpenHeapSnapshotTempFileResponse::OpenHeapSnapshotTempFileResponse(const OpenedFile& aOther)
{
    new (mozilla::KnownNotNull, ptr_OpenedFile()) OpenedFile(aOther);
    mType = TOpenedFile;
}

MOZ_IMPLICIT OpenHeapSnapshotTempFileResponse::OpenHeapSnapshotTempFileResponse(const OpenHeapSnapshotTempFileResponse& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult());
            break;
        }
    case TOpenedFile:
        {
            new (mozilla::KnownNotNull, ptr_OpenedFile()) OpenedFile((aOther).get_OpenedFile());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

OpenHeapSnapshotTempFileResponse::~OpenHeapSnapshotTempFileResponse()
{
    static_cast<void>(MaybeDestroy(T__None));
}

auto OpenHeapSnapshotTempFileResponse::operator=(const nsresult& aRhs) -> OpenHeapSnapshotTempFileResponse&
{
    if (MaybeDestroy(Tnsresult)) {
        new (mozilla::KnownNotNull, ptr_nsresult()) nsresult;
    }
    (*(ptr_nsresult())) = aRhs;
    mType = Tnsresult;
    return (*(this));
}

auto OpenHeapSnapshotTempFileResponse::operator=(const OpenedFile& aRhs) -> OpenHeapSnapshotTempFileResponse&
{
    if (MaybeDestroy(TOpenedFile)) {
        new (mozilla::KnownNotNull, ptr_OpenedFile()) OpenedFile;
    }
    (*(ptr_OpenedFile())) = aRhs;
    mType = TOpenedFile;
    return (*(this));
}

auto OpenHeapSnapshotTempFileResponse::operator=(const OpenHeapSnapshotTempFileResponse& aRhs) -> OpenHeapSnapshotTempFileResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            if (MaybeDestroy(t)) {
                new (mozilla::KnownNotNull, ptr_nsresult()) nsresult;
            }
            (*(ptr_nsresult())) = (aRhs).get_nsresult();
            break;
        }
    case TOpenedFile:
        {
            if (MaybeDestroy(t)) {
                new (mozilla::KnownNotNull, ptr_OpenedFile()) OpenedFile;
            }
            (*(ptr_OpenedFile())) = (aRhs).get_OpenedFile();
            break;
        }
    case T__None:
        {
            static_cast<void>(MaybeDestroy(t));
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto OpenHeapSnapshotTempFileResponse::operator==(const nsresult& aRhs) const -> bool
{
    return (get_nsresult()) == (aRhs);
}

auto OpenHeapSnapshotTempFileResponse::operator==(const OpenedFile& aRhs) const -> bool
{
    return (get_OpenedFile()) == (aRhs);
}

auto OpenHeapSnapshotTempFileResponse::operator==(const OpenHeapSnapshotTempFileResponse& aRhs) const -> bool
{
    if ((type()) != ((aRhs).type())) {
        return false;
    }

    switch (type()) {
    case Tnsresult:
        {
            return (get_nsresult()) == ((aRhs).get_nsresult());
        }
    case TOpenedFile:
        {
            return (get_OpenedFile()) == ((aRhs).get_OpenedFile());
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return false;
        }
    }
}

auto OpenHeapSnapshotTempFileResponse::get(nsresult* aOutValue) const -> void
{
    (*(aOutValue)) = get_nsresult();
}

auto OpenHeapSnapshotTempFileResponse::get(OpenedFile* aOutValue) const -> void
{
    (*(aOutValue)) = get_OpenedFile();
}

} // namespace devtools
} // namespace mozilla
