void setJSWorkerOnmessage(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); JSWorker* castedThis = static_cast<JSWorker*>(thisObject); Worker* imp = static_cast<Worker*>(castedThis->impl()); imp->setOnmessage(createJSAttributeEventListener(exec, value, thisObject)); }
JSValue JSC_HOST_CALL jsWorkerPrototypeFunctionPostMessage(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.inherits(&JSWorker::s_info)) return throwError(exec, TypeError); JSWorker* castedThisObj = static_cast<JSWorker*>(asObject(thisValue)); return castedThisObj->postMessage(exec, args); }
EncodedJSValue JSC_HOST_CALL jsWorkerPrototypeFunctionPostMessage(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSWorker::s_info)) return throwVMTypeError(exec); JSWorker* castedThis = static_cast<JSWorker*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSWorker::s_info); return JSValue::encode(castedThis->postMessage(exec)); }
bool JSWorkerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) { JSWorker* jsWorker = static_cast<JSWorker*>(handle.get().asCell()); if (jsWorker->impl()->hasPendingActivity()) return true; if (!isObservable(jsWorker)) return false; UNUSED_PARAM(visitor); return false; }
JSValue JSC_HOST_CALL jsWorkerPrototypeFunctionTerminate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.inherits(&JSWorker::s_info)) return throwError(exec, TypeError); JSWorker* castedThisObj = static_cast<JSWorker*>(asObject(thisValue)); Worker* imp = static_cast<Worker*>(castedThisObj->impl()); imp->terminate(); return jsUndefined(); }
EncodedJSValue JSC_HOST_CALL jsWorkerPrototypeFunctionTerminate(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSWorker::s_info)) return throwVMTypeError(exec); JSWorker* castedThis = static_cast<JSWorker*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSWorker::s_info); Worker* imp = static_cast<Worker*>(castedThis->impl()); imp->terminate(); return JSValue::encode(jsUndefined()); }
JSValue jsWorkerOnmessage(ExecState* exec, JSValue slotBase, const Identifier&) { JSWorker* castedThis = static_cast<JSWorker*>(asObject(slotBase)); UNUSED_PARAM(exec); Worker* imp = static_cast<Worker*>(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(); }
void JSWorkerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { JSWorker* jsWorker = static_cast<JSWorker*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsWorker->impl(), jsWorker); }
JSValue jsWorkerConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSWorker* domObject = static_cast<JSWorker*>(asObject(slotBase)); return JSWorker::getConstructor(exec, domObject->globalObject()); }