Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM RTCSessionDescription.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_RTCSESSIONDESCRIPTIONBINDING_H_
#define DOM_RTCSESSIONDESCRIPTIONBINDING_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/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsWeakReference.h"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class ProtoAndIfaceCache;
struct RTCLocalSessionDescriptionInitAtoms;
class RTCSessionDescription;
struct RTCSessionDescriptionAtoms;
struct RTCSessionDescriptionInit;
struct RTCSessionDescriptionInitAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class RTCSdpType : uint8_t {
Offer,
Pranswer,
Answer,
Rollback,
};
namespace binding_detail {
template <> struct EnumStrings<RTCSdpType> {
static constexpr nsLiteralCString Values[4] {
"offer"_ns,
"pranswer"_ns,
"answer"_ns,
"rollback"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, RTCSdpType aArgument, JS::MutableHandle<JS::Value> aValue);
struct RTCLocalSessionDescriptionInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mSdp;
MOZ_INIT_OUTSIDE_CTOR Optional<RTCSdpType> mType;
RTCLocalSessionDescriptionInit();
explicit inline RTCLocalSessionDescriptionInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
RTCLocalSessionDescriptionInit(RTCLocalSessionDescriptionInit&& aOther) = default;
explicit inline RTCLocalSessionDescriptionInit(const RTCLocalSessionDescriptionInit& 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);
RTCLocalSessionDescriptionInit&
operator=(const RTCLocalSessionDescriptionInit& aOther);
private:
static bool
InitIds(JSContext* cx, RTCLocalSessionDescriptionInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastRTCLocalSessionDescriptionInit : public RTCLocalSessionDescriptionInit
{
inline FastRTCLocalSessionDescriptionInit()
: RTCLocalSessionDescriptionInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct RTCSessionDescriptionInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mSdp;
MOZ_INIT_OUTSIDE_CTOR RTCSdpType mType;
RTCSessionDescriptionInit();
explicit inline RTCSessionDescriptionInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
RTCSessionDescriptionInit(RTCSessionDescriptionInit&& aOther) = default;
explicit inline RTCSessionDescriptionInit(const RTCSessionDescriptionInit& 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);
RTCSessionDescriptionInit&
operator=(const RTCSessionDescriptionInit& aOther);
private:
static bool
InitIds(JSContext* cx, RTCSessionDescriptionInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastRTCSessionDescriptionInit : public RTCSessionDescriptionInit
{
inline FastRTCSessionDescriptionInit()
: RTCSessionDescriptionInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace RTCSessionDescription_Binding {
typedef mozilla::dom::RTCSessionDescription NativeType;
MOZ_CAN_RUN_SCRIPT bool
CollectJSONAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::RTCSessionDescription* self, JS::Rooted<JSObject*>& result);
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::RTCSessionDescription* 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::RTCSessionDescription,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace RTCSessionDescription_Binding
class RTCSessionDescriptionJSImpl : public CallbackInterface
{
public:
explicit inline RTCSessionDescriptionJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
}
explicit inline RTCSessionDescriptionJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
explicit inline RTCSessionDescriptionJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
}
void ToJSON(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void __Init(const RTCSessionDescriptionInit& descriptionInitDict, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
inline bool
operator==(const RTCSessionDescriptionJSImpl& aOther) const
{
return CallbackInterface::operator==(aOther);
}
RTCSdpType GetType(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void GetSdp(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void SetType(RTCSdpType arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void SetSdp(const nsAString& arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
private:
static bool
InitIds(JSContext* cx, RTCSessionDescriptionAtoms* atomsCache);
};
class RTCSessionDescription final : public nsSupportsWeakReference,
public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(RTCSessionDescription)
private:
RefPtr<RTCSessionDescriptionJSImpl> mImpl;
nsCOMPtr<nsIGlobalObject> mParent;
public:
RTCSessionDescription(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent);
private:
~RTCSessionDescription();
public:
nsISupports* GetParentObject() const;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<RTCSessionDescription> Constructor(const GlobalObject& global, JSContext* cx, const RTCSessionDescriptionInit& descriptionInitDict, ErrorResult& aRv, JS::Handle<JSObject*> aGivenProto = nullptr);
RTCSdpType GetType(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const;
void SetType(RTCSdpType arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void GetSdp(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const;
void SetSdp(const nsAString& arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void ToJSON(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
static bool
_Create(JSContext* cx, unsigned argc, JS::Value* vp);
};
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::RTCSdpType>
{
static constexpr dom::RTCSdpType value = dom::RTCSdpType::Rollback;
static_assert(static_cast<uint8_t>(dom::RTCSdpType::Offer) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::RTCSdpType>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_RTCSESSIONDESCRIPTIONBINDING_H_