Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1025)

Unified Diff: base/message_loop/message_loop.cc

Issue 281073002: NOT FOR REVIEW: Adding prioritized incoming task queue to renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prioritize input events Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop/message_loop.h ('k') | content/child/high_priority_resource_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « base/message_loop/message_loop.h ('k') | content/child/high_priority_resource_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698