Bug 1023882 - Part 2 - Create a first-transaction block for all the first-transaction code. r=Cwiiis
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 11 Jun 2014 12:42:44 -0400
changeset 208282 d02aae5cb847f4c1909fa3d4aeffe5652c239281
parent 208281 f79198359c8689ffe07e05caf2b484cc0a232913
child 208283 f2a65256e3cb6810fbbe44b94681f37285e1e1ba
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs1023882
milestone32.0a2
Bug 1023882 - Part 2 - Create a first-transaction block for all the first-transaction code. r=Cwiiis
gfx/layers/client/ClientTiledThebesLayer.cpp
--- a/gfx/layers/client/ClientTiledThebesLayer.cpp
+++ b/gfx/layers/client/ClientTiledThebesLayer.cpp
@@ -83,20 +83,16 @@ GetTransformToAncestorsParentLayer(Layer
   gfx3DMatrix ret;
   gfx::To3DMatrix(transform, ret);
   return ret;
 }
 
 void
 ClientTiledThebesLayer::BeginPaint()
 {
-  if (ClientManager()->IsRepeatTransaction()) {
-    return;
-  }
-
   mPaintData.mLowPrecisionPaintCount = 0;
   mPaintData.mPaintFinished = false;
   mPaintData.mCompositionBounds.SetEmpty();
   mPaintData.mCriticalDisplayPort.SetEmpty();
 
   if (!GetBaseTransform().Is2D()) {
     // Give up if there is a complex CSS transform on the layer. We might
     // eventually support these but for now it's too complicated to handle
@@ -237,48 +233,44 @@ ClientTiledThebesLayer::RenderLayer()
 
   nsIntRegion invalidRegion;
   invalidRegion.Sub(mVisibleRegion, mValidRegion);
   if (invalidRegion.IsEmpty()) {
     EndPaint(true);
     return;
   }
 
-  // Only paint the mask layer on the first transaction.
-  if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) {
-    ToClientLayer(GetMaskLayer())->RenderLayer();
-  }
-
-  // In some cases we can take a fast path and just be done with it.
-  if (UseFastPath()) {
-    mValidRegion = mVisibleRegion;
-
-    NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
-
-    mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
-                                             callback, data);
+  if (!ClientManager()->IsRepeatTransaction()) {
+    // Only paint the mask layer on the first transaction.
+    if (GetMaskLayer()) {
+      ToClientLayer(GetMaskLayer())->RenderLayer();
+    }
 
-    ClientManager()->Hold(this);
-    mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
-
-    return;
-  }
+    // In some cases we can take a fast path and just be done with it.
+    if (UseFastPath()) {
+      TILING_PRLOG(("TILING 0x%p: Taking fast-path\n"));
+      mValidRegion = mVisibleRegion;
+      mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data);
+      ClientManager()->Hold(this);
+      mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
+      return;
+    }
 
-  // Calculate everything we need to perform the paint.
-  BeginPaint();
-  if (mPaintData.mPaintFinished) {
-    return;
-  }
+    // For more complex cases we need to calculate a bunch of metrics before we
+    // can do the paint.
+    BeginPaint();
+    if (mPaintData.mPaintFinished) {
+      return;
+    }
 
-  TILING_PRLOG_OBJ(("TILING 0x%p: Valid region %s\n", this, tmpstr.get()), mValidRegion);
-  TILING_PRLOG_OBJ(("TILING 0x%p: Visible region %s\n", this, tmpstr.get()), mVisibleRegion);
+    TILING_PRLOG_OBJ(("TILING 0x%p: Valid region %s\n", this, tmpstr.get()), mValidRegion);
+    TILING_PRLOG_OBJ(("TILING 0x%p: Visible region %s\n", this, tmpstr.get()), mVisibleRegion);
 
-  // Make sure that tiles that fall outside of the visible region are
-  // discarded on the first update.
-  if (!ClientManager()->IsRepeatTransaction()) {
+    // Make sure that tiles that fall outside of the visible region are
+    // discarded on the first update.
     mValidRegion.And(mValidRegion, mVisibleRegion);
     if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
       // Make sure that tiles that fall outside of the critical displayport are
       // discarded on the first update.
       mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
     }
   }