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; |