Index: src/debug-agent.cc |
=================================================================== |
--- src/debug-agent.cc (revision 7267) |
+++ src/debug-agent.cc (working copy) |
@@ -38,11 +38,11 @@ |
// Public V8 debugger API message handler function. This function just delegates |
// to the debugger agent through it's data parameter. |
void DebuggerAgentMessageHandler(const v8::Debug::Message& message) { |
- DebuggerAgent::instance_->DebuggerMessage(message); |
+ DebuggerAgent* agent = Isolate::Current()->debugger_agent_instance(); |
+ ASSERT(agent != NULL); |
+ agent->DebuggerMessage(message); |
} |
-// static |
-DebuggerAgent* DebuggerAgent::instance_ = NULL; |
// Debugger agent main thread. |
void DebuggerAgent::Run() { |
@@ -102,20 +102,21 @@ |
listening_->Wait(); |
} |
+static const char* kCreateSessionMessage = |
+ "Remote debugging session already active\r\n"; |
+ |
void DebuggerAgent::CreateSession(Socket* client) { |
ScopedLock with(session_access_); |
// If another session is already established terminate this one. |
if (session_ != NULL) { |
- static const char* message = "Remote debugging session already active\r\n"; |
- |
- client->Send(message, StrLength(message)); |
+ client->Send(kCreateSessionMessage, StrLength(kCreateSessionMessage)); |
delete client; |
return; |
} |
// Create a new session and hook up the debug message handler. |
- session_ = new DebuggerAgentSession(this, client); |
+ session_ = new DebuggerAgentSession(isolate(), this, client); |
v8::Debug::SetMessageHandler2(DebuggerAgentMessageHandler); |
session_->Start(); |
} |
@@ -224,8 +225,8 @@ |
} |
-const char* DebuggerAgentUtil::kContentLength = "Content-Length"; |
-int DebuggerAgentUtil::kContentLengthSize = |
+const char* const DebuggerAgentUtil::kContentLength = "Content-Length"; |
+const int DebuggerAgentUtil::kContentLengthSize = |
StrLength(kContentLength); |