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

Unified Diff: base/message_loop/message_loop.cc

Issue 18181011: Make a fairer combined message loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: caching the result from MessagePump::NeedsScheduleWorkPerTask Created 7 years, 6 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
Index: base/message_loop/message_loop.cc
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index 9e33a426eb9f1241be625c25aee1a1585898c6fc..a0ce91fa4b3b39bb34c4893261cd8eafb336d4aa 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -143,7 +143,8 @@ MessageLoop::MessageLoop(Type type)
#if defined(OS_WIN)
os_modal_loop_(false),
#endif // OS_WIN
- next_sequence_num_(0) {
+ next_sequence_num_(0),
+ always_notify_pump_(false) {
DCHECK(!current()) << "should only have one message loop per thread";
lazy_tls_ptr.Pointer()->Set(this);
@@ -186,6 +187,7 @@ MessageLoop::MessageLoop(Type type)
DCHECK_EQ(TYPE_DEFAULT, type_);
pump_ = new MessagePumpDefault();
}
+ always_notify_pump_ = pump_->NeedsScheduleWorkPerTask();
awong 2013/07/03 19:09:22 Always_notify_pump_ seems to effectively be a plat
Kristian Monsen 2013/07/03 21:20:03 I had a CL doing this locally, was not sure which
}
MessageLoop::~MessageLoop() {
@@ -624,7 +626,9 @@ bool MessageLoop::AddToIncomingQueue(PendingTask* pending_task,
bool was_empty = incoming_queue_.empty();
incoming_queue_.push(*pending_task);
pending_task->task.Reset();
- if (!was_empty)
+ // The Android UI message loop needs to get notified each time
+ // a task is added to the incoming queue
awong 2013/07/03 19:09:22 nit: Please end sentences with a period.
Kristian Monsen 2013/07/03 21:20:03 Done.
+ if (!was_empty && !always_notify_pump_)
return true; // Someone else should have started the sub-pump.
pump = pump_;

Powered by Google App Engine
This is Rietveld 408576698