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 #ifndef VM_MESSAGE_H_ | 5 #ifndef VM_MESSAGE_H_ |
6 #define VM_MESSAGE_H_ | 6 #define VM_MESSAGE_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 public: | 86 public: |
87 MessageQueue(); | 87 MessageQueue(); |
88 ~MessageQueue(); | 88 ~MessageQueue(); |
89 | 89 |
90 void Enqueue(Message* msg); | 90 void Enqueue(Message* msg); |
91 | 91 |
92 // Gets the next message from the message queue or NULL if no | 92 // Gets the next message from the message queue or NULL if no |
93 // message is available. This function will not block. | 93 // message is available. This function will not block. |
94 Message* Dequeue(); | 94 Message* Dequeue(); |
95 | 95 |
| 96 bool IsEmpty() { return head_ == NULL; } |
| 97 |
96 // Clear all messages from the message queue. | 98 // Clear all messages from the message queue. |
97 void Clear(); | 99 void Clear(); |
98 | 100 |
99 private: | 101 private: |
100 friend class MessageQueueTestPeer; | |
101 | |
102 Message* head_; | 102 Message* head_; |
103 Message* tail_; | 103 Message* tail_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(MessageQueue); | 105 DISALLOW_COPY_AND_ASSIGN(MessageQueue); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace dart | 108 } // namespace dart |
109 | 109 |
110 #endif // VM_MESSAGE_H_ | 110 #endif // VM_MESSAGE_H_ |
OLD | NEW |