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