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

Unified Diff: runtime/bin/socket.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/process_script.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.cc
===================================================================
--- runtime/bin/socket.cc (revision 775)
+++ runtime/bin/socket.cc (working copy)
@@ -44,9 +44,10 @@
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
intptr_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);
if (Dart_IsVMFlagSet("short_socket_read")) {
length = (length + 1) / 2;
@@ -55,8 +56,8 @@
uint8_t* buffer = new uint8_t[length];
intptr_t bytes_read = Socket::Read(socket, buffer, length);
if (bytes_read > 0) {
- Dart_Result result = Dart_ArraySet(buffer_obj, offset, buffer, bytes_read);
- ASSERT(Dart_IsValidResult(result));
+ Dart_Handle result = Dart_ArraySet(buffer_obj, offset, buffer, bytes_read);
+ ASSERT(Dart_IsValid(result));
} else if (bytes_read < 0) {
bytes_read = 0;
}
@@ -77,9 +78,10 @@
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
intptr_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);
if (Dart_IsVMFlagSet("short_socket_write")) {
length = (length + 1) / 2;
@@ -87,7 +89,7 @@
uint8_t* buffer = new uint8_t[length];
result = Dart_ArrayGet(buffer_obj, offset, buffer, length);
- ASSERT(Dart_IsValidResult(result));
+ ASSERT(Dart_IsValid(result));
intptr_t total_bytes_written =
Socket::Write(socket, reinterpret_cast<void*>(buffer), length);
delete[] buffer;
« no previous file with comments | « runtime/bin/process_script.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698