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 137997 3f64ceb4d0423fd12accdb48a39f884b261b83c6
parent 137996 6efe5b6904d0694ae63ecdd2a991c6362f8eb76c
child 137998 616f0b208426249ae0a871b64c989ad7ca7cbcc3
push id24941
push useremorley@mozilla.com
push dateThu, 11 Jul 2013 09:11:18 +0000
treeherdermozilla-central@c89e5b9fe935 [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)
 {