コード例 #1
0
bool JSSharedWorkerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSSharedWorker* jsSharedWorker = jsCast<JSSharedWorker*>(handle.get().asCell());
    if (jsSharedWorker->impl().hasPendingActivity())
        return true;
    if (jsSharedWorker->impl().isFiringEventListeners())
        return true;
    UNUSED_PARAM(visitor);
    return false;
}
コード例 #2
0
void JSSharedWorkerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSSharedWorker* jsSharedWorker = jsCast<JSSharedWorker*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsSharedWorker->impl(), jsSharedWorker);
    jsSharedWorker->releaseImpl();
}
コード例 #3
0
void JSSharedWorker::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSSharedWorker* thisObject = jsCast<JSSharedWorker*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(thisObject, visitor);

    if (MessagePort* port = thisObject->impl()->port())
        visitor.addOpaqueRoot(port);
}
コード例 #4
0
EncodedJSValue jsSharedWorkerPort(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSharedWorker* castedThis = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SharedWorker& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.port()));
    return JSValue::encode(result);
}
コード例 #5
0
void setJSSharedWorkerOnerror(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSharedWorker* castedThis = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    UNUSED_PARAM(exec);
    SharedWorker& impl = castedThis->impl();
    impl.setOnerror(createJSAttributeEventListener(exec, value, castedThis));
}
コード例 #6
0
EncodedJSValue jsSharedWorkerOnerror(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSharedWorker* castedThis = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SharedWorker& impl = castedThis->impl();
    if (EventListener* listener = impl.onerror()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(impl.scriptExecutionContext()))
                return JSValue::encode(jsFunction);
        }
    }
    return JSValue::encode(jsNull());
}