diff options
author | zork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 20:44:13 +0000 |
---|---|---|
committer | zork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 20:44:13 +0000 |
commit | 7520d82219786cae7484e4a9ca5e80879d56e036 (patch) | |
tree | 5103c88f52e777e0e37772e90e02e0a1509dcf0b | |
parent | cccb2121a119f6d604878cf0524851bcdc9f3fff (diff) | |
download | chromium_src-7520d82219786cae7484e4a9ca5e80879d56e036.zip chromium_src-7520d82219786cae7484e4a9ca5e80879d56e036.tar.gz chromium_src-7520d82219786cae7484e4a9ca5e80879d56e036.tar.bz2 |
Fix mediator_thread_impl.cc to run timer tasks when the task runner is
otherwise idle.
BUG=19784, 26988
TEST=1. Enable sync and log in.
2. Go to about:sync
3. Check that notifications are enabled.
4. Disable all network adapters, and wait 15 seconds.
5. Refresh about:sync, and ensure that notifications are disabled.
Review URL: http://codereview.chromium.org/391027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31820 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/notifier/listener/mediator_thread_impl.cc | 19 | ||||
-rw-r--r-- | third_party/libjingle/files/talk/base/taskrunner.h | 5 |
2 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc b/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc index 0934daf..62d44c0 100644 --- a/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc +++ b/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc @@ -53,19 +53,20 @@ void MediatorThreadImpl::Run() { // Since we just changed the socket server, ensure that any queued up // messages are processed. socket_server->WakeUp(); - ::MSG message; - while (::GetMessage(&message, NULL, 0, 0)) { - ::TranslateMessage(&message); - ::DispatchMessage(&message); - if (IsStopping()) { - break; - } - MessageLoop::current()->RunAllPending(); - } #endif do { +#if defined(OS_WIN) + ::MSG message; + if (::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { + ::TranslateMessage(&message); + ::DispatchMessage(&message); + } +#endif ProcessMessages(100); + if (pump_.get() && pump_->HasPendingTimeoutTask()) { + pump_->WakeTasks(); + } MessageLoop::current()->RunAllPending(); } while (!IsStopping()); diff --git a/third_party/libjingle/files/talk/base/taskrunner.h b/third_party/libjingle/files/talk/base/taskrunner.h index e1c5ed6..6590629 100644 --- a/third_party/libjingle/files/talk/base/taskrunner.h +++ b/third_party/libjingle/files/talk/base/taskrunner.h @@ -61,6 +61,11 @@ class TaskRunner : public Task, public sigslot::has_slots<> { // dummy state machine - never run. virtual int ProcessStart() { return STATE_DONE; } + bool HasPendingTimeoutTask() { + return next_timeout_task_ != NULL && + next_timeout_task_->TimedOut(); + } + private: std::vector<Task *> tasks_; Task *next_timeout_task_; |