| 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/thread.h" | 8 #include "bin/thread.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 | 10 |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 dart::TextBuffer msg(32); | 1034 dart::TextBuffer msg(32); |
| 1035 msg.Printf("{ \"id\": %d }", msg_id); | 1035 msg.Printf("{ \"id\": %d }", msg_id); |
| 1036 in_msg->SendReply(&msg); | 1036 in_msg->SendReply(&msg); |
| 1037 return false; | 1037 return false; |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 | 1040 |
| 1041 void DbgMsgQueue::AddMessage(int32_t cmd_idx, | 1041 void DbgMsgQueue::AddMessage(int32_t cmd_idx, |
| 1042 const char* start, | 1042 const char* start, |
| 1043 const char* end, | 1043 const char* end, |
| 1044 int debug_fd) { | 1044 intptr_t debug_fd) { |
| 1045 if ((end > start) && ((end - start) < kMaxInt32)) { | 1045 if ((end > start) && ((end - start) < kMaxInt32)) { |
| 1046 MonitorLocker ml(&msg_queue_lock_); | 1046 MonitorLocker ml(&msg_queue_lock_); |
| 1047 DbgMessage* msg = new DbgMessage(cmd_idx, start, end, debug_fd); | 1047 DbgMessage* msg = new DbgMessage(cmd_idx, start, end, debug_fd); |
| 1048 if (msglist_head_ == NULL) { | 1048 if (msglist_head_ == NULL) { |
| 1049 ASSERT(msglist_tail_ == NULL); | 1049 ASSERT(msglist_tail_ == NULL); |
| 1050 msglist_head_ = msg; | 1050 msglist_head_ = msg; |
| 1051 msglist_tail_ = msg; | 1051 msglist_tail_ = msg; |
| 1052 ml.Notify(); | 1052 ml.Notify(); |
| 1053 } else { | 1053 } else { |
| 1054 ASSERT(msglist_tail_ != NULL); | 1054 ASSERT(msglist_tail_ != NULL); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 i++; | 1228 i++; |
| 1229 } | 1229 } |
| 1230 return kInvalidCommand; | 1230 return kInvalidCommand; |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 | 1233 |
| 1234 bool DbgMsgQueueList::AddIsolateMessage(Dart_IsolateId isolate_id, | 1234 bool DbgMsgQueueList::AddIsolateMessage(Dart_IsolateId isolate_id, |
| 1235 int32_t cmd_idx, | 1235 int32_t cmd_idx, |
| 1236 const char* start, | 1236 const char* start, |
| 1237 const char* end, | 1237 const char* end, |
| 1238 int debug_fd) { | 1238 intptr_t debug_fd) { |
| 1239 MutexLocker ml(msg_queue_list_lock_); | 1239 MutexLocker ml(msg_queue_list_lock_); |
| 1240 DbgMsgQueue* queue = DbgMsgQueueList::GetIsolateMsgQueueLocked(isolate_id); | 1240 DbgMsgQueue* queue = DbgMsgQueueList::GetIsolateMsgQueueLocked(isolate_id); |
| 1241 if (queue != NULL) { | 1241 if (queue != NULL) { |
| 1242 queue->AddMessage(cmd_idx, start, end, debug_fd); | 1242 queue->AddMessage(cmd_idx, start, end, debug_fd); |
| 1243 return true; | 1243 return true; |
| 1244 } | 1244 } |
| 1245 return false; | 1245 return false; |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 | 1248 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 } else { | 1408 } else { |
| 1409 ASSERT(kind == kShutdown); | 1409 ASSERT(kind == kShutdown); |
| 1410 RemoveIsolateMsgQueue(isolate_id); | 1410 RemoveIsolateMsgQueue(isolate_id); |
| 1411 } | 1411 } |
| 1412 } | 1412 } |
| 1413 Dart_ExitScope(); | 1413 Dart_ExitScope(); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 } // namespace bin | 1416 } // namespace bin |
| 1417 } // namespace dart | 1417 } // namespace dart |
| OLD | NEW |