| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/message_queue.h" | 5 #include "vm/message_queue.h" |
| 6 | 6 |
| 7 namespace dart { | 7 namespace dart { |
| 8 | 8 |
| 9 MessageQueue::~MessageQueue() { | 9 MessageQueue::~MessageQueue() { |
| 10 // Ensure that all pending messages have been released. | 10 // Ensure that all pending messages have been released. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 if (result == NULL) { | 44 if (result == NULL) { |
| 45 ml.Wait(millis); | 45 ml.Wait(millis); |
| 46 result = head_; | 46 result = head_; |
| 47 } | 47 } |
| 48 if (result != NULL) { | 48 if (result != NULL) { |
| 49 head_ = result->next_; | 49 head_ = result->next_; |
| 50 // The following update to tail_ is not strictly needed. | 50 // The following update to tail_ is not strictly needed. |
| 51 if (head_ == NULL) { | 51 if (head_ == NULL) { |
| 52 tail_ = NULL; | 52 tail_ = NULL; |
| 53 } | 53 } |
| 54 #if DEBUG | 54 #if defined(DEBUG) |
| 55 result->next_ = result; // Make sure to trigger ASSERT in Enqueue. | 55 result->next_ = result; // Make sure to trigger ASSERT in Enqueue. |
| 56 #endif // DEBUG | 56 #endif // DEBUG |
| 57 } | 57 } |
| 58 return result; | 58 return result; |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 void MessageQueue::Flush(Dart_Port port) { | 62 void MessageQueue::Flush(Dart_Port port) { |
| 63 MonitorLocker ml(&monitor_); | 63 MonitorLocker ml(&monitor_); |
| 64 PortMessage* cur = head_; | 64 PortMessage* cur = head_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 tail_ = NULL; | 91 tail_ = NULL; |
| 92 while (cur != NULL) { | 92 while (cur != NULL) { |
| 93 PortMessage* next = cur->next_; | 93 PortMessage* next = cur->next_; |
| 94 delete cur; | 94 delete cur; |
| 95 cur = next; | 95 cur = next; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 } // namespace dart | 100 } // namespace dart |
| OLD | NEW |