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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug-agent.cc
diff --git a/src/debug-agent.cc b/src/debug-agent.cc
index e85622277591491c41e13b69a47522e981c2ba3e..811c00e0cc63a1dd4985df0ccbeae61810fe2044 100644
--- a/src/debug-agent.cc
+++ b/src/debug-agent.cc
@@ -192,21 +192,14 @@ void DebuggerAgentSession::Run() {
}
// Convert UTF-8 to UTF-16.
- unibrow::Utf8InputBuffer<> buf(msg, StrLength(msg));
- int len = 0;
- while (buf.has_more()) {
- buf.GetNext();
- len++;
- }
- ScopedVector<int16_t> temp(len + 1);
- buf.Reset(msg, StrLength(msg));
- for (int i = 0; i < len; i++) {
- temp[i] = buf.GetNext();
- }
+ unibrow::Utf8Decoder<128> decoder(msg, StrLength(msg));
+ int utf16_length = decoder.Utf16Length();
+ ScopedVector<uint16_t> temp(utf16_length + 1);
+ decoder.WriteUtf16(temp.start(), utf16_length);
// Send the request received to the debugger.
- v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp.start()),
- len,
+ v8::Debug::SendCommand(temp.start(),
+ utf16_length,
NULL,
reinterpret_cast<v8::Isolate*>(agent_->isolate()));
« 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