| Index: base/message_loop/message_loop.cc
|
| diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
|
| index dd1a393ab08633514df9d6d021a1be7ff4dbd23f..fc905a44f5f742aa1d60d9bac6a5a34105ed6784 100644
|
| --- a/base/message_loop/message_loop.cc
|
| +++ b/base/message_loop/message_loop.cc
|
| @@ -519,6 +519,10 @@ void MessageLoop::ReloadWorkQueue() {
|
| incoming_task_queue_->ReloadWorkQueue(&work_queue_);
|
| }
|
|
|
| +TaskQueue& MessageLoop::SelectNextWorkQueue() {
|
| + return work_queue_;
|
| +}
|
| +
|
| void MessageLoop::ScheduleWork(bool was_empty) {
|
| // The Android UI message loop needs to get notified each time
|
| // a task is added to the incoming queue.
|
| @@ -560,13 +564,16 @@ bool MessageLoop::DoWork() {
|
|
|
| for (;;) {
|
| ReloadWorkQueue();
|
| - if (work_queue_.empty())
|
| +
|
| + TaskQueue& current_work_queue = SelectNextWorkQueue();
|
| +
|
| + if (current_work_queue.empty())
|
| break;
|
|
|
| // Execute oldest task.
|
| do {
|
| - PendingTask pending_task = work_queue_.front();
|
| - work_queue_.pop();
|
| + PendingTask pending_task = current_work_queue.front();
|
| + current_work_queue.pop();
|
| if (!pending_task.delayed_run_time.is_null()) {
|
| AddToDelayedWorkQueue(pending_task);
|
| // If we changed the topmost task, then it is time to reschedule.
|
| @@ -576,7 +583,7 @@ bool MessageLoop::DoWork() {
|
| if (DeferOrRunPendingTask(pending_task))
|
| return true;
|
| }
|
| - } while (!work_queue_.empty());
|
| + } while (!current_work_queue.empty());
|
| }
|
|
|
| // Nothing happened.
|
|
|