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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 Isolate* isolate() { return isolate_; } | 65 Isolate* isolate() { return isolate_; } |
66 | 66 |
67 private: | 67 private: |
68 void Run(); | 68 void Run(); |
69 void CreateSession(Socket* socket); | 69 void CreateSession(Socket* socket); |
70 void DebuggerMessage(const v8::Debug::Message& message); | 70 void DebuggerMessage(const v8::Debug::Message& message); |
71 void CloseSession(); | 71 void CloseSession(); |
72 void OnSessionClosed(DebuggerAgentSession* session); | 72 void OnSessionClosed(DebuggerAgentSession* session); |
73 | 73 |
74 Isolate* isolate_; | 74 Isolate* isolate_; |
75 SmartPointer<const char> name_; // Name of the embedding application. | 75 SmartArrayPointer<const char> name_; // Name of the embedding application. |
76 int port_; // Port to use for the agent. | 76 int port_; // Port to use for the agent. |
77 Socket* server_; // Server socket for listen/accept. | 77 Socket* server_; // Server socket for listen/accept. |
78 bool terminate_; // Termination flag. | 78 bool terminate_; // Termination flag. |
79 Mutex* session_access_; // Mutex guarging access to session_. | 79 Mutex* session_access_; // Mutex guarging access to session_. |
80 DebuggerAgentSession* session_; // Current active session if any. | 80 DebuggerAgentSession* session_; // Current active session if any. |
81 Semaphore* terminate_now_; // Semaphore to signal termination. | 81 Semaphore* terminate_now_; // Semaphore to signal termination. |
82 Semaphore* listening_; | 82 Semaphore* listening_; |
83 | 83 |
84 friend class DebuggerAgentSession; | 84 friend class DebuggerAgentSession; |
85 friend void DebuggerAgentMessageHandler(const v8::Debug::Message& message); | 85 friend void DebuggerAgentMessageHandler(const v8::Debug::Message& message); |
(...skipping 24 matching lines...) Expand all Loading... |
110 DISALLOW_COPY_AND_ASSIGN(DebuggerAgentSession); | 110 DISALLOW_COPY_AND_ASSIGN(DebuggerAgentSession); |
111 }; | 111 }; |
112 | 112 |
113 | 113 |
114 // Utility methods factored out to be used by the D8 shell as well. | 114 // Utility methods factored out to be used by the D8 shell as well. |
115 class DebuggerAgentUtil { | 115 class DebuggerAgentUtil { |
116 public: | 116 public: |
117 static const char* const kContentLength; | 117 static const char* const kContentLength; |
118 static const int kContentLengthSize; | 118 static const int kContentLengthSize; |
119 | 119 |
120 static SmartPointer<char> ReceiveMessage(const Socket* conn); | 120 static SmartArrayPointer<char> ReceiveMessage(const Socket* conn); |
121 static bool SendConnectMessage(const Socket* conn, | 121 static bool SendConnectMessage(const Socket* conn, |
122 const char* embedding_host); | 122 const char* embedding_host); |
123 static bool SendMessage(const Socket* conn, const Vector<uint16_t> message); | 123 static bool SendMessage(const Socket* conn, const Vector<uint16_t> message); |
124 static bool SendMessage(const Socket* conn, | 124 static bool SendMessage(const Socket* conn, |
125 const v8::Handle<v8::String> message); | 125 const v8::Handle<v8::String> message); |
126 static int ReceiveAll(const Socket* conn, char* data, int len); | 126 static int ReceiveAll(const Socket* conn, char* data, int len); |
127 }; | 127 }; |
128 | 128 |
129 } } // namespace v8::internal | 129 } } // namespace v8::internal |
130 | 130 |
131 #endif // ENABLE_DEBUGGER_SUPPORT | 131 #endif // ENABLE_DEBUGGER_SUPPORT |
132 | 132 |
133 #endif // V8_DEBUG_AGENT_H_ | 133 #endif // V8_DEBUG_AGENT_H_ |
OLD | NEW |