Bug 1023882 - Part 8 - Remove the argument to EndPaint. r=Cwiiis a=bajaj
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 11 Jun 2014 12:42:46 -0400
changeset 207204 b5411d889c2d71ef49dcb9910afb4f039e6ee37f
parent 207203 5c082ed1469bc89163a56462bb20a0d71292fe5f
child 207205 f29fb8b5b4aa6acfdd2ed36148b5d144d434440c
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis, bajaj
bugs1023882
milestone32.0a2
Bug 1023882 - Part 8 - Remove the argument to EndPaint. r=Cwiiis a=bajaj
gfx/layers/client/ClientTiledThebesLayer.cpp
gfx/layers/client/ClientTiledThebesLayer.h
--- a/gfx/layers/client/ClientTiledThebesLayer.cpp
+++ b/gfx/layers/client/ClientTiledThebesLayer.cpp
@@ -291,22 +291,18 @@ ClientTiledThebesLayer::RenderLowPrecisi
     // region of the low precision buffer. This allows the shadow buffer's valid
     // region to be updated and the associated resources to be freed.
     return true;
   }
   return false;
 }
 
 void
-ClientTiledThebesLayer::EndPaint(bool aFinish)
+ClientTiledThebesLayer::EndPaint()
 {
-  if (!aFinish && !mPaintData.mPaintFinished) {
-    return;
-  }
-
   mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
   mPaintData.mPaintFinished = true;
   mPaintData.mFirstPaint = false;
   TILING_PRLOG(("TILING 0x%p: Paint finished\n", this));
 }
 
 void
 ClientTiledThebesLayer::RenderLayer()
@@ -333,17 +329,17 @@ ClientTiledThebesLayer::RenderLayer()
 
   TILING_PRLOG_OBJ(("TILING 0x%p: Initial visible region %s\n", this, tmpstr.get()), mVisibleRegion);
   TILING_PRLOG_OBJ(("TILING 0x%p: Initial valid region %s\n", this, tmpstr.get()), mValidRegion);
   TILING_PRLOG_OBJ(("TILING 0x%p: Initial low-precision valid region %s\n", this, tmpstr.get()), mLowPrecisionValidRegion);
 
   nsIntRegion invalidRegion;
   invalidRegion.Sub(mVisibleRegion, mValidRegion);
   if (invalidRegion.IsEmpty()) {
-    EndPaint(true);
+    EndPaint();
     return;
   }
 
   if (!ClientManager()->IsRepeatTransaction()) {
     // Only paint the mask layer on the first transaction.
     if (GetMaskLayer()) {
       ToClientLayer(GetMaskLayer())->RenderLayer();
     }
@@ -402,42 +398,44 @@ ClientTiledThebesLayer::RenderLayer()
       // done yet. A subsequent transaction will take care of this.
       ClientManager()->SetRepeatTransaction();
       return;
     }
   }
 
   // If there is nothing to draw in low-precision, then we're done.
   if (lowPrecisionInvalidRegion.IsEmpty()) {
-    EndPaint(true);
+    EndPaint();
     return;
   }
 
   if (updatedHighPrecision) {
     // If there are low precision updates, but we just did some high-precision
     // updates, then mark the paint as unfinished and request a repeat transaction.
     // This is so that we don't perform low-precision updates in the same transaction
     // as high-precision updates.
     TILING_PRLOG(("TILING 0x%p: Scheduling repeat transaction for low-precision painting\n", this));
     ClientManager()->SetRepeatTransaction();
     mPaintData.mLowPrecisionPaintCount = 1;
     mPaintData.mPaintFinished = false;
-    EndPaint(false);
     return;
   }
 
   bool updatedLowPrecision = RenderLowPrecision(lowPrecisionInvalidRegion, callback, data);
   if (updatedLowPrecision) {
     ClientManager()->Hold(this);
     mContentClient->UseTiledLayerBuffer(TiledContentClient::LOW_PRECISION_TILED_BUFFER);
 
     if (!mPaintData.mPaintFinished) {
       // There is still more low-res stuff to paint, so we're not
       // done yet. A subsequent transaction will take care of this.
       ClientManager()->SetRepeatTransaction();
+      return;
     }
   }
 
-  EndPaint(false);
+  // If we get here, we've done all the high- and low-precision
+  // paints we wanted to do, so we can finish the paint and chill.
+  EndPaint();
 }
 
 } // mozilla
 } // layers
--- a/gfx/layers/client/ClientTiledThebesLayer.h
+++ b/gfx/layers/client/ClientTiledThebesLayer.h
@@ -99,21 +99,20 @@ private:
    * Helper function to do the low-precision paint.
    * This function returns true if it updated the paint buffer.
    */
   bool RenderLowPrecision(nsIntRegion& aInvalidRegion,
                           LayerManager::DrawThebesLayerCallback aCallback,
                           void* aCallbackData);
 
   /**
-   * When a paint ends, updates any data necessary to persist until the next
-   * paint. If aFinish is true, this will cause the paint to be marked as
-   * finished.
+   * This causes the paint to be marked as finished, and updates any data
+   * necessary to persist until the next paint.
    */
-  void EndPaint(bool aFinish);
+  void EndPaint();
 
   RefPtr<TiledContentClient> mContentClient;
   nsIntRegion mLowPrecisionValidRegion;
   BasicTiledLayerPaintData mPaintData;
 };
 
 } // layers
 } // mozilla