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

Unified Diff: runtime/bin/file.cc

Issue 8380020: Refactor the dart api a bit: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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 775)
+++ runtime/bin/file.cc (working copy)
@@ -44,9 +44,11 @@
static File* GetFileHandle(Dart_Handle fileobj) {
- Dart_Result result = Dart_GetNativeInstanceField(fileobj, kFileFieldIndex);
- ASSERT(Dart_IsValidResult(result));
- File* file = reinterpret_cast<File*>(Dart_GetResultAsCIntptr(result));
+ intptr_t value = 0;
+ Dart_Handle result = Dart_GetNativeInstanceField(fileobj, kFileFieldIndex,
+ &value);
+ ASSERT(Dart_IsValid(result));
+ File* file = reinterpret_cast<File*>(value);
return file;
}
@@ -155,9 +157,10 @@
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
int64_t length =
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
- Dart_Result result = Dart_GetLength(buffer_obj);
- ASSERT(Dart_IsValidResult(result));
- ASSERT((offset + length) <= Dart_GetResultAsCIntptr(result));
+ intptr_t array_len = 0;
+ Dart_Handle result = Dart_GetLength(buffer_obj, &array_len);
+ ASSERT(Dart_IsValid(result));
+ ASSERT((offset + length) <= array_len);
uint8_t* buffer = new uint8_t[length];
int total_bytes_read =
file->Read(reinterpret_cast<void*>(buffer), length);
@@ -167,7 +170,7 @@
if (total_bytes_read >= 0) {
result =
Dart_ArraySet(buffer_obj, offset, buffer, total_bytes_read);
- ASSERT(Dart_IsValidResult(result));
+ ASSERT(Dart_IsValid(result));
return_value = total_bytes_read;
}
delete[] buffer;
@@ -188,12 +191,13 @@
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
int64_t length =
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
- Dart_Result result = Dart_GetLength(buffer_obj);
- ASSERT(Dart_IsValidResult(result));
- ASSERT((offset + length) <= Dart_GetResultAsCIntptr(result));
+ intptr_t buffer_len = 0;
+ Dart_Handle result = Dart_GetLength(buffer_obj, &buffer_len);
+ ASSERT(Dart_IsValid(result));
+ ASSERT((offset + length) <= buffer_len);
uint8_t* buffer = new uint8_t[length];
result = Dart_ArrayGet(buffer_obj, offset, buffer, length);
- ASSERT(Dart_IsValidResult(result));
+ ASSERT(Dart_IsValid(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