| 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 v8::Debug::Message& message); | 63 void DebuggerMessage(const uint16_t* message, int length); |
| 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 v8::Debug::Message& message); | 78 friend void DebuggerAgentMessageHandler(const uint16_t* message, int length, |
| 79 v8::Debug::ClientData* client_data); |
| 79 | 80 |
| 80 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); | 81 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 | 84 |
| 84 // Debugger agent session. The session receives requests from the remote | 85 // Debugger agent session. The session receives requests from the remote |
| 85 // debugger and sends debugger events/responses to the remote debugger. | 86 // debugger and sends debugger events/responses to the remote debugger. |
| 86 class DebuggerAgentSession: public Thread { | 87 class DebuggerAgentSession: public Thread { |
| 87 public: | 88 public: |
| 88 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) | 89 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 static bool SendMessage(const Socket* conn, | 117 static bool SendMessage(const Socket* conn, |
| 117 const v8::Handle<v8::String> message); | 118 const v8::Handle<v8::String> message); |
| 118 static int ReceiveAll(const Socket* conn, char* data, int len); | 119 static int ReceiveAll(const Socket* conn, char* data, int len); |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 } } // namespace v8::internal | 122 } } // namespace v8::internal |
| 122 | 123 |
| 123 #endif // ENABLE_DEBUGGER_SUPPORT | 124 #endif // ENABLE_DEBUGGER_SUPPORT |
| 124 | 125 |
| 125 #endif // V8_V8_DEBUG_AGENT_H_ | 126 #endif // V8_V8_DEBUG_AGENT_H_ |
| OLD | NEW |