Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM RTCPeerConnectionStatic.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_RTCPEERCONNECTIONSTATICBINDING_H_
#define DOM_RTCPEERCONNECTIONSTATICBINDING_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/CallbackFunction.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 PeerConnectionLifecycleCallback;
class ProtoAndIfaceCache;
class RTCPeerConnection;
class RTCPeerConnectionStatic;
struct RTCPeerConnectionStaticAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class RTCLifecycleEvent : uint8_t {
Initialized,
Icegatheringstatechange,
Iceconnectionstatechange,
Connectionstatechange,
};
namespace binding_detail {
template <> struct EnumStrings<RTCLifecycleEvent> {
static const nsLiteralCString Values[4];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, RTCLifecycleEvent aArgument, JS::MutableHandle<JS::Value> aValue);
class PeerConnectionLifecycleCallback : public CallbackFunction
{
public:
explicit inline PeerConnectionLifecycleCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline PeerConnectionLifecycleCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline PeerConnectionLifecycleCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline PeerConnectionLifecycleCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, RTCPeerConnection& pc, uint64_t windowId, RTCLifecycleEvent eventType, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "PeerConnectionLifecycleCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, pc, windowId, eventType, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(RTCPeerConnection& pc, uint64_t windowId, RTCLifecycleEvent eventType, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "PeerConnectionLifecycleCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, pc, windowId, eventType, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, RTCPeerConnection& pc, uint64_t windowId, RTCLifecycleEvent eventType, const char* aExecutionReason = nullptr)
{
return Call(thisVal, pc, windowId, eventType, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(RTCPeerConnection& pc, uint64_t windowId, RTCLifecycleEvent eventType, const char* aExecutionReason = nullptr)
{
return Call(pc, windowId, eventType, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const PeerConnectionLifecycleCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, RTCPeerConnection& pc, uint64_t windowId, RTCLifecycleEvent eventType, ErrorResult& aRv);
};
namespace binding_detail {
class FastPeerConnectionLifecycleCallback : public PeerConnectionLifecycleCallback
{
public:
explicit inline FastPeerConnectionLifecycleCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: PeerConnectionLifecycleCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
PeerConnectionLifecycleCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
PeerConnectionLifecycleCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
namespace RTCPeerConnectionStatic_Binding {
typedef mozilla::dom::RTCPeerConnectionStatic NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::RTCPeerConnectionStatic* 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, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::RTCPeerConnectionStatic,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::RTCPeerConnectionStatic,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace RTCPeerConnectionStatic_Binding
class RTCPeerConnectionStaticJSImpl : public CallbackInterface
{
public:
explicit inline RTCPeerConnectionStaticJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
}
explicit inline RTCPeerConnectionStaticJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
explicit inline RTCPeerConnectionStaticJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
}
void RegisterPeerConnectionLifecycleCallback(PeerConnectionLifecycleCallback& cb, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void __Init(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
inline bool
operator==(const RTCPeerConnectionStaticJSImpl& aOther) const
{
return CallbackInterface::operator==(aOther);
}
private:
static bool
InitIds(JSContext* cx, RTCPeerConnectionStaticAtoms* atomsCache);
};
class RTCPeerConnectionStatic final : public nsSupportsWeakReference,
public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(RTCPeerConnectionStatic)
private:
RefPtr<RTCPeerConnectionStaticJSImpl> mImpl;
nsCOMPtr<nsIGlobalObject> mParent;
public:
RTCPeerConnectionStatic(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent);
private:
~RTCPeerConnectionStatic();
public:
nsISupports* GetParentObject() const;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<RTCPeerConnectionStatic> Constructor(const GlobalObject& global, JSContext* cx, ErrorResult& aRv, JS::Handle<JSObject*> aGivenProto = nullptr);
void RegisterPeerConnectionLifecycleCallback(PeerConnectionLifecycleCallback& cb, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
static bool
_Create(JSContext* cx, unsigned argc, JS::Value* vp);
};
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::RTCLifecycleEvent>
{
static constexpr dom::RTCLifecycleEvent value = dom::RTCLifecycleEvent::Connectionstatechange;
static_assert(static_cast<uint8_t>(dom::RTCLifecycleEvent::Initialized) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::RTCLifecycleEvent>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_RTCPEERCONNECTIONSTATICBINDING_H_