Bug 704839 - [6/9] - Refactor mutual ownership of WebGL objects - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Sun, 04 Dec 2011 14:15:43 -0500
changeset 81408 c1de92ddbedfcc6f18e0f22d27fb003d844af535
parent 81407 9d44f155bdbb2bba1a54efab894137c4954532d3
child 81409 1a4f061c4f2d5a174fec2f7b87179561cc6ca4ff
push id21570
push usermbrubeck@mozilla.com
push dateMon, 05 Dec 2011 18:08:26 +0000
treeherdermozilla-central@fafaf614791f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs704839
milestone11.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 704839 - [6/9] - Refactor mutual ownership of WebGL objects - r=jgilbert This patch fixes WebGL isObject functions.
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -3083,133 +3083,105 @@ WebGLContext::IsBuffer(nsIWebGLBuffer *b
     {
         *retval = false;
         return NS_OK;
     }
 
     bool isDeleted;
     WebGLuint buffername;
     WebGLBuffer *buffer;
-    bool ok = GetConcreteObjectAndGLName("isBuffer", bobj, &buffer, &buffername, nsnull, &isDeleted) && 
-                !isDeleted &&
-                buffer->HasEverBeenBound();
-    if (ok) {
-        MakeContextCurrent();
-        ok = gl->fIsBuffer(buffername);
-    }
-
-    *retval = ok;
+    *retval = GetConcreteObjectAndGLName("isBuffer", bobj, &buffer, &buffername, nsnull, &isDeleted) && 
+              !isDeleted &&
+              buffer->HasEverBeenBound();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsFramebuffer(nsIWebGLFramebuffer *fbobj, WebGLboolean *retval)
 {
     if (mContextLost)
     {
         *retval = false;
         return NS_OK;
     }
 
     bool isDeleted;
     WebGLuint fbname;
     WebGLFramebuffer *fb;
-    bool ok = GetConcreteObjectAndGLName("isFramebuffer", fbobj, &fb, &fbname, nsnull, &isDeleted) &&
-                !isDeleted &&
-                fb->HasEverBeenBound();
-    if (ok) {
-        MakeContextCurrent();
-        ok = gl->fIsFramebuffer(fbname);
-    }
-
-    *retval = ok;
+    *retval = GetConcreteObjectAndGLName("isFramebuffer", fbobj, &fb, &fbname, nsnull, &isDeleted) &&
+              !isDeleted &&
+              fb->HasEverBeenBound();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsProgram(nsIWebGLProgram *pobj, WebGLboolean *retval)
 {
     if (mContextLost)
     {
         *retval = false;
         return NS_OK;
     }
 
     bool isDeleted;
     WebGLProgram *prog = nsnull;
-    bool ok = GetConcreteObject("isProgram", pobj, &prog, nsnull, &isDeleted, false) &&
-                !isDeleted;
-
-    *retval = ok;
+    *retval = GetConcreteObject("isProgram", pobj, &prog, nsnull, &isDeleted, false) &&
+              !isDeleted;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsRenderbuffer(nsIWebGLRenderbuffer *rbobj, WebGLboolean *retval)
 {
     if (mContextLost)
     {
         *retval = false;
         return NS_OK;
     }
 
     bool isDeleted;
     WebGLuint rbname;
     WebGLRenderbuffer *rb;
-    bool ok = GetConcreteObjectAndGLName("isRenderBuffer", rbobj, &rb, &rbname, nsnull, &isDeleted) &&
-                !isDeleted &&
-                rb->HasEverBeenBound();
-    if (ok) {
-        MakeContextCurrent();
-        ok = gl->fIsRenderbuffer(rbname);
-    }
-
-    *retval = ok;
+    *retval = GetConcreteObjectAndGLName("isRenderBuffer", rbobj, &rb, &rbname, nsnull, &isDeleted) &&
+              !isDeleted &&
+              rb->HasEverBeenBound();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsShader(nsIWebGLShader *sobj, WebGLboolean *retval)
 {
     if (mContextLost)
     {
         *retval = false;
         return NS_OK;
     }
 
     bool isDeleted;
     WebGLShader *shader = nsnull;
-    bool ok = GetConcreteObject("isShader", sobj, &shader, nsnull, &isDeleted, false) &&
-                !isDeleted;
-
-    *retval = ok;
+    *retval = GetConcreteObject("isShader", sobj, &shader, nsnull, &isDeleted, false) &&
+              !isDeleted;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsTexture(nsIWebGLTexture *tobj, WebGLboolean *retval)
 {
     if (mContextLost)
     {
         *retval = false;
         return NS_OK;
     }
 
     bool isDeleted;
     WebGLuint texname;
     WebGLTexture *tex;
-    bool ok = GetConcreteObjectAndGLName("isTexture", tobj, &tex, &texname, nsnull, &isDeleted) &&
-                !isDeleted &&
-                tex->HasEverBeenBound();
-    if (ok) {
-        MakeContextCurrent();
-        ok = gl->fIsTexture(texname);
-    }
-
-    *retval = ok;
+    *retval = GetConcreteObjectAndGLName("isTexture", tobj, &tex, &texname, nsnull, &isDeleted) &&
+              !isDeleted &&
+              tex->HasEverBeenBound();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsEnabled(WebGLenum cap, WebGLboolean *retval)
 {
     if (mContextLost)
     {