Bug 1384300. Stop refresh driver timers after swapping refresh drivers. r=billm
authorMason Chang <mchang@mozilla.com>
Fri, 28 Jul 2017 15:01:27 -0700
changeset 420788 ee5586d41e4e6b9f2dc18540732b63eb6017bdb2
parent 420787 c579ac37ac11a44b9af0c75720f519a40c439b19
child 420789 76abbe45dd0acd498a19fcfdef47c001c5d147e1
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1384300
milestone56.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 1384300. Stop refresh driver timers after swapping refresh drivers. r=billm
layout/base/nsRefreshDriver.cpp
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -222,16 +222,18 @@ public:
     for (nsRefreshDriver* driver : mRootRefreshDrivers) {
       aNewTimer->AddRefreshDriver(driver);
       driver->mActiveTimer = aNewTimer;
     }
     mRootRefreshDrivers.Clear();
 
     aNewTimer->mLastFireEpoch = mLastFireEpoch;
     aNewTimer->mLastFireTime = mLastFireTime;
+
+    StopTimer();
   }
 
   virtual TimeDuration GetTimerRate() = 0;
 
   bool LastTickSkippedAnyPaints() const
   {
     return mLastFireSkipped;
   }
@@ -360,17 +362,17 @@ public:
    * aRate -- the delay, in milliseconds, requested between timer firings
    */
   explicit SimpleTimerBasedRefreshDriverTimer(double aRate)
   {
     SetRate(aRate);
     mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   }
 
-  ~SimpleTimerBasedRefreshDriverTimer() override
+  virtual ~SimpleTimerBasedRefreshDriverTimer() override
   {
     StopTimer();
   }
 
   // will take effect at next timer tick
   virtual void SetRate(double aNewRate)
   {
     mRateMilliseconds = aNewRate;