Bug 638328 - use builtinclass and remove do_QueryInterface - r=peterv
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 13 Oct 2011 08:09:22 -0400
changeset 78693 ca162fd3c35241d591498aae03445a8d3126d5a5
parent 78692 7170a4b7a58d039d799e88deb596fcb4b44c18b2
child 78694 a375341a2a0756464a466e60425324fe6e9484c6
push id21326
push userbmo@edmorley.co.uk
push dateFri, 14 Oct 2011 10:00:06 +0000
treeherdermozilla-central@ca73f057dab7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs638328
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 638328 - use builtinclass and remove do_QueryInterface - r=peterv
content/canvas/src/WebGLContext.h
content/canvas/test/webgl/failing_tests_linux.txt
content/canvas/test/webgl/failing_tests_mac.txt
content/canvas/test/webgl/failing_tests_windows.txt
dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -2105,20 +2105,18 @@ public:
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(WebGLExtension, WEBGLACTIVEINFO_PRIVATE_IID)
 
 /**
  ** Template implementations
  **/
 
-/* Helper function taking a BaseInterfaceType pointer and check that
- * it matches the required concrete implementation type (if it's
- * non-null), that it's not null/deleted unless we allowed it to, and
- * obtain a pointer to the concrete object.
+/* Helper function taking a BaseInterfaceType pointer, casting it to
+ * ConcreteObjectType and performing some checks along the way.
  *
  * By default, null (respectively: deleted) aInterface pointers are
  * not allowed, but if you pass a non-null isNull (respectively:
  * isDeleted) pointer, then they become allowed and the value at
  * isNull (respecively isDeleted) is overwritten.
  *
  * If generateErrors is true (which is the default) then upon errors,
  * GL errors are synthesized and error messages are printed, prepended by
@@ -2146,22 +2144,28 @@ WebGLContext::GetConcreteObject(const ch
                 ErrorInvalidValue("%s: null object passed as argument", info);
             return PR_FALSE;
         }
     }
 
     if (isNull)
         *isNull = PR_FALSE;
 
-    nsresult rv;
-    nsCOMPtr<ConcreteObjectType> tmp(do_QueryInterface(aInterface, &rv));
-    if (NS_FAILED(rv))
-        return PR_FALSE;
-
-    *aConcreteObject = tmp;
+#ifdef DEBUG
+    {
+        // once bug 694114 is implemented, we want to replace this by a static assertion, without #ifdef DEBUG
+        nsresult rv;
+        do_QueryInterface(aInterface, &rv);
+        NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv),
+                          "QueryInterface failed. WebGL objects are builtinclass, so this should never happen. "
+                          "Please file a bug at bugzilla.mozilla.org -> Core -> Canvas:WebGL and link to the present page.");
+    }
+#endif
+    
+    *aConcreteObject = static_cast<ConcreteObjectType*>(aInterface);
 
     if (!(*aConcreteObject)->IsCompatibleWithContext(this)) {
         // the object doesn't belong to this WebGLContext
         if (generateErrors)
             ErrorInvalidOperation("%s: object from different WebGL context (or older generation of this one) "
                                   "passed as argument", info);
         return PR_FALSE;
     }
--- a/content/canvas/test/webgl/failing_tests_linux.txt
+++ b/content/canvas/test/webgl/failing_tests_linux.txt
@@ -12,10 +12,9 @@ conformance/gl-uniform-bool.html
 conformance/glsl-conformance.html
 conformance/glsl-long-variable-names.html
 conformance/premultiplyalpha-test.html
 conformance/read-pixels-test.html
 conformance/uninitialized-test.html
 conformance/more/conformance/quickCheckAPI.html
 conformance/more/functions/copyTexImage2D.html
 conformance/more/functions/copyTexSubImage2D.html
-conformance/more/functions/deleteBufferBadArgs.html
 conformance/more/functions/uniformfArrayLen1.html
--- a/content/canvas/test/webgl/failing_tests_mac.txt
+++ b/content/canvas/test/webgl/failing_tests_mac.txt
@@ -8,11 +8,10 @@ conformance/glsl-long-variable-names.htm
 conformance/premultiplyalpha-test.html
 conformance/program-test.html
 conformance/read-pixels-test.html
 conformance/tex-input-validation.html
 conformance/texture-npot.html
 conformance/more/conformance/quickCheckAPI.html
 conformance/more/functions/copyTexImage2D.html
 conformance/more/functions/copyTexSubImage2D.html
-conformance/more/functions/deleteBufferBadArgs.html
 conformance/more/functions/uniformfBadArgs.html
 conformance/more/functions/uniformiBadArgs.html
--- a/content/canvas/test/webgl/failing_tests_windows.txt
+++ b/content/canvas/test/webgl/failing_tests_windows.txt
@@ -3,10 +3,9 @@ conformance/drawingbuffer-test.html
 conformance/framebuffer-object-attachment.html
 conformance/glsl-conformance.html
 conformance/glsl-long-variable-names.html
 conformance/premultiplyalpha-test.html
 conformance/read-pixels-test.html
 conformance/more/conformance/quickCheckAPI.html
 conformance/more/functions/copyTexImage2D.html
 conformance/more/functions/copyTexSubImage2D.html
-conformance/more/functions/deleteBufferBadArgs.html
 conformance/more/functions/uniformfArrayLen1.html
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -69,97 +69,97 @@ struct TypedArray;
 %}
 
 [ptr] native WebGLJSObjectPtr (JSObject);
 
 //
 // OpenGL object wrappers
 //
 
-[scriptable, uuid(0df9f4ed-f5ff-4e51-a6ff-2bd9785a7639)]
+[scriptable, builtinclass, uuid(0df9f4ed-f5ff-4e51-a6ff-2bd9785a7639)]
 interface nsIWebGLTexture : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(9eca9c32-8305-11de-b89b-000c29206271)]
+[scriptable, builtinclass, uuid(9eca9c32-8305-11de-b89b-000c29206271)]
 interface nsIWebGLBuffer : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(a6a19e74-8305-11de-9ce9-000c29206271)]
+[scriptable, builtinclass, uuid(a6a19e74-8305-11de-9ce9-000c29206271)]
 interface nsIWebGLProgram : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(ac7440a4-8305-11de-807b-000c29206271)]
+[scriptable, builtinclass, uuid(ac7440a4-8305-11de-807b-000c29206271)]
 interface nsIWebGLShader : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(beea4b38-3094-4e8d-b6e6-8b21d07e8994)]
+[scriptable, builtinclass, uuid(beea4b38-3094-4e8d-b6e6-8b21d07e8994)]
 interface nsIWebGLShaderArray : nsISupports
 {
     readonly attribute unsigned long length;
     nsIWebGLShader item(in unsigned long index);
 };
 
-[scriptable, uuid(bce8be60-8305-11de-9f3c-000c29206271)]
+[scriptable, builtinclass, uuid(bce8be60-8305-11de-9f3c-000c29206271)]
 interface nsIWebGLFramebuffer : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(c82eacd0-8305-11de-9de9-000c29206271)]
+[scriptable, builtinclass, uuid(c82eacd0-8305-11de-9de9-000c29206271)]
 interface nsIWebGLRenderbuffer : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(a85d4fd0-5b9f-4cb8-aeee-5a2c5c5bad76)]
+[scriptable, builtinclass, uuid(a85d4fd0-5b9f-4cb8-aeee-5a2c5c5bad76)]
 interface nsIWebGLActiveInfo : nsISupports
 {
     readonly attribute WebGLint size;
     readonly attribute WebGLenum type;
     readonly attribute DOMString name;
 };
 
-[scriptable, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
+[scriptable, builtinclass, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
 interface nsIWebGLUniformLocation : nsISupports
 {
     [noscript] attribute WebGLint location;
 };
 
 /* Base class for all WebGL extensions, and for those without
  * any additional tokens/methods.
  */
