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

#include "JSSQLTransactionSync.h"

#include "SQLTransactionSync.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table for prototype */

static const HashTableValue JSSQLTransactionSyncPrototypeTableValues[] =
{
    { "executeSql", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsSQLTransactionSyncPrototypeFunctionExecuteSql), (intptr_t) (2) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSSQLTransactionSyncPrototypeTable = { 2, 1, false, JSSQLTransactionSyncPrototypeTableValues, 0 };
static const HashTable& getJSSQLTransactionSyncPrototypeTable(VM& vm)
{
    return getHashTableForGlobalData(vm, JSSQLTransactionSyncPrototypeTable);
}

const ClassInfo JSSQLTransactionSyncPrototype::s_info = { "SQLTransactionSyncPrototype", &Base::s_info, 0, getJSSQLTransactionSyncPrototypeTable, CREATE_METHOD_TABLE(JSSQLTransactionSyncPrototype) };

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

bool JSSQLTransactionSyncPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSSQLTransactionSyncPrototype* thisObject = jsCast<JSSQLTransactionSyncPrototype*>(object);
    return getStaticFunctionSlot<JSObject>(exec, getJSSQLTransactionSyncPrototypeTable(exec->vm()), thisObject, propertyName, slot);
}

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

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

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

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

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

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

EncodedJSValue JSC_HOST_CALL jsSQLTransactionSyncPrototypeFunctionExecuteSql(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSSQLTransactionSync* castedThis = jsDynamicCast<JSSQLTransactionSync*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSSQLTransactionSync::info());
    return JSValue::encode(castedThis->executeSql(exec));
}

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

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

JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SQLTransactionSync* impl)
{
    if (!impl)
        return jsNull();
    if (JSValue result = getExistingWrapper<JSSQLTransactionSync>(exec, impl))
        return result;
#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 SQLTransactionSync.
    COMPILE_ASSERT(!__is_polymorphic(SQLTransactionSync), SQLTransactionSync_is_polymorphic_but_idl_claims_not_to_be);
#endif
    ReportMemoryCost<SQLTransactionSync>::reportMemoryCost(exec, impl);
    return createNewWrapper<JSSQLTransactionSync>(exec, globalObject, impl);
}

SQLTransactionSync* toSQLTransactionSync(JSC::JSValue value)
{
    return value.inherits(JSSQLTransactionSync::info()) ? &jsCast<JSSQLTransactionSync*>(value)->impl() : 0;
}

}

#endif // ENABLE(SQL_DATABASE)
