From 9bcbf478c173d91958cdabc8a8902619392b7f1f Mon Sep 17 00:00:00 2001 From: "darin@google.com" Date: Sat, 30 Aug 2008 00:22:48 +0000 Subject: Switch SharedTimerWin over to using PostDelayedTask. I made some tweaks to the PostDelayedTask implementation to ensure that perf is still good. This involved recording the intended fire time of PostDelayedTask on the Task object so that it can be used to properly determine the delay passed to the StartTimer call. With this change, I am able to service timers (call DoDelayedWork) more often from within the MessagePump implementations. R=mbelshe BUG=1346553 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1578 0039d316-1c4b-4281-b951-d872f2087c98 --- base/message_pump_default.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'base/message_pump_default.cc') diff --git a/base/message_pump_default.cc b/base/message_pump_default.cc index 0460b28..c88f465 100644 --- a/base/message_pump_default.cc +++ b/base/message_pump_default.cc @@ -20,26 +20,18 @@ void MessagePumpDefault::Run(Delegate* delegate) { bool did_work = delegate->DoWork(); if (!keep_running_) break; - if (did_work) - continue; - - // TODO(darin): Delayed work will be starved if DoWork continues to return - // true. We should devise a better strategy. - // - // It is tempting to call DoWork followed by DoDelayedWork before checking - // did_work, but we need to make sure that any tasks that were dispatched - // prior to a timer actually run before the timer. Getting that right may - // require some additional changes. - did_work = delegate->DoDelayedWork(&delayed_work_time_); + did_work |= delegate->DoDelayedWork(&delayed_work_time_); if (!keep_running_) break; + if (did_work) continue; did_work = delegate->DoIdleWork(); if (!keep_running_) break; + if (did_work) continue; -- cgit v1.1