#include <message.h>
Definition at line 159 of file message.h.
◆ MessageQueue()
dart::MessageQueue::MessageQueue |
( |
| ) |
|
Definition at line 87 of file message.cc.
87 {
88 head_ = nullptr;
89 tail_ = nullptr;
90}
◆ ~MessageQueue()
dart::MessageQueue::~MessageQueue |
( |
| ) |
|
◆ Clear()
void dart::MessageQueue::Clear |
( |
| ) |
|
Definition at line 158 of file message.cc.
158 {
159 std::unique_ptr<Message> cur(head_);
160 head_ = nullptr;
161 tail_ = nullptr;
162 while (cur != nullptr) {
163 std::unique_ptr<Message>
next(cur->next_);
164 cur = std::move(
next);
165 }
166}
static float next(float f)
◆ Dequeue()
std::unique_ptr< Message > dart::MessageQueue::Dequeue |
( |
| ) |
|
Definition at line 142 of file message.cc.
142 {
146
147 if (head_ == nullptr) {
148 tail_ = nullptr;
149 }
150#if defined(DEBUG)
152#endif
153 return std::unique_ptr<Message>(
result);
154 }
155 return nullptr;
156}
◆ Enqueue()
void dart::MessageQueue::Enqueue |
( |
std::unique_ptr< Message > |
msg, |
|
|
bool |
before_events |
|
) |
| |
Definition at line 98 of file message.cc.
98 {
99
101
102
103 ASSERT(msg->next_ ==
nullptr);
104 if (head_ == nullptr) {
105
107 head_ = msg;
108 tail_ = msg;
109 } else {
111 if (!before_events) {
112
113 tail_->next_ = msg;
114 tail_ = msg;
115 } else {
118 msg->next_ = head_;
119 head_ = msg;
120 } else {
122 while (cur->next_ != nullptr) {
124
125 msg->next_ = cur->next_;
126 cur->next_ = msg;
127 return;
128 }
129 cur = cur->next_;
130 }
131
132
135 tail_->next_ = msg;
136 tail_ = msg;
137 }
138 }
139 }
140}
Dart_Port dest_port() const
static const Dart_Port kIllegalPort
◆ FindMessageById()
Message * dart::MessageQueue::FindMessageById |
( |
intptr_t |
id | ) |
|
Definition at line 201 of file message.cc.
201 {
202 MessageQueue::Iterator it(this);
203 while (it.HasNext()) {
205 ASSERT(current !=
nullptr);
206 if (current->Id() == id) {
207 return current;
208 }
209 }
210 return nullptr;
211}
◆ IsEmpty()
bool dart::MessageQueue::IsEmpty |
( |
| ) |
|
|
inline |
Definition at line 170 of file message.h.
170{ return head_ == nullptr; }
◆ Length()
intptr_t dart::MessageQueue::Length |
( |
| ) |
const |
Definition at line 191 of file message.cc.
191 {
192 MessageQueue::Iterator it(this);
194 while (it.HasNext()) {
195 it.Next();
197 }
199}
◆ PrintJSON()
void dart::MessageQueue::PrintJSON |
( |
JSONStream * |
stream | ) |
|
Definition at line 213 of file message.cc.
213 {
214#ifndef PRODUCT
215 JSONArray messages(
stream);
216
218
219 MessageQueue::Iterator it(this);
220 intptr_t depth = 0;
221 while (it.HasNext()) {
224 message.AddProperty(
"type",
"Message");
225 message.AddPropertyF(
"name",
"Isolate Message (%" Px ")", current->Id());
226 message.AddPropertyF(
"messageObjectId",
"messages/%" Px "", current->Id());
227 message.AddProperty(
"size", current->Size());
228 message.AddProperty(
"index", depth++);
229 message.AddPropertyF(
"_destinationPort",
"%" Pd64 "",
230 static_cast<int64_t>(current->dest_port()));
231 message.AddProperty(
"_priority",
233
234
236 if (msg_handler.IsClosure()) {
237
238 msg_handler = Closure::Cast(msg_handler).function();
239 }
240 if (msg_handler.IsFunction()) {
241 const Function&
function = Function::Cast(msg_handler);
243
248 }
249 }
250 }
251#endif
252}
static ObjectPtr LookupHandler(Dart_Port port_id)
static const char * PriorityAsString(Priority priority)
Dart_NativeFunction function
The documentation for this class was generated from the following files: