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/object.h" | 9 #include "vm/object.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 status = HandleMessages(&ml, false, false); | 339 status = HandleMessages(&ml, false, false); |
340 if (ShouldPauseOnStart(status)) { | 340 if (ShouldPauseOnStart(status)) { |
341 // Still paused. | 341 // Still paused. |
342 ASSERT(oob_queue_->IsEmpty()); | 342 ASSERT(oob_queue_->IsEmpty()); |
343 task_ = NULL; // No task in queue. | 343 task_ = NULL; // No task in queue. |
344 return; | 344 return; |
345 } else { | 345 } else { |
346 PausedOnStartLocked(&ml, false); | 346 PausedOnStartLocked(&ml, false); |
347 } | 347 } |
348 } | 348 } |
| 349 if (is_paused_on_exit()) { |
| 350 status = paused_on_exit_status_; |
| 351 } |
349 #endif | 352 #endif |
350 | 353 |
351 if (status == kOK) { | 354 if (status == kOK) { |
352 if (start_callback_) { | 355 if (start_callback_) { |
353 // Initialize the message handler by running its start function, | 356 // Initialize the message handler by running its start function, |
354 // if we have one. For an isolate, this will run the isolate's | 357 // if we have one. For an isolate, this will run the isolate's |
355 // main() function. | 358 // main() function. |
356 // | 359 // |
357 // Release the monitor_ temporarily while we call the start callback. | 360 // Release the monitor_ temporarily while we call the start callback. |
358 ml.Exit(); | 361 ml.Exit(); |
(...skipping 15 matching lines...) Expand all Loading... |
374 #if !defined(PRODUCT) | 377 #if !defined(PRODUCT) |
375 if (ShouldPauseOnExit(status)) { | 378 if (ShouldPauseOnExit(status)) { |
376 if (!is_paused_on_exit()) { | 379 if (!is_paused_on_exit()) { |
377 if (FLAG_trace_service_pause_events) { | 380 if (FLAG_trace_service_pause_events) { |
378 OS::PrintErr( | 381 OS::PrintErr( |
379 "Isolate %s paused before exiting. " | 382 "Isolate %s paused before exiting. " |
380 "Use the Observatory to release it.\n", | 383 "Use the Observatory to release it.\n", |
381 name()); | 384 name()); |
382 } | 385 } |
383 PausedOnExitLocked(&ml, true); | 386 PausedOnExitLocked(&ml, true); |
384 // More messages may have come in while we released the monitor. | 387 paused_on_exit_status_ = status; |
385 status = HandleMessages(&ml, false, false); | |
386 } | 388 } |
| 389 // More messages may have come in while we released the monitor. |
| 390 status = HandleMessages(&ml, false, false); |
387 if (ShouldPauseOnExit(status)) { | 391 if (ShouldPauseOnExit(status)) { |
388 // Still paused. | 392 // Still paused. |
389 ASSERT(oob_queue_->IsEmpty()); | 393 ASSERT(oob_queue_->IsEmpty()); |
390 task_ = NULL; // No task in queue. | 394 task_ = NULL; // No task in queue. |
391 return; | 395 return; |
392 } else { | 396 } else { |
393 PausedOnExitLocked(&ml, false); | 397 PausedOnExitLocked(&ml, false); |
394 } | 398 } |
395 } | 399 } |
396 #endif // !defined(PRODUCT) | 400 #endif // !defined(PRODUCT) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 ASSERT(handler != NULL); | 574 ASSERT(handler != NULL); |
571 handler_->oob_message_handling_allowed_ = false; | 575 handler_->oob_message_handling_allowed_ = false; |
572 } | 576 } |
573 | 577 |
574 MessageHandler::AcquiredQueues::~AcquiredQueues() { | 578 MessageHandler::AcquiredQueues::~AcquiredQueues() { |
575 ASSERT(handler_ != NULL); | 579 ASSERT(handler_ != NULL); |
576 handler_->oob_message_handling_allowed_ = true; | 580 handler_->oob_message_handling_allowed_ = true; |
577 } | 581 } |
578 | 582 |
579 } // namespace dart | 583 } // namespace dart |
OLD | NEW |