OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Forward decelrations. | 37 // Forward decelrations. |
38 class DebuggerAgentSession; | 38 class DebuggerAgentSession; |
39 | 39 |
40 | 40 |
41 // Debugger agent which starts a socket listener on the debugger port and | 41 // Debugger agent which starts a socket listener on the debugger port and |
42 // handles connection from a remote debugger. | 42 // handles connection from a remote debugger. |
43 class DebuggerAgent: public Thread { | 43 class DebuggerAgent: public Thread { |
44 public: | 44 public: |
45 explicit DebuggerAgent(const char* name, int port) | 45 explicit DebuggerAgent(const char* name, int port) |
46 : port_(port), name_(StrDup(name)), | 46 : name_(StrDup(name)), port_(port), |
47 server_(OS::CreateSocket()), terminate_(false), | 47 server_(OS::CreateSocket()), terminate_(false), |
48 session_access_(OS::CreateMutex()), session_(NULL), | 48 session_access_(OS::CreateMutex()), session_(NULL), |
49 terminate_now_(OS::CreateSemaphore(0)) {} | 49 terminate_now_(OS::CreateSemaphore(0)) {} |
50 ~DebuggerAgent() { delete server_; } | 50 ~DebuggerAgent() { delete server_; } |
51 | 51 |
52 void Shutdown(); | 52 void Shutdown(); |
53 | 53 |
54 private: | 54 private: |
55 void Run(); | 55 void Run(); |
56 void CreateSession(Socket* socket); | 56 void CreateSession(Socket* socket); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 static bool SendMessage(const Socket* conn, const Vector<uint16_t> message); | 108 static bool SendMessage(const Socket* conn, const Vector<uint16_t> message); |
109 static bool SendMessage(const Socket* conn, | 109 static bool SendMessage(const Socket* conn, |
110 const v8::Handle<v8::String> message); | 110 const v8::Handle<v8::String> message); |
111 static int ReceiveAll(const Socket* conn, char* data, int len); | 111 static int ReceiveAll(const Socket* conn, char* data, int len); |
112 }; | 112 }; |
113 | 113 |
114 | 114 |
115 } } // namespace v8::internal | 115 } } // namespace v8::internal |
116 | 116 |
117 #endif // V8_V8_DEBUG_AGENT_H_ | 117 #endif // V8_V8_DEBUG_AGENT_H_ |
OLD | NEW |