Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM RTCRtpCapabilities.webidl BY Codegen.py - DO NOT EDIT */
#include <type_traits>
#include "AtomList.h"
#include "MainThreadUtils.h"
#include "RTCRtpCapabilitiesBinding.h"
#include "js/Array.h"
#include "js/CallAndConstruct.h"
#include "js/Exception.h"
#include "js/ForOfIterator.h"
#include "js/MapAndSet.h"
#include "js/Object.h"
#include "js/PropertyAndElement.h"
#include "js/PropertyDescriptor.h"
#include "js/experimental/JitInfo.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/dom/BindingCallContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/PrimitiveConversions.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/SimpleGlobalObject.h"
namespace mozilla::dom {
namespace binding_detail {}; // Just to make sure it's known as a namespace
using namespace mozilla::dom::binding_detail;
RTCRtpCodec::RTCRtpCodec()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
RTCRtpCodec::InitIds(JSContext* cx, RTCRtpCodecAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->sdpFmtpLine_id.init(cx, "sdpFmtpLine") ||
!atomsCache->mimeType_id.init(cx, "mimeType") ||
!atomsCache->clockRate_id.init(cx, "clockRate") ||
!atomsCache->channels_id.init(cx, "channels")) {
return false;
}
return true;
}
bool
RTCRtpCodec::Init(const char* sourceDescription, bool passedToJSImpl)
{
return true;
}
bool
RTCRtpCodec::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
RTCRtpCodecAtoms* atomsCache = GetAtomCache<RTCRtpCodecAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
if (mChannels.WasPassed()) {
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
uint16_t const & currentValue = mChannels.InternalValue();
temp.setInt32(int32_t(currentValue));
if (!JS_DefinePropertyById(cx, obj, atomsCache->channels_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
}
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
uint32_t const & currentValue = mClockRate;
temp.setNumber(currentValue);
if (!JS_DefinePropertyById(cx, obj, atomsCache->clockRate_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mMimeType;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->mimeType_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
if (mSdpFmtpLine.WasPassed()) {
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mSdpFmtpLine.InternalValue();
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->sdpFmtpLine_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
}
return true;
}
void
RTCRtpCodec::TraceDictionary(JSTracer* trc)
{
}
RTCRtpCodec&
RTCRtpCodec::operator=(const RTCRtpCodec& aOther)
{
DictionaryBase::operator=(aOther);
mChannels.Reset();
if (aOther.mChannels.WasPassed()) {
mChannels.Construct(aOther.mChannels.Value());
}
mClockRate = aOther.mClockRate;
mMimeType = aOther.mMimeType;
mSdpFmtpLine.Reset();
if (aOther.mSdpFmtpLine.WasPassed()) {
mSdpFmtpLine.Construct(aOther.mSdpFmtpLine.Value());
}
return *this;
}
bool
RTCRtpCodec::operator==(const RTCRtpCodec& aOther) const
{
if (mChannels != aOther.mChannels) {
return false;
}
if (mClockRate != aOther.mClockRate) {
return false;
}
if (mMimeType != aOther.mMimeType) {
return false;
}
if (mSdpFmtpLine != aOther.mSdpFmtpLine) {
return false;
}
return true;
}
RTCRtpHeaderExtensionCapability::RTCRtpHeaderExtensionCapability()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
RTCRtpHeaderExtensionCapability::InitIds(JSContext* cx, RTCRtpHeaderExtensionCapabilityAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->uri_id.init(cx, "uri")) {
return false;
}
return true;
}
bool
RTCRtpHeaderExtensionCapability::Init(const char* sourceDescription, bool passedToJSImpl)
{
return true;
}
bool
RTCRtpHeaderExtensionCapability::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
RTCRtpHeaderExtensionCapabilityAtoms* atomsCache = GetAtomCache<RTCRtpHeaderExtensionCapabilityAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mUri;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->uri_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
return true;
}
void
RTCRtpHeaderExtensionCapability::TraceDictionary(JSTracer* trc)
{
}
RTCRtpHeaderExtensionCapability&
RTCRtpHeaderExtensionCapability::operator=(const RTCRtpHeaderExtensionCapability& aOther)
{
DictionaryBase::operator=(aOther);
mUri = aOther.mUri;
return *this;
}
bool
RTCRtpHeaderExtensionCapability::operator==(const RTCRtpHeaderExtensionCapability& aOther) const
{
if (mUri != aOther.mUri) {
return false;
}
return true;
}
RTCRtpCodecCapability::RTCRtpCodecCapability()
: RTCRtpCodec(FastDictionaryInitializer())
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
RTCRtpCodecCapability::Init(const char* sourceDescription, bool passedToJSImpl)
{
// We init the parent's members first
if (!RTCRtpCodec::Init()) {
return false;
}
return true;
}
bool
RTCRtpCodecCapability::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
// Per spec, we define the parent's members first
if (!RTCRtpCodec::ToObjectInternal(cx, rval)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, &rval.toObject());
return true;
}
void
RTCRtpCodecCapability::TraceDictionary(JSTracer* trc)
{
RTCRtpCodec::TraceDictionary(trc);
}
RTCRtpCodecCapability&
RTCRtpCodecCapability::operator=(const RTCRtpCodecCapability& aOther)
{
RTCRtpCodec::operator=(aOther);
return *this;
}
bool
RTCRtpCodecCapability::operator==(const RTCRtpCodecCapability& aOther) const
{
return true;
}
RTCRtpCapabilities::RTCRtpCapabilities()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
RTCRtpCapabilities::InitIds(JSContext* cx, RTCRtpCapabilitiesAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->headerExtensions_id.init(cx, "headerExtensions") ||
!atomsCache->codecs_id.init(cx, "codecs")) {
return false;
}
return true;
}
bool
RTCRtpCapabilities::Init(const char* sourceDescription, bool passedToJSImpl)
{
return true;
}
bool
RTCRtpCapabilities::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
RTCRtpCapabilitiesAtoms* atomsCache = GetAtomCache<RTCRtpCapabilitiesAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
Sequence<RTCRtpCodecCapability> const & currentValue = mCodecs;
uint32_t length = currentValue.Length();
JS::Rooted<JSObject*> returnArray(cx, JS::NewArrayObject(cx, length));
if (!returnArray) {
return false;
}
// Scope for 'tmp'
{
JS::Rooted<JS::Value> tmp(cx);
for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
// Control block to let us common up the JS_DefineElement calls when there
// are different ways to succeed at wrapping the object.
do {
if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
return false;
}
break;
} while (false);
if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
JSPROP_ENUMERATE)) {
return false;
}
}
}
temp.setObject(*returnArray);
if (!JS_DefinePropertyById(cx, obj, atomsCache->codecs_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
Sequence<RTCRtpHeaderExtensionCapability> const & currentValue = mHeaderExtensions;
uint32_t length = currentValue.Length();
JS::Rooted<JSObject*> returnArray(cx, JS::NewArrayObject(cx, length));
if (!returnArray) {
return false;
}
// Scope for 'tmp'
{
JS::Rooted<JS::Value> tmp(cx);
for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
// Control block to let us common up the JS_DefineElement calls when there
// are different ways to succeed at wrapping the object.
do {
if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
return false;
}
break;
} while (false);
if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
JSPROP_ENUMERATE)) {
return false;
}
}
}
temp.setObject(*returnArray);
if (!JS_DefinePropertyById(cx, obj, atomsCache->headerExtensions_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
return true;
}
void
RTCRtpCapabilities::TraceDictionary(JSTracer* trc)
{
}
RTCRtpCapabilities&
RTCRtpCapabilities::operator=(const RTCRtpCapabilities& aOther)
{
DictionaryBase::operator=(aOther);
mCodecs = aOther.mCodecs;
mHeaderExtensions = aOther.mHeaderExtensions;
return *this;
}
} // namespace mozilla::dom