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

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: Fixes with delayed messages, Bo found some cases were the current cases did not work Created 7 years, 5 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..b68a76bcba8a6d0d797350a726364d1fce865385 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -97,6 +97,14 @@ uint64 GetTaskTraceID(const PendingTask& task, MessageLoop* loop) {
static_cast<uint64>(reinterpret_cast<intptr_t>(loop));
}
+bool AlwaysNotifyPump(MessageLoop::Type type) {
brettw 2013/07/10 18:27:03 Can you add a comment for this function? Like what
Kristian Monsen 2013/07/11 23:29:42 Done.
+#if defined(OS_ANDROID)
+ return type == MessageLoop::TYPE_UI;
+#else
+ return false;
+#endif
+}
+
} // namespace
//------------------------------------------------------------------------------
@@ -624,7 +632,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.
+ if (!was_empty && !AlwaysNotifyPump(type_))
return true; // Someone else should have started the sub-pump.
pump = pump_;
« no previous file with comments | « base/android/java/src/org/chromium/base/SystemMessageHandler.java ('k') | base/message_loop/message_pump_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698