Bug 786503: mark nsSMILInstanceTime::mVisited as mutable. r=birtles
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 28 Aug 2012 22:27:53 -0700
changeset 105773 2f34d5cff8a036bd3ed23731720e6e6e5601c6aa
parent 105772 9e3f2ec9e8f7c98b6c324ad5d2440bff23aeac47
child 105774 ff45232365137efd148d881b86635582f24616d8
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersbirtles
bugs786503
milestone18.0a1
Bug 786503: mark nsSMILInstanceTime::mVisited as mutable. r=birtles
content/smil/nsSMILInstanceTime.cpp
content/smil/nsSMILInstanceTime.h
--- a/content/smil/nsSMILInstanceTime.cpp
+++ b/content/smil/nsSMILInstanceTime.cpp
@@ -162,19 +162,18 @@ nsSMILInstanceTime::IsDependentOn(const 
 
   const nsSMILInstanceTime* myBaseTime = GetBaseTime();
   if (!myBaseTime)
     return false;
 
   if (myBaseTime == &aOther)
     return true;
 
-  // mVisited is mutable
-  mozilla::AutoRestore<bool> setVisited(const_cast<nsSMILInstanceTime*>(this)->mVisited);
-  const_cast<nsSMILInstanceTime*>(this)->mVisited = true;
+  mozilla::AutoRestore<bool> setVisited(mVisited);
+  mVisited = true;
   return myBaseTime->IsDependentOn(aOther);
 }
 
 const nsSMILInstanceTime*
 nsSMILInstanceTime::GetBaseTime() const
 {
   if (!mBaseInterval) {
     return nullptr;
--- a/content/smil/nsSMILInstanceTime.h
+++ b/content/smil/nsSMILInstanceTime.h
@@ -127,17 +127,17 @@ protected:
     kFromDOM = 4,
 
     // Indicates that this instance time was used as the endpoint of an interval
     // that has been filtered or removed. However, since it is a dynamic time it
     // should be preserved and not filtered.
     kWasDynamicEndpoint = 8
   };
   uint8_t       mFlags;   // Combination of kDynamic, kMayUpdate, etc.
-  bool          mVisited; // (mutable) Cycle tracking
+  mutable bool  mVisited; // Cycle tracking
 
   // Additional reference count to determine if this instance time is currently
   // used as a fixed endpoint in any intervals. Instance times that are used in
   // this way should not be removed when the owning nsSMILTimedElement removes
   // instance times in response to a restart or in an attempt to free up memory
   // by filtering out old instance times.
   //
   // Instance times are only shared in a few cases, namely: