| 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/log.h" | 8 #include "bin/log.h" |
| 9 #include "bin/socket.h" | 9 #include "bin/socket.h" |
| 10 #include "bin/thread.h" | 10 #include "bin/thread.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 msgbuf_->PopMessage(); | 253 msgbuf_->PopMessage(); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 | 257 |
| 258 | 258 |
| 259 void DebuggerConnectionHandler::SendError(int debug_fd, | 259 void DebuggerConnectionHandler::SendError(int debug_fd, |
| 260 int msg_id, | 260 int msg_id, |
| 261 const char* err_msg) { | 261 const char* err_msg) { |
| 262 dart::TextBuffer msg(64); | 262 dart::TextBuffer msg(64); |
| 263 msg.Printf("{\"id\": %d, \"error\": \"Error: %s\"}", msg_id, err_msg); | 263 msg.Printf("{\"id\": %d, \"error\": \"Error: ", msg_id); |
| 264 msg.AddEscapedString(err_msg); |
| 265 msg.Printf("\"}"); |
| 264 SendMsg(debug_fd, &msg); | 266 SendMsg(debug_fd, &msg); |
| 265 } | 267 } |
| 266 | 268 |
| 267 | 269 |
| 268 void DebuggerConnectionHandler::CloseDbgConnection() { | 270 void DebuggerConnectionHandler::CloseDbgConnection() { |
| 269 if (debug_fd_ >= 0) { | 271 if (debug_fd_ >= 0) { |
| 270 Socket::Close(debug_fd_); | 272 Socket::Close(debug_fd_); |
| 271 } | 273 } |
| 272 if (msgbuf_ != NULL) { | 274 if (msgbuf_ != NULL) { |
| 273 delete msgbuf_; | 275 delete msgbuf_; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 457 |
| 456 | 458 |
| 457 bool DebuggerConnectionHandler::IsConnected() { | 459 bool DebuggerConnectionHandler::IsConnected() { |
| 458 // TODO(asiva): Support multiple debugger connections. | 460 // TODO(asiva): Support multiple debugger connections. |
| 459 // Return true if a connection has been established. | 461 // Return true if a connection has been established. |
| 460 return singleton_handler != NULL; | 462 return singleton_handler != NULL; |
| 461 } | 463 } |
| 462 | 464 |
| 463 } // namespace bin | 465 } // namespace bin |
| 464 } // namespace dart | 466 } // namespace dart |
| OLD | NEW |