diff -r 000000000000 -r 4f2f89ce4247 WebCore/generated/JSWorker.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebCore/generated/JSWorker.cpp Fri Sep 17 09:02:29 2010 +0300 @@ -0,0 +1,217 @@ +/* + 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 "JSWorker.h" + +#include "EventListener.h" +#include "JSEventListener.h" +#include "Worker.h" +#include +#include + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSWorker); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSWorkerTableValues[3] = +{ + { "onmessage", DontDelete, (intptr_t)static_cast(jsWorkerOnmessage), (intptr_t)setJSWorkerOnmessage THUNK_GENERATOR(0) }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsWorkerConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSWorkerTable = { 4, 3, JSWorkerTableValues, 0 }; +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSWorkerConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSWorkerConstructorTable = { 1, 0, JSWorkerConstructorTableValues, 0 }; +const ClassInfo JSWorkerConstructor::s_info = { "WorkerConstructor", 0, &JSWorkerConstructorTable, 0 }; + +JSWorkerConstructor::JSWorkerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSWorkerConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSWorkerPrototype::self(exec, globalObject), DontDelete | ReadOnly); + putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); +} + +bool JSWorkerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSWorkerConstructorTable, this, propertyName, slot); +} + +bool JSWorkerConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSWorkerConstructorTable, this, propertyName, descriptor); +} + +ConstructType JSWorkerConstructor::getConstructData(ConstructData& constructData) +{ + constructData.native.function = constructJSWorker; + return ConstructTypeHost; +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSWorkerPrototypeTableValues[3] = +{ + { "postMessage", DontDelete | Function, (intptr_t)static_cast(jsWorkerPrototypeFunctionPostMessage), (intptr_t)2 THUNK_GENERATOR(0) }, + { "terminate", DontDelete | Function, (intptr_t)static_cast(jsWorkerPrototypeFunctionTerminate), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSWorkerPrototypeTable = { 5, 3, JSWorkerPrototypeTableValues, 0 }; +const ClassInfo JSWorkerPrototype::s_info = { "WorkerPrototype", 0, &JSWorkerPrototypeTable, 0 }; + +JSObject* JSWorkerPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype(exec, globalObject); +} + +bool JSWorkerPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot(exec, &JSWorkerPrototypeTable, this, propertyName, slot); +} + +bool JSWorkerPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor(exec, &JSWorkerPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSWorker::s_info = { "Worker", &JSAbstractWorker::s_info, &JSWorkerTable, 0 }; + +JSWorker::JSWorker(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) + : JSAbstractWorker(structure, globalObject, impl) +{ +} + +JSObject* JSWorker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSWorkerPrototype(globalObject, JSWorkerPrototype::createStructure(JSAbstractWorkerPrototype::self(exec, globalObject))); +} + +bool JSWorker::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSWorkerTable, this, propertyName, slot); +} + +bool JSWorker::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSWorkerTable, this, propertyName, descriptor); +} + +JSValue jsWorkerOnmessage(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSWorker* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + Worker* imp = static_cast(castedThis->impl()); + if (EventListener* listener = imp->onmessage()) { + if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { + if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) + return jsFunction; + } + } + return jsNull(); +} + +JSValue jsWorkerConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSWorker* domObject = static_cast(asObject(slotBase)); + return JSWorker::getConstructor(exec, domObject->globalObject()); +} +void JSWorker::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + lookupPut(exec, propertyName, value, &JSWorkerTable, this, slot); +} + +void setJSWorkerOnmessage(ExecState* exec, JSObject* thisObject, JSValue value) +{ + UNUSED_PARAM(exec); + Worker* imp = static_cast(static_cast(thisObject)->impl()); + imp->setOnmessage(createJSAttributeEventListener(exec, value, thisObject)); +} + +JSValue JSWorker::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor(exec, static_cast(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsWorkerPrototypeFunctionPostMessage(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSWorker::s_info)) + return throwVMTypeError(exec); + JSWorker* castedThis = static_cast(asObject(thisValue)); + return JSValue::encode(castedThis->postMessage(exec)); +} + +EncodedJSValue JSC_HOST_CALL jsWorkerPrototypeFunctionTerminate(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSWorker::s_info)) + return throwVMTypeError(exec); + JSWorker* castedThis = static_cast(asObject(thisValue)); + Worker* imp = static_cast(castedThis->impl()); + + imp->terminate(); + return JSValue::encode(jsUndefined()); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Worker* object) +{ + return getDOMObjectWrapper(exec, globalObject, object); +} +Worker* toWorker(JSC::JSValue value) +{ + return value.inherits(&JSWorker::s_info) ? static_cast(asObject(value))->impl() : 0; +} + +} + +#endif // ENABLE(WORKERS)