OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "bin/dbg_connection.h" | 5 #include "bin/dbg_connection.h" |
6 #include "bin/dbg_message.h" | 6 #include "bin/dbg_message.h" |
7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
8 #include "bin/lockers.h" | 8 #include "bin/lockers.h" |
9 #include "bin/thread.h" | 9 #include "bin/thread.h" |
10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 MonitorLocker ml(&msg_queue_lock_); | 1089 MonitorLocker ml(&msg_queue_lock_); |
1090 is_running_ = false; | 1090 is_running_ = false; |
1091 | 1091 |
1092 // Request notification on isolate messages. This allows us to | 1092 // Request notification on isolate messages. This allows us to |
1093 // respond to vm service messages while at breakpoint. | 1093 // respond to vm service messages while at breakpoint. |
1094 Dart_SetMessageNotifyCallback(DbgMsgQueueList::NotifyIsolate); | 1094 Dart_SetMessageNotifyCallback(DbgMsgQueueList::NotifyIsolate); |
1095 | 1095 |
1096 while (true) { | 1096 while (true) { |
1097 // Handle all available vm service messages, up to a resume | 1097 // Handle all available vm service messages, up to a resume |
1098 // request. | 1098 // request. |
1099 if (Dart_HandleServiceMessages()) { | 1099 while (Dart_HasServiceMessages()) { |
1100 break; | 1100 // Release the message queue lock before handling service |
| 1101 // messages. This allows notifications to come in while we are |
| 1102 // processing long requests and avoids deadlock with the PortMap |
| 1103 // lock in the vm. |
| 1104 msg_queue_lock_.Exit(); |
| 1105 bool resume = Dart_HandleServiceMessages(); |
| 1106 msg_queue_lock_.Enter(); |
| 1107 if (resume) { |
| 1108 // Resume requested through the vm service. |
| 1109 break; |
| 1110 } |
1101 } | 1111 } |
1102 | 1112 |
1103 // Handle all available debug messages, up to a resume request. | 1113 // Handle all available debug messages, up to a resume request. |
1104 if (HandlePendingMessages()) { | 1114 if (HandlePendingMessages()) { |
1105 break; | 1115 break; |
1106 } | 1116 } |
1107 | 1117 |
1108 // Wait for more debug or vm service messages. | 1118 // Wait for more debug or vm service messages. |
1109 Monitor::WaitResult res = ml.Wait(); | 1119 Monitor::WaitResult res = ml.Wait(); |
1110 ASSERT(res == Monitor::kNotified); | 1120 ASSERT(res == Monitor::kNotified); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 } else { | 1421 } else { |
1412 ASSERT(kind == kShutdown); | 1422 ASSERT(kind == kShutdown); |
1413 RemoveIsolateMsgQueue(isolate_id); | 1423 RemoveIsolateMsgQueue(isolate_id); |
1414 } | 1424 } |
1415 } | 1425 } |
1416 Dart_ExitScope(); | 1426 Dart_ExitScope(); |
1417 } | 1427 } |
1418 | 1428 |
1419 } // namespace bin | 1429 } // namespace bin |
1420 } // namespace dart | 1430 } // namespace dart |
OLD | NEW |