Bug 895369. Add some asserts to ThebesLayerBuffer. r=mattwoodrow
authorNicholas Cameron <ncameron@mozilla.com>
Wed, 24 Jul 2013 18:46:27 +1200
changeset 152041 c3c3d36fa76e58f732d2d69cd611b8db7f8fcf06
parent 152040 3d6f937c200829149efe6d3c56f4d1c5bc62ad51
child 152042 80bea130f275d70d7163f5d3b20471e0dd286f1d
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs895369
milestone25.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 895369. Add some asserts to ThebesLayerBuffer. r=mattwoodrow
gfx/layers/ThebesLayerBuffer.cpp
gfx/layers/ThebesLayerBuffer.h
--- a/gfx/layers/ThebesLayerBuffer.cpp
+++ b/gfx/layers/ThebesLayerBuffer.cpp
@@ -585,18 +585,20 @@ ThebesLayerBuffer::BeginPaint(ThebesLaye
           // Don't set destBuffer; we special-case self-copies, and
           // just did the necessary work above.
           mBufferRect = destBufferRect;
         } else {
           // We can't do a real self-copy because the buffer is rotated.
           // So allocate a new buffer for the destination.
           destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
           if (SupportsAzureContent()) {
+            MOZ_ASSERT(!mBuffer);
             destDTBuffer = CreateDTBuffer(contentType, destBufferRect, bufferFlags);
           } else {
+            MOZ_ASSERT(!mDTBuffer);
             destBuffer = CreateBuffer(contentType, destBufferRect, bufferFlags, getter_AddRefs(destBufferOnWhite));
           }
           if (!destBuffer && !destDTBuffer)
             return result;
         }
       } else {
         mBufferRect = destBufferRect;
         mBufferRotation = newRotation;
@@ -606,18 +608,20 @@ ThebesLayerBuffer::BeginPaint(ThebesLaye
       // will be redrawn, so we don't need to copy anything, so we don't
       // set destBuffer.
       mBufferRect = destBufferRect;
       mBufferRotation = nsIntPoint(0,0);
     }
   } else {
     // The buffer's not big enough, so allocate a new one
     if (SupportsAzureContent()) {
+      MOZ_ASSERT(!mBuffer);
       destDTBuffer = CreateDTBuffer(contentType, destBufferRect, bufferFlags);
     } else {
+      MOZ_ASSERT(!mDTBuffer);
       destBuffer = CreateBuffer(contentType, destBufferRect, bufferFlags, getter_AddRefs(destBufferOnWhite));
     }
     if (!destBuffer && !destDTBuffer)
       return result;
   }
 
   NS_ASSERTION(!(aFlags & PAINT_WILL_RESAMPLE) || destBufferRect == neededRegion.GetBounds(),
                "If we're resampling, we need to validate the entire buffer");
@@ -642,29 +646,31 @@ ThebesLayerBuffer::BeginPaint(ThebesLaye
         nsRefPtr<gfxContext> tmpCtx = new gfxContext(destBufferOnWhite);
         nsIntPoint offset = -destBufferRect.TopLeft();
         tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
         tmpCtx->Translate(gfxPoint(offset.x, offset.y));
         DrawBufferWithRotation(tmpCtx, BUFFER_WHITE);
       }
     }
 
+    MOZ_ASSERT(!SupportsAzureContent());
     mBuffer = destBuffer.forget();
     mBufferRect = destBufferRect;
     mBufferOnWhite = destBufferOnWhite.forget();
     mBufferRotation = nsIntPoint(0,0);
   } else if (destDTBuffer) {
     if (!isClear && (mode != Layer::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) {
       MOZ_ASSERT(mode != Layer::SURFACE_COMPONENT_ALPHA, "We don't support azure here yet");
       // Copy the bits
       nsIntPoint offset = -destBufferRect.TopLeft();
       Matrix mat;
       mat.Translate(offset.x, offset.y);
       destDTBuffer->SetTransform(mat);
       EnsureBuffer();
+      MOZ_ASSERT(mDTBuffer, "Have we got a Thebes buffer for some reason?");
       DrawBufferWithRotation(destDTBuffer, BUFFER_BLACK);
       destDTBuffer->SetTransform(Matrix());
     }
 
     mDTBuffer = destDTBuffer.forget();
     mBufferRect = destBufferRect;
     mBufferRotation = nsIntPoint(0,0);
   }
--- a/gfx/layers/ThebesLayerBuffer.h
+++ b/gfx/layers/ThebesLayerBuffer.h
@@ -255,16 +255,17 @@ public:
               gfxASurface* aMask, const gfxMatrix* aMaskTransform);
 
 protected:
 
   already_AddRefed<gfxASurface>
   SetBuffer(gfxASurface* aBuffer,
             const nsIntRect& aBufferRect, const nsIntPoint& aBufferRotation)
   {
+    MOZ_ASSERT(!SupportsAzureContent());
     nsRefPtr<gfxASurface> tmp = mBuffer.forget();
     mBuffer = aBuffer;
     mBufferRect = aBufferRect;
     mBufferRotation = aBufferRotation;
     return tmp.forget();
   }
 
   already_AddRefed<gfxASurface>