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

#ifndef PTemporaryIPCBlob_h
#define PTemporaryIPCBlob_h

#include "mozilla/Attributes.h"
#include "IPCMessageStart.h"
#include "mozilla/RefPtr.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
#include "mozilla/MozPromise.h"
#include "mozilla/OperatorNewExtensions.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/ipc/ByteBuf.h"
#include "mozilla/ipc/FileDescriptor.h"
#include "mozilla/ipc/IPCForwards.h"
#include "mozilla/ipc/Shmem.h"
#include "mozilla/dom/IPCBlob.h"


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |union IPCBlobOrError|
//
namespace mozilla {
namespace dom {
class IPCBlobOrError final
{
public:
    enum Type {
        T__None,
        TIPCBlob = 1,
        Tnsresult,
        T__Last = Tnsresult
    };

private:
    typedef ::mozilla::dom::IPCBlob IPCBlob;
    typedef ::nsresult nsresult;
    typedef IPCBlob IPCBlob__tdef;
    typedef nsresult nsresult__tdef;

    IPCBlob*
    ptr_IPCBlob()
    {
        return (&(mVIPCBlob));
    }
    const IPCBlob*
    constptr_IPCBlob() const
    {
        return (&(mVIPCBlob));
    }
    nsresult*
    ptr_nsresult()
    {
        return (&(mVnsresult));
    }
    const nsresult*
    constptr_nsresult() const
    {
        return (&(mVnsresult));
    }

    void
    MaybeDestroy();

    void
    AssertSanity() const
    {
        MOZ_RELEASE_ASSERT((T__None) <= (mType), "invalid type tag");
        MOZ_RELEASE_ASSERT((mType) <= (T__Last), "invalid type tag");
    }
    void
    AssertSanity(Type aType) const
    {
        AssertSanity();
        MOZ_RELEASE_ASSERT((mType) == (aType), "unexpected type tag");
    }

public:
    MOZ_IMPLICIT IPCBlobOrError() :
        mType(T__None)
    {
    }

    MOZ_IMPLICIT IPCBlobOrError(const IPCBlob& aOther);

    MOZ_IMPLICIT IPCBlobOrError(IPCBlob&& aOther);

    MOZ_IMPLICIT IPCBlobOrError(const nsresult& aOther);

    MOZ_IMPLICIT IPCBlobOrError(nsresult&& aOther);

    MOZ_IMPLICIT IPCBlobOrError(const IPCBlobOrError& aOther);

    MOZ_IMPLICIT IPCBlobOrError(IPCBlobOrError&& aOther);

    ~IPCBlobOrError();

    Type
    type() const
    {
        return mType;
    }

    IPCBlobOrError&
    operator=(const IPCBlob& aRhs);

    IPCBlobOrError&
    operator=(IPCBlob&& aRhs);

    IPCBlobOrError&
    operator=(const nsresult& aRhs);

    IPCBlobOrError&
    operator=(nsresult&& aRhs);

    IPCBlobOrError&
    operator=(const IPCBlobOrError& aRhs);

    IPCBlobOrError&
    operator=(IPCBlobOrError&& aRhs);

    IPCBlob&
    get_IPCBlob()
    {
        AssertSanity(TIPCBlob);
        return (*(ptr_IPCBlob()));
    }
    const IPCBlob&
    get_IPCBlob() const
    {
        AssertSanity(TIPCBlob);
        return (*(constptr_IPCBlob()));
    }
    operator IPCBlob&()
    {
        return get_IPCBlob();
    }
    operator const IPCBlob&() const
    {
        return get_IPCBlob();
    }

    nsresult&
    get_nsresult()
    {
        AssertSanity(Tnsresult);
        return (*(ptr_nsresult()));
    }
    const nsresult&
    get_nsresult() const
    {
        AssertSanity(Tnsresult);
        return (*(constptr_nsresult()));
    }
    operator nsresult&()
    {
        return get_nsresult();
    }
    operator const nsresult&() const
    {
        return get_nsresult();
    }

private:
    union {
        IPCBlob mVIPCBlob;
        nsresult mVnsresult;
    };
    Type mType;
};
} // namespace dom
} // namespace mozilla

namespace IPC {
template<>
struct ParamTraits <::mozilla::dom::IPCBlobOrError>
{
    typedef ::mozilla::dom::IPCBlobOrError paramType;
    static void
    Write(
            IPC::MessageWriter* aWriter,
            const paramType& aVar);
    static IPC::ReadResult<paramType>
    Read(IPC::MessageReader* aReader);
};
} // namespace IPC

namespace mozilla {
namespace dom {
class PTemporaryIPCBlobParent;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
class PTemporaryIPCBlobChild;
} // namespace dom
} // namespace mozilla

//-----------------------------------------------------------------------------
// Code common to PTemporaryIPCBlobChild and PTemporaryIPCBlobParent
//
namespace mozilla {
namespace dom {
namespace PTemporaryIPCBlob {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PTemporaryIPCBlobParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PTemporaryIPCBlobChild>* aChild);

enum MessageType {
    PTemporaryIPCBlobStart = PTemporaryIPCBlobMsgStart << 16,
    Msg_FileDesc__ID,
    Msg___delete____ID,
    Reply___delete____ID,
    Msg_OperationFailed__ID,
    Msg_OperationDone__ID,
    PTemporaryIPCBlobEnd
};

mozilla::UniquePtr<IPC::Message>
Msg_FileDesc(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg___delete__(IPC::Message::routeid_t routingId);
mozilla::UniquePtr<IPC::Message>
Reply___delete__(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_OperationFailed(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_OperationDone(IPC::Message::routeid_t routingId);



} // namespace PTemporaryIPCBlob
} // namespace dom
} // namespace mozilla

#endif // ifndef PTemporaryIPCBlob_h
