WebCore/generated/JSIndexedDatabaseRequest.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(INDEXED_DATABASE)
       
    24 
       
    25 #include "JSIndexedDatabaseRequest.h"
       
    26 
       
    27 #include "IDBKeyRange.h"
       
    28 #include "IDBRequest.h"
       
    29 #include "IndexedDatabaseRequest.h"
       
    30 #include "JSIDBKeyRange.h"
       
    31 #include "JSIDBRequest.h"
       
    32 #include "SerializedScriptValue.h"
       
    33 #include <runtime/Error.h>
       
    34 #include <wtf/GetPtr.h>
       
    35 
       
    36 using namespace JSC;
       
    37 
       
    38 namespace WebCore {
       
    39 
       
    40 ASSERT_CLASS_FITS_IN_CELL(JSIndexedDatabaseRequest);
       
    41 
       
    42 /* Hash table */
       
    43 #if ENABLE(JIT)
       
    44 #define THUNK_GENERATOR(generator) , generator
       
    45 #else
       
    46 #define THUNK_GENERATOR(generator)
       
    47 #endif
       
    48 
       
    49 static const HashTableValue JSIndexedDatabaseRequestTableValues[2] =
       
    50 {
       
    51     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIndexedDatabaseRequestConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    52     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    53 };
       
    54 
       
    55 #undef THUNK_GENERATOR
       
    56 static JSC_CONST_HASHTABLE HashTable JSIndexedDatabaseRequestTable = { 2, 1, JSIndexedDatabaseRequestTableValues, 0 };
       
    57 /* Hash table for constructor */
       
    58 #if ENABLE(JIT)
       
    59 #define THUNK_GENERATOR(generator) , generator
       
    60 #else
       
    61 #define THUNK_GENERATOR(generator)
       
    62 #endif
       
    63 
       
    64 static const HashTableValue JSIndexedDatabaseRequestConstructorTableValues[1] =
       
    65 {
       
    66     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    67 };
       
    68 
       
    69 #undef THUNK_GENERATOR
       
    70 static JSC_CONST_HASHTABLE HashTable JSIndexedDatabaseRequestConstructorTable = { 1, 0, JSIndexedDatabaseRequestConstructorTableValues, 0 };
       
    71 class JSIndexedDatabaseRequestConstructor : public DOMConstructorObject {
       
    72 public:
       
    73     JSIndexedDatabaseRequestConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    74 
       
    75     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    76     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    77     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    78     static const JSC::ClassInfo s_info;
       
    79     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    80     {
       
    81         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    82     }
       
    83 protected:
       
    84     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    85 };
       
    86 
       
    87 const ClassInfo JSIndexedDatabaseRequestConstructor::s_info = { "IndexedDatabaseRequestConstructor", 0, &JSIndexedDatabaseRequestConstructorTable, 0 };
       
    88 
       
    89 JSIndexedDatabaseRequestConstructor::JSIndexedDatabaseRequestConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    90     : DOMConstructorObject(JSIndexedDatabaseRequestConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    91 {
       
    92     putDirect(exec->propertyNames().prototype, JSIndexedDatabaseRequestPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    93 }
       
    94 
       
    95 bool JSIndexedDatabaseRequestConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    96 {
       
    97     return getStaticValueSlot<JSIndexedDatabaseRequestConstructor, DOMObject>(exec, &JSIndexedDatabaseRequestConstructorTable, this, propertyName, slot);
       
    98 }
       
    99 
       
   100 bool JSIndexedDatabaseRequestConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   101 {
       
   102     return getStaticValueDescriptor<JSIndexedDatabaseRequestConstructor, DOMObject>(exec, &JSIndexedDatabaseRequestConstructorTable, this, propertyName, descriptor);
       
   103 }
       
   104 
       
   105 /* Hash table for prototype */
       
   106 #if ENABLE(JIT)
       
   107 #define THUNK_GENERATOR(generator) , generator
       
   108 #else
       
   109 #define THUNK_GENERATOR(generator)
       
   110 #endif
       
   111 
       
   112 static const HashTableValue JSIndexedDatabaseRequestPrototypeTableValues[6] =
       
   113 {
       
   114     { "open", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIndexedDatabaseRequestPrototypeFunctionOpen), (intptr_t)2 THUNK_GENERATOR(0) },
       
   115     { "makeSingleKeyRange", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIndexedDatabaseRequestPrototypeFunctionMakeSingleKeyRange), (intptr_t)1 THUNK_GENERATOR(0) },
       
   116     { "makeLeftBoundKeyRange", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIndexedDatabaseRequestPrototypeFunctionMakeLeftBoundKeyRange), (intptr_t)2 THUNK_GENERATOR(0) },
       
   117     { "makeRightBoundKeyRange", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIndexedDatabaseRequestPrototypeFunctionMakeRightBoundKeyRange), (intptr_t)2 THUNK_GENERATOR(0) },
       
   118     { "makeBoundKeyRange", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIndexedDatabaseRequestPrototypeFunctionMakeBoundKeyRange), (intptr_t)4 THUNK_GENERATOR(0) },
       
   119     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   120 };
       
   121 
       
   122 #undef THUNK_GENERATOR
       
   123 static JSC_CONST_HASHTABLE HashTable JSIndexedDatabaseRequestPrototypeTable = { 18, 15, JSIndexedDatabaseRequestPrototypeTableValues, 0 };
       
   124 const ClassInfo JSIndexedDatabaseRequestPrototype::s_info = { "IndexedDatabaseRequestPrototype", 0, &JSIndexedDatabaseRequestPrototypeTable, 0 };
       
   125 
       
   126 JSObject* JSIndexedDatabaseRequestPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   127 {
       
   128     return getDOMPrototype<JSIndexedDatabaseRequest>(exec, globalObject);
       
   129 }
       
   130 
       
   131 bool JSIndexedDatabaseRequestPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   132 {
       
   133     return getStaticFunctionSlot<JSObject>(exec, &JSIndexedDatabaseRequestPrototypeTable, this, propertyName, slot);
       
   134 }
       
   135 
       
   136 bool JSIndexedDatabaseRequestPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   137 {
       
   138     return getStaticFunctionDescriptor<JSObject>(exec, &JSIndexedDatabaseRequestPrototypeTable, this, propertyName, descriptor);
       
   139 }
       
   140 
       
   141 const ClassInfo JSIndexedDatabaseRequest::s_info = { "IndexedDatabaseRequest", 0, &JSIndexedDatabaseRequestTable, 0 };
       
   142 
       
   143 JSIndexedDatabaseRequest::JSIndexedDatabaseRequest(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<IndexedDatabaseRequest> impl)
       
   144     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   145     , m_impl(impl)
       
   146 {
       
   147 }
       
   148 
       
   149 JSIndexedDatabaseRequest::~JSIndexedDatabaseRequest()
       
   150 {
       
   151     forgetDOMObject(this, impl());
       
   152 }
       
   153 
       
   154 JSObject* JSIndexedDatabaseRequest::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   155 {
       
   156     return new (exec) JSIndexedDatabaseRequestPrototype(globalObject, JSIndexedDatabaseRequestPrototype::createStructure(globalObject->objectPrototype()));
       
   157 }
       
   158 
       
   159 bool JSIndexedDatabaseRequest::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   160 {
       
   161     return getStaticValueSlot<JSIndexedDatabaseRequest, Base>(exec, &JSIndexedDatabaseRequestTable, this, propertyName, slot);
       
   162 }
       
   163 
       
   164 bool JSIndexedDatabaseRequest::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   165 {
       
   166     return getStaticValueDescriptor<JSIndexedDatabaseRequest, Base>(exec, &JSIndexedDatabaseRequestTable, this, propertyName, descriptor);
       
   167 }
       
   168 
       
   169 JSValue jsIndexedDatabaseRequestConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   170 {
       
   171     JSIndexedDatabaseRequest* domObject = static_cast<JSIndexedDatabaseRequest*>(asObject(slotBase));
       
   172     return JSIndexedDatabaseRequest::getConstructor(exec, domObject->globalObject());
       
   173 }
       
   174 JSValue JSIndexedDatabaseRequest::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   175 {
       
   176     return getDOMConstructor<JSIndexedDatabaseRequestConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   177 }
       
   178 
       
   179 EncodedJSValue JSC_HOST_CALL jsIndexedDatabaseRequestPrototypeFunctionOpen(ExecState* exec)
       
   180 {
       
   181     JSValue thisValue = exec->hostThisValue();
       
   182     if (!thisValue.inherits(&JSIndexedDatabaseRequest::s_info))
       
   183         return throwVMTypeError(exec);
       
   184     JSIndexedDatabaseRequest* castedThis = static_cast<JSIndexedDatabaseRequest*>(asObject(thisValue));
       
   185     IndexedDatabaseRequest* imp = static_cast<IndexedDatabaseRequest*>(castedThis->impl());
       
   186     ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
       
   187     if (!scriptContext)
       
   188         return JSValue::encode(jsUndefined());
       
   189     const String& name = ustringToString(exec->argument(0).toString(exec));
       
   190     const String& description = ustringToString(exec->argument(1).toString(exec));
       
   191 
       
   192 
       
   193     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->open(scriptContext, name, description)));
       
   194     return JSValue::encode(result);
       
   195 }
       
   196 
       
   197 EncodedJSValue JSC_HOST_CALL jsIndexedDatabaseRequestPrototypeFunctionMakeSingleKeyRange(ExecState* exec)
       
   198 {
       
   199     JSValue thisValue = exec->hostThisValue();
       
   200     if (!thisValue.inherits(&JSIndexedDatabaseRequest::s_info))
       
   201         return throwVMTypeError(exec);
       
   202     JSIndexedDatabaseRequest* castedThis = static_cast<JSIndexedDatabaseRequest*>(asObject(thisValue));
       
   203     IndexedDatabaseRequest* imp = static_cast<IndexedDatabaseRequest*>(castedThis->impl());
       
   204     RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(exec, exec->argument(0));
       
   205 
       
   206 
       
   207     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeSingleKeyRange(value)));
       
   208     return JSValue::encode(result);
       
   209 }
       
   210 
       
   211 EncodedJSValue JSC_HOST_CALL jsIndexedDatabaseRequestPrototypeFunctionMakeLeftBoundKeyRange(ExecState* exec)
       
   212 {
       
   213     JSValue thisValue = exec->hostThisValue();
       
   214     if (!thisValue.inherits(&JSIndexedDatabaseRequest::s_info))
       
   215         return throwVMTypeError(exec);
       
   216     JSIndexedDatabaseRequest* castedThis = static_cast<JSIndexedDatabaseRequest*>(asObject(thisValue));
       
   217     IndexedDatabaseRequest* imp = static_cast<IndexedDatabaseRequest*>(castedThis->impl());
       
   218     RefPtr<SerializedScriptValue> bound = SerializedScriptValue::create(exec, exec->argument(0));
       
   219 
       
   220     int argsCount = exec->argumentCount();
       
   221     if (argsCount < 2) {
       
   222 
       
   223         JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeLeftBoundKeyRange(bound)));
       
   224         return JSValue::encode(result);
       
   225     }
       
   226 
       
   227     bool open = exec->argument(1).toBoolean(exec);
       
   228 
       
   229 
       
   230     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeLeftBoundKeyRange(bound, open)));
       
   231     return JSValue::encode(result);
       
   232 }
       
   233 
       
   234 EncodedJSValue JSC_HOST_CALL jsIndexedDatabaseRequestPrototypeFunctionMakeRightBoundKeyRange(ExecState* exec)
       
   235 {
       
   236     JSValue thisValue = exec->hostThisValue();
       
   237     if (!thisValue.inherits(&JSIndexedDatabaseRequest::s_info))
       
   238         return throwVMTypeError(exec);
       
   239     JSIndexedDatabaseRequest* castedThis = static_cast<JSIndexedDatabaseRequest*>(asObject(thisValue));
       
   240     IndexedDatabaseRequest* imp = static_cast<IndexedDatabaseRequest*>(castedThis->impl());
       
   241     RefPtr<SerializedScriptValue> bound = SerializedScriptValue::create(exec, exec->argument(0));
       
   242 
       
   243     int argsCount = exec->argumentCount();
       
   244     if (argsCount < 2) {
       
   245 
       
   246         JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeRightBoundKeyRange(bound)));
       
   247         return JSValue::encode(result);
       
   248     }
       
   249 
       
   250     bool open = exec->argument(1).toBoolean(exec);
       
   251 
       
   252 
       
   253     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeRightBoundKeyRange(bound, open)));
       
   254     return JSValue::encode(result);
       
   255 }
       
   256 
       
   257 EncodedJSValue JSC_HOST_CALL jsIndexedDatabaseRequestPrototypeFunctionMakeBoundKeyRange(ExecState* exec)
       
   258 {
       
   259     JSValue thisValue = exec->hostThisValue();
       
   260     if (!thisValue.inherits(&JSIndexedDatabaseRequest::s_info))
       
   261         return throwVMTypeError(exec);
       
   262     JSIndexedDatabaseRequest* castedThis = static_cast<JSIndexedDatabaseRequest*>(asObject(thisValue));
       
   263     IndexedDatabaseRequest* imp = static_cast<IndexedDatabaseRequest*>(castedThis->impl());
       
   264     RefPtr<SerializedScriptValue> left = SerializedScriptValue::create(exec, exec->argument(0));
       
   265     RefPtr<SerializedScriptValue> right = SerializedScriptValue::create(exec, exec->argument(1));
       
   266 
       
   267     int argsCount = exec->argumentCount();
       
   268     if (argsCount < 3) {
       
   269 
       
   270         JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeBoundKeyRange(left, right)));
       
   271         return JSValue::encode(result);
       
   272     }
       
   273 
       
   274     bool openLeft = exec->argument(2).toBoolean(exec);
       
   275     if (argsCount < 4) {
       
   276 
       
   277         JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeBoundKeyRange(left, right, openLeft)));
       
   278         return JSValue::encode(result);
       
   279     }
       
   280 
       
   281     bool openRight = exec->argument(3).toBoolean(exec);
       
   282 
       
   283 
       
   284     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->makeBoundKeyRange(left, right, openLeft, openRight)));
       
   285     return JSValue::encode(result);
       
   286 }
       
   287 
       
   288 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, IndexedDatabaseRequest* object)
       
   289 {
       
   290     return getDOMObjectWrapper<JSIndexedDatabaseRequest>(exec, globalObject, object);
       
   291 }
       
   292 IndexedDatabaseRequest* toIndexedDatabaseRequest(JSC::JSValue value)
       
   293 {
       
   294     return value.inherits(&JSIndexedDatabaseRequest::s_info) ? static_cast<JSIndexedDatabaseRequest*>(asObject(value))->impl() : 0;
       
   295 }
       
   296 
       
   297 }
       
   298 
       
   299 #endif // ENABLE(INDEXED_DATABASE)