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

Unified Diff: runtime/vm/message.cc

Issue 25646004: Add Dart_PostPriority function to dart_api, and use it in runAsync to schedule immediate events in … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More cleanup Created 7 years, 2 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: runtime/vm/message.cc
diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc
index 73f5da3c76b62652c2ee2c1b52285831e59524c6..7df75a3c18c8b3f9c1f50c016c75b4edcf19fe7a 100644
--- a/runtime/vm/message.cc
+++ b/runtime/vm/message.cc
@@ -29,9 +29,15 @@ void MessageQueue::Enqueue(Message* msg) {
tail_ = msg;
} else {
ASSERT(tail_ != NULL);
- // Append at the tail.
- tail_->next_ = msg;
- tail_ = msg;
+ if (msg->priority() == Message::kFirstPriority) {
+ // Set as head element in the queue.
+ msg->next_ = head_;
+ head_ = msg;
+ } else {
+ // Append at the tail.
+ tail_->next_ = msg;
+ tail_ = msg;
+ }
}
}
« runtime/vm/message.h ('K') | « runtime/vm/message.h ('k') | sdk/lib/io/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698