本文整理汇总了C++中jsc::ExecState::uncheckedArgument方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecState::uncheckedArgument方法的具体用法?C++ ExecState::uncheckedArgument怎么用?C++ ExecState::uncheckedArgument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsc::ExecState
的用法示例。
在下文中一共展示了ExecState::uncheckedArgument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCSSCanvasContext
JSValue JSDocument::getCSSCanvasContext(JSC::ExecState& state)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (UNLIKELY(state.argumentCount() < 4))
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
auto contextId = state.uncheckedArgument(0).toWTFString(&state);
if (UNLIKELY(state.hadException()))
return jsUndefined();
auto name = state.uncheckedArgument(1).toWTFString(&state);
if (UNLIKELY(state.hadException()))
return jsUndefined();
auto width = convert<int32_t>(state, state.uncheckedArgument(2), NormalConversion);
if (UNLIKELY(state.hadException()))
return jsUndefined();
auto height = convert<int32_t>(state, state.uncheckedArgument(3), NormalConversion);
if (UNLIKELY(state.hadException()))
return jsUndefined();
auto* context = wrapped().getCSSCanvasContext(WTFMove(contextId), WTFMove(name), WTFMove(width), WTFMove(height));
if (!context)
return jsNull();
#if ENABLE(WEBGL)
if (is<WebGLRenderingContextBase>(*context))
return toJS(&state, globalObject(), downcast<WebGLRenderingContextBase>(*context));
#endif
return toJS(&state, globalObject(), downcast<CanvasRenderingContext2D>(*context));
}
示例2: throwTypeError
static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState& state, WebGLRenderingContextBase& context)
{
if (state.argumentCount() != 2)
return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
WebGLUniformLocation* location = JSWebGLUniformLocation::toWrapped(state.uncheckedArgument(0));
if (!location && !state.uncheckedArgument(0).isUndefinedOrNull())
return throwTypeError(&state);
RefPtr<Int32Array> webGLArray = toInt32Array(state.uncheckedArgument(1));
ExceptionCode ec = 0;
if (webGLArray) {
switch (f) {
case f_uniform1v:
context.uniform1iv(location, *webGLArray, ec);
break;
case f_uniform2v:
context.uniform2iv(location, *webGLArray, ec);
break;
case f_uniform3v:
context.uniform3iv(location, *webGLArray, ec);
break;
case f_uniform4v:
context.uniform4iv(location, *webGLArray, ec);
break;
default:
break;
}
setDOMException(&state, ec);
return jsUndefined();
}
Vector<int, 64> array;
if (!toVector(state, state.uncheckedArgument(1), array))
return throwTypeError(&state);
switch (f) {
case f_uniform1v:
context.uniform1iv(location, array.data(), array.size(), ec);
break;
case f_uniform2v:
context.uniform2iv(location, array.data(), array.size(), ec);
break;
case f_uniform3v:
context.uniform3iv(location, array.data(), array.size(), ec);
break;
case f_uniform4v:
context.uniform4iv(location, array.data(), array.size(), ec);
break;
default:
break;
}
setDOMException(&state, ec);
return jsUndefined();
}