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 #include "JSTestMediaQueryListListener.h" 23 24 #include "ExceptionCode.h" 25 #include "JSDOMBinding.h" 26 #include "MediaQueryListListener.h" 27 #include "TestMediaQueryListListener.h" 28 #include <runtime/Error.h> 29 #include <wtf/GetPtr.h> 30 31 using namespace JSC; 32 33 namespace WebCore { 34 35 ASSERT_CLASS_FITS_IN_CELL(JSTestMediaQueryListListener); 36 37 /* Hash table */ 38 #if ENABLE(JIT) 39 #define THUNK_GENERATOR(generator) , generator 40 #else 41 #define THUNK_GENERATOR(generator) 42 #endif 43 44 static const HashTableValue JSTestMediaQueryListListenerTableValues[2] = 45 { 46 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestMediaQueryListListenerConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, 47 { 0, 0, 0, 0 THUNK_GENERATOR(0) } 48 }; 49 50 #undef THUNK_GENERATOR 51 static JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerTable = { 2, 1, JSTestMediaQueryListListenerTableValues, 0 }; 52 /* Hash table for constructor */ 53 #if ENABLE(JIT) 54 #define THUNK_GENERATOR(generator) , generator 55 #else 56 #define THUNK_GENERATOR(generator) 57 #endif 58 59 static const HashTableValue JSTestMediaQueryListListenerConstructorTableValues[1] = 60 { 61 { 0, 0, 0, 0 THUNK_GENERATOR(0) } 62 }; 63 64 #undef THUNK_GENERATOR 65 static JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerConstructorTable = { 1, 0, JSTestMediaQueryListListenerConstructorTableValues, 0 }; 66 class JSTestMediaQueryListListenerConstructor : public DOMConstructorObject { 67 public: 68 JSTestMediaQueryListListenerConstructor(JSC::ExecState*, JSDOMGlobalObject*); 69 70 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); 71 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); 72 static const JSC::ClassInfo s_info; 73 static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) 74 { 75 return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); 76 } 77 protected: 78 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; 79 }; 80 81 const ClassInfo JSTestMediaQueryListListenerConstructor::s_info = { "TestMediaQueryListListenerConstructor", &DOMConstructorObject::s_info, &JSTestMediaQueryListListenerConstructorTable, 0 }; 82 83 JSTestMediaQueryListListenerConstructor::JSTestMediaQueryListListenerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) 84 : DOMConstructorObject(JSTestMediaQueryListListenerConstructor::createStructure(globalObject->globalData(), globalObject->objectPrototype()), globalObject) 85 { 86 ASSERT(inherits(&s_info)); 87 putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestMediaQueryListListenerPrototype::self(exec, globalObject), DontDelete | ReadOnly); 88 } 89 90 bool JSTestMediaQueryListListenerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 91 { 92 return getStaticValueSlot<JSTestMediaQueryListListenerConstructor, DOMObject>(exec, &JSTestMediaQueryListListenerConstructorTable, this, propertyName, slot); 93 } 94 95 bool JSTestMediaQueryListListenerConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) 96 { 97 return getStaticValueDescriptor<JSTestMediaQueryListListenerConstructor, DOMObject>(exec, &JSTestMediaQueryListListenerConstructorTable, this, propertyName, descriptor); 98 } 99 100 /* Hash table for prototype */ 101 #if ENABLE(JIT) 102 #define THUNK_GENERATOR(generator) , generator 103 #else 104 #define THUNK_GENERATOR(generator) 105 #endif 106 107 static const HashTableValue JSTestMediaQueryListListenerPrototypeTableValues[2] = 108 { 109 { "method", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestMediaQueryListListenerPrototypeFunctionMethod), (intptr_t)1 THUNK_GENERATOR(0) }, 110 { 0, 0, 0, 0 THUNK_GENERATOR(0) } 111 }; 112 113 #undef THUNK_GENERATOR 114 static JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerPrototypeTable = { 2, 1, JSTestMediaQueryListListenerPrototypeTableValues, 0 }; 115 const ClassInfo JSTestMediaQueryListListenerPrototype::s_info = { "TestMediaQueryListListenerPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestMediaQueryListListenerPrototypeTable, 0 }; 116 117 JSObject* JSTestMediaQueryListListenerPrototype::self(ExecState* exec, JSGlobalObject* globalObject) 118 { 119 return getDOMPrototype<JSTestMediaQueryListListener>(exec, globalObject); 120 } 121 122 bool JSTestMediaQueryListListenerPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 123 { 124 return getStaticFunctionSlot<JSObject>(exec, &JSTestMediaQueryListListenerPrototypeTable, this, propertyName, slot); 125 } 126 127 bool JSTestMediaQueryListListenerPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) 128 { 129 return getStaticFunctionDescriptor<JSObject>(exec, &JSTestMediaQueryListListenerPrototypeTable, this, propertyName, descriptor); 130 } 131 132 const ClassInfo JSTestMediaQueryListListener::s_info = { "TestMediaQueryListListener", &DOMObjectWithGlobalPointer::s_info, &JSTestMediaQueryListListenerTable, 0 }; 133 134 JSTestMediaQueryListListener::JSTestMediaQueryListListener(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestMediaQueryListListener> impl) 135 : DOMObjectWithGlobalPointer(structure, globalObject) 136 , m_impl(impl) 137 { 138 ASSERT(inherits(&s_info)); 139 } 140 141 JSObject* JSTestMediaQueryListListener::createPrototype(ExecState* exec, JSGlobalObject* globalObject) 142 { 143 return new (exec) JSTestMediaQueryListListenerPrototype(globalObject, JSTestMediaQueryListListenerPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype())); 144 } 145 146 bool JSTestMediaQueryListListener::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 147 { 148 return getStaticValueSlot<JSTestMediaQueryListListener, Base>(exec, &JSTestMediaQueryListListenerTable, this, propertyName, slot); 149 } 150 151 bool JSTestMediaQueryListListener::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) 152 { 153 return getStaticValueDescriptor<JSTestMediaQueryListListener, Base>(exec, &JSTestMediaQueryListListenerTable, this, propertyName, descriptor); 154 } 155 156 JSValue jsTestMediaQueryListListenerConstructor(ExecState* exec, JSValue slotBase, const Identifier&) 157 { 158 JSTestMediaQueryListListener* domObject = static_cast<JSTestMediaQueryListListener*>(asObject(slotBase)); 159 return JSTestMediaQueryListListener::getConstructor(exec, domObject->globalObject()); 160 } 161 162 JSValue JSTestMediaQueryListListener::getConstructor(ExecState* exec, JSGlobalObject* globalObject) 163 { 164 return getDOMConstructor<JSTestMediaQueryListListenerConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); 165 } 166 167 EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod(ExecState* exec) 168 { 169 JSValue thisValue = exec->hostThisValue(); 170 if (!thisValue.inherits(&JSTestMediaQueryListListener::s_info)) 171 return throwVMTypeError(exec); 172 JSTestMediaQueryListListener* castedThis = static_cast<JSTestMediaQueryListListener*>(asObject(thisValue)); 173 TestMediaQueryListListener* imp = static_cast<TestMediaQueryListListener*>(castedThis->impl()); 174 RefPtr<MediaQueryListListener> listener(MediaQueryListListener::create(ScriptValue(exec->globalData(), exec->argument(0)))); 175 if (exec->hadException()) 176 return JSValue::encode(jsUndefined()); 177 178 imp->method(listener); 179 return JSValue::encode(jsUndefined()); 180 } 181 182 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestMediaQueryListListener* object) 183 { 184 return getDOMObjectWrapper<JSTestMediaQueryListListener>(exec, globalObject, object); 185 } 186 TestMediaQueryListListener* toTestMediaQueryListListener(JSC::JSValue value) 187 { 188 return value.inherits(&JSTestMediaQueryListListener::s_info) ? static_cast<JSTestMediaQueryListListener*>(asObject(value))->impl() : 0; 189 } 190 191 } 192