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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 intptr_t length, | 818 intptr_t length, |
819 void* stream); | 819 void* stream); |
820 | 820 |
821 typedef void (*Dart_FileCloseCallback)(void* stream); | 821 typedef void (*Dart_FileCloseCallback)(void* stream); |
822 | 822 |
823 typedef bool (*Dart_EntropySource)(uint8_t* buffer, intptr_t length); | 823 typedef bool (*Dart_EntropySource)(uint8_t* buffer, intptr_t length); |
824 | 824 |
825 /** | 825 /** |
826 * Initializes the VM. | 826 * Initializes the VM. |
827 * | 827 * |
| 828 * \param vm_isolate_snapshot A buffer containing a snapshot of the VM isolate |
| 829 * or NULL if no snapshot is provided. |
828 * \param create A function to be called during isolate creation. | 830 * \param create A function to be called during isolate creation. |
829 * See Dart_IsolateCreateCallback. | 831 * See Dart_IsolateCreateCallback. |
830 * \param interrupt A function to be called when an isolate is interrupted. | 832 * \param interrupt A function to be called when an isolate is interrupted. |
831 * See Dart_IsolateInterruptCallback. | 833 * See Dart_IsolateInterruptCallback. |
832 * \param unhandled_exception A function to be called if an isolate has an | 834 * \param unhandled_exception A function to be called if an isolate has an |
833 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. | 835 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. |
834 * \param shutdown A function to be called when an isolate is shutdown. | 836 * \param shutdown A function to be called when an isolate is shutdown. |
835 * See Dart_IsolateShutdownCallback. | 837 * See Dart_IsolateShutdownCallback. |
836 * | 838 * |
837 * \return True if initialization is successful. | 839 * \return True if initialization is successful. |
838 */ | 840 */ |
839 DART_EXPORT bool Dart_Initialize( | 841 DART_EXPORT bool Dart_Initialize( |
| 842 const uint8_t* vm_isolate_snapshot, |
840 Dart_IsolateCreateCallback create, | 843 Dart_IsolateCreateCallback create, |
841 Dart_IsolateInterruptCallback interrupt, | 844 Dart_IsolateInterruptCallback interrupt, |
842 Dart_IsolateUnhandledExceptionCallback unhandled_exception, | 845 Dart_IsolateUnhandledExceptionCallback unhandled_exception, |
843 Dart_IsolateShutdownCallback shutdown, | 846 Dart_IsolateShutdownCallback shutdown, |
844 Dart_FileOpenCallback file_open, | 847 Dart_FileOpenCallback file_open, |
845 Dart_FileReadCallback file_read, | 848 Dart_FileReadCallback file_read, |
846 Dart_FileWriteCallback file_write, | 849 Dart_FileWriteCallback file_write, |
847 Dart_FileCloseCallback file_close, | 850 Dart_FileCloseCallback file_close, |
848 Dart_EntropySource entropy_source); | 851 Dart_EntropySource entropy_source); |
849 | 852 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 * A snapshot can be used to restore the VM quickly to a saved state | 885 * A snapshot can be used to restore the VM quickly to a saved state |
883 * and is useful for fast startup. If snapshot data is provided, the | 886 * and is useful for fast startup. If snapshot data is provided, the |
884 * isolate will be started using that snapshot data. | 887 * isolate will be started using that snapshot data. |
885 * | 888 * |
886 * Requires there to be no current isolate. | 889 * Requires there to be no current isolate. |
887 * | 890 * |
888 * \param script_uri The name of the script this isolate will load. | 891 * \param script_uri The name of the script this isolate will load. |
889 * Provided only for advisory purposes to improve debugging messages. | 892 * Provided only for advisory purposes to improve debugging messages. |
890 * \param main The name of the main entry point this isolate will run. | 893 * \param main The name of the main entry point this isolate will run. |
891 * Provided only for advisory purposes to improve debugging messages. | 894 * Provided only for advisory purposes to improve debugging messages. |
892 * \param snapshot A buffer containing a VM snapshot or NULL if no | 895 * \param snapshot A buffer containing a snapshot of the isolate or |
893 * snapshot is provided. | 896 * NULL if no snapshot is provided. |
894 * \param callback_data Embedder data. This data will be passed to | 897 * \param callback_data Embedder data. This data will be passed to |
895 * the Dart_IsolateCreateCallback when new isolates are spawned from | 898 * the Dart_IsolateCreateCallback when new isolates are spawned from |
896 * this parent isolate. | 899 * this parent isolate. |
897 * \param error DOCUMENT | 900 * \param error DOCUMENT |
898 * | 901 * |
899 * \return The new isolate is returned. May be NULL if an error | 902 * \return The new isolate is returned. May be NULL if an error |
900 * occurs duing isolate initialization. | 903 * occurs duing isolate initialization. |
901 */ | 904 */ |
902 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, | 905 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, |
903 const char* main, | 906 const char* main, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 * - errors on bad overrides | 988 * - errors on bad overrides |
986 * | 989 * |
987 * This call requires there to be a current isolate, and requires that there has | 990 * This call requires there to be a current isolate, and requires that there has |
988 * not yet been any compilation for the current Isolate. | 991 * not yet been any compilation for the current Isolate. |
989 */ | 992 */ |
990 DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value); | 993 DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value); |
991 | 994 |
992 /** | 995 /** |
993 * Creates a full snapshot of the current isolate heap. | 996 * Creates a full snapshot of the current isolate heap. |
994 * | 997 * |
995 * A full snapshot is a compact representation of the dart heap state and | 998 * A full snapshot is a compact representation of the dart vm isolate heap |
996 * can be used for fast initialization of an isolate. A Snapshot of the heap | 999 * and dart isolate heap states. These snapshots are used to initialize |
997 * can only be created before any dart code has executed. | 1000 * the vm isolate on startup and fast initialization of an isolate. |
| 1001 * A Snapshot of the heap is created before any dart code has executed. |
998 * | 1002 * |
999 * Requires there to be a current isolate. | 1003 * Requires there to be a current isolate. |
1000 * | 1004 * |
1001 * \param buffer Returns a pointer to a buffer containing the | 1005 * \param buffer Returns a pointer to a buffer containing the |
1002 * snapshot. This buffer is scope allocated and is only valid | 1006 * snapshot. This buffer is scope allocated and is only valid |
1003 * until the next call to Dart_ExitScope. | 1007 * until the next call to Dart_ExitScope. |
1004 * \param size Returns the size of the buffer. | 1008 * \param size Returns the size of the buffer. |
1005 * | 1009 * |
1006 * \return A valid handle if no error occurs during the operation. | 1010 * \return A valid handle if no error occurs during the operation. |
1007 */ | 1011 */ |
1008 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, | 1012 DART_EXPORT Dart_Handle Dart_CreateSnapshot( |
1009 intptr_t* size); | 1013 uint8_t** vm_isolate_snapshot_buffer, |
| 1014 intptr_t* vm_isolate_snapshot_size, |
| 1015 uint8_t** isolate_snapshot_buffer, |
| 1016 intptr_t* isolate_snapshot_size); |
1010 | 1017 |
1011 /** | 1018 /** |
1012 * Creates a snapshot of the application script loaded in the isolate. | 1019 * Creates a snapshot of the application script loaded in the isolate. |
1013 * | 1020 * |
1014 * A script snapshot can be used for implementing fast startup of applications | 1021 * A script snapshot can be used for implementing fast startup of applications |
1015 * (skips the script tokenizing and parsing process). A Snapshot of the script | 1022 * (skips the script tokenizing and parsing process). A Snapshot of the script |
1016 * can only be created before any dart code has executed. | 1023 * can only be created before any dart code has executed. |
1017 * | 1024 * |
1018 * Requires there to be a current isolate which already has loaded script. | 1025 * Requires there to be a current isolate which already has loaded script. |
1019 * | 1026 * |
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2824 * NOTE: If multiple callbacks with the same name are registered, only the | 2831 * NOTE: If multiple callbacks with the same name are registered, only the |
2825 * last callback registered will be remembered. | 2832 * last callback registered will be remembered. |
2826 */ | 2833 */ |
2827 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 2834 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
2828 const char* name, | 2835 const char* name, |
2829 Dart_ServiceRequestCallback callback, | 2836 Dart_ServiceRequestCallback callback, |
2830 void* user_data); | 2837 void* user_data); |
2831 | 2838 |
2832 | 2839 |
2833 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2840 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |