Chromium Code Reviews| Index: runtime/bin/dbg_connection.cc |
| diff --git a/runtime/bin/dbg_connection.cc b/runtime/bin/dbg_connection.cc |
| index 0d92133ac1812917da9890a63e3cf9ff300d9f90..828c4fb610b3a397e95b67a2b0cf155b730f524f 100644 |
| --- a/runtime/bin/dbg_connection.cc |
| +++ b/runtime/bin/dbg_connection.cc |
| @@ -297,6 +297,13 @@ void DebuggerConnectionHandler::CloseDbgConnection() { |
| } |
| +// The vm service relies on certain debugger functionality. |
| +void DebuggerConnectionHandler::InitForVmService() { |
| + MonitorLocker ml(handler_lock_); |
| + DbgMsgQueueList::Initialize(); |
| +} |
| + |
| + |
| int DebuggerConnectionHandler::StartHandler(const char* address, |
| int port_number) { |
| ASSERT(handler_lock_ != NULL); |
| @@ -333,6 +340,11 @@ int DebuggerConnectionHandler::StartHandler(const char* address, |
| void DebuggerConnectionHandler::WaitForConnection() { |
| ASSERT(handler_lock_ != NULL); |
| MonitorLocker ml(handler_lock_); |
| + if (listener_fd_ == -1) { |
|
Cutch
2014/05/12 17:57:08
Maybe factor this into a predicate function.
if
|
| + // If we are only running the vm service, don't wait for |
| + // connections. |
| + return; |
| + } |
| while (!IsConnected()) { |
| dart::Monitor::WaitResult res = ml.Wait(); |
| ASSERT(res == dart::Monitor::kNotified); |
| @@ -350,6 +362,11 @@ void DebuggerConnectionHandler::SendMsg(int debug_fd, dart::TextBuffer* msg) { |
| void DebuggerConnectionHandler::BroadcastMsg(dart::TextBuffer* msg) { |
| ASSERT(handler_lock_ != NULL); |
| MonitorLocker ml(handler_lock_); |
| + if (listener_fd_ == -1) { |
| + // If we are only running the vm service, don't try to broadcast |
| + // to debugger clients. |
| + return; |
| + } |
| // TODO(asiva): Once we support connection to multiple debuggers |
| // we need to send the message to all of them. |
| ASSERT(singleton_handler != NULL); |