/*
    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(MEDIA_STREAM)

#include "JSAllVideoCapabilities.h"

#include "AllVideoCapabilities.h"
#include "CapabilityRange.h"
#include "DOMStringList.h"
#include "JSCapabilityRange.h"
#include "JSDOMStringList.h"
#include <runtime/JSArray.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table */

static const HashTableValue JSAllVideoCapabilitiesTableValues[] =
{
    { "sourceType", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesSourceType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "sourceId", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesSourceId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "width", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "height", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "frameRate", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesFrameRate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "aspectRatio", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesAspectRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "facingMode", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAllVideoCapabilitiesFacingMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSAllVideoCapabilitiesTable = { 17, 15, true, JSAllVideoCapabilitiesTableValues, 0 };
/* Hash table for prototype */

static const HashTableValue JSAllVideoCapabilitiesPrototypeTableValues[] =
{
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSAllVideoCapabilitiesPrototypeTable = { 1, 0, false, JSAllVideoCapabilitiesPrototypeTableValues, 0 };
const ClassInfo JSAllVideoCapabilitiesPrototype::s_info = { "AllVideoCapabilitiesPrototype", &Base::s_info, &JSAllVideoCapabilitiesPrototypeTable, 0, CREATE_METHOD_TABLE(JSAllVideoCapabilitiesPrototype) };

JSObject* JSAllVideoCapabilitiesPrototype::self(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSAllVideoCapabilities>(vm, globalObject);
}

const ClassInfo JSAllVideoCapabilities::s_info = { "AllVideoCapabilities", &Base::s_info, &JSAllVideoCapabilitiesTable, 0 , CREATE_METHOD_TABLE(JSAllVideoCapabilities) };

JSAllVideoCapabilities::JSAllVideoCapabilities(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<AllVideoCapabilities> impl)
    : JSMediaStreamCapabilities(structure, globalObject, impl)
{
}

void JSAllVideoCapabilities::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
}

JSObject* JSAllVideoCapabilities::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
    return JSAllVideoCapabilitiesPrototype::create(vm, globalObject, JSAllVideoCapabilitiesPrototype::createStructure(vm, globalObject, JSMediaStreamCapabilitiesPrototype::self(vm, globalObject)));
}

bool JSAllVideoCapabilities::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSAllVideoCapabilities* thisObject = jsCast<JSAllVideoCapabilities*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    return getStaticValueSlot<JSAllVideoCapabilities, Base>(exec, JSAllVideoCapabilitiesTable, thisObject, propertyName, slot);
}

EncodedJSValue jsAllVideoCapabilitiesSourceType(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = jsArray(exec, castedThis->globalObject(), impl.sourceType());
    return JSValue::encode(result);
}


EncodedJSValue jsAllVideoCapabilitiesSourceId(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = jsArray(exec, castedThis->globalObject(), impl.sourceId());
    return JSValue::encode(result);
}


EncodedJSValue jsAllVideoCapabilitiesWidth(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.width()));
    return JSValue::encode(result);
}


EncodedJSValue jsAllVideoCapabilitiesHeight(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.height()));
    return JSValue::encode(result);
}


EncodedJSValue jsAllVideoCapabilitiesFrameRate(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.frameRate()));
    return JSValue::encode(result);
}


EncodedJSValue jsAllVideoCapabilitiesAspectRatio(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.aspectRatio()));
    return JSValue::encode(result);
}


EncodedJSValue jsAllVideoCapabilitiesFacingMode(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSAllVideoCapabilities* castedThis = jsDynamicCast<JSAllVideoCapabilities*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    AllVideoCapabilities& impl = castedThis->impl();
    JSValue result = jsArray(exec, castedThis->globalObject(), impl.facingMode());
    return JSValue::encode(result);
}


#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7AllVideoCapabilities@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore20AllVideoCapabilitiesE[]; }
#endif
#endif
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, AllVideoCapabilities* impl)
{
    if (!impl)
        return jsNull();
    if (JSValue result = getExistingWrapper<JSAllVideoCapabilities>(exec, impl))
        return result;

#if ENABLE(BINDING_INTEGRITY)
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
#if PLATFORM(WIN)
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7AllVideoCapabilities@WebCore@@6B@"));
#else
    void* expectedVTablePointer = &_ZTVN7WebCore20AllVideoCapabilitiesE[2];
#if COMPILER(CLANG)
    // If this fails AllVideoCapabilities does not have a vtable, so you need to add the
    // ImplementationLacksVTable attribute to the interface definition
    COMPILE_ASSERT(__is_polymorphic(AllVideoCapabilities), AllVideoCapabilities_is_not_polymorphic);
#endif
#endif
    // If you hit this assertion you either have a use after free bug, or
    // AllVideoCapabilities has subclasses. If AllVideoCapabilities has subclasses that get passed
    // to toJS() we currently require AllVideoCapabilities you to opt out of binding hardening
    // by adding the SkipVTableValidation attribute to the interface IDL definition
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
    ReportMemoryCost<AllVideoCapabilities>::reportMemoryCost(exec, impl);
    return createNewWrapper<JSAllVideoCapabilities>(exec, globalObject, impl);
}


}

#endif // ENABLE(MEDIA_STREAM)
