Bug 1182978 (part 3) - Use nsTHashtable::Iterator in nsSMILAnimationController. r=birtles.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 22 Jul 2015 00:19:36 -0700
changeset 287547 2222bb624dbe639fd52d6af192e77e13fb65991b
parent 287546 2c58983492ec5805e407f2292c82a5f1bbb52049
child 287548 da0f28a2c1e3a1551e9fb7c77387a083f56e0bab
push id934
push userraliiev@mozilla.com
push dateMon, 26 Oct 2015 12:58:05 +0000
treeherdermozilla-release@05704e35c1d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1182978
milestone42.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 1182978 (part 3) - Use nsTHashtable::Iterator in nsSMILAnimationController. r=birtles.
dom/smil/nsSMILAnimationController.cpp
dom/smil/nsSMILAnimationController.h
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/nsSMILAnimationController.cpp
@@ -442,60 +442,38 @@ nsSMILAnimationController::DoSample(bool
 
   NS_ASSERTION(!mResampleNeeded, "Resample dirty flag set during sample!");
 }
 
 void
 nsSMILAnimationController::RewindElements()
 {
   bool rewindNeeded = false;
-  mChildContainerTable.EnumerateEntries(RewindNeeded, &rewindNeeded);
+  for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
+    nsSMILTimeContainer* container = iter.Get()->GetKey();
+    if (container->NeedsRewind()) {
+      rewindNeeded = true;
+      break;
+    }
+  }
+
   if (!rewindNeeded)
     return;
 
-  mAnimationElementTable.EnumerateEntries(RewindAnimation, nullptr);
-  mChildContainerTable.EnumerateEntries(ClearRewindNeeded, nullptr);
-}
-
-/*static*/ PLDHashOperator
-nsSMILAnimationController::RewindNeeded(TimeContainerPtrKey* aKey,
-                                        void* aData)
-{
-  MOZ_ASSERT(aData,
-             "Null data pointer during time container enumeration");
-  bool* rewindNeeded = static_cast<bool*>(aData);
-
-  nsSMILTimeContainer* container = aKey->GetKey();
-  if (container->NeedsRewind()) {
-    *rewindNeeded = true;
-    return PL_DHASH_STOP;
+  for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
+    SVGAnimationElement* animElem = iter.Get()->GetKey();
+    nsSMILTimeContainer* timeContainer = animElem->GetTimeContainer();
+    if (timeContainer && timeContainer->NeedsRewind()) {
+      animElem->TimedElement().Rewind();
+    }
   }
 
-  return PL_DHASH_NEXT;
-}
-
-/*static*/ PLDHashOperator
-nsSMILAnimationController::RewindAnimation(AnimationElementPtrKey* aKey,
-                                           void* aData)
-{
-  SVGAnimationElement* animElem = aKey->GetKey();
-  nsSMILTimeContainer* timeContainer = animElem->GetTimeContainer();
-  if (timeContainer && timeContainer->NeedsRewind()) {
-    animElem->TimedElement().Rewind();
+  for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
+    iter.Get()->GetKey()->ClearNeedsRewind();
   }
-
-  return PL_DHASH_NEXT;
-}
-
-/*static*/ PLDHashOperator
-nsSMILAnimationController::ClearRewindNeeded(TimeContainerPtrKey* aKey,
-                                             void* aData)
-{
-  aKey->GetKey()->ClearNeedsRewind();
-  return PL_DHASH_NEXT;
 }
 
 void
 nsSMILAnimationController::DoMilestoneSamples()
 {
   // We need to sample the timing model but because SMIL operates independently
   // of the frame-rate, we can get one sample at t=0s and the next at t=10min.
   //
--- a/dom/smil/nsSMILAnimationController.h
+++ b/dom/smil/nsSMILAnimationController.h
@@ -134,22 +134,16 @@ protected:
   // Wrapper for StartSampling that defers if no animations are registered.
   void MaybeStartSampling(nsRefreshDriver* aRefreshDriver);
 
   // Sample-related callbacks and implementation helpers
   virtual void DoSample() override;
   void DoSample(bool aSkipUnchangedContainers);
 
   void RewindElements();
-  static PLDHashOperator RewindNeeded(
-      TimeContainerPtrKey* aKey, void* aData);
-  static PLDHashOperator RewindAnimation(
-      AnimationElementPtrKey* aKey, void* aData);
-  static PLDHashOperator ClearRewindNeeded(
-      TimeContainerPtrKey* aKey, void* aData);
 
   void DoMilestoneSamples();
   static PLDHashOperator GetNextMilestone(
       TimeContainerPtrKey* aKey, void* aData);
   static PLDHashOperator GetMilestoneElements(
       TimeContainerPtrKey* aKey, void* aData);
 
   static void SampleTimedElement(mozilla::dom::SVGAnimationElement* aElement,