Index: runtime/vm/message.h |
diff --git a/runtime/vm/message.h b/runtime/vm/message.h |
index 3c08ae94ee3f7471cb7a3024b5e4e5db092c5441..42a1eb1e1a353a1bb681b27ba33b56aa29301d57 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,31 @@ 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. |
+ bool HasNext(); |
+ |
+ // Returns the current message and moves forward. |
+ Message* Next(); |
+ |
+ private: |
+ Message* next_; |
+ }; |
+ |
+ 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_; |