| 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 namespace internal { | 36 namespace internal { |
| 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 DebuggerAgent(const char* name, int port) | 46 DebuggerAgent(Isolate* isolate, const char* name, int port) |
| 47 : Thread(name), | 47 : Thread(name), |
| 48 isolate_(Isolate::Current()), | 48 isolate_(isolate), |
| 49 name_(StrDup(name)), port_(port), | 49 name_(StrDup(name)), port_(port), |
| 50 server_(OS::CreateSocket()), terminate_(false), | 50 server_(OS::CreateSocket()), terminate_(false), |
| 51 session_(NULL), | 51 session_(NULL), |
| 52 terminate_now_(OS::CreateSemaphore(0)), | 52 terminate_now_(OS::CreateSemaphore(0)), |
| 53 listening_(OS::CreateSemaphore(0)) { | 53 listening_(OS::CreateSemaphore(0)) { |
| 54 ASSERT(isolate_->debugger_agent_instance() == NULL); | 54 ASSERT(isolate_->debugger_agent_instance() == NULL); |
| 55 isolate_->set_debugger_agent_instance(this); | 55 isolate_->set_debugger_agent_instance(this); |
| 56 } | 56 } |
| 57 ~DebuggerAgent() { | 57 ~DebuggerAgent() { |
| 58 isolate_->set_debugger_agent_instance(NULL); | 58 isolate_->set_debugger_agent_instance(NULL); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 static bool SendMessage(const Socket* conn, | 123 static bool SendMessage(const Socket* conn, |
| 124 const v8::Handle<v8::String> message); | 124 const v8::Handle<v8::String> message); |
| 125 static int ReceiveAll(const Socket* conn, char* data, int len); | 125 static int ReceiveAll(const Socket* conn, char* data, int len); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } } // namespace v8::internal | 128 } } // namespace v8::internal |
| 129 | 129 |
| 130 #endif // ENABLE_DEBUGGER_SUPPORT | 130 #endif // ENABLE_DEBUGGER_SUPPORT |
| 131 | 131 |
| 132 #endif // V8_DEBUG_AGENT_H_ | 132 #endif // V8_DEBUG_AGENT_H_ |
| OLD | NEW |