зеркало из https://github.com/mozilla/gecko-dev.git
Bug 722154 - Part b: Remove custom quickstub for bufferSubData; r=bjacob
This commit is contained in:
Родитель
ce7192e639
Коммит
79d282af26
|
@ -77,79 +77,6 @@ helper_isFloat32Array(JSObject *obj) {
|
|||
return js::GetObjectClass(obj) == &js::TypedArray::fastClasses[js::TypedArray::TYPE_FLOAT32];
|
||||
}
|
||||
|
||||
/*
|
||||
* BufferSubData takes:
|
||||
* BufferSubData (int, int, js::ArrayBuffer *)
|
||||
* BufferSubData_array (int, int, js::TypedArray *)
|
||||
*/
|
||||
static JSBool
|
||||
nsIDOMWebGLRenderingContext_BufferSubData(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
|
||||
nsIDOMWebGLRenderingContext *self;
|
||||
xpc_qsSelfRef selfref;
|
||||
JS::AutoValueRooter tvr(cx);
|
||||
if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
|
||||
return JS_FALSE;
|
||||
|
||||
if (argc < 3)
|
||||
return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
|
||||
|
||||
jsval *argv = JS_ARGV(cx, vp);
|
||||
|
||||
int32_t target;
|
||||
int32_t offset;
|
||||
JSObject *wa = 0;
|
||||
JSObject *wb = 0;
|
||||
|
||||
if (!JS_ValueToECMAInt32(cx, argv[0], &target))
|
||||
return JS_FALSE;
|
||||
if (!JS_ValueToECMAInt32(cx, argv[1], &offset))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!JSVAL_IS_OBJECT(argv[2])) {
|
||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSBool nullobject = JSVAL_IS_NULL(argv[2]);
|
||||
|
||||
if (!nullobject) {
|
||||
JSObject *arg3 = JSVAL_TO_OBJECT(argv[2]);
|
||||
if (js_IsArrayBuffer(arg3)) {
|
||||
wb = js::ArrayBuffer::getArrayBuffer(arg3);
|
||||
} else if (js_IsTypedArray(arg3)) {
|
||||
wa = js::TypedArray::getTypedArray(arg3);
|
||||
} else {
|
||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (wa) {
|
||||
rv = self->BufferSubData_array(target, offset, wa);
|
||||
} else if (wb) {
|
||||
rv = self->BufferSubData_buf(target, offset, wb);
|
||||
} else if (nullobject) {
|
||||
rv = self->BufferSubData_null();
|
||||
} else {
|
||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
||||
|
||||
*vp = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* CompressedTexImage2D takes:
|
||||
* CompressedTexImage2D(uint, int, uint, int, int, int, ArrayBufferView)
|
||||
|
|
|
@ -692,6 +692,9 @@ protected:
|
|||
nsresult BufferData_buf(WebGLenum target, JSObject* data, WebGLenum usage);
|
||||
nsresult BufferData_array(WebGLenum target, JSObject* data, WebGLenum usage);
|
||||
|
||||
nsresult BufferSubData_buf(WebGLenum target, PRInt32 offset, JSObject* data);
|
||||
nsresult BufferSubData_array(WebGLenum target, PRInt32 offset, JSObject* data);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCanvasElement> mCanvasElement;
|
||||
nsHTMLCanvasElement *HTMLCanvasElement() {
|
||||
return static_cast<nsHTMLCanvasElement*>(mCanvasElement.get());
|
||||
|
|
|
@ -585,24 +585,30 @@ WebGLContext::BufferData_array(WebGLenum target, JSObject *wa, WebGLenum usage)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BufferSubData(PRInt32)
|
||||
WebGLContext::BufferSubData(PRInt32 target, PRInt32 offset, const JS::Value& data)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
if (data.isNull()) {
|
||||
// see http://www.khronos.org/bugzilla/show_bug.cgi?id=386
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!data.isObject()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSObject& dataObj = data.toObject();
|
||||
if (js_IsArrayBuffer(&dataObj)) {
|
||||
return BufferSubData_buf(target, offset, &dataObj);
|
||||
}
|
||||
|
||||
if (js_IsTypedArray(&dataObj)) {
|
||||
return BufferSubData_array(target, offset, &dataObj);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BufferSubData_null()
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
return NS_OK; // see http://www.khronos.org/bugzilla/show_bug.cgi?id=386
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
WebGLContext::BufferSubData_buf(GLenum target, WebGLsizei byteOffset, JSObject *wb)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
|
@ -642,7 +648,7 @@ WebGLContext::BufferSubData_buf(GLenum target, WebGLsizei byteOffset, JSObject *
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, JSObject *wa)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
|
|
|
@ -177,7 +177,7 @@ interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
|
|||
const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(c0d5f7cb-91ad-433c-a426-a701e06d4413)]
|
||||
[scriptable, builtinclass, uuid(cabad79d-222c-40d1-a746-4942278c0bba)]
|
||||
interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
{
|
||||
//
|
||||
|
@ -624,10 +624,7 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
|||
// Modified: void glBufferData(WebGLenum target, long size, const void* data, WebGLenum usage);
|
||||
[implicit_jscontext] void bufferData(in long target, in jsval data, in long usage);
|
||||
|
||||
void bufferSubData([optional] in long dummy);
|
||||
[noscript] void bufferSubData_buf(in WebGLenum target, in long offset, in WebGLJSObjectPtr data);
|
||||
[noscript] void bufferSubData_array(in WebGLenum target, in long offset, in WebGLJSObjectPtr data);
|
||||
[noscript] void bufferSubData_null();
|
||||
void bufferSubData(in long target, in long offset, in jsval data);
|
||||
|
||||
WebGLenum checkFramebufferStatus(in WebGLenum target);
|
||||
void clear(in WebGLbitfield mask);
|
||||
|
|
|
@ -978,7 +978,6 @@ customMethodCalls = {
|
|||
'unwrapThisFailureFatal' : False
|
||||
},
|
||||
# WebGL
|
||||
'nsIDOMWebGLRenderingContext_BufferSubData': CUSTOM_QS,
|
||||
'nsIDOMWebGLRenderingContext_ReadPixels': CUSTOM_QS,
|
||||
'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
|
||||
'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
|
||||
|
|
Загрузка…
Ссылка в новой задаче