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

#ifndef PCompositorManager_h
#define PCompositorManager_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"

// Headers for typedefs
#include "Units.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/ipc/IPDLStructMember.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/LayersSurfaces.h"


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |struct WidgetCompositorOptions|
//
namespace mozilla {
namespace layers {
class WidgetCompositorOptions final
{
private:
    typedef ::mozilla::CSSToLayoutDeviceScale CSSToLayoutDeviceScale;
    typedef ::mozilla::TimeDuration TimeDuration;
    typedef ::mozilla::layers::CompositorOptions CompositorOptions;
    typedef ::mozilla::gfx::IntSize IntSize;
    typedef ::uint64_t uint64_t;

public:
#ifdef __clang__
#  pragma clang diagnostic push
#  if __has_warning("-Wdefaulted-function-deleted")
#    pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
#  endif
#endif
    WidgetCompositorOptions() = default;
#ifdef __clang__
#  pragma clang diagnostic pop
#endif

    MOZ_IMPLICIT WidgetCompositorOptions(
            const CSSToLayoutDeviceScale& _scale,
            const TimeDuration& _vsyncRate,
            const CompositorOptions& _options,
            const bool& _useExternalSurfaceSize,
            const IntSize& _surfaceSize,
            const uint64_t& _innerWindowId) :
        scale_(_scale),
        vsyncRate_(_vsyncRate),
        options_(_options),
        useExternalSurfaceSize_(_useExternalSurfaceSize),
        surfaceSize_(_surfaceSize),
        innerWindowId_(_innerWindowId)
    {
    }

    MOZ_IMPLICIT WidgetCompositorOptions(
            CSSToLayoutDeviceScale&& _scale,
            TimeDuration&& _vsyncRate,
            CompositorOptions&& _options,
            bool&& _useExternalSurfaceSize,
            IntSize&& _surfaceSize,
            uint64_t&& _innerWindowId) :
        scale_(std::move(_scale)),
        vsyncRate_(std::move(_vsyncRate)),
        options_(std::move(_options)),
        useExternalSurfaceSize_(std::move(_useExternalSurfaceSize)),
        surfaceSize_(std::move(_surfaceSize)),
        innerWindowId_(std::move(_innerWindowId))
    {
    }

    CSSToLayoutDeviceScale&
    scale()
    {
        return scale_;
    }
    const CSSToLayoutDeviceScale&
    scale() const
    {
        return scale_;
    }

    TimeDuration&
    vsyncRate()
    {
        return vsyncRate_;
    }
    const TimeDuration&
    vsyncRate() const
    {
        return vsyncRate_;
    }

    CompositorOptions&
    options()
    {
        return options_;
    }
    const CompositorOptions&
    options() const
    {
        return options_;
    }

    bool&
    useExternalSurfaceSize()
    {
        return useExternalSurfaceSize_;
    }
    const bool&
    useExternalSurfaceSize() const
    {
        return useExternalSurfaceSize_;
    }

    IntSize&
    surfaceSize()
    {
        return surfaceSize_;
    }
    const IntSize&
    surfaceSize() const
    {
        return surfaceSize_;
    }