-[scriptable, uuid(70814f32-a5c5-4b95-83d5-ac653bac3316)]
+[scriptable, builtinclass, uuid(70814f32-a5c5-4b95-83d5-ac653bac3316)]
 interface nsIWebGLExtension : nsISupports
 {
 };
 
 /* Classes that extend on nsIWebGLExtension and provide
  * extra tokens, functions, etc.
  */
-[scriptable, uuid(3de3dfd9-864a-4e4c-989b-2977eaa80b7b)]
+[scriptable, builtinclass, uuid(3de3dfd9-864a-4e4c-989b-2977eaa80b7b)]
 interface nsIWebGLExtensionStandardDerivatives : nsIWebGLExtension
 {
   //
   //  CONSTANTS
   //
 
   /* Fragment shader hint */
   const WebGLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES   = 0x8B8B;
 };
 
 
-[scriptable, uuid(ef15ae85-4670-4dc4-848d-51ca81e8397a)]
+[scriptable, builtinclass, uuid(ef15ae85-4670-4dc4-848d-51ca81e8397a)]
 interface nsIDOMWebGLRenderingContext : nsISupports
 {
   //
   //  CONSTANTS
   //
 
   /* ClearBufferMask */
   const unsigned long DEPTH_BUFFER_BIT               = 0x00000100;