| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "bin/file.h" | 7 #include "bin/file.h" |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 426 |
| 427 | 427 |
| 428 Dart_CObject* CObject::NewUint8Array(int length) { | 428 Dart_CObject* CObject::NewUint8Array(int length) { |
| 429 Dart_CObject* cobject = New(Dart_CObject::kUint8Array, length); | 429 Dart_CObject* cobject = New(Dart_CObject::kUint8Array, length); |
| 430 cobject->value.as_byte_array.length = length; | 430 cobject->value.as_byte_array.length = length; |
| 431 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); | 431 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); |
| 432 return cobject; | 432 return cobject; |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 Dart_CObject* CObject::NewExternalUint8Array(int length, |
| 437 uint8_t* data, |
| 438 void* peer, |
| 439 Dart_PeerFinalizer callback) { |
| 440 Dart_CObject* cobject = New(Dart_CObject::kExternalUint8Array); |
| 441 cobject->value.as_external_byte_array.length = length; |
| 442 cobject->value.as_external_byte_array.data = data; |
| 443 cobject->value.as_external_byte_array.peer = peer; |
| 444 cobject->value.as_external_byte_array.callback = callback; |
| 445 return cobject; |
| 446 } |
| 447 |
| 448 |
| 436 static int kIllegalArgumentError = 1; | 449 static int kIllegalArgumentError = 1; |
| 437 static int kOSError = 2; | 450 static int kOSError = 2; |
| 438 static int kFileClosedError = 3; | 451 static int kFileClosedError = 3; |
| 439 | 452 |
| 440 | 453 |
| 441 CObject* CObject::IllegalArgumentError() { | 454 CObject* CObject::IllegalArgumentError() { |
| 442 CObjectArray* result = new CObjectArray(CObject::NewArray(1)); | 455 CObjectArray* result = new CObjectArray(CObject::NewArray(1)); |
| 443 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kIllegalArgumentError))); | 456 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kIllegalArgumentError))); |
| 444 return result; | 457 return result; |
| 445 } | 458 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 459 | 472 |
| 460 CObject* CObject::NewOSError(OSError* os_error) { | 473 CObject* CObject::NewOSError(OSError* os_error) { |
| 461 CObject* error_message = | 474 CObject* error_message = |
| 462 new CObjectString(CObject::NewString(os_error->message())); | 475 new CObjectString(CObject::NewString(os_error->message())); |
| 463 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 476 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 464 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 477 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 465 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 478 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 466 result->SetAt(2, error_message); | 479 result->SetAt(2, error_message); |
| 467 return result; | 480 return result; |
| 468 } | 481 } |
| OLD | NEW |