Bug 803826 - Only reset the layer builder pointer in ~ClippedDisplayItem. r=mattwoodrow, a=bajaj
authorChris Lord <chrislord.net@gmail.com>
Tue, 23 Oct 2012 12:05:14 +0100
changeset 113716 fde0347f1e03242d12b5d37ea87fc153da445524
parent 113715 0633ae7db53fd1b89c870b1213e39ff8e50e0bf8
child 113717 c8d33f6290fdb571418b1adc1824be3e72f7f99e
push id2481
push userryanvm@gmail.com
push dateSat, 27 Oct 2012 23:58:38 +0000
treeherdermozilla-aurora@8447e7c219ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, bajaj
bugs803826
milestone18.0a2
Bug 803826 - Only reset the layer builder pointer in ~ClippedDisplayItem. r=mattwoodrow, a=bajaj PaintInactiveLayer was resetting the layer manager's layer builder pointer, but this was unnecessary as this was also being done on destruction of the ClippedDisplayItem.
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1923,18 +1923,17 @@ PaintInactiveLayer(nsDisplayListBuilder*
     }
   } else {
     basic->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
   }
   FrameLayerBuilder *builder = static_cast<FrameLayerBuilder*>(basic->GetUserData(&gLayerManagerLayerBuilder));
   if (builder) {
     builder->DidEndTransaction();
   }
- 
-  basic->SetUserData(&gLayerManagerLayerBuilder, NULL);
+
 #ifdef MOZ_DUMP_PAINTING
   if (gfxUtils::sDumpPainting) {
     DumpPaintedImage(aItem, surf);
 
     surf->SetDeviceOffset(gfxPoint(0, 0));
     aContext->SetSource(surf, itemVisibleRect.TopLeft());
     aContext->Rectangle(itemVisibleRect);
     aContext->Fill();
@@ -2336,17 +2335,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
         invalid.ScaleRoundOut(data->mXScale, data->mYScale);
         InvalidatePostTransformRegion(aLayer, invalid,
                                       GetTranslationForThebesLayer(aLayer));
       }
     }
     ClippedDisplayItem* cdi =
       entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClip,
                                                      mContainerLayerGeneration));
-    cdi->mInactiveLayer = tempManager;
+    cdi->mInactiveLayerManager = tempManager;
   }
 }
 
 FrameLayerBuilder::DisplayItemData*
 FrameLayerBuilder::StoreDataForFrame(nsDisplayItem* aItem, Layer* aLayer, LayerState aState)
 {
   DisplayItemData* oldData = GetDisplayItemDataForManager(aItem, mRetainingManager);
   if (oldData) {
@@ -2397,21 +2396,21 @@ FrameLayerBuilder::StoreDataForFrame(nsI
 
   data->AddFrame(aFrame);
 
   lmd->mDisplayItems.PutEntry(data);
 }
 
 FrameLayerBuilder::ClippedDisplayItem::~ClippedDisplayItem()
 {
-  if (mInactiveLayer) {
+  if (mInactiveLayerManager) {
     // We always start a transaction during layer construction for all inactive
     // layers, but we don't necessarily call EndTransaction during painting.
     // If the transaaction is still open, end it to avoid assertions.
-    BasicLayerManager* basic = static_cast<BasicLayerManager*>(mInactiveLayer.get());
+    BasicLayerManager* basic = static_cast<BasicLayerManager*>(mInactiveLayerManager.get());
     if (basic->InTransaction()) {
       basic->EndTransaction(nullptr, nullptr);
     }
     basic->SetUserData(&gLayerManagerLayerBuilder, nullptr);
   }
 }
 
 void
@@ -3151,18 +3150,18 @@ FrameLayerBuilder::DrawThebesLayer(Thebe
         currentClip = cdi->mClip;
         aContext->Save();
         NS_ASSERTION(commonClipCount < 100,
           "Maybe you really do have more than a hundred clipping rounded rects, or maybe something has gone wrong.");
         currentClip.ApplyTo(aContext, presContext, commonClipCount);
       }
     }
 
-    if (cdi->mInactiveLayer) {
-      PaintInactiveLayer(builder, cdi->mInactiveLayer, cdi->mItem, aContext, rc);
+    if (cdi->mInactiveLayerManager) {
+      PaintInactiveLayer(builder, cdi->mInactiveLayerManager, cdi->mItem, aContext, rc);
     } else {
       nsIFrame* frame = cdi->mItem->GetUnderlyingFrame();
       if (frame) {
         frame->AddStateBits(NS_FRAME_PAINTED_THEBES);
       }
 #ifdef MOZ_DUMP_PAINTING
 
       if (gfxUtils::sDumpPainting) {
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -600,17 +600,17 @@ protected:
 
     nsDisplayItem* mItem;
 
     /**
      * If the display item is being rendered as an inactive
      * layer, then this stores the layer manager being
      * used for the inactive transaction.
      */
-    nsRefPtr<LayerManager> mInactiveLayer;
+    nsRefPtr<LayerManager> mInactiveLayerManager;
 
     Clip mClip;
     uint32_t mContainerLayerGeneration;
   };
 
   /**
    * We accumulate ClippedDisplayItem elements in a hashtable during
    * the paint process. This is the hashentry for that hashtable.