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

Unified Diff: runtime/bin/file.cc

Issue 9657001: Start using Dart_PropagateError in the runtime/bin directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/file.cc
===================================================================
--- runtime/bin/file.cc (revision 5191)
+++ runtime/bin/file.cc (working copy)
@@ -179,7 +179,9 @@
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
intptr_t array_len = 0;
Dart_Handle result = Dart_ListLength(buffer_obj, &array_len);
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
ASSERT((offset + length) <= array_len);
uint8_t* buffer = new uint8_t[length];
int total_bytes_read =
@@ -190,9 +192,10 @@
if (total_bytes_read >= 0) {
result =
Dart_ListSetAsBytes(buffer_obj, offset, buffer, total_bytes_read);
- if (!Dart_IsError(result)) {
- return_value = total_bytes_read;
+ if (Dart_IsError(result)) {
Søren Gjesse 2012/03/08 21:18:46 Missing delete[] buffer.
turnidge 2012/03/08 22:19:26 Done.
+ Dart_PropagateError(result);
}
+ return_value = total_bytes_read;
}
delete[] buffer;
}
@@ -216,11 +219,15 @@
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);
uint8_t* buffer = new uint8_t[length];
result = Dart_ListGetAsBytes(buffer_obj, offset, buffer, length);
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
Søren Gjesse 2012/03/08 21:18:46 Missing delete[] buffer.
turnidge 2012/03/08 22:19:26 Done.
+ Dart_PropagateError(result);
+ }
int total_bytes_written =
file->Write(reinterpret_cast<void*>(buffer), length);
if (total_bytes_written >= 0) {

Powered by Google App Engine
This is Rietveld 408576698