diff -r 000000000000 -r 4f2f89ce4247 WebCore/generated/JSAbstractWorker.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebCore/generated/JSAbstractWorker.cpp Fri Sep 17 09:02:29 2010 +0300 @@ -0,0 +1,262 @@ +/* + 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(WORKERS) + +#include "JSAbstractWorker.h" + +#include "AbstractWorker.h" +#include "Event.h" +#include "EventListener.h" +#include "JSEvent.h" +#include "JSEventListener.h" +#include "RegisteredEventListener.h" +#include +#include + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSAbstractWorker); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSAbstractWorkerTableValues[3] = +{ + { "onerror", DontDelete, (intptr_t)static_cast(jsAbstractWorkerOnerror), (intptr_t)setJSAbstractWorkerOnerror THUNK_GENERATOR(0) }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsAbstractWorkerConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSAbstractWorkerTable = { 4, 3, JSAbstractWorkerTableValues, 0 }; +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSAbstractWorkerConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSAbstractWorkerConstructorTable = { 1, 0, JSAbstractWorkerConstructorTableValues, 0 }; +class JSAbstractWorkerConstructor : public DOMConstructorObject { +public: + JSAbstractWorkerConstructor(JSC::ExecState*, JSDOMGlobalObject*); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + static PassRefPtr createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSAbstractWorkerConstructor::s_info = { "AbstractWorkerConstructor", 0, &JSAbstractWorkerConstructorTable, 0 }; + +JSAbstractWorkerConstructor::JSAbstractWorkerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSAbstractWorkerConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSAbstractWorkerPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSAbstractWorkerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSAbstractWorkerConstructorTable, this, propertyName, slot); +} + +bool JSAbstractWorkerConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSAbstractWorkerConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSAbstractWorkerPrototypeTableValues[4] = +{ + { "addEventListener", DontDelete | Function, (intptr_t)static_cast(jsAbstractWorkerPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, + { "removeEventListener", DontDelete | Function, (intptr_t)static_cast(jsAbstractWorkerPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, + { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast(jsAbstractWorkerPrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSAbstractWorkerPrototypeTable = { 8, 7, JSAbstractWorkerPrototypeTableValues, 0 }; +const ClassInfo JSAbstractWorkerPrototype::s_info = { "AbstractWorkerPrototype", 0, &JSAbstractWorkerPrototypeTable, 0 }; + +JSObject* JSAbstractWorkerPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype(exec, globalObject); +} + +bool JSAbstractWorkerPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot(exec, &JSAbstractWorkerPrototypeTable, this, propertyName, slot); +} + +bool JSAbstractWorkerPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor(exec, &JSAbstractWorkerPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSAbstractWorker::s_info = { "AbstractWorker", 0, &JSAbstractWorkerTable, 0 }; + +JSAbstractWorker::JSAbstractWorker(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ +} + +JSAbstractWorker::~JSAbstractWorker() +{ + impl()->invalidateJSEventListeners(this); + forgetDOMObject(this, impl()); +} + +void JSAbstractWorker::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + impl()->markJSEventListeners(markStack); +} + +JSObject* JSAbstractWorker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSAbstractWorkerPrototype(globalObject, JSAbstractWorkerPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSAbstractWorker::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSAbstractWorkerTable, this, propertyName, slot); +} + +bool JSAbstractWorker::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSAbstractWorkerTable, this, propertyName, descriptor); +} + +JSValue jsAbstractWorkerOnerror(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSAbstractWorker* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + AbstractWorker* imp = static_cast(castedThis->impl()); + if (EventListener* listener = imp->onerror()) { + if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { + if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) + return jsFunction; + } + } + return jsNull(); +} + +JSValue jsAbstractWorkerConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSAbstractWorker* domObject = static_cast(asObject(slotBase)); + return JSAbstractWorker::getConstructor(exec, domObject->globalObject()); +} +void JSAbstractWorker::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + lookupPut(exec, propertyName, value, &JSAbstractWorkerTable, this, slot); +} + +void setJSAbstractWorkerOnerror(ExecState* exec, JSObject* thisObject, JSValue value) +{ + UNUSED_PARAM(exec); + AbstractWorker* imp = static_cast(static_cast(thisObject)->impl()); + imp->setOnerror(createJSAttributeEventListener(exec, value, thisObject)); +} + +JSValue JSAbstractWorker::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor(exec, static_cast(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsAbstractWorkerPrototypeFunctionAddEventListener(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSAbstractWorker::s_info)) + return throwVMTypeError(exec); + JSAbstractWorker* castedThis = static_cast(asObject(thisValue)); + AbstractWorker* imp = static_cast(castedThis->impl()); + JSValue listener = exec->argument(1); + if (!listener.isObject()) + return JSValue::encode(jsUndefined()); + imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsAbstractWorkerPrototypeFunctionRemoveEventListener(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSAbstractWorker::s_info)) + return throwVMTypeError(exec); + JSAbstractWorker* castedThis = static_cast(asObject(thisValue)); + AbstractWorker* imp = static_cast(castedThis->impl()); + JSValue listener = exec->argument(1); + if (!listener.isObject()) + return JSValue::encode(jsUndefined()); + imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsAbstractWorkerPrototypeFunctionDispatchEvent(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSAbstractWorker::s_info)) + return throwVMTypeError(exec); + JSAbstractWorker* castedThis = static_cast(asObject(thisValue)); + AbstractWorker* imp = static_cast(castedThis->impl()); + ExceptionCode ec = 0; + Event* evt = toEvent(exec->argument(0)); + + + JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec)); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +AbstractWorker* toAbstractWorker(JSC::JSValue value) +{ + return value.inherits(&JSAbstractWorker::s_info) ? static_cast(asObject(value))->impl() : 0; +} + +} + +#endif // ENABLE(WORKERS)