WebCore/generated/JSIDBKey.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 "JSIDBKey.h"
       
    26 
       
    27 #include "IDBKey.h"
       
    28 #include <wtf/GetPtr.h>
       
    29 
       
    30 using namespace JSC;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 ASSERT_CLASS_FITS_IN_CELL(JSIDBKey);
       
    35 
       
    36 /* Hash table */
       
    37 #if ENABLE(JIT)
       
    38 #define THUNK_GENERATOR(generator) , generator
       
    39 #else
       
    40 #define THUNK_GENERATOR(generator)
       
    41 #endif
       
    42 
       
    43 static const HashTableValue JSIDBKeyTableValues[2] =
       
    44 {
       
    45     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    46     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    47 };
       
    48 
       
    49 #undef THUNK_GENERATOR
       
    50 static JSC_CONST_HASHTABLE HashTable JSIDBKeyTable = { 2, 1, JSIDBKeyTableValues, 0 };
       
    51 /* Hash table for constructor */
       
    52 #if ENABLE(JIT)
       
    53 #define THUNK_GENERATOR(generator) , generator
       
    54 #else
       
    55 #define THUNK_GENERATOR(generator)
       
    56 #endif
       
    57 
       
    58 static const HashTableValue JSIDBKeyConstructorTableValues[1] =
       
    59 {
       
    60     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    61 };
       
    62 
       
    63 #undef THUNK_GENERATOR
       
    64 static JSC_CONST_HASHTABLE HashTable JSIDBKeyConstructorTable = { 1, 0, JSIDBKeyConstructorTableValues, 0 };
       
    65 class JSIDBKeyConstructor : public DOMConstructorObject {
       
    66 public:
       
    67     JSIDBKeyConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    68 
       
    69     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    70     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    71     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    72     static const JSC::ClassInfo s_info;
       
    73     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    74     {
       
    75         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    76     }
       
    77 protected:
       
    78     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    79 };
       
    80 
       
    81 const ClassInfo JSIDBKeyConstructor::s_info = { "IDBKeyConstructor", 0, &JSIDBKeyConstructorTable, 0 };
       
    82 
       
    83 JSIDBKeyConstructor::JSIDBKeyConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    84     : DOMConstructorObject(JSIDBKeyConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    85 {
       
    86     putDirect(exec->propertyNames().prototype, JSIDBKeyPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    87 }
       
    88 
       
    89 bool JSIDBKeyConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    90 {
       
    91     return getStaticValueSlot<JSIDBKeyConstructor, DOMObject>(exec, &JSIDBKeyConstructorTable, this, propertyName, slot);
       
    92 }
       
    93 
       
    94 bool JSIDBKeyConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    95 {
       
    96     return getStaticValueDescriptor<JSIDBKeyConstructor, DOMObject>(exec, &JSIDBKeyConstructorTable, this, propertyName, descriptor);
       
    97 }
       
    98 
       
    99 /* Hash table for prototype */
       
   100 #if ENABLE(JIT)
       
   101 #define THUNK_GENERATOR(generator) , generator
       
   102 #else
       
   103 #define THUNK_GENERATOR(generator)
       
   104 #endif
       
   105 
       
   106 static const HashTableValue JSIDBKeyPrototypeTableValues[1] =
       
   107 {
       
   108     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   109 };
       
   110 
       
   111 #undef THUNK_GENERATOR
       
   112 static JSC_CONST_HASHTABLE HashTable JSIDBKeyPrototypeTable = { 1, 0, JSIDBKeyPrototypeTableValues, 0 };
       
   113 const ClassInfo JSIDBKeyPrototype::s_info = { "IDBKeyPrototype", 0, &JSIDBKeyPrototypeTable, 0 };
       
   114 
       
   115 JSObject* JSIDBKeyPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   116 {
       
   117     return getDOMPrototype<JSIDBKey>(exec, globalObject);
       
   118 }
       
   119 
       
   120 const ClassInfo JSIDBKey::s_info = { "IDBKey", 0, &JSIDBKeyTable, 0 };
       
   121 
       
   122 JSIDBKey::JSIDBKey(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<IDBKey> impl)
       
   123     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   124     , m_impl(impl)
       
   125 {
       
   126 }
       
   127 
       
   128 JSIDBKey::~JSIDBKey()
       
   129 {
       
   130     forgetDOMObject(this, impl());
       
   131 }
       
   132 
       
   133 JSObject* JSIDBKey::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   134 {
       
   135     return new (exec) JSIDBKeyPrototype(globalObject, JSIDBKeyPrototype::createStructure(globalObject->objectPrototype()));
       
   136 }
       
   137 
       
   138 bool JSIDBKey::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   139 {
       
   140     return getStaticValueSlot<JSIDBKey, Base>(exec, &JSIDBKeyTable, this, propertyName, slot);
       
   141 }
       
   142 
       
   143 bool JSIDBKey::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   144 {
       
   145     return getStaticValueDescriptor<JSIDBKey, Base>(exec, &JSIDBKeyTable, this, propertyName, descriptor);
       
   146 }
       
   147 
       
   148 JSValue jsIDBKeyConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   149 {
       
   150     JSIDBKey* domObject = static_cast<JSIDBKey*>(asObject(slotBase));
       
   151     return JSIDBKey::getConstructor(exec, domObject->globalObject());
       
   152 }
       
   153 JSValue JSIDBKey::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   154 {
       
   155     return getDOMConstructor<JSIDBKeyConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   156 }
       
   157 
       
   158 IDBKey* toIDBKey(JSC::JSValue value)
       
   159 {
       
   160     return value.inherits(&JSIDBKey::s_info) ? static_cast<JSIDBKey*>(asObject(value))->impl() : 0;
       
   161 }
       
   162 
       
   163 }
       
   164 
       
   165 #endif // ENABLE(INDEXED_DATABASE)