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

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

Issue 1737023: Turn some usages of NewArray with DeleteArray in the same scope into ScopedVector or SmartPointer. (Closed)
Patch Set: Disabling implicit constructors Created 10 years, 7 months 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
« no previous file with comments | « src/debug.cc ('k') | src/flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 // Convert UTF-8 to UTF-16. 176 // Convert UTF-8 to UTF-16.
177 unibrow::Utf8InputBuffer<> buf(*message, 177 unibrow::Utf8InputBuffer<> buf(*message,
178 StrLength(*message)); 178 StrLength(*message));
179 int len = 0; 179 int len = 0;
180 while (buf.has_more()) { 180 while (buf.has_more()) {
181 buf.GetNext(); 181 buf.GetNext();
182 len++; 182 len++;
183 } 183 }
184 int16_t* temp = NewArray<int16_t>(len + 1); 184 ScopedVector<int16_t> temp(len + 1);
185 buf.Reset(*message, StrLength(*message)); 185 buf.Reset(*message, StrLength(*message));
186 for (int i = 0; i < len; i++) { 186 for (int i = 0; i < len; i++) {
187 temp[i] = buf.GetNext(); 187 temp[i] = buf.GetNext();
188 } 188 }
189 189
190 // Send the request received to the debugger. 190 // Send the request received to the debugger.
191 v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp), len); 191 v8::Debug::SendCommand(reinterpret_cast<const uint16_t *>(temp.start()),
192 DeleteArray(temp); 192 len);
193 } 193 }
194 } 194 }
195 195
196 196
197 void DebuggerAgentSession::DebuggerMessage(Vector<uint16_t> message) { 197 void DebuggerAgentSession::DebuggerMessage(Vector<uint16_t> message) {
198 DebuggerAgentUtil::SendMessage(client_, message); 198 DebuggerAgentUtil::SendMessage(client_, message);
199 } 199 }
200 200
201 201
202 void DebuggerAgentSession::Shutdown() { 202 void DebuggerAgentSession::Shutdown() {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return total_received; 418 return total_received;
419 } 419 }
420 total_received += received; 420 total_received += received;
421 } 421 }
422 return total_received; 422 return total_received;
423 } 423 }
424 424
425 } } // namespace v8::internal 425 } } // namespace v8::internal
426 426
427 #endif // ENABLE_DEBUGGER_SUPPORT 427 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698