blob: f018b10a28a1503f95f673efdf9e34d4dd74686e [file] [log] [blame]
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#if ENABLE(WEB_RTC)
#include "JSRTCStatsReport.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSRTCStatsReport.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSArray.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsRTCStatsReportPrototypeFunctionStat(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsRTCStatsReportPrototypeFunctionNames(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsRTCStatsReportTimestamp(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCStatsReportId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCStatsReportType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCStatsReportLocal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCStatsReportRemote(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSRTCStatsReportConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSRTCStatsReportPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSRTCStatsReportPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSRTCStatsReportPrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCStatsReportPrototype>(vm.heap)) JSRTCStatsReportPrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSRTCStatsReportPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
/* Hash table for prototype */
static const HashTableValue JSRTCStatsReportPrototypeTableValues[] =
{
{ "timestamp", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReportTimestamp), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "id", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReportId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "type", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReportType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "local", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReportLocal), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "remote", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReportRemote), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "stat", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsRTCStatsReportPrototypeFunctionStat), (intptr_t) (1) } },
{ "names", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsRTCStatsReportPrototypeFunctionNames), (intptr_t) (0) } },
};
const ClassInfo JSRTCStatsReportPrototype::s_info = { "RTCStatsReportPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCStatsReportPrototype) };
void JSRTCStatsReportPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSRTCStatsReportPrototypeTableValues, *this);
}
const ClassInfo JSRTCStatsReport::s_info = { "RTCStatsReport", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCStatsReport) };
JSRTCStatsReport::JSRTCStatsReport(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCStatsReport>&& impl)
: JSDOMWrapper<RTCStatsReport>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSRTCStatsReport::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSRTCStatsReportPrototype::create(vm, globalObject, JSRTCStatsReportPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSRTCStatsReport::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSRTCStatsReport>(vm, globalObject);
}
void JSRTCStatsReport::destroy(JSC::JSCell* cell)
{
JSRTCStatsReport* thisObject = static_cast<JSRTCStatsReport*>(cell);
thisObject->JSRTCStatsReport::~JSRTCStatsReport();
}
EncodedJSValue jsRTCStatsReportTimestamp(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSRTCStatsReport*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCStatsReport", "timestamp");
}
auto& impl = castedThis->wrapped();
JSValue result = jsDate(state, impl.timestamp());
return JSValue::encode(result);
}
EncodedJSValue jsRTCStatsReportId(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSRTCStatsReport*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCStatsReport", "id");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.id());
return JSValue::encode(result);
}
EncodedJSValue jsRTCStatsReportType(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSRTCStatsReport*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCStatsReport", "type");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.type());
return JSValue::encode(result);
}
EncodedJSValue jsRTCStatsReportLocal(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSRTCStatsReport*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCStatsReport", "local");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(state, castedThis->globalObject(), impl.local());
return JSValue::encode(result);
}
EncodedJSValue jsRTCStatsReportRemote(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSRTCStatsReport*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCStatsReport", "remote");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(state, castedThis->globalObject(), impl.remote());
return JSValue::encode(result);
}
bool setJSRTCStatsReportConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSRTCStatsReportPrototype* domObject = jsDynamicCast<JSRTCStatsReportPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
EncodedJSValue JSC_HOST_CALL jsRTCStatsReportPrototypeFunctionStat(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSRTCStatsReport*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "RTCStatsReport", "stat");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSRTCStatsReport::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto name = state->uncheckedArgument(0).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = jsStringWithCache(state, impl.stat(WTFMove(name)));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsRTCStatsReportPrototypeFunctionNames(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSRTCStatsReport*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "RTCStatsReport", "names");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSRTCStatsReport::info());
auto& impl = castedThis->wrapped();
JSValue result = jsArray(state, castedThis->globalObject(), impl.names());
return JSValue::encode(result);
}
bool JSRTCStatsReportOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSRTCStatsReportOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsRTCStatsReport = jsCast<JSRTCStatsReport*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsRTCStatsReport->wrapped(), jsRTCStatsReport);
}
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<RTCStatsReport>&& impl)
{
#if COMPILER(CLANG)
// If you hit this failure the interface definition has the ImplementationLacksVTable
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
// attribute to RTCStatsReport.
static_assert(!__is_polymorphic(RTCStatsReport), "RTCStatsReport is polymorphic but the IDL claims it is not");
#endif
return createWrapper<RTCStatsReport>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RTCStatsReport& impl)
{
return wrap(state, globalObject, impl);
}
RTCStatsReport* JSRTCStatsReport::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSRTCStatsReport*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(WEB_RTC)