Bug 1253094, part 5 - Stop using DebugOnly for class/struct members in layout/. r=mats draft
authorJonathan Watt <jwatt@jwatt.org>
Wed, 02 Mar 2016 23:53:04 +0000
changeset 336256 b9bcbe8c8fe00ccae7d3340a2bedc2530a6386b6
parent 336255 201a36a1b6a02962d50444475580176d62ca1373
child 336257 ca3e12a665c020b6d26768dbd2235f73d8b20064
push id12025
push userjwatt@jwatt.org
push dateThu, 03 Mar 2016 00:03:10 +0000
reviewersmats
bugs1253094
milestone47.0a1
Bug 1253094, part 5 - Stop using DebugOnly for class/struct members in layout/. r=mats MozReview-Commit-ID: 158TFIKukIU
layout/base/DisplayListClipState.cpp
layout/base/DisplayListClipState.h
layout/base/FrameLayerBuilder.cpp
layout/generic/nsFloatManager.cpp
layout/generic/nsFloatManager.h
layout/svg/nsSVGClipPathFrame.h
--- a/layout/base/DisplayListClipState.cpp
+++ b/layout/base/DisplayListClipState.cpp
@@ -199,13 +199,15 @@ DisplayListClipState::InsertInactiveScro
     CreateInactiveScrollClip(aBuilder, aScrollableFrame);
   mScrollClipContainingBlockDescendants = scrollClip;
   return scrollClip;
 }
 
 DisplayListClipState::AutoSaveRestore::AutoSaveRestore(nsDisplayListBuilder* aBuilder)
   : mState(aBuilder->ClipState())
   , mSavedState(aBuilder->ClipState())
+#ifdef DEBUG
   , mClipUsed(false)
   , mRestored(false)
+#endif
 {}
 
 } // namespace mozilla
--- a/layout/base/DisplayListClipState.h
+++ b/layout/base/DisplayListClipState.h
@@ -194,105 +194,127 @@ private:
  * dangling pointers to DisplayItemClips.
  */
 class DisplayListClipState::AutoSaveRestore {
 public:
   explicit AutoSaveRestore(nsDisplayListBuilder* aBuilder);
   void Restore()
   {
     mState = mSavedState;
+#ifdef DEBUG
     mRestored = true;
+#endif
   }
   ~AutoSaveRestore()
   {
     mState = mSavedState;
   }
 
   void Clear()
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     mState.Clear();
+#ifdef DEBUG
     mClipUsed = false;
+#endif
   }
 
   void ClearForStackingContextContents()
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     mState.ClearForStackingContextContents();
+#ifdef DEBUG
     mClipUsed = false;
+#endif
   }
 
 
   void ClearIncludingScrollClip()
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     mState.ClearIncludingScrollClip();
+#ifdef DEBUG
     mClipUsed = false;
+#endif
   }
 
   void TurnClipIntoScrollClipForContentDescendants(nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     mState.TurnClipIntoScrollClipForContentDescendants(aBuilder, aScrollableFrame);
+#ifdef DEBUG
     mClipUsed = true;
+#endif
   }
 
   void TurnClipIntoScrollClipForContainingBlockDescendants(nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     mState.TurnClipIntoScrollClipForContainingBlockDescendants(aBuilder, aScrollableFrame);
+#ifdef DEBUG
     mClipUsed = true;
+#endif
   }
 
   DisplayItemScrollClip* InsertInactiveScrollClipForContentDescendants(nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     DisplayItemScrollClip* scrollClip = mState.InsertInactiveScrollClipForContentDescendants(aBuilder, aScrollableFrame);
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     return scrollClip;
   }
 
   DisplayItemScrollClip* InsertInactiveScrollClipForContainingBlockDescendants(nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     DisplayItemScrollClip* scrollClip = mState.InsertInactiveScrollClipForContainingBlockDescendants(aBuilder, aScrollableFrame);
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     return scrollClip;
   }
 
   /**
    * Intersects the given clip rect (with optional aRadii) with the current
    * mClipContainingBlockDescendants and sets mClipContainingBlockDescendants to
    * the result, stored in aClipOnStack.
    */
   void ClipContainingBlockDescendants(const nsRect& aRect,
                                       const nscoord* aRadii = nullptr)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     NS_ASSERTION(!mClipUsed, "mClip already used");
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     mState.ClipContainingBlockDescendants(aRect, aRadii, mClip);
   }
 
   void ClipContentDescendants(const nsRect& aRect,
                               const nscoord* aRadii = nullptr)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     NS_ASSERTION(!mClipUsed, "mClip already used");
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     mState.ClipContentDescendants(aRect, aRadii, mClip);
   }
 
   void ClipContentDescendants(const nsRect& aRect,
                               const nsRect& aRoundedRect,
                               const nscoord* aRadii = nullptr)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     NS_ASSERTION(!mClipUsed, "mClip already used");
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     mState.ClipContentDescendants(aRect, aRoundedRect, aRadii, mClip);
   }
 
   /**
    * Clips containing-block descendants to the frame's content-box,
    * taking border-radius into account.
    * If aFlags contains ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT then
    * we assume display items will not draw outside the content rect, so
@@ -300,50 +322,58 @@ public:
    * optimization to reduce the amount of clipping required.
    */
   void ClipContainingBlockDescendantsToContentBox(nsDisplayListBuilder* aBuilder,
                                                   nsIFrame* aFrame,
                                                   uint32_t aFlags = 0)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     NS_ASSERTION(!mClipUsed, "mClip already used");
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     mState.ClipContainingBlockDescendantsToContentBox(aBuilder, aFrame, mClip, aFlags);
   }
 
 protected:
   DisplayListClipState& mState;
   DisplayListClipState mSavedState;
   DisplayItemClip mClip;
