Bug 1336598 P2 Avoid underflow in timeout CancelOrUpdateBackpressure(). r=smaug a=lizzard
authorBen Kelly <ben@wanderview.com>
Mon, 13 Feb 2017 15:02:30 -0500
changeset 378423 a07f4b1cef63068d31e8ea17130d5068cc8e05a3
parent 378422 c234f1f1ed00994e018b49bfabedd104dbfa173a
child 378424 49a9d644f1e778fad84738c26acb4ec7377131d3
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lizzard
bugs1336598
milestone53.0a2
Bug 1336598 P2 Avoid underflow in timeout CancelOrUpdateBackpressure(). r=smaug a=lizzard
dom/base/TimeoutManager.cpp
--- a/dom/base/TimeoutManager.cpp
+++ b/dom/base/TimeoutManager.cpp
@@ -640,18 +640,18 @@ TimeoutManager::CancelOrUpdateBackPressu
 
   // If the delay has decreased, though, we only apply the new value if it has
   // reduced significantly.  This hysteresis avoids thrashing the back pressure
   // value back and forth rapidly.  This is important because reducing the
   // backpressure delay requires calling ResetTimerForThrottleReduction() which
   // can be quite expensive.  We only want to call that method if the back log
   // is really clearing.
   else if (newBackPressureDelayMS == 0 ||
-           (newBackPressureDelayMS <=
-           (mBackPressureDelayMS - kBackPressureDelayReductionThresholdMS))) {
+           (mBackPressureDelayMS >
+           (newBackPressureDelayMS + kBackPressureDelayReductionThresholdMS))) {
     int32_t oldBackPressureDelayMS = mBackPressureDelayMS;
     mBackPressureDelayMS = newBackPressureDelayMS;
 
     // If the back pressure delay has gone down we must reset any existing
     // timers to use the new value.  Otherwise we run the risk of executing
     // timer callbacks out-of-order.
     ResetTimersForThrottleReduction(oldBackPressureDelayMS);
   }