WebCore/generated/JSDatabase.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2     This file is part of the WebKit open source project.
       
     3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #include "config.h"
       
    22 
       
    23 #if ENABLE(DATABASE)
       
    24 
       
    25 #include "JSDatabase.h"
       
    26 
       
    27 #include "Database.h"
       
    28 #include "KURL.h"
       
    29 #include <runtime/Error.h>
       
    30 #include <runtime/JSString.h>
       
    31 #include <wtf/GetPtr.h>
       
    32 
       
    33 using namespace JSC;
       
    34 
       
    35 namespace WebCore {
       
    36 
       
    37 ASSERT_CLASS_FITS_IN_CELL(JSDatabase);
       
    38 
       
    39 /* Hash table */
       
    40 #if ENABLE(JIT)
       
    41 #define THUNK_GENERATOR(generator) , generator
       
    42 #else
       
    43 #define THUNK_GENERATOR(generator)
       
    44 #endif
       
    45 
       
    46 static const HashTableValue JSDatabaseTableValues[2] =
       
    47 {
       
    48     { "version", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDatabaseVersion), (intptr_t)0 THUNK_GENERATOR(0) },
       
    49     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    50 };
       
    51 
       
    52 #undef THUNK_GENERATOR
       
    53 static JSC_CONST_HASHTABLE HashTable JSDatabaseTable = { 2, 1, JSDatabaseTableValues, 0 };
       
    54 /* Hash table for prototype */
       
    55 #if ENABLE(JIT)
       
    56 #define THUNK_GENERATOR(generator) , generator
       
    57 #else
       
    58 #define THUNK_GENERATOR(generator)
       
    59 #endif
       
    60 
       
    61 static const HashTableValue JSDatabasePrototypeTableValues[4] =
       
    62 {
       
    63     { "changeVersion", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDatabasePrototypeFunctionChangeVersion), (intptr_t)5 THUNK_GENERATOR(0) },
       
    64     { "transaction", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDatabasePrototypeFunctionTransaction), (intptr_t)3 THUNK_GENERATOR(0) },
       
    65     { "readTransaction", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDatabasePrototypeFunctionReadTransaction), (intptr_t)3 THUNK_GENERATOR(0) },
       
    66     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    67 };
       
    68 
       
    69 #undef THUNK_GENERATOR
       
    70 static JSC_CONST_HASHTABLE HashTable JSDatabasePrototypeTable = { 8, 7, JSDatabasePrototypeTableValues, 0 };
       
    71 static const HashTable* getJSDatabasePrototypeTable(ExecState* exec)
       
    72 {
       
    73     return getHashTableForGlobalData(exec->globalData(), &JSDatabasePrototypeTable);
       
    74 }
       
    75 const ClassInfo JSDatabasePrototype::s_info = { "DatabasePrototype", 0, 0, getJSDatabasePrototypeTable };
       
    76 
       
    77 JSObject* JSDatabasePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
    78 {
       
    79     return getDOMPrototype<JSDatabase>(exec, globalObject);
       
    80 }
       
    81 
       
    82 bool JSDatabasePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    83 {
       
    84     return getStaticFunctionSlot<JSObject>(exec, getJSDatabasePrototypeTable(exec), this, propertyName, slot);
       
    85 }
       
    86 
       
    87 bool JSDatabasePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    88 {
       
    89     return getStaticFunctionDescriptor<JSObject>(exec, getJSDatabasePrototypeTable(exec), this, propertyName, descriptor);
       
    90 }
       
    91 
       
    92 static const HashTable* getJSDatabaseTable(ExecState* exec)
       
    93 {
       
    94     return getHashTableForGlobalData(exec->globalData(), &JSDatabaseTable);
       
    95 }
       
    96 const ClassInfo JSDatabase::s_info = { "Database", 0, 0, getJSDatabaseTable };
       
    97 
       
    98 JSDatabase::JSDatabase(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Database> impl)
       
    99     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   100     , m_impl(impl)
       
   101 {
       
   102 }
       
   103 
       
   104 JSDatabase::~JSDatabase()
       
   105 {
       
   106     forgetDOMObject(this, impl());
       
   107 }
       
   108 
       
   109 JSObject* JSDatabase::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   110 {
       
   111     return new (exec) JSDatabasePrototype(globalObject, JSDatabasePrototype::createStructure(globalObject->objectPrototype()));
       
   112 }
       
   113 
       
   114 bool JSDatabase::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   115 {
       
   116     return getStaticValueSlot<JSDatabase, Base>(exec, getJSDatabaseTable(exec), this, propertyName, slot);
       
   117 }
       
   118 
       
   119 bool JSDatabase::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   120 {
       
   121     return getStaticValueDescriptor<JSDatabase, Base>(exec, getJSDatabaseTable(exec), this, propertyName, descriptor);
       
   122 }
       
   123 
       
   124 JSValue jsDatabaseVersion(ExecState* exec, JSValue slotBase, const Identifier&)
       
   125 {
       
   126     JSDatabase* castedThis = static_cast<JSDatabase*>(asObject(slotBase));
       
   127     UNUSED_PARAM(exec);
       
   128     Database* imp = static_cast<Database*>(castedThis->impl());
       
   129     JSValue result = jsString(exec, imp->version());
       
   130     return result;
       
   131 }
       
   132 
       
   133 EncodedJSValue JSC_HOST_CALL jsDatabasePrototypeFunctionChangeVersion(ExecState* exec)
       
   134 {
       
   135     JSValue thisValue = exec->hostThisValue();
       
   136     if (!thisValue.inherits(&JSDatabase::s_info))
       
   137         return throwVMTypeError(exec);
       
   138     JSDatabase* castedThis = static_cast<JSDatabase*>(asObject(thisValue));
       
   139     return JSValue::encode(castedThis->changeVersion(exec));
       
   140 }
       
   141 
       
   142 EncodedJSValue JSC_HOST_CALL jsDatabasePrototypeFunctionTransaction(ExecState* exec)
       
   143 {
       
   144     JSValue thisValue = exec->hostThisValue();
       
   145     if (!thisValue.inherits(&JSDatabase::s_info))
       
   146         return throwVMTypeError(exec);
       
   147     JSDatabase* castedThis = static_cast<JSDatabase*>(asObject(thisValue));
       
   148     return JSValue::encode(castedThis->transaction(exec));
       
   149 }
       
   150 
       
   151 EncodedJSValue JSC_HOST_CALL jsDatabasePrototypeFunctionReadTransaction(ExecState* exec)
       
   152 {
       
   153     JSValue thisValue = exec->hostThisValue();
       
   154     if (!thisValue.inherits(&JSDatabase::s_info))
       
   155         return throwVMTypeError(exec);
       
   156     JSDatabase* castedThis = static_cast<JSDatabase*>(asObject(thisValue));
       
   157     return JSValue::encode(castedThis->readTransaction(exec));
       
   158 }
       
   159 
       
   160 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Database* object)
       
   161 {
       
   162     return getDOMObjectWrapper<JSDatabase>(exec, globalObject, object);
       
   163 }
       
   164 Database* toDatabase(JSC::JSValue value)
       
   165 {
       
   166     return value.inherits(&JSDatabase::s_info) ? static_cast<JSDatabase*>(asObject(value))->impl() : 0;
       
   167 }
       
   168 
       
   169 }
       
   170 
       
   171 #endif // ENABLE(DATABASE)