diff options
Diffstat (limited to 'src/debug-agent.h')
-rw-r--r-- | src/debug-agent.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/debug-agent.h b/src/debug-agent.h index 4cedb831..a25002e0 100644 --- a/src/debug-agent.h +++ b/src/debug-agent.h @@ -43,18 +43,18 @@ class DebuggerAgentSession; // handles connection from a remote debugger. class DebuggerAgent: public Thread { public: - explicit DebuggerAgent(const char* name, int port) - : Thread(name), + DebuggerAgent(Isolate* isolate, const char* name, int port) + : Thread(isolate, name), name_(StrDup(name)), port_(port), server_(OS::CreateSocket()), terminate_(false), session_access_(OS::CreateMutex()), session_(NULL), terminate_now_(OS::CreateSemaphore(0)), listening_(OS::CreateSemaphore(0)) { - ASSERT(instance_ == NULL); - instance_ = this; + ASSERT(Isolate::Current()->debugger_agent_instance() == NULL); + Isolate::Current()->set_debugger_agent_instance(this); } ~DebuggerAgent() { - instance_ = NULL; + Isolate::Current()->set_debugger_agent_instance(NULL); delete server_; } @@ -77,8 +77,6 @@ class DebuggerAgent: public Thread { Semaphore* terminate_now_; // Semaphore to signal termination. Semaphore* listening_; - static DebuggerAgent* instance_; - friend class DebuggerAgentSession; friend void DebuggerAgentMessageHandler(const v8::Debug::Message& message); @@ -90,8 +88,8 @@ class DebuggerAgent: public Thread { // debugger and sends debugger events/responses to the remote debugger. class DebuggerAgentSession: public Thread { public: - DebuggerAgentSession(DebuggerAgent* agent, Socket* client) - : Thread("v8:DbgAgntSessn"), + DebuggerAgentSession(Isolate* isolate, DebuggerAgent* agent, Socket* client) + : Thread(isolate, "v8:DbgAgntSessn"), agent_(agent), client_(client) {} void DebuggerMessage(Vector<uint16_t> message); @@ -112,8 +110,8 @@ class DebuggerAgentSession: public Thread { // Utility methods factored out to be used by the D8 shell as well. class DebuggerAgentUtil { public: - static const char* kContentLength; - static int kContentLengthSize; + static const char* const kContentLength; + static const int kContentLengthSize; static SmartPointer<char> ReceiveMessage(const Socket* conn); static bool SendConnectMessage(const Socket* conn, |