Index: runtime/vm/message.h |
=================================================================== |
--- runtime/vm/message.h (revision 4842) |
+++ runtime/vm/message.h (working copy) |
@@ -67,16 +67,26 @@ |
void Enqueue(Message* msg); |
- // Gets the next message from the message queue if available. |
- // Returns NULL if no message is available. |
- Message* Dequeue(); |
+ // Gets the next message from the message queue, possibly blocking |
+ // if no message is available. 'millis' is a timeout in |
+ // milliseconds. If 'millis' is 0, then this means to block |
+ // indefinitely. May block if no message is available. May return |
+ // NULL even if 'millis' is 0 due to spurious wakeups. |
+ Message* Dequeue(int64_t millis); |
+ // Gets the next message from the message queue if available. Will |
+ // not block. |
+ Message* DequeueNoWait(); |
+ |
void Flush(Dart_Port port); |
void FlushAll(); |
private: |
friend class MessageQueueTestPeer; |
+ Message* DequeueNoWaitHoldsLock(); |
+ |
+ Monitor monitor_; |
Message* head_[Message::kNumPriorities]; |
Message* tail_[Message::kNumPriorities]; |
@@ -86,11 +96,12 @@ |
// A MessageHandler is an entity capable of accepting messages. |
class MessageHandler { |
protected: |
+ MessageHandler(); |
+ |
// Allows subclasses to provide custom message notification. |
virtual void MessageNotify(Message::Priority priority); |
public: |
- MessageHandler(); |
virtual ~MessageHandler(); |
// Allow subclasses to provide a handler name. |
@@ -109,17 +120,6 @@ |
void ClosePort(Dart_Port port); |
void CloseAllPorts(); |
- // Gets the next message from the message queue, possibly blocking |
- // if no message is available. 'millis' is a timeout in |
- // milliseconds. If 'millis' is 0, then this means to block |
- // indefinitely. May block if no message is available. May return |
- // NULL even if 'millis' is 0 due to spurious wakeups. |
- Message* Dequeue(int64_t millis); |
- |
- // Gets the next message from the message queue if available. Will |
- // not block. |
- Message* DequeueNoWait(); |
- |
// A message handler tracks how many live ports it has. |
bool HasLivePorts() const { return live_ports_ > 0; } |
void increment_live_ports() { |
@@ -140,10 +140,9 @@ |
// This is used to delete handlers when their last live port is closed. |
virtual bool OwnedByPortMap() const { return false; } |
- private: |
- friend class MessageHandlerTestPeer; |
+ MessageQueue* queue() const { return queue_; } |
- Monitor monitor_; |
+ private: |
intptr_t live_ports_; |
MessageQueue* queue_; |
}; |