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

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

Issue 11649018: Remove Utf8InputBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
185 // Check if we're getting a disconnect request: 185 // Check if we're getting a disconnect request:
186 const char* disconnectRequestStr = 186 const char* disconnectRequestStr =
187 "\"type\":\"request\",\"command\":\"disconnect\"}"; 187 "\"type\":\"request\",\"command\":\"disconnect\"}";
188 const char* result = strstr(msg, disconnectRequestStr); 188 const char* result = strstr(msg, disconnectRequestStr);
189 if (result != NULL) { 189 if (result != NULL) {
190 is_closing_session = true; 190 is_closing_session = true;
191 } 191 }
192 } 192 }
193 193
194 // Convert UTF-8 to UTF-16. 194 // Convert UTF-8 to UTF-16.
195 unibrow::Utf8InputBuffer<> buf(msg, StrLength(msg)); 195 unibrow::Utf8Decoder<128> decoder(msg, StrLength(msg));
196 int len = 0; 196 int utf16_length = decoder.Utf16Length();
197 while (buf.has_more()) { 197 ScopedVector<uint16_t> temp(utf16_length + 1);
198 buf.GetNext(); 198 decoder.WriteUtf16(temp.start(), utf16_length);
199 len++;
200 }
201 ScopedVector<int16_t> temp(len + 1);
202 buf.Reset(msg, StrLength(msg));
203 for (int i = 0; i < len; i++) {
204 temp[i] = buf.GetNext();
205 }
206 199
207 // Send the request received to the debugger. 200 // Send the request received to the debugger.
208 v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp.start()), 201 v8::Debug::SendCommand(temp.start(),
209 len, 202 utf16_length,
210 NULL, 203 NULL,
211 reinterpret_cast<v8::Isolate*>(agent_->isolate())); 204 reinterpret_cast<v8::Isolate*>(agent_->isolate()));
212 205
213 if (is_closing_session) { 206 if (is_closing_session) {
214 // Session is closed. 207 // Session is closed.
215 agent_->OnSessionClosed(this); 208 agent_->OnSessionClosed(this);
216 return; 209 return;
217 } 210 }
218 } 211 }
219 } 212 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 return total_received; 453 return total_received;
461 } 454 }
462 total_received += received; 455 total_received += received;
463 } 456 }
464 return total_received; 457 return total_received;
465 } 458 }
466 459
467 } } // namespace v8::internal 460 } } // namespace v8::internal
468 461
469 #endif // ENABLE_DEBUGGER_SUPPORT 462 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698