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

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
« no previous file with comments | « runtime/bin/eventhandler.cc ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,11 @@
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)) {
+ delete[] buffer;
+ Dart_PropagateError(result);
}
+ return_value = total_bytes_read;
}
delete[] buffer;
}
@@ -216,11 +220,16 @@
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)) {
+ delete[] buffer;
+ Dart_PropagateError(result);
+ }
int total_bytes_written =
file->Write(reinterpret_cast<void*>(buffer), length);
if (total_bytes_written >= 0) {
« no previous file with comments | « runtime/bin/eventhandler.cc ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698