Bug 890362 - Delayed tasks posted to the mozilla UI message loop stop working after sleep/wake. r=bsmedberg
authorBrian R. Bondy <netzen@gmail.com>
Wed, 10 Jul 2013 12:39:09 -0400
changeset 137990 3f64ceb4d0423fd12accdb48a39f884b261b83c6
parent 137989 6efe5b6904d0694ae63ecdd2a991c6362f8eb76c
child 137991 616f0b208426249ae0a871b64c989ad7ca7cbcc3
push id30774
push userbbondy@mozilla.com
push dateWed, 10 Jul 2013 16:40:00 +0000
treeherdermozilla-inbound@3f64ceb4d042 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs890362
milestone25.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 890362 - Delayed tasks posted to the mozilla UI message loop stop working after sleep/wake. r=bsmedberg
ipc/glue/MessagePump.cpp
--- a/ipc/glue/MessagePump.cpp
+++ b/ipc/glue/MessagePump.cpp
@@ -159,17 +159,21 @@ MessagePump::ScheduleDelayedWork(const b
   }
 
   if (!delayed_work_time_.is_null()) {
     mDelayedWorkTimer->Cancel();
   }
 
   delayed_work_time_ = aDelayedTime;
 
-  base::TimeDelta delay = aDelayedTime - base::TimeTicks::Now();
+  // TimeDelta's constructor initializes to 0
+  base::TimeDelta delay;
+  if (aDelayedTime > base::TimeTicks::Now())
+    delay = aDelayedTime - base::TimeTicks::Now();
+
   uint32_t delayMS = uint32_t(delay.InMilliseconds());
   mDelayedWorkTimer->InitWithCallback(mDoWorkEvent, delayMS,
                                       nsITimer::TYPE_ONE_SHOT);
 }
 
 void
 MessagePump::DoDelayedWork(base::MessagePump::Delegate* aDelegate)
 {