Bug 1321357 part 2 - Make nsSMILTimeContainer::mHoldingEntries debug-only; r=dholbert
authorBrian Birtles <birtles@gmail.com>
Fri, 02 Dec 2016 11:22:40 +0900
changeset 325056 7004ffd040dc2bbe1aa8fb3bd378cb4ce73d2ff6
parent 325055 8c1e9210ea8585b0a266dff886a7f2cd8a180254
child 325057 31d734b71af6df8d7eabb3b4ab98dd9ccf5273e5
push id31026
push usercbook@mozilla.com
push dateFri, 02 Dec 2016 08:24:04 +0000
treeherdermozilla-central@f65ad27efe83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1321357
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1321357 part 2 - Make nsSMILTimeContainer::mHoldingEntries debug-only; r=dholbert MozReview-Commit-ID: 2plUpGMj1FB
dom/smil/nsSMILTimeContainer.cpp
dom/smil/nsSMILTimeContainer.h
--- a/dom/smil/nsSMILTimeContainer.cpp
+++ b/dom/smil/nsSMILTimeContainer.cpp
@@ -15,17 +15,19 @@ nsSMILTimeContainer::nsSMILTimeContainer
 :
   mParent(nullptr),
   mCurrentTime(0L),
   mParentOffset(0L),
   mPauseStart(0L),
   mNeedsPauseSample(false),
   mNeedsRewind(false),
   mIsSeeking(false),
+#ifdef DEBUG
   mHoldingEntries(false),
+#endif
   mPauseState(PAUSE_BEGIN)
 {
 }
 
 nsSMILTimeContainer::~nsSMILTimeContainer()
 {
   if (mParent) {
     mParent->RemoveChild(*this);
@@ -211,24 +213,24 @@ nsSMILTimeContainer::SetParent(nsSMILTim
 bool
 nsSMILTimeContainer::AddMilestone(const nsSMILMilestone& aMilestone,
                                   mozilla::dom::SVGAnimationElement& aElement)
 {
   // We record the milestone time and store it along with the element but this
   // time may change (e.g. if attributes are changed on the timed element in
   // between samples). If this happens, then we may do an unecessary sample
   // but that's pretty cheap.
-  MOZ_RELEASE_ASSERT(!mHoldingEntries);
+  MOZ_ASSERT(!mHoldingEntries);
   return mMilestoneEntries.Push(MilestoneEntry(aMilestone, aElement));
 }
 
 void
 nsSMILTimeContainer::ClearMilestones()
 {
-  MOZ_RELEASE_ASSERT(!mHoldingEntries);
+  MOZ_ASSERT(!mHoldingEntries);
   mMilestoneEntries.Clear();
 }
 
 bool
 nsSMILTimeContainer::GetNextMilestoneInParentTime(
     nsSMILMilestone& aNextMilestone) const
 {
   if (mMilestoneEntries.IsEmpty())
@@ -259,46 +261,48 @@ nsSMILTimeContainer::PopMilestoneElement
 
   nsSMILMilestone containerMilestone(containerTime.GetMillis(),
                                      aMilestone.mIsEnd);
 
   MOZ_ASSERT(mMilestoneEntries.Top().mMilestone >= containerMilestone,
              "Trying to pop off earliest times but we have earlier ones that "
              "were overlooked");
 
-  MOZ_RELEASE_ASSERT(!mHoldingEntries);
+  MOZ_ASSERT(!mHoldingEntries);
 
   bool gotOne = false;
   while (!mMilestoneEntries.IsEmpty() &&
       mMilestoneEntries.Top().mMilestone == containerMilestone)
   {
     aMatchedElements.AppendElement(mMilestoneEntries.Pop().mTimebase);
     gotOne = true;
   }
 
   return gotOne;
 }
 
 void
 nsSMILTimeContainer::Traverse(nsCycleCollectionTraversalCallback* aCallback)
 {
+#ifdef DEBUG
   AutoRestore<bool> saveHolding(mHoldingEntries);
   mHoldingEntries = true;
+#endif
   const MilestoneEntry* p = mMilestoneEntries.Elements();
   while (p < mMilestoneEntries.Elements() + mMilestoneEntries.Length()) {
     NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*aCallback, "mTimebase");
     aCallback->NoteXPCOMChild(static_cast<nsIContent*>(p->mTimebase.get()));
     ++p;
   }
 }
 
 void
 nsSMILTimeContainer::Unlink()
 {
-  MOZ_RELEASE_ASSERT(!mHoldingEntries);
+  MOZ_ASSERT(!mHoldingEntries);
   mMilestoneEntries.Clear();
 }
 
 void
 nsSMILTimeContainer::UpdateCurrentTime()
 {
   nsSMILTime now = IsPaused() ? mPauseStart : GetParentTime();
   mCurrentTime = now - mParentOffset;
@@ -319,18 +323,20 @@ nsSMILTimeContainer::NotifyTimeChange()
   // registered. Other timed elements don't matter.
 
   // Copy the timed elements to a separate array before calling
   // HandleContainerTimeChange on each of them in case doing so mutates
   // mMilestoneEntries.
   nsTArray<RefPtr<mozilla::dom::SVGAnimationElement>> elems;
 
   {
+#ifdef DEBUG
     AutoRestore<bool> saveHolding(mHoldingEntries);
     mHoldingEntries = true;
+#endif
     for (const MilestoneEntry* p = mMilestoneEntries.Elements();
         p < mMilestoneEntries.Elements() + mMilestoneEntries.Length();
         ++p) {
       elems.AppendElement(p->mTimebase.get());
     }
   }
 
   for (auto& elem : elems) {
--- a/dom/smil/nsSMILTimeContainer.h
+++ b/dom/smil/nsSMILTimeContainer.h
@@ -261,17 +261,20 @@ protected:
   nsSMILTime mPauseStart;
 
   // Whether or not a pause sample is required
   bool mNeedsPauseSample;
 
   bool mNeedsRewind; // Backwards seek performed
   bool mIsSeeking; // Currently in the middle of a seek operation
 
-  bool mHoldingEntries; // True if there's a raw pointer to mMilestoneEntries on the stack.
+#ifdef DEBUG
+  bool mHoldingEntries; // True if there's a raw pointer to mMilestoneEntries
+                        // on the stack.
+#endif
 
   // A bitfield of the pause state for all pause requests
   uint32_t mPauseState;
 
   struct MilestoneEntry
   {
     MilestoneEntry(nsSMILMilestone aMilestone,
                    mozilla::dom::SVGAnimationElement& aElement)