예제 #1
0
JSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionNextWorkerId(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
        return throwError(exec, TypeError);
    JSInjectedScriptHost* castedThisObj = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
    InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThisObj->impl());

#if ENABLE(WORKERS)
    JSC::JSValue result = jsNumber(exec, imp->nextWorkerId());
#else
    JSC::JSValue result = jsNumber(exec, 0);  // TODO: Change this to something that would actually work.
#endif

    return result;
}
static v8::Handle<v8::Value> nextWorkerIdCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.InjectedScriptHost.nextWorkerId");
    InjectedScriptHost* imp = V8InjectedScriptHost::toNative(args.Holder());
    return v8::Integer::New(imp->nextWorkerId());
}