Bug 1141089 - Add a few more MOZ_RELEASE_ASSERT(mLayer) checks, just for fun. r=roc, a=lizzard
authorMarkus Stange <mstange@themasta.com>
Fri, 10 Apr 2015 17:30:09 -0400
changeset 263186 5d5fea3658ad27537e9f734d91e221f448bedae0
parent 263185 3c53ae1afd8f7a401f3913a3aa171b896f28551f
child 263187 c3f3f6cdb84cbc11e8d27ca386e6891b26fbecc4
push id1963
push userpaolo.mozmail@amadzone.org
push dateSun, 10 May 2015 10:26:20 +0000
reviewersroc, lizzard
bugs1141089
milestone39.0a2
Bug 1141089 - Add a few more MOZ_RELEASE_ASSERT(mLayer) checks, just for fun. r=roc, a=lizzard
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -50,24 +50,26 @@ FrameLayerBuilder::DisplayItemData::Disp
 
   : mParent(aParent)
   , mLayer(aLayer)
   , mDisplayItemKey(aKey)
   , mItem(nullptr)
   , mUsed(true)
   , mIsInvalid(false)
 {
+  MOZ_RELEASE_ASSERT(mLayer);
   if (aFrame) {
     AddFrame(aFrame);
   }
 }
 
 void
 FrameLayerBuilder::DisplayItemData::AddFrame(nsIFrame* aFrame)
 {
+  MOZ_RELEASE_ASSERT(mLayer);
   mFrameList.AppendElement(aFrame);
 
   nsTArray<DisplayItemData*> *array =
     reinterpret_cast<nsTArray<DisplayItemData*>*>(aFrame->Properties().Get(FrameLayerBuilder::LayerManagerDataProperty()));
   if (!array) {
     array = new nsTArray<DisplayItemData*>();
     aFrame->Properties().Set(FrameLayerBuilder::LayerManagerDataProperty(), array);
   }
@@ -110,16 +112,17 @@ FrameLayerBuilder::DisplayItemData::EndU
   EndUpdate();
 }
 
 void
 FrameLayerBuilder::DisplayItemData::BeginUpdate(Layer* aLayer, LayerState aState,
                                                 uint32_t aContainerLayerGeneration,
                                                 nsDisplayItem* aItem /* = nullptr */)
 {
+  MOZ_RELEASE_ASSERT(mLayer);
   MOZ_RELEASE_ASSERT(aLayer);
   mLayer = aLayer;
   mOptLayer = nullptr;
   mInactiveManager = nullptr;
   mLayerState = aState;
   mContainerLayerGeneration = aContainerLayerGeneration;
   mUsed = true;
 
@@ -152,16 +155,17 @@ FrameLayerBuilder::DisplayItemData::Begi
     RemoveFrame(copy[i]);
     mFrameListChanges.AppendElement(copy[i]);
   }
 }
 
 static nsIFrame* sDestroyedFrame = nullptr;
 FrameLayerBuilder::DisplayItemData::~DisplayItemData()
 {
+  MOZ_RELEASE_ASSERT(mLayer);
   for (uint32_t i = 0; i < mFrameList.Length(); i++) {
     nsIFrame* frame = mFrameList[i];
     if (frame == sDestroyedFrame) {
       continue;
     }
     nsTArray<DisplayItemData*> *array =
       reinterpret_cast<nsTArray<DisplayItemData*>*>(frame->Properties().Get(LayerManagerDataProperty()));
     array->RemoveElement(this);