| 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/extensions.h" | 7 #include "bin/extensions.h" |
| 8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
| 9 #include "bin/file.h" | 9 #include "bin/file.h" |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 Dart_PeerFinalizer callback) { | 627 Dart_PeerFinalizer callback) { |
| 628 Dart_CObject* cobject = New(Dart_CObject::kExternalUint8Array); | 628 Dart_CObject* cobject = New(Dart_CObject::kExternalUint8Array); |
| 629 cobject->value.as_external_byte_array.length = length; | 629 cobject->value.as_external_byte_array.length = length; |
| 630 cobject->value.as_external_byte_array.data = data; | 630 cobject->value.as_external_byte_array.data = data; |
| 631 cobject->value.as_external_byte_array.peer = peer; | 631 cobject->value.as_external_byte_array.peer = peer; |
| 632 cobject->value.as_external_byte_array.callback = callback; | 632 cobject->value.as_external_byte_array.callback = callback; |
| 633 return cobject; | 633 return cobject; |
| 634 } | 634 } |
| 635 | 635 |
| 636 | 636 |
| 637 static int kIllegalArgumentError = 1; | 637 static int kArgumentError = 1; |
| 638 static int kOSError = 2; | 638 static int kOSError = 2; |
| 639 static int kFileClosedError = 3; | 639 static int kFileClosedError = 3; |
| 640 | 640 |
| 641 | 641 |
| 642 CObject* CObject::IllegalArgumentError() { | 642 CObject* CObject::IllegalArgumentError() { |
| 643 CObjectArray* result = new CObjectArray(CObject::NewArray(1)); | 643 CObjectArray* result = new CObjectArray(CObject::NewArray(1)); |
| 644 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kIllegalArgumentError))); | 644 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kArgumentError))); |
| 645 return result; | 645 return result; |
| 646 } | 646 } |
| 647 | 647 |
| 648 | 648 |
| 649 CObject* CObject::FileClosedError() { | 649 CObject* CObject::FileClosedError() { |
| 650 CObjectArray* result = new CObjectArray(CObject::NewArray(1)); | 650 CObjectArray* result = new CObjectArray(CObject::NewArray(1)); |
| 651 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kFileClosedError))); | 651 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kFileClosedError))); |
| 652 return result; | 652 return result; |
| 653 } | 653 } |
| 654 | 654 |
| 655 | 655 |
| 656 CObject* CObject::NewOSError() { | 656 CObject* CObject::NewOSError() { |
| 657 OSError os_error; | 657 OSError os_error; |
| 658 return NewOSError(&os_error); | 658 return NewOSError(&os_error); |
| 659 } | 659 } |
| 660 | 660 |
| 661 CObject* CObject::NewOSError(OSError* os_error) { | 661 CObject* CObject::NewOSError(OSError* os_error) { |
| 662 CObject* error_message = | 662 CObject* error_message = |
| 663 new CObjectString(CObject::NewString(os_error->message())); | 663 new CObjectString(CObject::NewString(os_error->message())); |
| 664 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 664 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 665 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 665 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 666 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 666 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 667 result->SetAt(2, error_message); | 667 result->SetAt(2, error_message); |
| 668 return result; | 668 return result; |
| 669 } | 669 } |
| OLD | NEW |