| 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 "vm/thread.h" | 8 #include "vm/thread.h" |
| 9 | 9 |
| 10 // Duplicated from dart_api.h to avoid including the whole header. | 10 // Duplicated from dart_api.h to avoid including the whole header. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // if no message is available. 'millis' is a timeout in | 71 // if no message is available. 'millis' is a timeout in |
| 72 // milliseconds. If 'millis' is 0, then this means to block | 72 // milliseconds. If 'millis' is 0, then this means to block |
| 73 // indefinitely. May block if no message is available. May return | 73 // indefinitely. May block if no message is available. May return |
| 74 // NULL even if 'millis' is 0 due to spurious wakeups. | 74 // NULL even if 'millis' is 0 due to spurious wakeups. |
| 75 Message* Dequeue(int64_t millis); | 75 Message* Dequeue(int64_t millis); |
| 76 | 76 |
| 77 // Gets the next message from the message queue if available. Will | 77 // Gets the next message from the message queue if available. Will |
| 78 // not block. | 78 // not block. |
| 79 Message* DequeueNoWait(); | 79 Message* DequeueNoWait(); |
| 80 | 80 |
| 81 // Gets the next message of the specified priority or greater from |
| 82 // the message queue if available. Will not block. |
| 83 Message* DequeueNoWaitWithPriority(Message::Priority min_priority); |
| 84 |
| 81 void Flush(Dart_Port port); | 85 void Flush(Dart_Port port); |
| 82 void FlushAll(); | 86 void FlushAll(); |
| 83 | 87 |
| 84 private: | 88 private: |
| 85 friend class MessageQueueTestPeer; | 89 friend class MessageQueueTestPeer; |
| 86 | 90 |
| 87 Message* DequeueNoWaitHoldsLock(); | 91 Message* DequeueNoWaitHoldsLock(Message::Priority min_priority); |
| 88 | 92 |
| 89 Monitor monitor_; | 93 Monitor monitor_; |
| 90 Message* head_[Message::kNumPriorities]; | 94 Message* head_[Message::kNumPriorities]; |
| 91 Message* tail_[Message::kNumPriorities]; | 95 Message* tail_[Message::kNumPriorities]; |
| 92 | 96 |
| 93 DISALLOW_COPY_AND_ASSIGN(MessageQueue); | 97 DISALLOW_COPY_AND_ASSIGN(MessageQueue); |
| 94 }; | 98 }; |
| 95 | 99 |
| 96 // A MessageHandler is an entity capable of accepting messages. | 100 // A MessageHandler is an entity capable of accepting messages. |
| 97 class MessageHandler { | 101 class MessageHandler { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 MessageQueue* queue() const { return queue_; } | 147 MessageQueue* queue() const { return queue_; } |
| 144 | 148 |
| 145 private: | 149 private: |
| 146 intptr_t live_ports_; | 150 intptr_t live_ports_; |
| 147 MessageQueue* queue_; | 151 MessageQueue* queue_; |
| 148 }; | 152 }; |
| 149 | 153 |
| 150 } // namespace dart | 154 } // namespace dart |
| 151 | 155 |
| 152 #endif // VM_MESSAGE_H_ | 156 #endif // VM_MESSAGE_H_ |
| OLD | NEW |