Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM MediaStreamTrack.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_MEDIASTREAMTRACKBINDING_H_
#define DOM_MEDIASTREAMTRACKBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FakeString.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/UnionMember.h"
#include "mozilla/dom/UnionTypes.h"
namespace mozilla {
namespace dom {
class BooleanOrConstrainBooleanParameters;
struct ConstrainBooleanParametersAtoms;
struct ConstrainDOMStringParametersAtoms;
struct ConstrainDoubleRangeAtoms;
struct ConstrainLongRangeAtoms;
class DoubleOrConstrainDoubleRange;
class LongOrConstrainLongRange;
class MediaStreamTrack;
struct MediaTrackConstraintSet;
struct MediaTrackConstraintSetAtoms;
struct MediaTrackConstraintsAtoms;
struct NativePropertyHooks;
class OwningBooleanOrConstrainBooleanParameters;
class OwningDoubleOrConstrainDoubleRange;
class OwningLongOrConstrainLongRange;
class OwningStringOrStringSequence;
class OwningStringOrStringSequenceOrConstrainDOMStringParameters;
class ProtoAndIfaceCache;
class StringOrStringSequence;
class StringOrStringSequenceOrConstrainDOMStringParameters;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class VideoFacingModeEnum : uint8_t {
User,
Environment,
Left,
Right,
};
namespace binding_detail {
template <> struct EnumStrings<VideoFacingModeEnum> {
static constexpr nsLiteralCString Values[4] {
"user"_ns,
"environment"_ns,
"left"_ns,
"right"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, VideoFacingModeEnum aArgument, JS::MutableHandle<JS::Value> aValue);
enum class MediaSourceEnum : uint8_t {
Camera,
Screen,
Application,
Window,
Browser,
Microphone,
AudioCapture,
Other,
};
namespace binding_detail {
template <> struct EnumStrings<MediaSourceEnum> {
static constexpr nsLiteralCString Values[8] {
"camera"_ns,
"screen"_ns,
"application"_ns,
"window"_ns,
"browser"_ns,
"microphone"_ns,
"audioCapture"_ns,
"other"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, MediaSourceEnum aArgument, JS::MutableHandle<JS::Value> aValue);
enum class MediaStreamTrackState : uint8_t {
Live,
Ended,
};
namespace binding_detail {
template <> struct EnumStrings<MediaStreamTrackState> {
static constexpr nsLiteralCString Values[2] {
"live"_ns,
"ended"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, MediaStreamTrackState aArgument, JS::MutableHandle<JS::Value> aValue);
struct ConstrainBooleanParameters : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<bool> mExact;
MOZ_INIT_OUTSIDE_CTOR Optional<bool> mIdeal;
ConstrainBooleanParameters();
explicit inline ConstrainBooleanParameters(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
ConstrainBooleanParameters(ConstrainBooleanParameters&& aOther) = default;
explicit inline ConstrainBooleanParameters(const ConstrainBooleanParameters& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
ConstrainBooleanParameters&
operator=(const ConstrainBooleanParameters& aOther);
private:
static bool
InitIds(JSContext* cx, ConstrainBooleanParametersAtoms* atomsCache);
};
namespace binding_detail {
struct FastConstrainBooleanParameters : public ConstrainBooleanParameters
{
inline FastConstrainBooleanParameters()
: ConstrainBooleanParameters(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct ConstrainDOMStringParameters : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<OwningStringOrStringSequence> mExact;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningStringOrStringSequence> mIdeal;
ConstrainDOMStringParameters();
explicit inline ConstrainDOMStringParameters(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
ConstrainDOMStringParameters(ConstrainDOMStringParameters&& aOther) = default;
explicit inline ConstrainDOMStringParameters(const ConstrainDOMStringParameters& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
ConstrainDOMStringParameters&
operator=(const ConstrainDOMStringParameters& aOther);
private:
static bool
InitIds(JSContext* cx, ConstrainDOMStringParametersAtoms* atomsCache);
};
namespace binding_detail {
struct FastConstrainDOMStringParameters : public ConstrainDOMStringParameters
{
inline FastConstrainDOMStringParameters()
: ConstrainDOMStringParameters(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct ConstrainDoubleRange : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<double> mExact;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mIdeal;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mMax;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mMin;
ConstrainDoubleRange();
explicit inline ConstrainDoubleRange(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
ConstrainDoubleRange(ConstrainDoubleRange&& aOther) = default;
explicit inline ConstrainDoubleRange(const ConstrainDoubleRange& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
ConstrainDoubleRange&
operator=(const ConstrainDoubleRange& aOther);
private:
static bool
InitIds(JSContext* cx, ConstrainDoubleRangeAtoms* atomsCache);
};
namespace binding_detail {
struct FastConstrainDoubleRange : public ConstrainDoubleRange
{
inline FastConstrainDoubleRange()
: ConstrainDoubleRange(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct ConstrainLongRange : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mExact;
MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mIdeal;
MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMax;
MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMin;
ConstrainLongRange();
explicit inline ConstrainLongRange(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
ConstrainLongRange(ConstrainLongRange&& aOther) = default;
explicit inline ConstrainLongRange(const ConstrainLongRange& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
ConstrainLongRange&
operator=(const ConstrainLongRange& aOther);
private:
static bool
InitIds(JSContext* cx, ConstrainLongRangeAtoms* atomsCache);
};
namespace binding_detail {
struct FastConstrainLongRange : public ConstrainLongRange
{
inline FastConstrainLongRange()
: ConstrainLongRange(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class BooleanOrConstrainBooleanParameters : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eBoolean,
eConstrainBooleanParameters
};
public:
enum class Type
{
eBoolean = TypeOrUninit::eBoolean,
eConstrainBooleanParameters = TypeOrUninit::eConstrainBooleanParameters
};
private:
union Value
{
UnionMember<bool > mBoolean;
UnionMember<binding_detail::FastConstrainBooleanParameters > mConstrainBooleanParameters;
};
TypeOrUninit mType;
Value mValue;
BooleanOrConstrainBooleanParameters(const BooleanOrConstrainBooleanParameters&) = delete;
BooleanOrConstrainBooleanParameters& operator=(const BooleanOrConstrainBooleanParameters&) = delete;
public:
explicit inline BooleanOrConstrainBooleanParameters()
: mType(eUninitialized)
{
}
inline ~BooleanOrConstrainBooleanParameters()
{
Uninit();
}
[[nodiscard]] inline bool&
RawSetAsBoolean()
{
if (mType == eBoolean) {
return mValue.mBoolean.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eBoolean;
return mValue.mBoolean.SetValue();
}
[[nodiscard]] inline bool&
SetAsBoolean()
{
if (mType == eBoolean) {
return mValue.mBoolean.Value();
}
Uninit();
mType = eBoolean;
return mValue.mBoolean.SetValue();
}
inline bool
IsBoolean() const
{
return mType == eBoolean;
}
inline bool&
GetAsBoolean()
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
inline bool
GetAsBoolean() const
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
[[nodiscard]] inline binding_detail::FastConstrainBooleanParameters&
RawSetAsConstrainBooleanParameters()
{
if (mType == eConstrainBooleanParameters) {
return mValue.mConstrainBooleanParameters.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eConstrainBooleanParameters;
return mValue.mConstrainBooleanParameters.SetValue();
}
[[nodiscard]] inline binding_detail::FastConstrainBooleanParameters&
SetAsConstrainBooleanParameters()
{
if (mType == eConstrainBooleanParameters) {
return mValue.mConstrainBooleanParameters.Value();
}
Uninit();
mType = eConstrainBooleanParameters;
return mValue.mConstrainBooleanParameters.SetValue();
}
inline bool
IsConstrainBooleanParameters() const
{
return mType == eConstrainBooleanParameters;
}
inline binding_detail::FastConstrainBooleanParameters&
GetAsConstrainBooleanParameters()
{
MOZ_RELEASE_ASSERT(IsConstrainBooleanParameters(), "Wrong type!");
return mValue.mConstrainBooleanParameters.Value();
}
inline const ConstrainBooleanParameters&
GetAsConstrainBooleanParameters() const
{
MOZ_RELEASE_ASSERT(IsConstrainBooleanParameters(), "Wrong type!");
return mValue.mConstrainBooleanParameters.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
inline void
Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eBoolean: {
DestroyBoolean();
break;
}
case eConstrainBooleanParameters: {
DestroyConstrainBooleanParameters();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyBoolean()
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
mValue.mBoolean.Destroy();
mType = eUninitialized;
}
bool
TrySetToConstrainBooleanParameters(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainBooleanParameters(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyConstrainBooleanParameters()
{
MOZ_RELEASE_ASSERT(IsConstrainBooleanParameters(), "Wrong type!");
mValue.mConstrainBooleanParameters.Destroy();
mType = eUninitialized;
}
};
class OwningBooleanOrConstrainBooleanParameters : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eBoolean,
eConstrainBooleanParameters
};
public:
enum class Type
{
eBoolean = TypeOrUninit::eBoolean,
eConstrainBooleanParameters = TypeOrUninit::eConstrainBooleanParameters
};
private:
union Value
{
UnionMember<bool > mBoolean;
UnionMember<ConstrainBooleanParameters > mConstrainBooleanParameters;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningBooleanOrConstrainBooleanParameters()
: mType(eUninitialized)
{
}
OwningBooleanOrConstrainBooleanParameters(OwningBooleanOrConstrainBooleanParameters&& aOther);
explicit inline OwningBooleanOrConstrainBooleanParameters(const OwningBooleanOrConstrainBooleanParameters& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningBooleanOrConstrainBooleanParameters()
{
Uninit();
}
[[nodiscard]] bool&
RawSetAsBoolean();
[[nodiscard]] bool&
SetAsBoolean();
inline bool
IsBoolean() const
{
return mType == eBoolean;
}
inline bool&
GetAsBoolean()
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
inline bool const &
GetAsBoolean() const
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
[[nodiscard]] ConstrainBooleanParameters&
RawSetAsConstrainBooleanParameters();
[[nodiscard]] ConstrainBooleanParameters&
SetAsConstrainBooleanParameters();
inline bool
IsConstrainBooleanParameters() const
{
return mType == eConstrainBooleanParameters;
}
inline ConstrainBooleanParameters&
GetAsConstrainBooleanParameters()
{
MOZ_RELEASE_ASSERT(IsConstrainBooleanParameters(), "Wrong type!");
return mValue.mConstrainBooleanParameters.Value();
}
inline ConstrainBooleanParameters const &
GetAsConstrainBooleanParameters() const
{
MOZ_RELEASE_ASSERT(IsConstrainBooleanParameters(), "Wrong type!");
return mValue.mConstrainBooleanParameters.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
Uninit();
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
OwningBooleanOrConstrainBooleanParameters&
operator=(OwningBooleanOrConstrainBooleanParameters&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningBooleanOrConstrainBooleanParameters&
operator=(const OwningBooleanOrConstrainBooleanParameters& aOther);
private:
bool
TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyBoolean();
bool
TrySetToConstrainBooleanParameters(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainBooleanParameters(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyConstrainBooleanParameters();
};
class DoubleOrConstrainDoubleRange : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eDouble,
eConstrainDoubleRange
};
public:
enum class Type
{
eDouble = TypeOrUninit::eDouble,
eConstrainDoubleRange = TypeOrUninit::eConstrainDoubleRange
};
private:
union Value
{
UnionMember<double > mDouble;
UnionMember<binding_detail::FastConstrainDoubleRange > mConstrainDoubleRange;
};
TypeOrUninit mType;
Value mValue;
DoubleOrConstrainDoubleRange(const DoubleOrConstrainDoubleRange&) = delete;
DoubleOrConstrainDoubleRange& operator=(const DoubleOrConstrainDoubleRange&) = delete;
public:
explicit inline DoubleOrConstrainDoubleRange()
: mType(eUninitialized)
{
}
inline ~DoubleOrConstrainDoubleRange()
{
Uninit();
}
[[nodiscard]] inline double&
RawSetAsDouble()
{
if (mType == eDouble) {
return mValue.mDouble.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eDouble;
return mValue.mDouble.SetValue();
}
[[nodiscard]] inline double&
SetAsDouble()
{
if (mType == eDouble) {
return mValue.mDouble.Value();
}
Uninit();
mType = eDouble;
return mValue.mDouble.SetValue();
}
inline bool
IsDouble() const
{
return mType == eDouble;
}
inline double&
GetAsDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
inline double
GetAsDouble() const
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
[[nodiscard]] inline binding_detail::FastConstrainDoubleRange&
RawSetAsConstrainDoubleRange()
{
if (mType == eConstrainDoubleRange) {
return mValue.mConstrainDoubleRange.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eConstrainDoubleRange;
return mValue.mConstrainDoubleRange.SetValue();
}
[[nodiscard]] inline binding_detail::FastConstrainDoubleRange&
SetAsConstrainDoubleRange()
{
if (mType == eConstrainDoubleRange) {
return mValue.mConstrainDoubleRange.Value();
}
Uninit();
mType = eConstrainDoubleRange;
return mValue.mConstrainDoubleRange.SetValue();
}
inline bool
IsConstrainDoubleRange() const
{
return mType == eConstrainDoubleRange;
}
inline binding_detail::FastConstrainDoubleRange&
GetAsConstrainDoubleRange()
{
MOZ_RELEASE_ASSERT(IsConstrainDoubleRange(), "Wrong type!");
return mValue.mConstrainDoubleRange.Value();
}
inline const ConstrainDoubleRange&
GetAsConstrainDoubleRange() const
{
MOZ_RELEASE_ASSERT(IsConstrainDoubleRange(), "Wrong type!");
return mValue.mConstrainDoubleRange.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
inline void
Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eDouble: {
DestroyDouble();
break;
}
case eConstrainDoubleRange: {
DestroyConstrainDoubleRange();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToDouble(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToDouble(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
mValue.mDouble.Destroy();
mType = eUninitialized;
}
bool
TrySetToConstrainDoubleRange(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainDoubleRange(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyConstrainDoubleRange()
{
MOZ_RELEASE_ASSERT(IsConstrainDoubleRange(), "Wrong type!");
mValue.mConstrainDoubleRange.Destroy();
mType = eUninitialized;
}
};
class OwningDoubleOrConstrainDoubleRange : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eDouble,
eConstrainDoubleRange
};
public:
enum class Type
{
eDouble = TypeOrUninit::eDouble,
eConstrainDoubleRange = TypeOrUninit::eConstrainDoubleRange
};
private:
union Value
{
UnionMember<double > mDouble;
UnionMember<ConstrainDoubleRange > mConstrainDoubleRange;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningDoubleOrConstrainDoubleRange()
: mType(eUninitialized)
{
}
OwningDoubleOrConstrainDoubleRange(OwningDoubleOrConstrainDoubleRange&& aOther);
explicit inline OwningDoubleOrConstrainDoubleRange(const OwningDoubleOrConstrainDoubleRange& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningDoubleOrConstrainDoubleRange()
{
Uninit();
}
[[nodiscard]] double&
RawSetAsDouble();
[[nodiscard]] double&
SetAsDouble();
inline bool
IsDouble() const
{
return mType == eDouble;
}
inline double&
GetAsDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
inline double const &
GetAsDouble() const
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
[[nodiscard]] ConstrainDoubleRange&
RawSetAsConstrainDoubleRange();
[[nodiscard]] ConstrainDoubleRange&
SetAsConstrainDoubleRange();
inline bool
IsConstrainDoubleRange() const
{
return mType == eConstrainDoubleRange;
}
inline ConstrainDoubleRange&
GetAsConstrainDoubleRange()
{
MOZ_RELEASE_ASSERT(IsConstrainDoubleRange(), "Wrong type!");
return mValue.mConstrainDoubleRange.Value();
}
inline ConstrainDoubleRange const &
GetAsConstrainDoubleRange() const
{
MOZ_RELEASE_ASSERT(IsConstrainDoubleRange(), "Wrong type!");
return mValue.mConstrainDoubleRange.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
Uninit();
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
OwningDoubleOrConstrainDoubleRange&
operator=(OwningDoubleOrConstrainDoubleRange&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningDoubleOrConstrainDoubleRange&
operator=(const OwningDoubleOrConstrainDoubleRange& aOther);
private:
bool
TrySetToDouble(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToDouble(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyDouble();
bool
TrySetToConstrainDoubleRange(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainDoubleRange(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyConstrainDoubleRange();
};
class LongOrConstrainLongRange : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eLong,
eConstrainLongRange
};
public:
enum class Type
{
eLong = TypeOrUninit::eLong,
eConstrainLongRange = TypeOrUninit::eConstrainLongRange
};
private:
union Value
{
UnionMember<int32_t > mLong;
UnionMember<binding_detail::FastConstrainLongRange > mConstrainLongRange;
};
TypeOrUninit mType;
Value mValue;
LongOrConstrainLongRange(const LongOrConstrainLongRange&) = delete;
LongOrConstrainLongRange& operator=(const LongOrConstrainLongRange&) = delete;
public:
explicit inline LongOrConstrainLongRange()
: mType(eUninitialized)
{
}
inline ~LongOrConstrainLongRange()
{
Uninit();
}
[[nodiscard]] inline int32_t&
RawSetAsLong()
{
if (mType == eLong) {
return mValue.mLong.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eLong;
return mValue.mLong.SetValue();
}
[[nodiscard]] inline int32_t&
SetAsLong()
{
if (mType == eLong) {
return mValue.mLong.Value();
}
Uninit();
mType = eLong;
return mValue.mLong.SetValue();
}
inline bool
IsLong() const
{
return mType == eLong;
}
inline int32_t&
GetAsLong()
{
MOZ_RELEASE_ASSERT(IsLong(), "Wrong type!");
return mValue.mLong.Value();
}
inline int32_t
GetAsLong() const
{
MOZ_RELEASE_ASSERT(IsLong(), "Wrong type!");
return mValue.mLong.Value();
}
[[nodiscard]] inline binding_detail::FastConstrainLongRange&
RawSetAsConstrainLongRange()
{
if (mType == eConstrainLongRange) {
return mValue.mConstrainLongRange.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eConstrainLongRange;
return mValue.mConstrainLongRange.SetValue();
}
[[nodiscard]] inline binding_detail::FastConstrainLongRange&
SetAsConstrainLongRange()
{
if (mType == eConstrainLongRange) {
return mValue.mConstrainLongRange.Value();
}
Uninit();
mType = eConstrainLongRange;
return mValue.mConstrainLongRange.SetValue();
}
inline bool
IsConstrainLongRange() const
{
return mType == eConstrainLongRange;
}
inline binding_detail::FastConstrainLongRange&
GetAsConstrainLongRange()
{
MOZ_RELEASE_ASSERT(IsConstrainLongRange(), "Wrong type!");
return mValue.mConstrainLongRange.Value();
}
inline const ConstrainLongRange&
GetAsConstrainLongRange() const
{
MOZ_RELEASE_ASSERT(IsConstrainLongRange(), "Wrong type!");
return mValue.mConstrainLongRange.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
inline void
Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eLong: {
DestroyLong();
break;
}
case eConstrainLongRange: {
DestroyConstrainLongRange();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToLong(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyLong()
{
MOZ_RELEASE_ASSERT(IsLong(), "Wrong type!");
mValue.mLong.Destroy();
mType = eUninitialized;
}
bool
TrySetToConstrainLongRange(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainLongRange(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyConstrainLongRange()
{
MOZ_RELEASE_ASSERT(IsConstrainLongRange(), "Wrong type!");
mValue.mConstrainLongRange.Destroy();
mType = eUninitialized;
}
};
class OwningLongOrConstrainLongRange : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eLong,
eConstrainLongRange
};
public:
enum class Type
{
eLong = TypeOrUninit::eLong,
eConstrainLongRange = TypeOrUninit::eConstrainLongRange
};
private:
union Value
{
UnionMember<int32_t > mLong;
UnionMember<ConstrainLongRange > mConstrainLongRange;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningLongOrConstrainLongRange()
: mType(eUninitialized)
{
}
OwningLongOrConstrainLongRange(OwningLongOrConstrainLongRange&& aOther);
explicit inline OwningLongOrConstrainLongRange(const OwningLongOrConstrainLongRange& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningLongOrConstrainLongRange()
{
Uninit();
}
[[nodiscard]] int32_t&
RawSetAsLong();
[[nodiscard]] int32_t&
SetAsLong();
inline bool
IsLong() const
{
return mType == eLong;
}
inline int32_t&
GetAsLong()
{
MOZ_RELEASE_ASSERT(IsLong(), "Wrong type!");
return mValue.mLong.Value();
}
inline int32_t const &
GetAsLong() const
{
MOZ_RELEASE_ASSERT(IsLong(), "Wrong type!");
return mValue.mLong.Value();
}
[[nodiscard]] ConstrainLongRange&
RawSetAsConstrainLongRange();
[[nodiscard]] ConstrainLongRange&
SetAsConstrainLongRange();
inline bool
IsConstrainLongRange() const
{
return mType == eConstrainLongRange;
}
inline ConstrainLongRange&
GetAsConstrainLongRange()
{
MOZ_RELEASE_ASSERT(IsConstrainLongRange(), "Wrong type!");
return mValue.mConstrainLongRange.Value();
}
inline ConstrainLongRange const &
GetAsConstrainLongRange() const
{
MOZ_RELEASE_ASSERT(IsConstrainLongRange(), "Wrong type!");
return mValue.mConstrainLongRange.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
Uninit();
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
OwningLongOrConstrainLongRange&
operator=(OwningLongOrConstrainLongRange&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningLongOrConstrainLongRange&
operator=(const OwningLongOrConstrainLongRange& aOther);
private:
bool
TrySetToLong(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyLong();
bool
TrySetToConstrainLongRange(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainLongRange(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyConstrainLongRange();
};
class StringOrStringSequenceOrConstrainDOMStringParameters : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eString,
eStringSequence,
eConstrainDOMStringParameters
};
public:
enum class Type
{
eString = TypeOrUninit::eString,
eStringSequence = TypeOrUninit::eStringSequence,
eConstrainDOMStringParameters = TypeOrUninit::eConstrainDOMStringParameters
};
private:
union Value
{
UnionMember<binding_detail::FakeString<char16_t> > mString;
UnionMember<binding_detail::AutoSequence<nsString> > mStringSequence;
UnionMember<binding_detail::FastConstrainDOMStringParameters > mConstrainDOMStringParameters;
};
TypeOrUninit mType;
Value mValue;
StringOrStringSequenceOrConstrainDOMStringParameters(const StringOrStringSequenceOrConstrainDOMStringParameters&) = delete;
StringOrStringSequenceOrConstrainDOMStringParameters& operator=(const StringOrStringSequenceOrConstrainDOMStringParameters&) = delete;
public:
explicit inline StringOrStringSequenceOrConstrainDOMStringParameters()
: mType(eUninitialized)
{
}
inline ~StringOrStringSequenceOrConstrainDOMStringParameters()
{
Uninit();
}
[[nodiscard]] inline binding_detail::FakeString<char16_t>&
RawSetAsString()
{
if (mType == eString) {
return mValue.mString.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eString;
return mValue.mString.SetValue();
}
[[nodiscard]] inline binding_detail::FakeString<char16_t>&
SetAsString()
{
if (mType == eString) {
return mValue.mString.Value();
}
Uninit();
mType = eString;
return mValue.mString.SetValue();
}
template <int N>
inline void
SetStringLiteral(const nsString::char_type (&aData)[N])
{
RawSetAsString().AssignLiteral(aData);
}
inline bool
IsString() const
{
return mType == eString;
}
inline binding_detail::FakeString<char16_t>&
GetAsString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
inline const nsAString&
GetAsString() const
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
[[nodiscard]] inline binding_detail::AutoSequence<nsString>&
RawSetAsStringSequence()
{
if (mType == eStringSequence) {
return mValue.mStringSequence.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eStringSequence;
return mValue.mStringSequence.SetValue();
}
[[nodiscard]] inline binding_detail::AutoSequence<nsString>&
SetAsStringSequence()
{
if (mType == eStringSequence) {
return mValue.mStringSequence.Value();
}
Uninit();
mType = eStringSequence;
return mValue.mStringSequence.SetValue();
}
inline bool
IsStringSequence() const
{
return mType == eStringSequence;
}
inline binding_detail::AutoSequence<nsString>&
GetAsStringSequence()
{
MOZ_RELEASE_ASSERT(IsStringSequence(), "Wrong type!");
return mValue.mStringSequence.Value();
}
inline const Sequence<nsString>&
GetAsStringSequence() const
{
MOZ_RELEASE_ASSERT(IsStringSequence(), "Wrong type!");
return mValue.mStringSequence.Value();
}
[[nodiscard]] inline binding_detail::FastConstrainDOMStringParameters&
RawSetAsConstrainDOMStringParameters()
{
if (mType == eConstrainDOMStringParameters) {
return mValue.mConstrainDOMStringParameters.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eConstrainDOMStringParameters;
return mValue.mConstrainDOMStringParameters.SetValue();
}
[[nodiscard]] inline binding_detail::FastConstrainDOMStringParameters&
SetAsConstrainDOMStringParameters()
{
if (mType == eConstrainDOMStringParameters) {
return mValue.mConstrainDOMStringParameters.Value();
}
Uninit();
mType = eConstrainDOMStringParameters;
return mValue.mConstrainDOMStringParameters.SetValue();
}
inline bool
IsConstrainDOMStringParameters() const
{
return mType == eConstrainDOMStringParameters;
}
inline binding_detail::FastConstrainDOMStringParameters&
GetAsConstrainDOMStringParameters()
{
MOZ_RELEASE_ASSERT(IsConstrainDOMStringParameters(), "Wrong type!");
return mValue.mConstrainDOMStringParameters.Value();
}
inline const ConstrainDOMStringParameters&
GetAsConstrainDOMStringParameters() const
{
MOZ_RELEASE_ASSERT(IsConstrainDOMStringParameters(), "Wrong type!");
return mValue.mConstrainDOMStringParameters.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
inline void
Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eString: {
DestroyString();
break;
}
case eStringSequence: {
DestroyStringSequence();
break;
}
case eConstrainDOMStringParameters: {
DestroyConstrainDOMStringParameters();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
mValue.mString.Destroy();
mType = eUninitialized;
}
bool
TrySetToStringSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToStringSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyStringSequence()
{
MOZ_RELEASE_ASSERT(IsStringSequence(), "Wrong type!");
mValue.mStringSequence.Destroy();
mType = eUninitialized;
}
bool
TrySetToConstrainDOMStringParameters(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainDOMStringParameters(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyConstrainDOMStringParameters()
{
MOZ_RELEASE_ASSERT(IsConstrainDOMStringParameters(), "Wrong type!");
mValue.mConstrainDOMStringParameters.Destroy();
mType = eUninitialized;
}
};
class OwningStringOrStringSequenceOrConstrainDOMStringParameters : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eString,
eStringSequence,
eConstrainDOMStringParameters
};
public:
enum class Type
{
eString = TypeOrUninit::eString,
eStringSequence = TypeOrUninit::eStringSequence,
eConstrainDOMStringParameters = TypeOrUninit::eConstrainDOMStringParameters
};
private:
union Value
{
UnionMember<nsString > mString;
UnionMember<Sequence<nsString> > mStringSequence;
UnionMember<ConstrainDOMStringParameters > mConstrainDOMStringParameters;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningStringOrStringSequenceOrConstrainDOMStringParameters()
: mType(eUninitialized)
{
}
OwningStringOrStringSequenceOrConstrainDOMStringParameters(OwningStringOrStringSequenceOrConstrainDOMStringParameters&& aOther);
explicit inline OwningStringOrStringSequenceOrConstrainDOMStringParameters(const OwningStringOrStringSequenceOrConstrainDOMStringParameters& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningStringOrStringSequenceOrConstrainDOMStringParameters()
{
Uninit();
}
[[nodiscard]] nsString&
RawSetAsString();
[[nodiscard]] nsString&
SetAsString();
template <int N>
inline void
SetStringLiteral(const nsString::char_type (&aData)[N])
{
RawSetAsString().AssignLiteral(aData);
}
inline bool
IsString() const
{
return mType == eString;
}
inline nsString&
GetAsString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
inline nsString const &
GetAsString() const
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
[[nodiscard]] Sequence<nsString>&
RawSetAsStringSequence();
[[nodiscard]] Sequence<nsString>&
SetAsStringSequence();
inline bool
IsStringSequence() const
{
return mType == eStringSequence;
}
inline Sequence<nsString>&
GetAsStringSequence()
{
MOZ_RELEASE_ASSERT(IsStringSequence(), "Wrong type!");
return mValue.mStringSequence.Value();
}
inline Sequence<nsString> const &
GetAsStringSequence() const
{
MOZ_RELEASE_ASSERT(IsStringSequence(), "Wrong type!");
return mValue.mStringSequence.Value();
}
[[nodiscard]] ConstrainDOMStringParameters&
RawSetAsConstrainDOMStringParameters();
[[nodiscard]] ConstrainDOMStringParameters&
SetAsConstrainDOMStringParameters();
inline bool
IsConstrainDOMStringParameters() const
{
return mType == eConstrainDOMStringParameters;
}
inline ConstrainDOMStringParameters&
GetAsConstrainDOMStringParameters()
{
MOZ_RELEASE_ASSERT(IsConstrainDOMStringParameters(), "Wrong type!");
return mValue.mConstrainDOMStringParameters.Value();
}
inline ConstrainDOMStringParameters const &
GetAsConstrainDOMStringParameters() const
{
MOZ_RELEASE_ASSERT(IsConstrainDOMStringParameters(), "Wrong type!");
return mValue.mConstrainDOMStringParameters.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
Uninit();
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
OwningStringOrStringSequenceOrConstrainDOMStringParameters&
operator=(OwningStringOrStringSequenceOrConstrainDOMStringParameters&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningStringOrStringSequenceOrConstrainDOMStringParameters&
operator=(const OwningStringOrStringSequenceOrConstrainDOMStringParameters& aOther);
private:
bool
TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyString();
bool
TrySetToStringSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToStringSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyStringSequence();
bool
TrySetToConstrainDOMStringParameters(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToConstrainDOMStringParameters(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyConstrainDOMStringParameters();
};
struct MediaTrackConstraintSet : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<OwningBooleanOrConstrainBooleanParameters> mAutoGainControl;
MOZ_INIT_OUTSIDE_CTOR Optional<int64_t> mBrowserWindow;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mChannelCount;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningStringOrStringSequenceOrConstrainDOMStringParameters> mDeviceId;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningBooleanOrConstrainBooleanParameters> mEchoCancellation;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningStringOrStringSequenceOrConstrainDOMStringParameters> mFacingMode;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningDoubleOrConstrainDoubleRange> mFrameRate;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningStringOrStringSequenceOrConstrainDOMStringParameters> mGroupId;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mHeight;
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMediaSource;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningBooleanOrConstrainBooleanParameters> mNoiseSuppression;
MOZ_INIT_OUTSIDE_CTOR Optional<bool> mScrollWithPage;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mViewportHeight;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mViewportOffsetX;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mViewportOffsetY;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mViewportWidth;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningLongOrConstrainLongRange> mWidth;
MediaTrackConstraintSet();
explicit inline MediaTrackConstraintSet(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaTrackConstraintSet(MediaTrackConstraintSet&& aOther) = default;
explicit inline MediaTrackConstraintSet(const MediaTrackConstraintSet& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
MediaTrackConstraintSet&
operator=(const MediaTrackConstraintSet& aOther);
private:
static bool
InitIds(JSContext* cx, MediaTrackConstraintSetAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaTrackConstraintSet : public MediaTrackConstraintSet
{
inline FastMediaTrackConstraintSet()
: MediaTrackConstraintSet(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MediaTrackConstraints : public MediaTrackConstraintSet
{
MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<MediaTrackConstraintSet>> mAdvanced;
MediaTrackConstraints();
explicit inline MediaTrackConstraints(const FastDictionaryInitializer& )
: MediaTrackConstraintSet(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaTrackConstraints(MediaTrackConstraints&& aOther) = default;
explicit inline MediaTrackConstraints(const MediaTrackConstraints& aOther)
: MediaTrackConstraintSet(FastDictionaryInitializer())
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
bool
ToJSON(nsAString& aJSON) const;
void
TraceDictionary(JSTracer* trc);
MediaTrackConstraints&
operator=(const MediaTrackConstraints& aOther);
private:
static bool
InitIds(JSContext* cx, MediaTrackConstraintsAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaTrackConstraints : public MediaTrackConstraints
{
inline FastMediaTrackConstraints()
: MediaTrackConstraints(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace MediaStreamTrack_Binding {
typedef mozilla::dom::MediaStreamTrack NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::MediaStreamTrack* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::MediaStreamTrack,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace MediaStreamTrack_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::VideoFacingModeEnum>
{
static constexpr dom::VideoFacingModeEnum value = dom::VideoFacingModeEnum::Right;
static_assert(static_cast<uint8_t>(dom::VideoFacingModeEnum::User) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::VideoFacingModeEnum>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::MediaSourceEnum>
{
static constexpr dom::MediaSourceEnum value = dom::MediaSourceEnum::Other;
static_assert(static_cast<uint8_t>(dom::MediaSourceEnum::Camera) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::MediaSourceEnum>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::MediaStreamTrackState>
{
static constexpr dom::MediaStreamTrackState value = dom::MediaStreamTrackState::Ended;
static_assert(static_cast<uint8_t>(dom::MediaStreamTrackState::Live) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::MediaStreamTrackState>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_MEDIASTREAMTRACKBINDING_H_