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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 data_length_++; | 133 data_length_++; |
134 } | 134 } |
135 buf_[data_length_] = '\0'; | 135 buf_[data_length_] = '\0'; |
136 ASSERT(data_length_ < buf_length_); | 136 ASSERT(data_length_ < buf_length_); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 static bool IsValidJSON(const char* msg) { | 141 static bool IsValidJSON(const char* msg) { |
142 dart::JSONReader r(msg); | 142 dart::JSONReader r(msg); |
143 return r.EndOfObject() != NULL; | 143 return r.CheckMessage(); |
144 } | 144 } |
145 | 145 |
146 | 146 |
147 DebuggerConnectionHandler::DebuggerConnectionHandler(int debug_fd) | 147 DebuggerConnectionHandler::DebuggerConnectionHandler(int debug_fd) |
148 : debug_fd_(debug_fd), msgbuf_(NULL) { | 148 : debug_fd_(debug_fd), msgbuf_(NULL) { |
149 msgbuf_ = new MessageBuffer(debug_fd_); | 149 msgbuf_ = new MessageBuffer(debug_fd_); |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 DebuggerConnectionHandler::~DebuggerConnectionHandler() { | 153 DebuggerConnectionHandler::~DebuggerConnectionHandler() { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 ASSERT(singleton_handler != NULL); | 431 ASSERT(singleton_handler != NULL); |
432 return singleton_handler; | 432 return singleton_handler; |
433 } | 433 } |
434 | 434 |
435 | 435 |
436 bool DebuggerConnectionHandler::IsConnected() { | 436 bool DebuggerConnectionHandler::IsConnected() { |
437 // TODO(asiva): Support multiple debugger connections. | 437 // TODO(asiva): Support multiple debugger connections. |
438 // Return true if a connection has been established. | 438 // Return true if a connection has been established. |
439 return singleton_handler != NULL; | 439 return singleton_handler != NULL; |
440 } | 440 } |
OLD | NEW |