本文整理汇总了C++中MessagePort::dispatchEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ MessagePort::dispatchEvent方法的具体用法?C++ MessagePort::dispatchEvent怎么用?C++ MessagePort::dispatchEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessagePort
的用法示例。
在下文中一共展示了MessagePort::dispatchEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsMessagePortPrototypeFunctionDispatchEvent
JSValue JSC_HOST_CALL jsMessagePortPrototypeFunctionDispatchEvent(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSMessagePort::s_info))
return throwError(exec, TypeError);
JSMessagePort* castedThisObj = static_cast<JSMessagePort*>(asObject(thisValue));
MessagePort* imp = static_cast<MessagePort*>(castedThisObj->impl());
ExceptionCode ec = 0;
Event* evt = toEvent(args.at(0));
JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
setDOMException(exec, ec);
return result;
}
示例2: throwNotEnoughArgumentsError
static v8::Handle<v8::Value> dispatchEventCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
MessagePort* imp = V8MessagePort::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH(Event*, evt, V8Event::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
bool result = imp->dispatchEvent(evt, ec);
if (UNLIKELY(ec))
goto fail;
return v8Boolean(result, args.GetIsolate());
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例3: dispatchEventCallback
static v8::Handle<v8::Value> dispatchEventCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MessagePort.dispatchEvent");
MessagePort* imp = V8MessagePort::toNative(args.Holder());
ExceptionCode ec = 0;
{
EXCEPTION_BLOCK(Event*, evt, V8Event::HasInstance(args[0]) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
bool result = imp->dispatchEvent(evt, ec);
if (UNLIKELY(ec))
goto fail;
return v8Boolean(result);
}
fail:
V8Proxy::setDOMException(ec);
return v8::Handle<v8::Value>();
}
示例4: jsMessagePortPrototypeFunctionDispatchEvent
EncodedJSValue JSC_HOST_CALL jsMessagePortPrototypeFunctionDispatchEvent(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSMessagePort::s_info))
return throwVMTypeError(exec);
JSMessagePort* castedThis = static_cast<JSMessagePort*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSMessagePort::s_info);
MessagePort* imp = static_cast<MessagePort*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
ExceptionCode ec = 0;
Event* evt(toEvent(exec->argument(0)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}