| 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 #include "vm/port.h" | 6 #include "vm/port.h" |
| 7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| 11 DECLARE_FLAG(bool, trace_isolates); | 11 DECLARE_FLAG(bool, trace_isolates); |
| 12 | 12 DECLARE_FLAG(bool, trace_service_pause_events); |
| 13 | 13 |
| 14 class MessageHandlerTask : public ThreadPool::Task { | 14 class MessageHandlerTask : public ThreadPool::Task { |
| 15 public: | 15 public: |
| 16 explicit MessageHandlerTask(MessageHandler* handler) | 16 explicit MessageHandlerTask(MessageHandler* handler) |
| 17 : handler_(handler) { | 17 : handler_(handler) { |
| 18 ASSERT(handler != NULL); | 18 ASSERT(handler != NULL); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void Run() { | 21 void Run() { |
| 22 handler_->TaskCallback(); | 22 handler_->TaskCallback(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Handle any pending messages for this message handler. | 226 // Handle any pending messages for this message handler. |
| 227 if (ok) { | 227 if (ok) { |
| 228 ok = HandleMessages(true, true); | 228 ok = HandleMessages(true, true); |
| 229 } | 229 } |
| 230 task_ = NULL; // No task in queue. | 230 task_ = NULL; // No task in queue. |
| 231 | 231 |
| 232 if (!ok || !HasLivePorts()) { | 232 if (!ok || !HasLivePorts()) { |
| 233 if (pause_on_exit()) { | 233 if (pause_on_exit()) { |
| 234 if (FLAG_trace_service_pause_events && !paused_on_exit_) { |
| 235 OS::PrintErr("Isolate %s paused before exiting. " |
| 236 "Use the Observatory to release it.\n", name()); |
| 237 } |
| 234 paused_on_exit_ = true; | 238 paused_on_exit_ = true; |
| 235 } else { | 239 } else { |
| 236 if (FLAG_trace_isolates) { | 240 if (FLAG_trace_isolates) { |
| 237 OS::Print("[-] Stopping message handler (%s):\n" | 241 OS::Print("[-] Stopping message handler (%s):\n" |
| 238 "\thandler: %s\n", | 242 "\thandler: %s\n", |
| 239 (ok ? "no live ports" : "error"), | 243 (ok ? "no live ports" : "error"), |
| 240 name()); | 244 name()); |
| 241 } | 245 } |
| 242 pool_ = NULL; | 246 pool_ = NULL; |
| 243 run_end_callback = true; | 247 run_end_callback = true; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 309 |
| 306 void MessageHandler::decrement_control_ports() { | 310 void MessageHandler::decrement_control_ports() { |
| 307 MonitorLocker ml(&monitor_); | 311 MonitorLocker ml(&monitor_); |
| 308 #if defined(DEBUG) | 312 #if defined(DEBUG) |
| 309 CheckAccess(); | 313 CheckAccess(); |
| 310 #endif | 314 #endif |
| 311 control_ports_--; | 315 control_ports_--; |
| 312 } | 316 } |
| 313 | 317 |
| 314 } // namespace dart | 318 } // namespace dart |
| OLD | NEW |