-  DebugOnly<bool> mClipUsed;
-  DebugOnly<bool> mRestored;
+#ifdef DEBUG
+  bool mClipUsed;
+  bool mRestored;
+#endif
 };
 
 class DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox : public AutoSaveRestore {
 public:
   AutoClipContainingBlockDescendantsToContentBox(nsDisplayListBuilder* aBuilder,
                                                  nsIFrame* aFrame,
                                                  uint32_t aFlags = 0)
     : AutoSaveRestore(aBuilder)
   {
+#ifdef DEBUG
     mClipUsed = true;
+#endif
     mState.ClipContainingBlockDescendantsToContentBox(aBuilder, aFrame, mClip, aFlags);
   }
 };
 
 /**
  * Do not use this outside of nsFrame::BuildDisplayListForChild, use
  * multiple AutoSaveRestores instead. We provide this class just to ensure
  * BuildDisplayListForChild is as efficient as possible.
  */
 class DisplayListClipState::AutoClipMultiple : public AutoSaveRestore {
 public:
   explicit AutoClipMultiple(nsDisplayListBuilder* aBuilder)
     : AutoSaveRestore(aBuilder)
+#ifdef DEBUG
     , mExtraClipUsed(false)
+#endif
   {}
 
   /**
    * *aClip must survive longer than this object. Be careful!!!
    */
   void SetClipForContainingBlockDescendants(const DisplayItemClip* aClip)
   {
     mState.SetClipForContainingBlockDescendants(aClip);
@@ -359,20 +389,24 @@ public:
    * mClipContainingBlockDescendants and sets mClipContainingBlockDescendants to
    * the result, stored in aClipOnStack.
    */
   void ClipContainingBlockDescendantsExtra(const nsRect& aRect,
                                            const nscoord* aRadii)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     NS_ASSERTION(!mExtraClipUsed, "mExtraClip already used");
+#ifdef DEBUG
     mExtraClipUsed = true;
+#endif
     mState.ClipContainingBlockDescendants(aRect, aRadii, mExtraClip);
   }
 
 protected:
   DisplayItemClip mExtraClip;
-  DebugOnly<bool> mExtraClipUsed;
+#ifdef DEBUG
+  bool mExtraClipUsed;
+#endif
 };
 
 } // namespace mozilla
 
 #endif /* DISPLAYLISTCLIPSTATE_H_ */
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1360,17 +1360,19 @@ protected:
   LayerManager*                    mManager;
   FrameLayerBuilder*               mLayerBuilder;
   nsIFrame*                        mContainerFrame;
   nsIFrame*                        mContainerReferenceFrame;
   AnimatedGeometryRoot*            mContainerAnimatedGeometryRoot;
   ContainerLayer*                  mContainerLayer;
   nsRect                           mContainerBounds;
   const DisplayItemScrollClip*     mContainerScrollClip;
-  DebugOnly<nsRect>                mAccumulatedChildBounds;
+#ifdef DEBUG
+  nsRect                           mAccumulatedChildBounds;
+#endif
   ContainerLayerParameters         mParameters;
   /**
    * The region of PaintedLayers that should be invalidated every time
    * we recycle one.
    */
   nsIntRegion                      mInvalidPaintedContent;
   PaintedLayerDataTree             mPaintedLayerDataTree;
   /**
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -110,17 +110,17 @@ void nsFloatManager::Shutdown()
       free(floatManager);
   }
 
   // Disable further caching.
   sCachedFloatManagerCount = -1;
 }
 
 #define CHECK_BLOCK_DIR(aWM) \
-  NS_ASSERTION(aWM.GetBlockDir() == mWritingMode.value.GetBlockDir(), \
+  NS_ASSERTION(aWM.GetBlockDir() == mWritingMode.GetBlockDir(), \
   "incompatible writing modes")
 
 nsFlowAreaRect
 nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
                             BandInfoType aInfoType, nscoord aBSize,
                             LogicalRect aContentArea, SavedState* aState,
                             const nsSize& aContainerSize) const
 {
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -335,17 +335,19 @@ private:
     // placing floats, which is not necessarily the actual writing mode
     // either of the block which created the frame manager or the block
     // that is calling the frame manager. The inline coordinates are in
     // the line-relative axis of the frame manager and its block
     // coordinates are in the frame manager's real block direction.
     nsRect mRect;
   };
 
-  mozilla::DebugOnly<mozilla::WritingMode> mWritingMode;
+#ifdef DEBUG
+  mozilla::WritingMode mWritingMode;
+#endif
 
   // Translation from local to global coordinate space.
   nscoord mLineLeft, mBlockStart;
   nsTArray<FloatInfo> mFloats;
   nsIntervalSet   mFloatDamage;
 
   // Did we try to place a float that could not fit at all and had to be
   // pushed to the next page/column?  If so, we can't place any more
--- a/layout/svg/nsSVGClipPathFrame.h
+++ b/layout/svg/nsSVGClipPathFrame.h
@@ -179,17 +179,19 @@ private:
       }
       aFrame->mInUse = true;
       mFrame = aFrame;
       return true;
     }
 
   private:
     nsSVGClipPathFrame* mFrame;
-    DebugOnly<bool> mMarkAsInUseCalled;
+#ifdef DEBUG
+    bool mMarkAsInUseCalled;
+#endif
   };
 
   // Set, during a GetClipMask() call, to the transform that still needs to be
   // concatenated to the transform of the DrawTarget that was passed to
   // GetClipMask in order to establish the coordinate space that the clipPath
   // establishes for its contents (i.e. including applying 'clipPathUnits' and
   // any 'transform' attribute set on the clipPath) specifically for clipping
   // the frame that was passed to GetClipMask at that moment in time.  This is