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_MACOS_H_ | |
6 #define BIN_DBG_CONNECTION_MACOS_H_ | |
7 | |
8 #include <arpa/inet.h> | |
9 #include <netdb.h> | |
10 #include <sys/socket.h> | |
11 | |
12 | |
13 namespace dart { | |
14 namespace bin { | |
15 | |
16 class DebuggerConnectionImpl { | |
17 public: | |
18 static void StartHandler(int port_number); | |
19 static void StopHandler(intptr_t debug_fd) {} | |
20 static intptr_t Send(intptr_t socket, const char* buf, int len); | |
21 static intptr_t Receive(intptr_t socket, char* buf, int len); | |
22 | |
23 private: | |
24 enum MessageType { | |
25 kAddDbgFd = 1, | |
26 kRemoveDbgFd, | |
27 kQuit | |
28 }; | |
29 | |
30 struct Message { | |
31 MessageType msg_id; | |
32 }; | |
33 | |
34 static void SendMessage(MessageType id); | |
35 static bool ReceiveMessage(Message* msg); | |
36 | |
37 static void SetupPollQueue(); | |
38 static void HandleEvent(struct kevent* event); | |
39 static void Handler(uword args); | |
40 | |
41 | |
42 | |
43 // File descriptors for pipes used to communicate with the debugger thread. | |
44 static int wakeup_fds_[2]; | |
45 // File descriptor for the polling queue. | |
46 static int kqueue_fd_; | |
47 }; | |
48 | |
49 } // namespace bin | |
50 } // namespace dart | |
51 | |
52 #endif // BIN_DBG_CONNECTION_MACOS_H_ | |
OLD | NEW |