Chromium Code Reviews| Index: runtime/vm/message.h |
| diff --git a/runtime/vm/message.h b/runtime/vm/message.h |
| index 3c08ae94ee3f7471cb7a3024b5e4e5db092c5441..8968dec842bdd98bc2b58a0142dcfd1199a1c2d9 100644 |
| --- a/runtime/vm/message.h |
| +++ b/runtime/vm/message.h |
| @@ -6,6 +6,7 @@ |
| #define VM_MESSAGE_H_ |
| #include "platform/assert.h" |
| +#include "vm/allocation.h" |
| #include "vm/globals.h" |
| // Duplicated from dart_api.h to avoid including the whole header. |
| @@ -13,6 +14,8 @@ typedef int64_t Dart_Port; |
| namespace dart { |
| +class JSONStream; |
| + |
| class Message { |
| public: |
| typedef enum { |
| @@ -68,6 +71,10 @@ class Message { |
| bool RedirectToDeliveryFailurePort(); |
| + intptr_t Id() const; |
| + |
| + static const char* PriorityAsString(Priority priority); |
| + |
| private: |
| friend class MessageQueue; |
| @@ -98,6 +105,37 @@ class MessageQueue { |
| // Clear all messages from the message queue. |
| void Clear(); |
| + // Iterator class. |
| + class Iterator : public ValueObject { |
| + public: |
| + explicit Iterator(const MessageQueue* queue); |
| + virtual ~Iterator(); |
| + |
| + void Reset(const MessageQueue* queue); |
| + |
| + // returns false when there are no more messages left. |
|
turnidge
2015/05/04 20:11:51
Capitalize "returns" for consistency.
Cutch
2015/05/04 20:18:57
Done.
|
| + bool HasNext(); |
| + |
| + // Moves forward and then returns current(). |
| + Message* Next(); |
| + |
| + // Returns the current message or NULL. |
| + Message* current() const { |
| + return current_; |
| + } |
| + |
| + private: |
| + Message* current_; |
| + const MessageQueue* queue_; |
| + }; |
| + |
| + intptr_t Length() const; |
| + |
| + // Returns the message with id or NULL. |
| + Message* FindMessageById(intptr_t id); |
| + |
| + void PrintJSON(JSONStream* stream); |
| + |
| private: |
| Message* head_; |
| Message* tail_; |