    uint64_t&
    innerWindowId()
    {
        return innerWindowId_;
    }
    const uint64_t&
    innerWindowId() const
    {
        return innerWindowId_;
    }

private:
    ::mozilla::ipc::IPDLStructMember<CSSToLayoutDeviceScale> scale_;
    ::mozilla::ipc::IPDLStructMember<TimeDuration> vsyncRate_;
    ::mozilla::ipc::IPDLStructMember<CompositorOptions> options_;
    ::mozilla::ipc::IPDLStructMember<bool> useExternalSurfaceSize_;
    ::mozilla::ipc::IPDLStructMember<IntSize> surfaceSize_;
    ::mozilla::ipc::IPDLStructMember<uint64_t> innerWindowId_;
};
} // namespace layers
} // namespace mozilla

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


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |struct ContentCompositorOptions|
//
namespace mozilla {
namespace layers {
class ContentCompositorOptions final
{
private:

public:
#ifdef __clang__
#  pragma clang diagnostic push
#  if __has_warning("-Wdefaulted-function-deleted")
#    pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
#  endif
#endif
    ContentCompositorOptions() = default;
#ifdef __clang__
#  pragma clang diagnostic pop
#endif

private:
};
} // namespace layers
} // namespace mozilla

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


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |struct SameProcessWidgetCompositorOptions|
//
namespace mozilla {
namespace layers {
class SameProcessWidgetCompositorOptions final
{
private:

public:
#ifdef __clang__
#  pragma clang diagnostic push
#  if __has_warning("-Wdefaulted-function-deleted")
#    pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
#  endif
#endif
    SameProcessWidgetCompositorOptions() = default;
#ifdef __clang__
#  pragma clang diagnostic pop
#endif

private:
};
} // namespace layers
} // namespace mozilla

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


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |union CompositorBridgeOptions|
//
namespace mozilla {
namespace layers {
class CompositorBridgeOptions final
{
public:
    enum Type {
        T__None,
        TContentCompositorOptions = 1,
        TWidgetCompositorOptions,
        TSameProcessWidgetCompositorOptions,
        T__Last = TSameProcessWidgetCompositorOptions
    };

private:
    typedef ::mozilla::layers::ContentCompositorOptions ContentCompositorOptions;
    typedef ::mozilla::layers::WidgetCompositorOptions WidgetCompositorOptions;
    typedef ::mozilla::layers::SameProcessWidgetCompositorOptions SameProcessWidgetCompositorOptions;
    typedef ContentCompositorOptions ContentCompositorOptions__tdef;
    typedef WidgetCompositorOptions WidgetCompositorOptions__tdef;
    typedef SameProcessWidgetCompositorOptions SameProcessWidgetCompositorOptions__tdef;

    ContentCompositorOptions*
    ptr_ContentCompositorOptions()
    {
        return (&(mVContentCompositorOptions));
    }
    const ContentCompositorOptions*
    constptr_ContentCompositorOptions() const
    {
        return (&(mVContentCompositorOptions));
    }
    WidgetCompositorOptions*
    ptr_WidgetCompositorOptions()
    {
        return (&(mVWidgetCompositorOptions));
    }
    const WidgetCompositorOptions*
    constptr_WidgetCompositorOptions() const
    {
        return (&(mVWidgetCompositorOptions));
    }
    SameProcessWidgetCompositorOptions*
    ptr_SameProcessWidgetCompositorOptions()
    {
        return (&(mVSameProcessWidgetCompositorOptions));
    }
    const SameProcessWidgetCompositorOptions*
    constptr_SameProcessWidgetCompositorOptions() const
    {
        return (&(mVSameProcessWidgetCompositorOptions));
    }

    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 CompositorBridgeOptions() :
        mType(T__None)
    {
    }

