Bug 1531277 - Check child container count in NotifyRefreshDriverCreated; r=dholbert a=lizzard
authorBrian Birtles <birtles@gmail.com>
Mon, 04 Mar 2019 15:54:55 +0000
changeset 516297 b72048157f1839b41ea407be0606a8f3cee83e47
parent 516296 5d767f7d3d488c96e6df5e927cc0349fc969adb9
child 516298 8d7186b2f9a6cc4ac5f13fb4c97106de0fdbead8
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, lizzard
bugs1531277
milestone66.0
Bug 1531277 - Check child container count in NotifyRefreshDriverCreated; r=dholbert a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D21636
dom/smil/SMILAnimationController.cpp
--- a/dom/smil/SMILAnimationController.cpp
+++ b/dom/smil/SMILAnimationController.cpp
@@ -88,17 +88,17 @@ void SMILAnimationController::Pause(uint
 void SMILAnimationController::Resume(uint32_t aType) {
   bool wasPaused = (mPauseState != 0);
   // Update mCurrentSampleTime so that calls to GetParentTime--used for
   // calculating parent offsets--are accurate
   mCurrentSampleTime = mozilla::TimeStamp::Now();
 
   SMILTimeContainer::Resume(aType);
 
-  if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
+  if (wasPaused && !mPauseState && !mChildContainerTable.IsEmpty()) {
     MaybeStartSampling(GetRefreshDriver());
     Sample();  // Run the first sample manually
   }
 }
 
 SMILTime SMILAnimationController::GetParentTime() const {
   return (SMILTime)(mCurrentSampleTime - mStartTime).ToMilliseconds();
 }
@@ -159,17 +159,17 @@ void SMILAnimationController::WillRefres
 //----------------------------------------------------------------------
 // Animation element registration methods:
 
 void SMILAnimationController::RegisterAnimationElement(
     SVGAnimationElement* aAnimationElement) {
   mAnimationElementTable.PutEntry(aAnimationElement);
   if (mDeferredStartSampling) {
     mDeferredStartSampling = false;
-    if (mChildContainerTable.Count()) {
+    if (!mChildContainerTable.IsEmpty()) {
       // mAnimationElementTable was empty, but now we've added its 1st element
       MOZ_ASSERT(mAnimationElementTable.Count() == 1,
                  "we shouldn't have deferred sampling if we already had "
                  "animations registered");
       StartSampling(GetRefreshDriver());
       Sample();  // Run the first sample manually
     }  // else, don't sample until a time container is registered (via AddChild)
   }
@@ -207,17 +207,17 @@ void SMILAnimationController::Traverse(
 
 void SMILAnimationController::Unlink() { mLastCompositorTable = nullptr; }
 
 //----------------------------------------------------------------------
 // Refresh driver lifecycle related methods
 
 void SMILAnimationController::NotifyRefreshDriverCreated(
     nsRefreshDriver* aRefreshDriver) {
-  if (!mPauseState) {
+  if (!mPauseState && !mChildContainerTable.IsEmpty()) {
     MaybeStartSampling(aRefreshDriver);
   }
 }
 
 void SMILAnimationController::NotifyRefreshDriverDestroying(
     nsRefreshDriver* aRefreshDriver) {
   if (!mPauseState && !mDeferredStartSampling) {
     StopSampling(aRefreshDriver);
@@ -703,17 +703,17 @@ nsresult SMILAnimationController::AddChi
   }
 
   return NS_OK;
 }
 
 void SMILAnimationController::RemoveChild(SMILTimeContainer& aChild) {
   mChildContainerTable.RemoveEntry(&aChild);
 
-  if (!mPauseState && mChildContainerTable.Count() == 0) {
+  if (!mPauseState && mChildContainerTable.IsEmpty()) {
     StopSampling(GetRefreshDriver());
   }
 }
 
 // Helper method
 nsRefreshDriver* SMILAnimationController::GetRefreshDriver() {
   if (!mDocument) {
     NS_ERROR("Requesting refresh driver after document has disconnected!");