| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bool MessageHandler::HandleMessages(bool allow_normal_messages, | 140 bool MessageHandler::HandleMessages(bool allow_normal_messages, |
| 141 bool allow_multiple_normal_messages) { | 141 bool allow_multiple_normal_messages) { |
| 142 // If isolate() returns NULL StartIsolateScope does nothing. | 142 // If isolate() returns NULL StartIsolateScope does nothing. |
| 143 StartIsolateScope start_isolate(isolate()); | 143 StartIsolateScope start_isolate(isolate()); |
| 144 | 144 |
| 145 // TODO(turnidge): Add assert that monitor_ is held here. | 145 // TODO(turnidge): Add assert that monitor_ is held here. |
| 146 bool result = true; | 146 bool result = true; |
| 147 Message::Priority min_priority = (allow_normal_messages && !paused()) ? | 147 Message::Priority min_priority = (allow_normal_messages && !paused()) ? |
| 148 Message::kNormalPriority : Message::kOOBPriority; | 148 Message::kNormalPriority : Message::kOOBPriority; |
| 149 Message* message = DequeueMessage(min_priority); | 149 Message* message = DequeueMessage(min_priority); |
| 150 intptr_t message_len = message->len(); | |
| 151 while (message != NULL) { | 150 while (message != NULL) { |
| 151 intptr_t message_len = message->len(); |
| 152 if (FLAG_trace_isolates) { | 152 if (FLAG_trace_isolates) { |
| 153 OS::Print("[<] Handling message:\n" | 153 OS::Print("[<] Handling message:\n" |
| 154 "\tlen: %" Pd "\n" | 154 "\tlen: %" Pd "\n" |
| 155 "\thandler: %s\n" | 155 "\thandler: %s\n" |
| 156 "\tport: %" Pd64 "\n", | 156 "\tport: %" Pd64 "\n", |
| 157 message_len, name(), message->dest_port()); | 157 message_len, name(), message->dest_port()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Release the monitor_ temporarily while we handle the message. | 160 // Release the monitor_ temporarily while we handle the message. |
| 161 // The monitor was acquired in MessageHandler::TaskCallback(). | 161 // The monitor was acquired in MessageHandler::TaskCallback(). |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 void MessageHandler::decrement_live_ports() { | 326 void MessageHandler::decrement_live_ports() { |
| 327 MonitorLocker ml(&monitor_); | 327 MonitorLocker ml(&monitor_); |
| 328 #if defined(DEBUG) | 328 #if defined(DEBUG) |
| 329 CheckAccess(); | 329 CheckAccess(); |
| 330 #endif | 330 #endif |
| 331 live_ports_--; | 331 live_ports_--; |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace dart | 334 } // namespace dart |
| OLD | NEW |