    MOZ_IMPLICIT CompositorBridgeOptions(const ContentCompositorOptions& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(ContentCompositorOptions&& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(const WidgetCompositorOptions& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(WidgetCompositorOptions&& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(const SameProcessWidgetCompositorOptions& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(SameProcessWidgetCompositorOptions&& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(const CompositorBridgeOptions& aOther);

    MOZ_IMPLICIT CompositorBridgeOptions(CompositorBridgeOptions&& aOther);

    ~CompositorBridgeOptions();

    Type
    type() const
    {
        return mType;
    }

    CompositorBridgeOptions&
    operator=(const ContentCompositorOptions& aRhs);

    CompositorBridgeOptions&
    operator=(ContentCompositorOptions&& aRhs);

    CompositorBridgeOptions&
    operator=(const WidgetCompositorOptions& aRhs);

    CompositorBridgeOptions&
    operator=(WidgetCompositorOptions&& aRhs);

    CompositorBridgeOptions&
    operator=(const SameProcessWidgetCompositorOptions& aRhs);

    CompositorBridgeOptions&
    operator=(SameProcessWidgetCompositorOptions&& aRhs);

    CompositorBridgeOptions&
    operator=(const CompositorBridgeOptions& aRhs);

    CompositorBridgeOptions&
    operator=(CompositorBridgeOptions&& aRhs);

    ContentCompositorOptions&
    get_ContentCompositorOptions()
    {
        AssertSanity(TContentCompositorOptions);
        return (*(ptr_ContentCompositorOptions()));
    }
    const ContentCompositorOptions&
    get_ContentCompositorOptions() const
    {
        AssertSanity(TContentCompositorOptions);
        return (*(constptr_ContentCompositorOptions()));
    }
    operator ContentCompositorOptions&()
    {
        return get_ContentCompositorOptions();
    }
    operator const ContentCompositorOptions&() const
    {
        return get_ContentCompositorOptions();
    }

    WidgetCompositorOptions&
    get_WidgetCompositorOptions()
    {
        AssertSanity(TWidgetCompositorOptions);
        return (*(ptr_WidgetCompositorOptions()));
    }
    const WidgetCompositorOptions&
    get_WidgetCompositorOptions() const
    {
        AssertSanity(TWidgetCompositorOptions);
        return (*(constptr_WidgetCompositorOptions()));
    }
    operator WidgetCompositorOptions&()
    {
        return get_WidgetCompositorOptions();
    }
    operator const WidgetCompositorOptions&() const
    {
        return get_WidgetCompositorOptions();
    }

    SameProcessWidgetCompositorOptions&
    get_SameProcessWidgetCompositorOptions()
    {
        AssertSanity(TSameProcessWidgetCompositorOptions);
        return (*(ptr_SameProcessWidgetCompositorOptions()));
    }
    const SameProcessWidgetCompositorOptions&
    get_SameProcessWidgetCompositorOptions() const
    {
        AssertSanity(TSameProcessWidgetCompositorOptions);
        return (*(constptr_SameProcessWidgetCompositorOptions()));
    }
    operator SameProcessWidgetCompositorOptions&()
    {
        return get_SameProcessWidgetCompositorOptions();
    }
    operator const SameProcessWidgetCompositorOptions&() const
    {
        return get_SameProcessWidgetCompositorOptions();
    }

private:
    union {
        ContentCompositorOptions mVContentCompositorOptions;
        WidgetCompositorOptions mVWidgetCompositorOptions;
        SameProcessWidgetCompositorOptions mVSameProcessWidgetCompositorOptions;
    };
    Type mType;
};
} // namespace layers
} // namespace mozilla

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

namespace mozilla {
namespace layers {
class PCompositorManagerParent;
} // namespace layers
} // namespace mozilla
namespace mozilla {
namespace layers {
class PCompositorManagerChild;
} // namespace layers
} // namespace mozilla

//-----------------------------------------------------------------------------
// Code common to PCompositorManagerChild and PCompositorManagerParent
//
namespace mozilla {
namespace layers {
namespace PCompositorManager {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::layers::PCompositorManagerParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::layers::PCompositorManagerChild>* aChild);

enum MessageType {
    PCompositorManagerStart = PCompositorManagerMsgStart << 16,
    Msg_PCompositorBridgeConstructor__ID,
    Reply_PCompositorBridgeConstructor__ID,
    Msg_AddSharedSurface__ID,
    Msg_RemoveSharedSurface__ID,
    Msg_ReportSharedSurfacesMemory__ID,
    Reply_ReportSharedSurfacesMemory__ID,
    Msg_NotifyMemoryPressure__ID,
    Msg_ReportMemory__ID,
    Reply_ReportMemory__ID,
    Msg_InitCanvasManager__ID,
    Msg_NotifyWebRenderError__ID,
    PCompositorManagerEnd
};

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

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

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

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

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

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

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

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



} // namespace PCompositorManager
} // namespace layers
} // namespace mozilla

#endif // ifndef PCompositorManager_h
