Back out bug 792663 (1ba44c7c860a)
authorChris Jones <jones.chris.g@gmail.com>
Fri, 21 Sep 2012 00:46:18 -0700
changeset 107825 a0b08694ac6d1f15275fa1639f5ee504b04e36fa
parent 107824 929786a618f4f124a49479b920acdd7c9a757fce
child 107826 31084b468d5ac65ce91710e491ae1f6c552e978a
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
bugs792663
milestone18.0a1
Back out bug 792663 (1ba44c7c860a)
gfx/layers/ThebesLayerBuffer.h
gfx/layers/basic/BasicThebesLayer.cpp
--- a/gfx/layers/ThebesLayerBuffer.h
+++ b/gfx/layers/ThebesLayerBuffer.h
@@ -185,20 +185,16 @@ protected:
    * unset the provider when inactive, by calling
    * SetBufferProvider(nullptr).
    */
   void SetBufferProvider(AutoOpenSurface* aProvider)
   {
     mBufferProvider = aProvider;
     if (!mBufferProvider) {
       mBuffer = nullptr;
-    } else {
-      // Only this buffer provider can give us a buffer.  If we
-      // already have one, something has gone wrong.
-      MOZ_ASSERT(!mBuffer);
     }
   }
 
   /**
    * Get a context at the specified resolution for updating |aBounds|,
    * which must be contained within a single quadrant.
    */
   already_AddRefed<gfxContext>
--- a/gfx/layers/basic/BasicThebesLayer.cpp
+++ b/gfx/layers/basic/BasicThebesLayer.cpp
@@ -309,30 +309,31 @@ BasicShadowableThebesLayer::SetBackBuffe
     mBackBuffer = aBuffer.get_ThebesBuffer().buffer();
     mBackBufferRect = aBuffer.get_ThebesBuffer().rect();
     mBackBufferRectRotation = aBuffer.get_ThebesBuffer().rotation();
   }
   mFrontAndBackBufferDiffer = true;
   mROFrontBuffer = aReadOnlyFrontBuffer;
   mFrontUpdatedRegion = aFrontUpdatedRegion;
   mFrontValidRegion = aValidRegion;
+  if (OptionalThebesBuffer::Tnull_t == mROFrontBuffer.type()) {
+    // For null readonly front, we have single buffer mode
+    // so we can do sync right now, because it does not create new buffer and
+    // don't do any graphic operations
+    SyncFrontBufferToBackBuffer();
+  }
 }
 
 void
 BasicShadowableThebesLayer::SyncFrontBufferToBackBuffer()
 {
   if (!mFrontAndBackBufferDiffer) {
     return;
   }
 
-  // We temporarily map our back buffer here in order to copy from the
-  // front buffer.  We need a live buffer tracker in order to unmap
-  // that buffer when appropriate.
-  MOZ_ASSERT(mBufferTracker);
-
   gfxASurface* backBuffer = mBuffer.GetBuffer();
   if (!IsSurfaceDescriptorValid(mBackBuffer)) {
     MOZ_ASSERT(!backBuffer);
     MOZ_ASSERT(mROFrontBuffer.type() == OptionalThebesBuffer::TThebesBuffer);
     const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
     AutoOpenSurface roFrontBuffer(OPEN_READ_ONLY, roFront.buffer());
     AllocBackBuffer(roFrontBuffer.ContentType(), roFrontBuffer.Size());
   }