Bug 1250710 - Remove redundant IsCurrent checks. - r=jrmuizel draft
authorJeff Gilbert <jgilbert@mozilla.com>
Tue, 14 Jun 2016 10:08:27 -0700
changeset 383810 358802d5fce990bddd8eef3fbd0b6c173f706ea1
parent 383809 d7c14cab3d5358f27672bb6d84ae4392cbaa8ec9
child 383811 82cd7adbb8062bcb863fb665b18b280ea7cb565e
push id22101
push userbmo:jgilbert@mozilla.com
push dateTue, 05 Jul 2016 04:23:13 +0000
reviewersjrmuizel
bugs1250710
milestone50.0a1
Bug 1250710 - Remove redundant IsCurrent checks. - r=jrmuizel MozReview-Commit-ID: GApYK5HC0EO
gfx/gl/ScopedGLHelpers.cpp
--- a/gfx/gl/ScopedGLHelpers.cpp
+++ b/gfx/gl/ScopedGLHelpers.cpp
@@ -81,19 +81,16 @@ ScopedBindFramebuffer::ScopedBindFramebu
 {
     Init();
     mGL->BindFB(aNewFB);
 }
 
 void
 ScopedBindFramebuffer::UnwrapImpl()
 {
-    // Check that we're not falling out of scope after the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
-
     if (mOldReadFB == mOldDrawFB) {
         mGL->BindFB(mOldDrawFB);
     } else {
         mGL->BindDrawFB(mOldDrawFB);
         mGL->BindReadFB(mOldReadFB);
     }
 }
 
@@ -105,76 +102,60 @@ ScopedBindTextureUnit::ScopedBindTexture
 {
     MOZ_ASSERT(aTexUnit >= LOCAL_GL_TEXTURE0);
     mGL->GetUIntegerv(LOCAL_GL_ACTIVE_TEXTURE, &mOldTexUnit);
     mGL->fActiveTexture(aTexUnit);
 }
 
 void
 ScopedBindTextureUnit::UnwrapImpl() {
-    // Check that we're not falling out of scope after the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
-
     mGL->fActiveTexture(mOldTexUnit);
 }
 
 
 /* ScopedTexture **************************************************************/
 
 ScopedTexture::ScopedTexture(GLContext* aGL)
     : ScopedGLWrapper<ScopedTexture>(aGL)
 {
-    MOZ_ASSERT(mGL->IsCurrent());
     mGL->fGenTextures(1, &mTexture);
 }
 
 void
 ScopedTexture::UnwrapImpl()
 {
-    // Check that we're not falling out of scope after
-    // the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
     mGL->fDeleteTextures(1, &mTexture);
 }
 
-
 /* ScopedFramebuffer **************************************************************/
 
 ScopedFramebuffer::ScopedFramebuffer(GLContext* aGL)
     : ScopedGLWrapper<ScopedFramebuffer>(aGL)
 {
-    MOZ_ASSERT(mGL->IsCurrent());
     mGL->fGenFramebuffers(1, &mFB);
 }
 
 void
 ScopedFramebuffer::UnwrapImpl()
 {
-    // Check that we're not falling out of scope after
-    // the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
     mGL->fDeleteFramebuffers(1, &mFB);
 }
 
 
 /* ScopedRenderbuffer **************************************************************/
 
 ScopedRenderbuffer::ScopedRenderbuffer(GLContext* aGL)
     : ScopedGLWrapper<ScopedRenderbuffer>(aGL)
 {
-    MOZ_ASSERT(mGL->IsCurrent());
     mGL->fGenRenderbuffers(1, &mRB);
 }
 
 void
 ScopedRenderbuffer::UnwrapImpl()
 {
-    // Check that we're not falling out of scope after
-    // the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
     mGL->fDeleteRenderbuffers(1, &mRB);
 }
 
 /* ScopedBindTexture **********************************************************/
 
 static GLuint
 GetBoundTexture(GLContext* gl, GLenum texTarget)
 {
@@ -246,20 +227,18 @@ ScopedBindRenderbuffer::ScopedBindRender
 ScopedBindRenderbuffer::ScopedBindRenderbuffer(GLContext* aGL, GLuint aNewRB)
     : ScopedGLWrapper<ScopedBindRenderbuffer>(aGL)
 {
     Init();
     mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, aNewRB);
 }
 
 void
-ScopedBindRenderbuffer::UnwrapImpl() {
-    // Check that we're not falling out of scope after the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
-
+ScopedBindRenderbuffer::UnwrapImpl()
+{
     mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, mOldRB);
 }
 
 
 /* ScopedFramebufferForTexture ************************************************/
 ScopedFramebufferForTexture::ScopedFramebufferForTexture(GLContext* aGL,
                                                          GLuint aTexture,
                                                          GLenum aTarget)
@@ -545,19 +524,16 @@ ScopedPackState::ScopedPackState(GLConte
     if (mRowLength != 0)   mGL->fPixelStorei(LOCAL_GL_PACK_ROW_LENGTH, 0);
     if (mSkipPixels != 0)  mGL->fPixelStorei(LOCAL_GL_PACK_SKIP_PIXELS, 0);
     if (mSkipRows != 0)    mGL->fPixelStorei(LOCAL_GL_PACK_SKIP_ROWS, 0);
 }
 
 void
 ScopedPackState::UnwrapImpl()
 {
-    // Check that we're not falling out of scope after the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
-
     mGL->fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, mAlignment);
 
     if (!HasPBOState(mGL))
         return;
 
     mGL->fBindBuffer(LOCAL_GL_PIXEL_PACK_BUFFER, mPixelBuffer);
     mGL->fPixelStorei(LOCAL_GL_PACK_ROW_LENGTH, mRowLength);
     mGL->fPixelStorei(LOCAL_GL_PACK_SKIP_PIXELS, mSkipPixels);
@@ -590,19 +566,16 @@ ScopedUnpackState::ScopedUnpackState(GLC
     if (mSkipImages != 0)  mGL->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, 0);
     if (mSkipPixels != 0)  mGL->fPixelStorei(LOCAL_GL_UNPACK_SKIP_PIXELS, 0);
     if (mSkipRows != 0)    mGL->fPixelStorei(LOCAL_GL_UNPACK_SKIP_ROWS, 0);
 }
 
 void
 ScopedUnpackState::UnwrapImpl()
 {
-    // Check that we're not falling out of scope after the current context changed.
-    MOZ_ASSERT(mGL->IsCurrent());
-
     mGL->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, mAlignment);
 
     if (!HasPBOState(mGL))
         return;
 
     mGL->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, mPixelBuffer);
     mGL->fPixelStorei(LOCAL_GL_UNPACK_IMAGE_HEIGHT, mImageHeight);
     mGL->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, mRowLength);