Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: src/debug-agent.cc

Issue 390004: Fix warnings on Win64. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 listening_->Wait(); 98 listening_->Wait();
99 } 99 }
100 100
101 void DebuggerAgent::CreateSession(Socket* client) { 101 void DebuggerAgent::CreateSession(Socket* client) {
102 ScopedLock with(session_access_); 102 ScopedLock with(session_access_);
103 103
104 // If another session is already established terminate this one. 104 // If another session is already established terminate this one.
105 if (session_ != NULL) { 105 if (session_ != NULL) {
106 static const char* message = "Remote debugging session already active\r\n"; 106 static const char* message = "Remote debugging session already active\r\n";
107 107
108 client->Send(message, strlen(message)); 108 client->Send(message, StrLength(message));
109 delete client; 109 delete client;
110 return; 110 return;
111 } 111 }
112 112
113 // Create a new session and hook up the debug message handler. 113 // Create a new session and hook up the debug message handler.
114 session_ = new DebuggerAgentSession(this, client); 114 session_ = new DebuggerAgentSession(this, client);
115 v8::Debug::SetMessageHandler2(DebuggerAgentMessageHandler); 115 v8::Debug::SetMessageHandler2(DebuggerAgentMessageHandler);
116 session_->Start(); 116 session_->Start();
117 } 117 }
118 118
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 while (true) { 165 while (true) {
166 // Read data from the debugger front end. 166 // Read data from the debugger front end.
167 SmartPointer<char> message = DebuggerAgentUtil::ReceiveMessage(client_); 167 SmartPointer<char> message = DebuggerAgentUtil::ReceiveMessage(client_);
168 if (*message == NULL) { 168 if (*message == NULL) {
169 // Session is closed. 169 // Session is closed.
170 agent_->OnSessionClosed(this); 170 agent_->OnSessionClosed(this);
171 return; 171 return;
172 } 172 }
173 173
174 // Convert UTF-8 to UTF-16. 174 // Convert UTF-8 to UTF-16.
175 unibrow::Utf8InputBuffer<> buf(*message, strlen(*message)); 175 unibrow::Utf8InputBuffer<> buf(*message,
176 StrLength(*message));
176 int len = 0; 177 int len = 0;
177 while (buf.has_more()) { 178 while (buf.has_more()) {
178 buf.GetNext(); 179 buf.GetNext();
179 len++; 180 len++;
180 } 181 }
181 int16_t* temp = NewArray<int16_t>(len + 1); 182 int16_t* temp = NewArray<int16_t>(len + 1);
182 buf.Reset(*message, strlen(*message)); 183 buf.Reset(*message, StrLength(*message));
183 for (int i = 0; i < len; i++) { 184 for (int i = 0; i < len; i++) {
184 temp[i] = buf.GetNext(); 185 temp[i] = buf.GetNext();
185 } 186 }
186 187
187 // Send the request received to the debugger. 188 // Send the request received to the debugger.
188 v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp), len); 189 v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp), len);
189 DeleteArray(temp); 190 DeleteArray(temp);
190 } 191 }
191 } 192 }
192 193
193 194
194 void DebuggerAgentSession::DebuggerMessage(Vector<uint16_t> message) { 195 void DebuggerAgentSession::DebuggerMessage(Vector<uint16_t> message) {
195 DebuggerAgentUtil::SendMessage(client_, message); 196 DebuggerAgentUtil::SendMessage(client_, message);
196 } 197 }
197 198
198 199
199 void DebuggerAgentSession::Shutdown() { 200 void DebuggerAgentSession::Shutdown() {
200 // Shutdown the socket to end the blocking receive. 201 // Shutdown the socket to end the blocking receive.
201 client_->Shutdown(); 202 client_->Shutdown();
202 } 203 }
203 204
204 205
205 const char* DebuggerAgentUtil::kContentLength = "Content-Length"; 206 const char* DebuggerAgentUtil::kContentLength = "Content-Length";
206 int DebuggerAgentUtil::kContentLengthSize = strlen(kContentLength); 207 int DebuggerAgentUtil::kContentLengthSize =
208 StrLength(kContentLength);
207 209
208 210
209 SmartPointer<char> DebuggerAgentUtil::ReceiveMessage(const Socket* conn) { 211 SmartPointer<char> DebuggerAgentUtil::ReceiveMessage(const Socket* conn) {
210 int received; 212 int received;
211 213
212 // Read header. 214 // Read header.
213 int content_length = 0; 215 int content_length = 0;
214 while (true) { 216 while (true) {
215 const int kHeaderBufferSize = 80; 217 const int kHeaderBufferSize = 80;
216 char header_buffer[kHeaderBufferSize]; 218 char header_buffer[kHeaderBufferSize];
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 return total_received; 416 return total_received;
415 } 417 }
416 total_received += received; 418 total_received += received;
417 } 419 }
418 return total_received; 420 return total_received;
419 } 421 }
420 422
421 } } // namespace v8::internal 423 } } // namespace v8::internal
422 424
423 #endif // ENABLE_DEBUGGER_SUPPORT 425 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« src/api.cc ('K') | « src/debug.cc ('k') | src/disassembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698