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

Unified Diff: runtime/bin/file.cc

Issue 10379018: Revert "Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index 1f6c6a4e864e157a83cd62e8de560d60c1632918..1318fe80e95e0af5170ccbcc81ad8e90197bf7fa 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -768,8 +768,8 @@ static CObject* FileReadListRequest(const CObjectArray& request) {
File* file = CObjectToFilePointer(request[1]);
if (file != NULL && !file->IsClosed()) {
int64_t length = CObjectInt32OrInt64ToInt64(request[2]);
- CObjectByteArray* byte_array =
- new CObjectByteArray(CObject::NewByteArray(length));
+ CObjectUint8Array* byte_array =
+ new CObjectUint8Array(CObject::NewUint8Array(length));
void* buffer = reinterpret_cast<void*>(byte_array->Buffer());
int bytes_read = file->Read(buffer, byte_array->Length());
if (bytes_read >= 0) {
@@ -792,7 +792,7 @@ static CObject* FileReadListRequest(const CObjectArray& request) {
static CObject* FileWriteListRequest(const CObjectArray& request) {
if (request.Length() == 5 &&
request[1]->IsIntptr() &&
- (request[2]->IsByteArray() || request[2]->IsArray()) &&
+ (request[2]->IsUint8Array() || request[2]->IsArray()) &&
request[3]->IsInt32OrInt64() &&
request[4]->IsInt32OrInt64()) {
File* file = CObjectToFilePointer(request[1]);
@@ -800,8 +800,8 @@ static CObject* FileWriteListRequest(const CObjectArray& request) {
int64_t offset = CObjectInt32OrInt64ToInt64(request[3]);
int64_t length = CObjectInt32OrInt64ToInt64(request[4]);
uint8_t* buffer_start;
- if (request[2]->IsByteArray()) {
- CObjectByteArray byte_array(request[2]);
+ if (request[2]->IsUint8Array()) {
+ CObjectUint8Array byte_array(request[2]);
buffer_start = byte_array.Buffer() + offset;
} else {
CObjectArray array(request[2]);
@@ -820,7 +820,7 @@ static CObject* FileWriteListRequest(const CObjectArray& request) {
}
int64_t bytes_written =
file->Write(reinterpret_cast<void*>(buffer_start), length);
- if (!request[2]->IsByteArray()) {
+ if (!request[2]->IsUint8Array()) {
delete[] buffer_start;
}
if (bytes_written >= 0) {
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/file_impl.dart » ('j') | runtime/include/dart_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698