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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Forward decelrations. | 38 // Forward decelrations. |
39 class DebuggerAgentSession; | 39 class DebuggerAgentSession; |
40 | 40 |
41 | 41 |
42 // Debugger agent which starts a socket listener on the debugger port and | 42 // Debugger agent which starts a socket listener on the debugger port and |
43 // handles connection from a remote debugger. | 43 // handles connection from a remote debugger. |
44 class DebuggerAgent: public Thread { | 44 class DebuggerAgent: public Thread { |
45 public: | 45 public: |
46 explicit DebuggerAgent(const char* name, int port) | 46 explicit DebuggerAgent(const char* name, int port) |
47 : name_(StrDup(name)), port_(port), | 47 : Thread(name), |
| 48 name_(StrDup(name)), port_(port), |
48 server_(OS::CreateSocket()), terminate_(false), | 49 server_(OS::CreateSocket()), terminate_(false), |
49 session_access_(OS::CreateMutex()), session_(NULL), | 50 session_access_(OS::CreateMutex()), session_(NULL), |
50 terminate_now_(OS::CreateSemaphore(0)), | 51 terminate_now_(OS::CreateSemaphore(0)), |
51 listening_(OS::CreateSemaphore(0)) { | 52 listening_(OS::CreateSemaphore(0)) { |
52 ASSERT(instance_ == NULL); | 53 ASSERT(instance_ == NULL); |
53 instance_ = this; | 54 instance_ = this; |
54 } | 55 } |
55 ~DebuggerAgent() { | 56 ~DebuggerAgent() { |
56 instance_ = NULL; | 57 instance_ = NULL; |
57 delete server_; | 58 delete server_; |
(...skipping 25 matching lines...) Expand all Loading... |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); | 85 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); |
85 }; | 86 }; |
86 | 87 |
87 | 88 |
88 // Debugger agent session. The session receives requests from the remote | 89 // Debugger agent session. The session receives requests from the remote |
89 // debugger and sends debugger events/responses to the remote debugger. | 90 // debugger and sends debugger events/responses to the remote debugger. |
90 class DebuggerAgentSession: public Thread { | 91 class DebuggerAgentSession: public Thread { |
91 public: | 92 public: |
92 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) | 93 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) |
93 : agent_(agent), client_(client) {} | 94 : Thread("v8:DbgAgntSessn"), |
| 95 agent_(agent), client_(client) {} |
94 | 96 |
95 void DebuggerMessage(Vector<uint16_t> message); | 97 void DebuggerMessage(Vector<uint16_t> message); |
96 void Shutdown(); | 98 void Shutdown(); |
97 | 99 |
98 private: | 100 private: |
99 void Run(); | 101 void Run(); |
100 | 102 |
101 void DebuggerMessage(Vector<char> message); | 103 void DebuggerMessage(Vector<char> message); |
102 | 104 |
103 DebuggerAgent* agent_; | 105 DebuggerAgent* agent_; |
(...skipping 16 matching lines...) Expand all Loading... |
120 static bool SendMessage(const Socket* conn, | 122 static bool SendMessage(const Socket* conn, |
121 const v8::Handle<v8::String> message); | 123 const v8::Handle<v8::String> message); |
122 static int ReceiveAll(const Socket* conn, char* data, int len); | 124 static int ReceiveAll(const Socket* conn, char* data, int len); |
123 }; | 125 }; |
124 | 126 |
125 } } // namespace v8::internal | 127 } } // namespace v8::internal |
126 | 128 |
127 #endif // ENABLE_DEBUGGER_SUPPORT | 129 #endif // ENABLE_DEBUGGER_SUPPORT |
128 | 130 |
129 #endif // V8_DEBUG_AGENT_H_ | 131 #endif // V8_DEBUG_AGENT_H_ |
OLD | NEW |