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

#include "JSWebGLVertexArrayObjectOES.h"

#include "WebGLVertexArrayObjectOES.h"
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table for prototype */

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

static const HashTable JSWebGLVertexArrayObjectOESPrototypeTable = { 1, 0, false, JSWebGLVertexArrayObjectOESPrototypeTableValues, 0 };
const ClassInfo JSWebGLVertexArrayObjectOESPrototype::s_info = { "WebGLVertexArrayObjectOESPrototype", &Base::s_info, &JSWebGLVertexArrayObjectOESPrototypeTable, 0, CREATE_METHOD_TABLE(JSWebGLVertexArrayObjectOESPrototype) };

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

const ClassInfo JSWebGLVertexArrayObjectOES::s_info = { "WebGLVertexArrayObjectOES", &Base::s_info, 0, 0 , CREATE_METHOD_TABLE(JSWebGLVertexArrayObjectOES) };

JSWebGLVertexArrayObjectOES::JSWebGLVertexArrayObjectOES(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<WebGLVertexArrayObjectOES> impl)
    : JSDOMWrapper(structure, globalObject)
    , m_impl(impl.leakRef())
{
}

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

JSObject* JSWebGLVertexArrayObjectOES::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
    return JSWebGLVertexArrayObjectOESPrototype::create(vm, globalObject, JSWebGLVertexArrayObjectOESPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}

void JSWebGLVertexArrayObjectOES::destroy(JSC::JSCell* cell)
{
    JSWebGLVertexArrayObjectOES* thisObject = static_cast<JSWebGLVertexArrayObjectOES*>(cell);
    thisObject->JSWebGLVertexArrayObjectOES::~JSWebGLVertexArrayObjectOES();
}

JSWebGLVertexArrayObjectOES::~JSWebGLVertexArrayObjectOES()
{
    releaseImplIfNotNull();
}

bool JSWebGLVertexArrayObjectOESOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    UNUSED_PARAM(handle);
    UNUSED_PARAM(visitor);
    return false;
}

void JSWebGLVertexArrayObjectOESOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSWebGLVertexArrayObjectOES* jsWebGLVertexArrayObjectOES = jsCast<JSWebGLVertexArrayObjectOES*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsWebGLVertexArrayObjectOES->impl(), jsWebGLVertexArrayObjectOES);
    jsWebGLVertexArrayObjectOES->releaseImpl();
}

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

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

WebGLVertexArrayObjectOES* toWebGLVertexArrayObjectOES(JSC::JSValue value)
{
    return value.inherits(JSWebGLVertexArrayObjectOES::info()) ? &jsCast<JSWebGLVertexArrayObjectOES*>(value)->impl() : 0;
}

}

#endif // ENABLE(WEBGL)
