Chromium Code Reviews| Index: runtime/bin/socket.cc |
| =================================================================== |
| --- runtime/bin/socket.cc (revision 5191) |
| +++ runtime/bin/socket.cc (working copy) |
| @@ -48,7 +48,9 @@ |
| DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); |
| intptr_t buffer_len = 0; |
| Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len); |
| - ASSERT(!Dart_IsError(result)); |
| + if (Dart_IsError(result)) { |
| + Dart_PropagateError(result); |
| + } |
| ASSERT((offset + length) <= buffer_len); |
| if (Dart_IsVMFlagSet("short_socket_read")) { |
| @@ -61,7 +63,7 @@ |
| Dart_Handle result = |
| Dart_ListSetAsBytes(buffer_obj, offset, buffer, bytes_read); |
| if (Dart_IsError(result)) { |
|
Søren Gjesse
2012/03/08 21:18:46
Missing delete[] buffer
|
| - bytes_read = -1; |
| + Dart_PropagateError(result); |
| } |
| } |
| delete[] buffer; |
| @@ -83,7 +85,9 @@ |
| DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); |
| intptr_t buffer_len = 0; |
| Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len); |
| - ASSERT(!Dart_IsError(result)); |
| + if (Dart_IsError(result)) { |
| + Dart_PropagateError(result); |
| + } |
| ASSERT((offset + length) <= buffer_len); |
| if (Dart_IsVMFlagSet("short_socket_write")) { |
| @@ -103,7 +107,9 @@ |
| offset + total_bytes_written, |
| buffer, |
| chunk_length); |
| - ASSERT(!Dart_IsError(result)); |
| + if (Dart_IsError(result)) { |
|
Søren Gjesse
2012/03/08 21:18:46
Missing delete[] buffer.
|
| + Dart_PropagateError(result); |
| + } |
| bytes_written = |
| Socket::Write(socket, reinterpret_cast<void*>(buffer), chunk_length); |
| total_bytes_written += bytes_written; |