OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 | 28 |
29 #include "v8.h" | 29 #include "v8.h" |
30 #include "debug-agent.h" | 30 #include "debug-agent.h" |
31 | 31 |
32 #ifdef ENABLE_DEBUGGER_SUPPORT | 32 #ifdef ENABLE_DEBUGGER_SUPPORT |
33 namespace v8 { namespace internal { | 33 namespace v8 { namespace internal { |
34 | 34 |
35 // Public V8 debugger API message handler function. This function just delegates | 35 // Public V8 debugger API message handler function. This function just delegates |
36 // to the debugger agent through it's data parameter. | 36 // to the debugger agent through it's data parameter. |
37 void DebuggerAgentMessageHandler(const v8::Debug::Message& message) { | 37 void DebuggerAgentMessageHandler(const uint16_t* message, int length, |
38 DebuggerAgent::instance_->DebuggerMessage(message); | 38 v8::Debug::ClientData* client_data) { |
| 39 DebuggerAgent::instance_->DebuggerMessage(message, length); |
39 } | 40 } |
40 | 41 |
41 // static | 42 // static |
42 DebuggerAgent* DebuggerAgent::instance_ = NULL; | 43 DebuggerAgent* DebuggerAgent::instance_ = NULL; |
43 | 44 |
44 // Debugger agent main thread. | 45 // Debugger agent main thread. |
45 void DebuggerAgent::Run() { | 46 void DebuggerAgent::Run() { |
46 const int kOneSecondInMicros = 1000000; | 47 const int kOneSecondInMicros = 1000000; |
47 | 48 |
48 // Allow this socket to reuse port even if still in TIME_WAIT. | 49 // Allow this socket to reuse port even if still in TIME_WAIT. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Terminate the session. | 118 // Terminate the session. |
118 if (session_ != NULL) { | 119 if (session_ != NULL) { |
119 session_->Shutdown(); | 120 session_->Shutdown(); |
120 session_->Join(); | 121 session_->Join(); |
121 delete session_; | 122 delete session_; |
122 session_ = NULL; | 123 session_ = NULL; |
123 } | 124 } |
124 } | 125 } |
125 | 126 |
126 | 127 |
127 void DebuggerAgent::DebuggerMessage(const v8::Debug::Message& message) { | 128 void DebuggerAgent::DebuggerMessage(const uint16_t* message, int length) { |
128 ScopedLock with(session_access_); | 129 ScopedLock with(session_access_); |
129 | 130 |
130 // Forward the message handling to the session. | 131 // Forward the message handling to the session. |
131 if (session_ != NULL) { | 132 if (session_ != NULL) { |
132 v8::String::Value val(message.GetJSON()); | 133 session_->DebuggerMessage(Vector<uint16_t>(const_cast<uint16_t*>(message), |
133 session_->DebuggerMessage(Vector<uint16_t>(const_cast<uint16_t*>(*val), | 134 length)); |
134 val.length())); | |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 void DebuggerAgent::OnSessionClosed(DebuggerAgentSession* session) { | 139 void DebuggerAgent::OnSessionClosed(DebuggerAgentSession* session) { |
140 // Don't do anything during termination. | 140 // Don't do anything during termination. |
141 if (terminate_) { | 141 if (terminate_) { |
142 return; | 142 return; |
143 } | 143 } |
144 | 144 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 return total_received; | 408 return total_received; |
409 } | 409 } |
410 total_received += received; | 410 total_received += received; |
411 } | 411 } |
412 return total_received; | 412 return total_received; |
413 } | 413 } |
414 | 414 |
415 } } // namespace v8::internal | 415 } } // namespace v8::internal |
416 | 416 |
417 #endif // ENABLE_DEBUGGER_SUPPORT | 417 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |