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

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

Issue 10543018: Fix assertion in the debug agent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 conn->Send(buffer, len); 392 conn->Send(buffer, len);
393 393
394 // Send message body as UTF-8. 394 // Send message body as UTF-8.
395 int buffer_position = 0; // Current buffer position. 395 int buffer_position = 0; // Current buffer position.
396 previous = unibrow::Utf16::kNoPreviousCharacter; 396 previous = unibrow::Utf16::kNoPreviousCharacter;
397 for (int i = 0; i < message.length(); i++) { 397 for (int i = 0; i < message.length(); i++) {
398 // Write next UTF-8 encoded character to buffer. 398 // Write next UTF-8 encoded character to buffer.
399 uint16_t character = message[i]; 399 uint16_t character = message[i];
400 buffer_position += 400 buffer_position +=
401 unibrow::Utf8::Encode(buffer + buffer_position, character, previous); 401 unibrow::Utf8::Encode(buffer + buffer_position, character, previous);
402 ASSERT(buffer_position < kBufferSize); 402 ASSERT(buffer_position <= kBufferSize);
403 403
404 // Send buffer if full or last character is encoded. 404 // Send buffer if full or last character is encoded.
405 if (kBufferSize - buffer_position < 405 if (kBufferSize - buffer_position <
406 unibrow::Utf16::kMaxExtraUtf8BytesForOneUtf16CodeUnit || 406 unibrow::Utf16::kMaxExtraUtf8BytesForOneUtf16CodeUnit ||
407 i == message.length() - 1) { 407 i == message.length() - 1) {
408 if (unibrow::Utf16::IsLeadSurrogate(character)) { 408 if (unibrow::Utf16::IsLeadSurrogate(character)) {
409 const int kEncodedSurrogateLength = 409 const int kEncodedSurrogateLength =
410 unibrow::Utf16::kUtf8BytesToCodeASurrogate; 410 unibrow::Utf16::kUtf8BytesToCodeASurrogate;
411 ASSERT(buffer_position >= kEncodedSurrogateLength); 411 ASSERT(buffer_position >= kEncodedSurrogateLength);
412 conn->Send(buffer, buffer_position - kEncodedSurrogateLength); 412 conn->Send(buffer, buffer_position - kEncodedSurrogateLength);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 return total_received; 460 return total_received;
461 } 461 }
462 total_received += received; 462 total_received += received;
463 } 463 }
464 return total_received; 464 return total_received;
465 } 465 }
466 466
467 } } // namespace v8::internal 467 } } // namespace v8::internal
468 468
469 #endif // ENABLE_DEBUGGER_SUPPORT 469 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698