Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BIN_DBG_CONNECTION_H_ | |
| 6 #define BIN_DBG_CONNECTION_H_ | |
| 7 | |
| 8 #include "bin/builtin.h" | |
| 9 #include "bin/utils.h" | |
| 10 | |
| 11 #include "include/dart_debugger_api.h" | |
| 12 | |
| 13 #include "platform/globals.h" | |
| 14 #include "platform/thread.h" | |
| 15 // Declare the OS-specific types ahead of defining the generic class. | |
| 16 #if defined(TARGET_OS_LINUX) | |
| 17 #include "bin/dbg_connection_linux.h" | |
| 18 #elif defined(TARGET_OS_MACOS) | |
| 19 #include "bin/dbg_connection_macos.h" | |
| 20 #elif defined(TARGET_OS_WINDOWS) | |
| 21 #include "bin/dbg_connection_win.h" | |
| 22 #else | |
| 23 #error Unknown target os. | |
| 24 #endif | |
| 25 | |
| 26 | |
| 27 class MessageBuffer; | |
| 28 | |
| 29 class DebuggerConnectionHandler { | |
|
siva
2012/05/03 22:52:08
extends AllStatic.
I guess we do not have AllStat
hausner
2012/05/03 23:52:00
Done.
| |
| 30 public: | |
| 31 ~DebuggerConnectionHandler(); | |
| 32 static void StartHandler(int port_number); | |
| 33 | |
| 34 static bool IsConnected() { | |
| 35 return debugger_fd_ >= 0; | |
| 36 } | |
| 37 | |
| 38 private: | |
| 39 static void SendBreakpointEvent(Dart_Breakpoint bpt, Dart_StackTrace trace); | |
| 40 static void BreakpointHandler(Dart_Breakpoint bpt, Dart_StackTrace trace); | |
| 41 | |
| 42 static void AcceptDbgConnection(int debug_fd); | |
| 43 static void CloseDbgConnection(); | |
| 44 | |
| 45 static void HandleMessages(); | |
| 46 static void HandleResumeCmd(); | |
| 47 | |
| 48 static bool handler_started_; | |
| 49 | |
| 50 // The socket that is listening for incoming debugger connections. | |
| 51 // This descriptor is created and closed by a VM thread. | |
| 52 static int listener_fd_; | |
| 53 | |
| 54 // The socket that connects with the debugger client. | |
| 55 // The descriptor is created by the debugger connection thread and | |
| 56 // closed by a VM thread. | |
| 57 static int debugger_fd_; | |
| 58 | |
| 59 static MessageBuffer* msgbuf_; | |
| 60 | |
| 61 friend class DebuggerConnectionImpl; | |
| 62 }; | |
| 63 | |
| 64 #endif // BIN_DBG_CONNECTION_H_ | |
| OLD | NEW |