blob: 1b9fe314072d3c8c88f8f4efd40964f324cffe1a [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 "JSRTCStatsResponse.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSRTCStatsReport.h"
#include "RTCStatsReport.h"
#include "wtf/text/AtomicString.h"
#include <runtime/Error.h>
#include <runtime/JSArray.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsRTCStatsResponsePrototypeFunctionResult(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsRTCStatsResponsePrototypeFunctionNamedItem(JSC::ExecState*);
class JSRTCStatsResponsePrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSRTCStatsResponsePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSRTCStatsResponsePrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCStatsResponsePrototype>(vm.heap)) JSRTCStatsResponsePrototype(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:
JSRTCStatsResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
/* Hash table for prototype */
static const HashTableValue JSRTCStatsResponsePrototypeTableValues[] =
{
{ "result", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsRTCStatsResponsePrototypeFunctionResult), (intptr_t) (0) } },
{ "namedItem", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsRTCStatsResponsePrototypeFunctionNamedItem), (intptr_t) (1) } },
};
const ClassInfo JSRTCStatsResponsePrototype::s_info = { "RTCStatsResponsePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCStatsResponsePrototype) };
void JSRTCStatsResponsePrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSRTCStatsResponsePrototypeTableValues, *this);
}
const ClassInfo JSRTCStatsResponse::s_info = { "RTCStatsResponse", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCStatsResponse) };
JSRTCStatsResponse::JSRTCStatsResponse(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCStatsResponse>&& impl)
: JSDOMWrapper<RTCStatsResponse>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSRTCStatsResponse::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSRTCStatsResponsePrototype::create(vm, globalObject, JSRTCStatsResponsePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSRTCStatsResponse::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSRTCStatsResponse>(vm, globalObject);
}
void JSRTCStatsResponse::destroy(JSC::JSCell* cell)
{
JSRTCStatsResponse* thisObject = static_cast<JSRTCStatsResponse*>(cell);
thisObject->JSRTCStatsResponse::~JSRTCStatsResponse();
}
bool JSRTCStatsResponse::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
{
auto* thisObject = jsCast<JSRTCStatsResponse*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
return true;
JSValue proto = thisObject->getPrototypeDirect();
if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
return false;
if (thisObject->classInfo() == info()) {
JSValue value;
if (thisObject->nameGetter(state, propertyName, value)) {
slot.setValue(thisObject, ReadOnly | DontEnum, value);
return true;
}
}
return false;
}
bool JSRTCStatsResponse::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
{
auto* thisObject = jsCast<JSRTCStatsResponse*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Identifier propertyName = Identifier::from(state, index);
if (thisObject->classInfo() == info()) {
JSValue value;
if (thisObject->nameGetter(state, propertyName, value)) {
slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum, value);
return true;
}
}
return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
}
void JSRTCStatsResponse::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
{
auto* thisObject = jsCast<JSRTCStatsResponse*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
if (mode.includeDontEnumProperties()) {
for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
propertyNames.add(Identifier::fromString(state, propertyName));
}
Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
}
EncodedJSValue JSC_HOST_CALL jsRTCStatsResponsePrototypeFunctionResult(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSRTCStatsResponse*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "RTCStatsResponse", "result");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSRTCStatsResponse::info());
auto& impl = castedThis->wrapped();
JSValue result = jsArray(state, castedThis->globalObject(), impl.result());
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsRTCStatsResponsePrototypeFunctionNamedItem(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSRTCStatsResponse*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "RTCStatsResponse", "namedItem");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSRTCStatsResponse::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 = toJS(state, castedThis->globalObject(), impl.namedItem(WTFMove(name)));
return JSValue::encode(result);
}
bool JSRTCStatsResponseOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSRTCStatsResponseOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsRTCStatsResponse = jsCast<JSRTCStatsResponse*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsRTCStatsResponse->wrapped(), jsRTCStatsResponse);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7RTCStatsResponse@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore16RTCStatsResponseE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<RTCStatsResponse>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7RTCStatsResponse@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore16RTCStatsResponseE[2];
#if COMPILER(CLANG)
// If this fails RTCStatsResponse does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(RTCStatsResponse), "RTCStatsResponse is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// RTCStatsResponse has subclasses. If RTCStatsResponse has subclasses that get passed
// to toJS() we currently require RTCStatsResponse you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<RTCStatsResponse>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RTCStatsResponse& impl)
{
return wrap(state, globalObject, impl);
}
RTCStatsResponse* JSRTCStatsResponse::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSRTCStatsResponse*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(WEB_RTC)