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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_tools_api.h" | 8 #include "include/dart_tools_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 | 10 |
11 #include "platform/assert.h" | 11 #include "platform/assert.h" |
12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
13 | 13 |
14 #include "bin/crypto.h" | 14 #include "bin/crypto.h" |
15 #include "bin/directory.h" | 15 #include "bin/directory.h" |
16 #include "bin/extensions.h" | 16 #include "bin/extensions.h" |
17 #include "bin/file.h" | 17 #include "bin/file.h" |
18 #include "bin/io_buffer.h" | 18 #include "bin/io_buffer.h" |
19 #include "bin/isolate_data.h" | 19 #include "bin/isolate_data.h" |
20 #include "bin/platform.h" | 20 #include "bin/platform.h" |
21 #include "bin/socket.h" | 21 #include "bin/socket.h" |
22 #include "bin/utils.h" | 22 #include "bin/utils.h" |
23 | 23 |
| 24 // Return the error from the containing function if handle is in error handle. |
| 25 #define RETURN_IF_ERROR(handle) \ |
| 26 { \ |
| 27 Dart_Handle __handle = handle; \ |
| 28 if (Dart_IsError((__handle))) { \ |
| 29 return __handle; \ |
| 30 } \ |
| 31 } |
| 32 |
24 namespace dart { | 33 namespace dart { |
25 namespace bin { | 34 namespace bin { |
26 | 35 |
27 const char* DartUtils::original_working_directory = NULL; | 36 const char* DartUtils::original_working_directory = NULL; |
28 const char* DartUtils::kDartScheme = "dart:"; | 37 const char* DartUtils::kDartScheme = "dart:"; |
29 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; | 38 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; |
30 const char* DartUtils::kAsyncLibURL = "dart:async"; | 39 const char* DartUtils::kAsyncLibURL = "dart:async"; |
31 const char* DartUtils::kBuiltinLibURL = "dart:_builtin"; | 40 const char* DartUtils::kBuiltinLibURL = "dart:_builtin"; |
32 const char* DartUtils::kCoreLibURL = "dart:core"; | 41 const char* DartUtils::kCoreLibURL = "dart:core"; |
33 const char* DartUtils::kInternalLibURL = "dart:_internal"; | 42 const char* DartUtils::kInternalLibURL = "dart:_internal"; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // Handle URI canonicalization requests. | 385 // Handle URI canonicalization requests. |
377 if (tag == Dart_kCanonicalizeUrl) { | 386 if (tag == Dart_kCanonicalizeUrl) { |
378 // If this is a Dart Scheme URL or 'part' of a io library | 387 // If this is a Dart Scheme URL or 'part' of a io library |
379 // then it is not modified as it will be handled internally. | 388 // then it is not modified as it will be handled internally. |
380 if (is_dart_scheme_url || is_io_library) { | 389 if (is_dart_scheme_url || is_io_library) { |
381 return url; | 390 return url; |
382 } | 391 } |
383 // Resolve the url within the context of the library's URL. | 392 // Resolve the url within the context of the library's URL. |
384 Dart_Handle builtin_lib = | 393 Dart_Handle builtin_lib = |
385 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | 394 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); |
386 DART_CHECK_VALID(builtin_lib); | 395 RETURN_IF_ERROR(builtin_lib); |
387 return ResolveUri(library_url, url, builtin_lib); | 396 return ResolveUri(library_url, url, builtin_lib); |
388 } | 397 } |
389 | 398 |
390 // Handle 'import' of dart scheme URIs (i.e they start with 'dart:'). | 399 // Handle 'import' of dart scheme URIs (i.e they start with 'dart:'). |
391 if (is_dart_scheme_url) { | 400 if (is_dart_scheme_url) { |
392 if (tag == Dart_kImportTag) { | 401 if (tag == Dart_kImportTag) { |
393 // Handle imports of other built-in libraries present in the SDK. | 402 // Handle imports of other built-in libraries present in the SDK. |
394 if (DartUtils::IsDartIOLibURL(url_string)) { | 403 if (DartUtils::IsDartIOLibURL(url_string)) { |
395 return Builtin::LoadLibrary(url, Builtin::kIOLibrary); | 404 return Builtin::LoadLibrary(url, Builtin::kIOLibrary); |
396 } | 405 } |
(...skipping 19 matching lines...) Expand all Loading... |
416 part_uri_obj, | 425 part_uri_obj, |
417 Builtin::PartSource(Builtin::kIOLibrary, url_string), 0, 0); | 426 Builtin::PartSource(Builtin::kIOLibrary, url_string), 0, 0); |
418 } else { | 427 } else { |
419 ASSERT(tag == Dart_kImportTag); | 428 ASSERT(tag == Dart_kImportTag); |
420 return NewError("Unable to import '%s' ", url_string); | 429 return NewError("Unable to import '%s' ", url_string); |
421 } | 430 } |
422 } | 431 } |
423 | 432 |
424 Dart_Handle builtin_lib = | 433 Dart_Handle builtin_lib = |
425 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | 434 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); |
426 DART_CHECK_VALID(builtin_lib); | 435 RETURN_IF_ERROR(builtin_lib); |
427 if (DartUtils::IsDartExtensionSchemeURL(url_string)) { | 436 if (DartUtils::IsDartExtensionSchemeURL(url_string)) { |
428 // Load a native code shared library to use in a native extension | 437 // Load a native code shared library to use in a native extension |
429 if (tag != Dart_kImportTag) { | 438 if (tag != Dart_kImportTag) { |
430 return NewError("Dart extensions must use import: '%s'", url_string); | 439 return NewError("Dart extensions must use import: '%s'", url_string); |
431 } | 440 } |
432 Dart_Handle path_parts = DartUtils::ExtensionPathFromUri(url, builtin_lib); | 441 Dart_Handle path_parts = DartUtils::ExtensionPathFromUri(url, builtin_lib); |
433 if (Dart_IsError(path_parts)) { | 442 if (Dart_IsError(path_parts)) { |
434 return path_parts; | 443 return path_parts; |
435 } | 444 } |
436 const char* extension_directory = NULL; | 445 const char* extension_directory = NULL; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 Dart_Handle source = Dart_NewStringFromUTF8(data, num_bytes); | 571 Dart_Handle source = Dart_NewStringFromUTF8(data, num_bytes); |
563 if (Dart_IsError(source)) { | 572 if (Dart_IsError(source)) { |
564 result = DartUtils::NewError("%s is not a valid UTF-8 script", | 573 result = DartUtils::NewError("%s is not a valid UTF-8 script", |
565 resolved_script_uri); | 574 resolved_script_uri); |
566 } else { | 575 } else { |
567 if (tag == Dart_kImportTag) { | 576 if (tag == Dart_kImportTag) { |
568 result = Dart_LoadLibrary(resolved_script_uri, source, 0, 0); | 577 result = Dart_LoadLibrary(resolved_script_uri, source, 0, 0); |
569 } else { | 578 } else { |
570 ASSERT(tag == Dart_kSourceTag); | 579 ASSERT(tag == Dart_kSourceTag); |
571 Dart_Handle library = Dart_LookupLibrary(library_uri); | 580 Dart_Handle library = Dart_LookupLibrary(library_uri); |
572 DART_CHECK_VALID(library); | 581 if (Dart_IsError(library)) { |
| 582 Dart_PropagateError(library); |
| 583 } |
573 result = Dart_LoadSource(library, resolved_script_uri, source, 0, 0); | 584 result = Dart_LoadSource(library, resolved_script_uri, source, 0, 0); |
574 } | 585 } |
575 } | 586 } |
576 } | 587 } |
577 | 588 |
578 if (buffer_copy != NULL) { | 589 if (buffer_copy != NULL) { |
579 free(const_cast<uint8_t *>(buffer_copy)); | 590 free(const_cast<uint8_t *>(buffer_copy)); |
580 } | 591 } |
581 | 592 |
582 if (Dart_IsError(result)) { | 593 if (Dart_IsError(result)) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 639 |
629 Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib, | 640 Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib, |
630 Dart_Handle internal_lib, | 641 Dart_Handle internal_lib, |
631 bool is_service_isolate, | 642 bool is_service_isolate, |
632 bool trace_loading, | 643 bool trace_loading, |
633 const char* package_root, | 644 const char* package_root, |
634 const char* packages_file) { | 645 const char* packages_file) { |
635 // Setup the internal library's 'internalPrint' function. | 646 // Setup the internal library's 'internalPrint' function. |
636 Dart_Handle print = Dart_Invoke( | 647 Dart_Handle print = Dart_Invoke( |
637 builtin_lib, NewString("_getPrintClosure"), 0, NULL); | 648 builtin_lib, NewString("_getPrintClosure"), 0, NULL); |
638 DART_CHECK_VALID(print); | 649 RETURN_IF_ERROR(print); |
639 Dart_Handle result = | 650 Dart_Handle result = |
640 Dart_SetField(internal_lib, NewString("_printClosure"), print); | 651 Dart_SetField(internal_lib, NewString("_printClosure"), print); |
641 DART_CHECK_VALID(result); | 652 RETURN_IF_ERROR(result); |
642 | 653 |
643 if (!is_service_isolate) { | 654 if (!is_service_isolate) { |
644 if (IsWindowsHost()) { | 655 if (IsWindowsHost()) { |
645 result = Dart_SetField(builtin_lib, NewString("_isWindows"), Dart_True()); | 656 result = Dart_SetField(builtin_lib, NewString("_isWindows"), Dart_True()); |
646 DART_CHECK_VALID(result); | 657 RETURN_IF_ERROR(result); |
647 } | 658 } |
648 if (trace_loading) { | 659 if (trace_loading) { |
649 result = Dart_SetField(builtin_lib, | 660 result = Dart_SetField(builtin_lib, |
650 NewString("_traceLoading"), Dart_True()); | 661 NewString("_traceLoading"), Dart_True()); |
651 DART_CHECK_VALID(result); | 662 RETURN_IF_ERROR(result); |
652 } | 663 } |
653 // Set current working directory. | 664 // Set current working directory. |
654 result = SetWorkingDirectory(builtin_lib); | 665 result = SetWorkingDirectory(builtin_lib); |
655 DART_CHECK_VALID(result); | 666 RETURN_IF_ERROR(result); |
656 // Wait for the service isolate to initialize the load port. | 667 // Wait for the service isolate to initialize the load port. |
657 Dart_Port load_port = Dart_ServiceWaitForLoadPort(); | 668 Dart_Port load_port = Dart_ServiceWaitForLoadPort(); |
658 if (load_port == ILLEGAL_PORT) { | 669 if (load_port == ILLEGAL_PORT) { |
659 return NewDartUnsupportedError("Service did not return load port."); | 670 return NewDartUnsupportedError("Service did not return load port."); |
660 } | 671 } |
661 Builtin::SetLoadPort(load_port); | 672 Builtin::SetLoadPort(load_port); |
662 } | 673 } |
663 | 674 |
664 // Set up package root if specified. | 675 // Set up package root if specified. |
665 if (package_root != NULL) { | 676 if (package_root != NULL) { |
666 ASSERT(packages_file == NULL); | 677 ASSERT(packages_file == NULL); |
667 result = NewString(package_root); | 678 result = NewString(package_root); |
668 DART_CHECK_VALID(result); | 679 RETURN_IF_ERROR(result); |
669 const int kNumArgs = 1; | 680 const int kNumArgs = 1; |
670 Dart_Handle dart_args[kNumArgs]; | 681 Dart_Handle dart_args[kNumArgs]; |
671 dart_args[0] = result; | 682 dart_args[0] = result; |
672 result = Dart_Invoke(builtin_lib, | 683 result = Dart_Invoke(builtin_lib, |
673 NewString("_setPackageRoot"), | 684 NewString("_setPackageRoot"), |
674 kNumArgs, | 685 kNumArgs, |
675 dart_args); | 686 dart_args); |
676 DART_CHECK_VALID(result); | 687 RETURN_IF_ERROR(result); |
677 } else if (packages_file != NULL) { | 688 } else if (packages_file != NULL) { |
678 result = NewString(packages_file); | 689 result = NewString(packages_file); |
679 DART_CHECK_VALID(result); | 690 RETURN_IF_ERROR(result); |
680 const int kNumArgs = 1; | 691 const int kNumArgs = 1; |
681 Dart_Handle dart_args[kNumArgs]; | 692 Dart_Handle dart_args[kNumArgs]; |
682 dart_args[0] = result; | 693 dart_args[0] = result; |
683 result = Dart_Invoke(builtin_lib, | 694 result = Dart_Invoke(builtin_lib, |
684 NewString("_loadPackagesMap"), | 695 NewString("_loadPackagesMap"), |
685 kNumArgs, | 696 kNumArgs, |
686 dart_args); | 697 dart_args); |
687 DART_CHECK_VALID(result); | 698 RETURN_IF_ERROR(result); |
688 } | 699 } |
689 return Dart_True(); | 700 return Dart_True(); |
690 } | 701 } |
691 | 702 |
692 | 703 |
693 void DartUtils::PrepareCoreLibrary(Dart_Handle core_lib, | 704 Dart_Handle DartUtils::PrepareCoreLibrary(Dart_Handle core_lib, |
694 Dart_Handle builtin_lib, | 705 Dart_Handle builtin_lib, |
695 bool is_service_isolate) { | 706 bool is_service_isolate) { |
696 if (!is_service_isolate) { | 707 if (!is_service_isolate) { |
697 // Setup the 'Uri.base' getter in dart:core. | 708 // Setup the 'Uri.base' getter in dart:core. |
698 Dart_Handle uri_base = Dart_Invoke( | 709 Dart_Handle uri_base = Dart_Invoke( |
699 builtin_lib, NewString("_getUriBaseClosure"), 0, NULL); | 710 builtin_lib, NewString("_getUriBaseClosure"), 0, NULL); |
700 DART_CHECK_VALID(uri_base); | 711 RETURN_IF_ERROR(uri_base); |
701 Dart_Handle result = Dart_SetField(core_lib, | 712 Dart_Handle result = Dart_SetField(core_lib, |
702 NewString("_uriBaseClosure"), | 713 NewString("_uriBaseClosure"), |
703 uri_base); | 714 uri_base); |
704 DART_CHECK_VALID(result); | 715 RETURN_IF_ERROR(result); |
705 } | 716 } |
| 717 return Dart_True(); |
706 } | 718 } |
707 | 719 |
708 | 720 |
709 void DartUtils::PrepareAsyncLibrary(Dart_Handle async_lib, | 721 Dart_Handle DartUtils::PrepareAsyncLibrary(Dart_Handle async_lib, |
710 Dart_Handle isolate_lib) { | 722 Dart_Handle isolate_lib) { |
711 Dart_Handle schedule_immediate_closure = | 723 Dart_Handle schedule_immediate_closure = |
712 Dart_Invoke(isolate_lib, NewString("_getIsolateScheduleImmediateClosure"), | 724 Dart_Invoke(isolate_lib, NewString("_getIsolateScheduleImmediateClosure"), |
713 0, NULL); | 725 0, NULL); |
714 Dart_Handle args[1]; | 726 Dart_Handle args[1]; |
715 args[0] = schedule_immediate_closure; | 727 args[0] = schedule_immediate_closure; |
716 DART_CHECK_VALID(Dart_Invoke( | 728 return Dart_Invoke( |
717 async_lib, NewString("_setScheduleImmediateClosure"), 1, args)); | 729 async_lib, NewString("_setScheduleImmediateClosure"), 1, args); |
718 } | 730 } |
719 | 731 |
720 | 732 |
721 void DartUtils::PrepareIOLibrary(Dart_Handle io_lib) { | 733 Dart_Handle DartUtils::PrepareIOLibrary(Dart_Handle io_lib) { |
722 DART_CHECK_VALID(Dart_Invoke(io_lib, NewString("_setupHooks"), 0, NULL)); | 734 return Dart_Invoke(io_lib, NewString("_setupHooks"), 0, NULL); |
723 } | 735 } |
724 | 736 |
725 | 737 |
726 void DartUtils::PrepareIsolateLibrary(Dart_Handle isolate_lib) { | 738 Dart_Handle DartUtils::PrepareIsolateLibrary(Dart_Handle isolate_lib) { |
727 DART_CHECK_VALID(Dart_Invoke(isolate_lib, NewString("_setupHooks"), 0, NULL)); | 739 return Dart_Invoke(isolate_lib, NewString("_setupHooks"), 0, NULL); |
728 } | 740 } |
729 | 741 |
730 | 742 |
731 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, | 743 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, |
732 const char* packages_file, | 744 const char* packages_file, |
733 bool is_service_isolate, | 745 bool is_service_isolate, |
734 bool trace_loading, | 746 bool trace_loading, |
735 Dart_Handle builtin_lib) { | 747 Dart_Handle builtin_lib) { |
736 // First ensure all required libraries are available. | 748 // First ensure all required libraries are available. |
737 Dart_Handle url = NewString(kCoreLibURL); | 749 Dart_Handle url = NewString(kCoreLibURL); |
738 DART_CHECK_VALID(url); | 750 RETURN_IF_ERROR(url); |
739 Dart_Handle core_lib = Dart_LookupLibrary(url); | 751 Dart_Handle core_lib = Dart_LookupLibrary(url); |
740 DART_CHECK_VALID(core_lib); | 752 RETURN_IF_ERROR(core_lib); |
741 url = NewString(kAsyncLibURL); | 753 url = NewString(kAsyncLibURL); |
742 DART_CHECK_VALID(url); | 754 RETURN_IF_ERROR(url); |
743 Dart_Handle async_lib = Dart_LookupLibrary(url); | 755 Dart_Handle async_lib = Dart_LookupLibrary(url); |
744 DART_CHECK_VALID(async_lib); | 756 RETURN_IF_ERROR(async_lib); |
745 url = NewString(kIsolateLibURL); | 757 url = NewString(kIsolateLibURL); |
746 DART_CHECK_VALID(url); | 758 RETURN_IF_ERROR(url); |
747 Dart_Handle isolate_lib = Dart_LookupLibrary(url); | 759 Dart_Handle isolate_lib = Dart_LookupLibrary(url); |
748 DART_CHECK_VALID(isolate_lib); | 760 RETURN_IF_ERROR(isolate_lib); |
749 url = NewString(kInternalLibURL); | 761 url = NewString(kInternalLibURL); |
750 DART_CHECK_VALID(url); | 762 RETURN_IF_ERROR(url); |
751 Dart_Handle internal_lib = Dart_LookupLibrary(url); | 763 Dart_Handle internal_lib = Dart_LookupLibrary(url); |
752 DART_CHECK_VALID(internal_lib); | 764 RETURN_IF_ERROR(internal_lib); |
753 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); | 765 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); |
754 DART_CHECK_VALID(io_lib); | 766 RETURN_IF_ERROR(io_lib); |
755 | 767 |
756 // We need to ensure that all the scripts loaded so far are finalized | 768 // We need to ensure that all the scripts loaded so far are finalized |
757 // as we are about to invoke some Dart code below to setup closures. | 769 // as we are about to invoke some Dart code below to setup closures. |
758 Dart_Handle result = Dart_FinalizeLoading(false); | 770 Dart_Handle result = Dart_FinalizeLoading(false); |
759 DART_CHECK_VALID(result); | 771 RETURN_IF_ERROR(result); |
760 | 772 |
761 result = PrepareBuiltinLibrary(builtin_lib, | 773 result = PrepareBuiltinLibrary(builtin_lib, |
762 internal_lib, | 774 internal_lib, |
763 is_service_isolate, | 775 is_service_isolate, |
764 trace_loading, | 776 trace_loading, |
765 package_root, | 777 package_root, |
766 packages_file); | 778 packages_file); |
767 DART_CHECK_VALID(result); | 779 RETURN_IF_ERROR(result); |
768 | 780 |
769 PrepareAsyncLibrary(async_lib, isolate_lib); | 781 RETURN_IF_ERROR(PrepareAsyncLibrary(async_lib, isolate_lib)); |
770 PrepareCoreLibrary(core_lib, builtin_lib, is_service_isolate); | 782 RETURN_IF_ERROR(PrepareCoreLibrary( |
771 PrepareIsolateLibrary(isolate_lib); | 783 core_lib, builtin_lib, is_service_isolate)); |
772 PrepareIOLibrary(io_lib); | 784 RETURN_IF_ERROR(PrepareIsolateLibrary(isolate_lib)); |
| 785 RETURN_IF_ERROR(PrepareIOLibrary(io_lib)); |
773 return result; | 786 return result; |
774 } | 787 } |
775 | 788 |
776 | 789 |
777 void DartUtils::SetupIOLibrary(const char* script_uri) { | 790 Dart_Handle DartUtils::SetupIOLibrary(const char* script_uri) { |
778 Dart_Handle io_lib_url = NewString(kIOLibURL); | 791 Dart_Handle io_lib_url = NewString(kIOLibURL); |
779 DART_CHECK_VALID(io_lib_url); | 792 RETURN_IF_ERROR(io_lib_url); |
780 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); | 793 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); |
781 DART_CHECK_VALID(io_lib); | 794 RETURN_IF_ERROR(io_lib); |
782 Dart_Handle platform_type = GetDartType(DartUtils::kIOLibURL, "_Platform"); | 795 Dart_Handle platform_type = GetDartType(DartUtils::kIOLibURL, "_Platform"); |
783 DART_CHECK_VALID(platform_type); | 796 RETURN_IF_ERROR(platform_type); |
784 Dart_Handle script_name = NewString("_nativeScript"); | 797 Dart_Handle script_name = NewString("_nativeScript"); |
785 DART_CHECK_VALID(script_name); | 798 RETURN_IF_ERROR(script_name); |
786 Dart_Handle dart_script = NewString(script_uri); | 799 Dart_Handle dart_script = NewString(script_uri); |
787 DART_CHECK_VALID(dart_script); | 800 RETURN_IF_ERROR(dart_script); |
788 Dart_Handle set_script_name = | 801 Dart_Handle set_script_name = |
789 Dart_SetField(platform_type, script_name, dart_script); | 802 Dart_SetField(platform_type, script_name, dart_script); |
790 DART_CHECK_VALID(set_script_name); | 803 RETURN_IF_ERROR(set_script_name); |
| 804 return Dart_Null(); |
791 } | 805 } |
792 | 806 |
793 | 807 |
794 bool DartUtils::PostNull(Dart_Port port_id) { | 808 bool DartUtils::PostNull(Dart_Port port_id) { |
795 // Post a message with just the null object. | 809 // Post a message with just the null object. |
796 return Dart_PostCObject(port_id, CObject::Null()->AsApiCObject()); | 810 return Dart_PostCObject(port_id, CObject::Null()->AsApiCObject()); |
797 } | 811 } |
798 | 812 |
799 | 813 |
800 bool DartUtils::PostInt32(Dart_Port port_id, int32_t value) { | 814 bool DartUtils::PostInt32(Dart_Port port_id, int32_t value) { |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 new CObjectString(CObject::NewString(os_error->message())); | 1243 new CObjectString(CObject::NewString(os_error->message())); |
1230 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1244 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
1231 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1245 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
1232 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1246 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
1233 result->SetAt(2, error_message); | 1247 result->SetAt(2, error_message); |
1234 return result; | 1248 return result; |
1235 } | 1249 } |
1236 | 1250 |
1237 } // namespace bin | 1251 } // namespace bin |
1238 } // namespace dart | 1252 } // namespace dart |
OLD | NEW |