| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (session == session_) { | 185 if (session == session_) { |
| 186 session_->Shutdown(); | 186 session_->Shutdown(); |
| 187 delete session_; | 187 delete session_; |
| 188 session_ = NULL; | 188 session_ = NULL; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| 193 void DebuggerAgentSession::Run() { | 193 void DebuggerAgentSession::Run() { |
| 194 // Send the hello message. | 194 // Send the hello message. |
| 195 bool ok = DebuggerAgentUtil::SendConnectMessage(client_, *agent_->name_); | 195 bool ok = DebuggerAgentUtil::SendConnectMessage(client_, agent_->name_.get()); |
| 196 if (!ok) return; | 196 if (!ok) return; |
| 197 | 197 |
| 198 while (true) { | 198 while (true) { |
| 199 // Read data from the debugger front end. | 199 // Read data from the debugger front end. |
| 200 SmartArrayPointer<char> message = | 200 SmartArrayPointer<char> message = |
| 201 DebuggerAgentUtil::ReceiveMessage(client_); | 201 DebuggerAgentUtil::ReceiveMessage(client_); |
| 202 | 202 |
| 203 const char* msg = *message; | 203 const char* msg = message.get(); |
| 204 bool is_closing_session = (msg == NULL); | 204 bool is_closing_session = (msg == NULL); |
| 205 | 205 |
| 206 if (msg == NULL) { | 206 if (msg == NULL) { |
| 207 // If we lost the connection, then simulate a disconnect msg: | 207 // If we lost the connection, then simulate a disconnect msg: |
| 208 msg = "{\"seq\":1,\"type\":\"request\",\"command\":\"disconnect\"}"; | 208 msg = "{\"seq\":1,\"type\":\"request\",\"command\":\"disconnect\"}"; |
| 209 | 209 |
| 210 } else { | 210 } else { |
| 211 // Check if we're getting a disconnect request: | 211 // Check if we're getting a disconnect request: |
| 212 const char* disconnectRequestStr = | 212 const char* disconnectRequestStr = |
| 213 "\"type\":\"request\",\"command\":\"disconnect\"}"; | 213 "\"type\":\"request\",\"command\":\"disconnect\"}"; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 return total_received; | 494 return total_received; |
| 495 } | 495 } |
| 496 total_received += received; | 496 total_received += received; |
| 497 } | 497 } |
| 498 return total_received; | 498 return total_received; |
| 499 } | 499 } |
| 500 | 500 |
| 501 } } // namespace v8::internal | 501 } } // namespace v8::internal |
| 502 | 502 |
| 503 #endif // ENABLE_DEBUGGER_SUPPORT | 503 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |