Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: bin/dbg_connection.cc

Issue 11144027: Fix race condition when posting debugger messages to the message queue (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bin/dbg_message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/dbg_connection.cc
===================================================================
--- bin/dbg_connection.cc (revision 13666)
+++ bin/dbg_connection.cc (working copy)
@@ -227,12 +227,14 @@
// Get debug message queue corresponding to isolate.
// TODO(asiva): Once we have support for including the isolate id
// in the debug wire protocol we need to read the isolate id and
- // pass it down to GetIsolateMsgQueue to get the appropriate debug
- // message queue.
- DbgMsgQueue* queue =
- DbgMsgQueueList::GetIsolateMsgQueue(ILLEGAL_ISOLATE_ID);
- ASSERT(queue != NULL);
- queue->AddMessage(cmd_idx, msgbuf_->buf(), r.EndOfObject(), debug_fd_);
+ // pass it down to AddIsolateMessage.
+ if (!DbgMsgQueueList::AddIsolateMessage(ILLEGAL_ISOLATE_ID,
+ cmd_idx,
+ msgbuf_->buf(),
+ r.EndOfObject(),
+ debug_fd_)) {
+ SendError(debug_fd_, MessageId(), "Invalid isolate specified");
+ }
msgbuf_->PopMessage();
continue;
}
@@ -377,9 +379,10 @@
in_msg->SendErrorReply(msg_id, "Invalid isolate specified");
return;
}
- DbgMsgQueue* queue = DbgMsgQueueList::GetIsolateMsgQueue(isolate_id);
- ASSERT(queue != NULL);
- queue->InterruptIsolate();
+ if (!DbgMsgQueueList::InterruptIsolate(isolate_id)) {
+ in_msg->SendErrorReply(msg_id, "Invalid isolate specified");
+ return;
+ }
dart::TextBuffer msg(64);
msg.Printf("{ \"id\": %d }", msg_id);
in_msg->SendReply(&msg);
« no previous file with comments | « no previous file | bin/dbg_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698