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 #include "vm/message_handler.h" | 5 #include "vm/message_handler.h" |
6 | 6 |
7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
8 #include "vm/lockers.h" | 8 #include "vm/lockers.h" |
9 #include "vm/port.h" | 9 #include "vm/port.h" |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 Message* message = oob_queue_->Dequeue(); | 130 Message* message = oob_queue_->Dequeue(); |
131 if ((message == NULL) && (min_priority < Message::kOOBPriority)) { | 131 if ((message == NULL) && (min_priority < Message::kOOBPriority)) { |
132 message = queue_->Dequeue(); | 132 message = queue_->Dequeue(); |
133 } | 133 } |
134 return message; | 134 return message; |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 bool MessageHandler::HandleMessages(bool allow_normal_messages, | 138 bool MessageHandler::HandleMessages(bool allow_normal_messages, |
139 bool allow_multiple_normal_messages) { | 139 bool allow_multiple_normal_messages) { |
| 140 // If isolate() returns NULL StartIsolateScope does nothing. |
| 141 StartIsolateScope start_isolate(isolate()); |
| 142 |
140 // TODO(turnidge): Add assert that monitor_ is held here. | 143 // TODO(turnidge): Add assert that monitor_ is held here. |
141 bool result = true; | 144 bool result = true; |
142 Message::Priority min_priority = (allow_normal_messages && !paused()) ? | 145 Message::Priority min_priority = (allow_normal_messages && !paused()) ? |
143 Message::kNormalPriority : Message::kOOBPriority; | 146 Message::kNormalPriority : Message::kOOBPriority; |
144 Message* message = DequeueMessage(min_priority); | 147 Message* message = DequeueMessage(min_priority); |
145 while (message != NULL) { | 148 while (message != NULL) { |
146 if (FLAG_trace_isolates) { | 149 if (FLAG_trace_isolates) { |
147 OS::Print("[<] Handling message:\n" | 150 OS::Print("[<] Handling message:\n" |
148 "\thandler: %s\n" | 151 "\thandler: %s\n" |
149 "\tport: %" Pd64 "\n", | 152 "\tport: %" Pd64 "\n", |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 309 |
307 void MessageHandler::decrement_live_ports() { | 310 void MessageHandler::decrement_live_ports() { |
308 MonitorLocker ml(&monitor_); | 311 MonitorLocker ml(&monitor_); |
309 #if defined(DEBUG) | 312 #if defined(DEBUG) |
310 CheckAccess(); | 313 CheckAccess(); |
311 #endif | 314 #endif |
312 live_ports_--; | 315 live_ports_--; |
313 } | 316 } |
314 | 317 |
315 } // namespace dart | 318 } // namespace dart |
OLD | NEW |