Index: src/debug-agent.cc |
=================================================================== |
--- src/debug-agent.cc (revision 6182) |
+++ src/debug-agent.cc (working copy) |
@@ -27,11 +27,9 @@ |
#include "v8.h" |
-#include "debug.h" |
#include "debug-agent.h" |
#ifdef ENABLE_DEBUGGER_SUPPORT |
- |
namespace v8 { |
namespace internal { |
@@ -169,33 +167,22 @@ |
while (true) { |
// Read data from the debugger front end. |
SmartPointer<char> message = DebuggerAgentUtil::ReceiveMessage(client_); |
- |
- const char* msg = *message; |
- bool is_closing_session = (msg == NULL); |
- |
- if (msg == NULL) { |
- // If we lost the connection, then simulate a disconnect msg: |
- msg = "{\"seq\":1,\"type\":\"request\",\"command\":\"disconnect\"}"; |
- |
- } else { |
- // Check if we're getting a disconnect request: |
- const char* disconnectRequestStr = |
- "\"type\":\"request\",\"command\":\"disconnect\"}"; |
- const char* result = strstr(msg, disconnectRequestStr); |
- if (result != NULL) { |
- is_closing_session = true; |
- } |
+ if (*message == NULL) { |
+ // Session is closed. |
+ agent_->OnSessionClosed(this); |
+ return; |
} |
// Convert UTF-8 to UTF-16. |
- unibrow::Utf8InputBuffer<> buf(msg, StrLength(msg)); |
+ unibrow::Utf8InputBuffer<> buf(*message, |
+ StrLength(*message)); |
int len = 0; |
while (buf.has_more()) { |
buf.GetNext(); |
len++; |
} |
ScopedVector<int16_t> temp(len + 1); |
- buf.Reset(msg, StrLength(msg)); |
+ buf.Reset(*message, StrLength(*message)); |
for (int i = 0; i < len; i++) { |
temp[i] = buf.GetNext(); |
} |
@@ -203,12 +190,6 @@ |
// Send the request received to the debugger. |
v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp.start()), |
len); |
- |
- if (is_closing_session) { |
- // Session is closed. |
- agent_->OnSessionClosed(this); |
- return; |
- } |
} |
} |