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

Unified Diff: runtime/vm/message.cc

Issue 11440035: Optimize the message queue for many active ports with few messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with caching changes. Created 8 years 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 | « runtime/vm/message.h ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message.cc
diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc
index 807de7ea9ec7101b96619d33fd7c1ae632f68257..73f5da3c76b62652c2ee2c1b52285831e59524c6 100644
--- a/runtime/vm/message.cc
+++ b/runtime/vm/message.cc
@@ -14,9 +14,8 @@ MessageQueue::MessageQueue() {
MessageQueue::~MessageQueue() {
// Ensure that all pending messages have been released.
-#if defined(DEBUG)
+ Clear();
ASSERT(head_ == NULL);
-#endif
}
@@ -54,31 +53,7 @@ Message* MessageQueue::Dequeue() {
}
-void MessageQueue::Flush(Dart_Port port) {
- Message* cur = head_;
- Message* prev = NULL;
- while (cur != NULL) {
- Message* next = cur->next_;
- // If the message matches, then remove it from the queue and delete it.
- if (cur->dest_port() == port) {
- if (prev != NULL) {
- prev->next_ = next;
- } else {
- head_ = next;
- }
- delete cur;
- } else {
- // Move prev forward.
- prev = cur;
- }
- // Advance to the next message in the queue.
- cur = next;
- }
- tail_ = prev;
-}
-
-
-void MessageQueue::FlushAll() {
+void MessageQueue::Clear() {
Message* cur = head_;
head_ = NULL;
tail_ = NULL;
« no previous file with comments | « runtime/vm/message.h ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698