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

Unified Diff: base/message_loop/message_loop.cc

Issue 242103007: NOT FOR REVIEW - prioritize fonts Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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/child_resource_message_filter.cc » ('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 2315fd14b127de472eddd37b2df348481648170f..6291d060013fde0483ed08be91527c0cabf514d4 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -525,6 +525,18 @@ void MessageLoop::ScheduleWork(bool was_empty) {
pump_->ScheduleWork();
}
+void MessageLoop::ReloadAllWorkQueues() {
+ ReloadWorkQueue();
+}
+
+TaskQueue& MessageLoop::GetNextWorkQueue() {
+ return work_queue_;
+}
+
+bool MessageLoop::HasWorkAvailable() const {
+ return !work_queue_.empty();
+}
+
//------------------------------------------------------------------------------
// Method and data for histogramming events and actions taken by each instance
// on each thread.
@@ -558,14 +570,17 @@ bool MessageLoop::DoWork() {
}
for (;;) {
- ReloadWorkQueue();
- if (work_queue_.empty())
+ ReloadAllWorkQueues();
+
+ if (!HasWorkAvailable())
break;
+ TaskQueue& current_work_queue = GetNextWorkQueue();
+
// 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.
@@ -575,7 +590,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/child_resource_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698