| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
| 4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #ifndef INCLUDE_DART_API_H_ | 7 #ifndef INCLUDE_DART_API_H_ |
| 8 #define INCLUDE_DART_API_H_ | 8 #define INCLUDE_DART_API_H_ |
| 9 | 9 |
| 10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 678 |
| 679 /** | 679 /** |
| 680 * Gets the version string for the Dart VM. | 680 * Gets the version string for the Dart VM. |
| 681 * | 681 * |
| 682 * The version of the Dart VM can be accessed without initializing the VM. | 682 * The version of the Dart VM can be accessed without initializing the VM. |
| 683 * | 683 * |
| 684 * \return The version string for the embedded Dart VM. | 684 * \return The version string for the embedded Dart VM. |
| 685 */ | 685 */ |
| 686 DART_EXPORT const char* Dart_VersionString(); | 686 DART_EXPORT const char* Dart_VersionString(); |
| 687 | 687 |
| 688 |
| 689 /** |
| 690 * Isolate specific flags are set when creating a new isolate using the |
| 691 * Dart_IsolateFlags structure. |
| 692 * |
| 693 * Current version of flags is encoded in a 32-bit integer with 16 bits used |
| 694 * for each part. |
| 695 */ |
| 696 |
| 697 #define DART_FLAGS_CURRENT_VERSION (0x00000001) |
| 698 |
| 699 typedef struct { |
| 700 int32_t version; |
| 701 bool enable_type_checks; |
| 702 bool enable_asserts; |
| 703 } Dart_IsolateFlags; |
| 704 |
| 688 /** | 705 /** |
| 689 * An isolate creation and initialization callback function. | 706 * An isolate creation and initialization callback function. |
| 690 * | 707 * |
| 691 * This callback, provided by the embedder, is called when the vm | 708 * This callback, provided by the embedder, is called when the vm |
| 692 * needs to create an isolate. The callback should create an isolate | 709 * needs to create an isolate. The callback should create an isolate |
| 693 * by calling Dart_CreateIsolate and load any scripts required for | 710 * by calling Dart_CreateIsolate and load any scripts required for |
| 694 * execution. | 711 * execution. |
| 695 * | 712 * |
| 696 * When the function returns false, it is the responsibility of this | 713 * When the function returns false, it is the responsibility of this |
| 697 * function to ensure that Dart_ShutdownIsolate has been called if | 714 * function to ensure that Dart_ShutdownIsolate has been called if |
| (...skipping 18 matching lines...) Expand all Loading... |
| 716 * The callback is responsible for loading the script used in the | 733 * The callback is responsible for loading the script used in the |
| 717 * parent isolate by a call to Dart_LoadScript or | 734 * parent isolate by a call to Dart_LoadScript or |
| 718 * Dart_LoadScriptFromSnapshot. | 735 * Dart_LoadScriptFromSnapshot. |
| 719 * \param main The name of the main entry point this isolate will | 736 * \param main The name of the main entry point this isolate will |
| 720 * eventually run. This is provided for advisory purposes only to | 737 * eventually run. This is provided for advisory purposes only to |
| 721 * improve debugging messages. The main function is not invoked by | 738 * improve debugging messages. The main function is not invoked by |
| 722 * this function. | 739 * this function. |
| 723 * \param package_root The package root path for this isolate to resolve | 740 * \param package_root The package root path for this isolate to resolve |
| 724 * package imports against. If this parameter is NULL, the package root path | 741 * package imports against. If this parameter is NULL, the package root path |
| 725 * of the parent isolate should be used. | 742 * of the parent isolate should be used. |
| 743 * \param flags Default flags for this isolate being spawned. Either inherited |
| 744 * from the spawning isolate or passed as parameters when spawning the |
| 745 * isolate from Dart code. |
| 726 * \param callback_data The callback data which was passed to the | 746 * \param callback_data The callback data which was passed to the |
| 727 * parent isolate when it was created by calling Dart_CreateIsolate(). | 747 * parent isolate when it was created by calling Dart_CreateIsolate(). |
| 728 * \param error A structure into which the embedder can place a | 748 * \param error A structure into which the embedder can place a |
| 729 * C string containing an error message in the case of failures. | 749 * C string containing an error message in the case of failures. |
| 730 * | 750 * |
| 731 * \return The embedder returns NULL if the creation and | 751 * \return The embedder returns NULL if the creation and |
| 732 * initialization was not successful and the isolate if successful. | 752 * initialization was not successful and the isolate if successful. |
| 733 */ | 753 */ |
| 734 typedef Dart_Isolate (*Dart_IsolateCreateCallback)(const char* script_uri, | 754 typedef Dart_Isolate (*Dart_IsolateCreateCallback)(const char* script_uri, |
| 735 const char* main, | 755 const char* main, |
| 736 const char* package_root, | 756 const char* package_root, |
| 757 Dart_IsolateFlags* flags, |
| 737 void* callback_data, | 758 void* callback_data, |
| 738 char** error); | 759 char** error); |
| 739 | 760 |
| 740 /** | 761 /** |
| 741 * An isolate interrupt callback function. | 762 * An isolate interrupt callback function. |
| 742 * | 763 * |
| 743 * This callback, provided by the embedder, is called when an isolate | 764 * This callback, provided by the embedder, is called when an isolate |
| 744 * is interrupted as a result of a call to Dart_InterruptIsolate(). | 765 * is interrupted as a result of a call to Dart_InterruptIsolate(). |
| 745 * When the callback is called, Dart_CurrentIsolate can be used to | 766 * When the callback is called, Dart_CurrentIsolate can be used to |
| 746 * figure out which isolate is being interrupted. | 767 * figure out which isolate is being interrupted. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 * isolate will be started using that snapshot data. | 908 * isolate will be started using that snapshot data. |
| 888 * | 909 * |
| 889 * Requires there to be no current isolate. | 910 * Requires there to be no current isolate. |
| 890 * | 911 * |
| 891 * \param script_uri The name of the script this isolate will load. | 912 * \param script_uri The name of the script this isolate will load. |
| 892 * Provided only for advisory purposes to improve debugging messages. | 913 * Provided only for advisory purposes to improve debugging messages. |
| 893 * \param main The name of the main entry point this isolate will run. | 914 * \param main The name of the main entry point this isolate will run. |
| 894 * Provided only for advisory purposes to improve debugging messages. | 915 * Provided only for advisory purposes to improve debugging messages. |
| 895 * \param snapshot A buffer containing a snapshot of the isolate or | 916 * \param snapshot A buffer containing a snapshot of the isolate or |
| 896 * NULL if no snapshot is provided. | 917 * NULL if no snapshot is provided. |
| 918 * \param flags Pointer to VM specific flags or NULL for default flags. |
| 897 * \param callback_data Embedder data. This data will be passed to | 919 * \param callback_data Embedder data. This data will be passed to |
| 898 * the Dart_IsolateCreateCallback when new isolates are spawned from | 920 * the Dart_IsolateCreateCallback when new isolates are spawned from |
| 899 * this parent isolate. | 921 * this parent isolate. |
| 900 * \param error DOCUMENT | 922 * \param error DOCUMENT |
| 901 * | 923 * |
| 902 * \return The new isolate is returned. May be NULL if an error | 924 * \return The new isolate is returned. May be NULL if an error |
| 903 * occurs duing isolate initialization. | 925 * occurs duing isolate initialization. |
| 904 */ | 926 */ |
| 905 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, | 927 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, |
| 906 const char* main, | 928 const char* main, |
| 907 const uint8_t* snapshot, | 929 const uint8_t* snapshot, |
| 930 Dart_IsolateFlags* flags, |
| 908 void* callback_data, | 931 void* callback_data, |
| 909 char** error); | 932 char** error); |
| 910 /* TODO(turnidge): Document behavior when there is already a current | 933 /* TODO(turnidge): Document behavior when there is already a current |
| 911 * isolate. */ | 934 * isolate. */ |
| 912 | 935 |
| 913 /** | 936 /** |
| 914 * Shuts down the current isolate. After this call, the current isolate | 937 * Shuts down the current isolate. After this call, the current isolate |
| 915 * is NULL. Invokes the shutdown callback and any callbacks of remaining | 938 * is NULL. Invokes the shutdown callback and any callbacks of remaining |
| 916 * weak persistent handles. | 939 * weak persistent handles. |
| 917 * | 940 * |
| (...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 * NOTE: If multiple callbacks with the same name are registered, only | 2868 * NOTE: If multiple callbacks with the same name are registered, only |
| 2846 * the last callback registered will be remembered. | 2869 * the last callback registered will be remembered. |
| 2847 */ | 2870 */ |
| 2848 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 2871 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 2849 const char* method, | 2872 const char* method, |
| 2850 Dart_ServiceRequestCallback callback, | 2873 Dart_ServiceRequestCallback callback, |
| 2851 void* user_data); | 2874 void* user_data); |
| 2852 | 2875 |
| 2853 | 2876 |
| 2854 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2877 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |