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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ~DebuggerAgent() { | 53 ~DebuggerAgent() { |
54 instance_ = NULL; | 54 instance_ = NULL; |
55 delete server_; | 55 delete server_; |
56 } | 56 } |
57 | 57 |
58 void Shutdown(); | 58 void Shutdown(); |
59 | 59 |
60 private: | 60 private: |
61 void Run(); | 61 void Run(); |
62 void CreateSession(Socket* socket); | 62 void CreateSession(Socket* socket); |
63 void DebuggerMessage(const uint16_t* message, int length); | 63 void DebuggerMessage(const v8::Debug::Message& message); |
64 void CloseSession(); | 64 void CloseSession(); |
65 void OnSessionClosed(DebuggerAgentSession* session); | 65 void OnSessionClosed(DebuggerAgentSession* session); |
66 | 66 |
67 SmartPointer<const char> name_; // Name of the embedding application. | 67 SmartPointer<const char> name_; // Name of the embedding application. |
68 int port_; // Port to use for the agent. | 68 int port_; // Port to use for the agent. |
69 Socket* server_; // Server socket for listen/accept. | 69 Socket* server_; // Server socket for listen/accept. |
70 bool terminate_; // Termination flag. | 70 bool terminate_; // Termination flag. |
71 Mutex* session_access_; // Mutex guarging access to session_. | 71 Mutex* session_access_; // Mutex guarging access to session_. |
72 DebuggerAgentSession* session_; // Current active session if any. | 72 DebuggerAgentSession* session_; // Current active session if any. |
73 Semaphore* terminate_now_; // Semaphore to signal termination. | 73 Semaphore* terminate_now_; // Semaphore to signal termination. |
74 | 74 |
75 static DebuggerAgent* instance_; | 75 static DebuggerAgent* instance_; |
76 | 76 |
77 friend class DebuggerAgentSession; | 77 friend class DebuggerAgentSession; |
78 friend void DebuggerAgentMessageHandler(const uint16_t* message, int length, | 78 friend void DebuggerAgentMessageHandler(const v8::Debug::Message& message); |
79 v8::Debug::ClientData* client_data); | |
80 | 79 |
81 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); | 80 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); |
82 }; | 81 }; |
83 | 82 |
84 | 83 |
85 // Debugger agent session. The session receives requests from the remote | 84 // Debugger agent session. The session receives requests from the remote |
86 // debugger and sends debugger events/responses to the remote debugger. | 85 // debugger and sends debugger events/responses to the remote debugger. |
87 class DebuggerAgentSession: public Thread { | 86 class DebuggerAgentSession: public Thread { |
88 public: | 87 public: |
89 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) | 88 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) |
(...skipping 27 matching lines...) Expand all Loading... |
117 static bool SendMessage(const Socket* conn, | 116 static bool SendMessage(const Socket* conn, |
118 const v8::Handle<v8::String> message); | 117 const v8::Handle<v8::String> message); |
119 static int ReceiveAll(const Socket* conn, char* data, int len); | 118 static int ReceiveAll(const Socket* conn, char* data, int len); |
120 }; | 119 }; |
121 | 120 |
122 } } // namespace v8::internal | 121 } } // namespace v8::internal |
123 | 122 |
124 #endif // ENABLE_DEBUGGER_SUPPORT | 123 #endif // ENABLE_DEBUGGER_SUPPORT |
125 | 124 |
126 #endif // V8_V8_DEBUG_AGENT_H_ | 125 #endif // V8_V8_DEBUG_AGENT_H_ |
OLD | NEW |