Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1036)

Side by Side Diff: runtime/include/dart_api.h

Issue 2525623002: VM: [Kernel] Split kernel API into 3 steps: ([read binary], parse-binary, bootstrap, load program) (Closed)
Patch Set: addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/bootstrap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RUNTIME_INCLUDE_DART_API_H_ 7 #ifndef RUNTIME_INCLUDE_DART_API_H_
8 #define RUNTIME_INCLUDE_DART_API_H_ 8 #define RUNTIME_INCLUDE_DART_API_H_
9 9
10 /** \mainpage Dart Embedding API Reference 10 /** \mainpage Dart Embedding API Reference
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 char** error); 883 char** error);
884 /* TODO(turnidge): Document behavior when there is already a current 884 /* TODO(turnidge): Document behavior when there is already a current
885 * isolate. */ 885 * isolate. */
886 886
887 /** 887 /**
888 * Creates a new isolate from a Dart Kernel file. The new isolate 888 * Creates a new isolate from a Dart Kernel file. The new isolate
889 * becomes the current isolate. 889 * becomes the current isolate.
890 * 890 *
891 * Requires there to be no current isolate. 891 * Requires there to be no current isolate.
892 * 892 *
893 * After this call, the `kernel_program` needs to be supplied to a call to
894 * `Dart_LoadKernel()` which will then take ownership of the memory.
895 *
893 * \param script_uri The name of the script this isolate will load. 896 * \param script_uri The name of the script this isolate will load.
894 * Provided only for advisory purposes to improve debugging messages. 897 * Provided only for advisory purposes to improve debugging messages.
895 * \param main The name of the main entry point this isolate will run. 898 * \param main The name of the main entry point this isolate will run.
896 * Provided only for advisory purposes to improve debugging messages. 899 * Provided only for advisory purposes to improve debugging messages.
897 * \param kernel A buffer containing the Dart Kernel binary. 900 * \param kernel_program The `dart::kernel::Program` object.
898 * \param kernel_length The length of the Kernel buffer.
899 * \param flags Pointer to VM specific flags or NULL for default flags. 901 * \param flags Pointer to VM specific flags or NULL for default flags.
900 * \param callback_data Embedder data. This data will be passed to 902 * \param callback_data Embedder data. This data will be passed to
901 * the Dart_IsolateCreateCallback when new isolates are spawned from 903 * the Dart_IsolateCreateCallback when new isolates are spawned from
902 * this parent isolate. 904 * this parent isolate.
903 * \param error DOCUMENT 905 * \param error DOCUMENT
904 * 906 *
905 * \return The new isolate is returned. May be NULL if an error 907 * \return The new isolate is returned. May be NULL if an error
906 * occurs during isolate initialization. 908 * occurs during isolate initialization.
907 */ 909 */
908 DART_EXPORT Dart_Isolate Dart_CreateIsolateFromKernel(const char* script_uri, 910 DART_EXPORT Dart_Isolate Dart_CreateIsolateFromKernel(const char* script_uri,
909 const char* main, 911 const char* main,
910 const uint8_t* kernel, 912 void* kernel_program,
911 intptr_t kernel_length,
912 Dart_IsolateFlags* flags, 913 Dart_IsolateFlags* flags,
913 void* callback_data, 914 void* callback_data,
914 char** error); 915 char** error);
915 /** 916 /**
916 * Shuts down the current isolate. After this call, the current isolate 917 * Shuts down the current isolate. After this call, the current isolate
917 * is NULL. Invokes the shutdown callback and any callbacks of remaining 918 * is NULL. Invokes the shutdown callback and any callbacks of remaining
918 * weak persistent handles. 919 * weak persistent handles.
919 * 920 *
920 * Requires there to be a current isolate. 921 * Requires there to be a current isolate.
921 */ 922 */
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 * \param buffer A buffer which contains a snapshot of the script. 2857 * \param buffer A buffer which contains a snapshot of the script.
2857 * \param buffer_len Length of the passed in buffer. 2858 * \param buffer_len Length of the passed in buffer.
2858 * 2859 *
2859 * \return If no error occurs, the Library object corresponding to the root 2860 * \return If no error occurs, the Library object corresponding to the root
2860 * script is returned. Otherwise an error handle is returned. 2861 * script is returned. Otherwise an error handle is returned.
2861 */ 2862 */
2862 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, 2863 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
2863 intptr_t buffer_len); 2864 intptr_t buffer_len);
2864 2865
2865 /** 2866 /**
2866 * Loads a dart application which was compiled to a Kernel binary. 2867 * Loads a dart application via an in-memory kernel program.
2867 * 2868 *
2868 * \param buffer A buffer which contains a Kernel binary. 2869 * \param kernel_program The kernel program obtained via
2869 * \param buffer_len Length of the passed in buffer. 2870 * `Dart_ReadKernelBinary`.
2871 *
2872 * The VM will take ownership of the `kernel_program` object.
2870 * 2873 *
2871 * \return If no error occurs, the Library object corresponding to the root 2874 * \return If no error occurs, the Library object corresponding to the root
2872 * script is returned. Otherwise an error handle is returned. 2875 * script is returned. Otherwise an error handle is returned.
2873 */ 2876 */
2874 DART_EXPORT Dart_Handle Dart_LoadKernel(const uint8_t* buffer, 2877 DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program);
2878
2879
2880 /**
2881 * Constructs an in-memory kernel program form a binary.
2882 *
2883 * \param buffer The start of a memory buffer containing the binary format.
2884 * \param buffer_len The length of the memory buffer.
2885 *
2886 * \return kernel_program The `dart::kernel::Program` object.
2887 */
2888 DART_EXPORT void* Dart_ReadKernelBinary(const uint8_t* buffer,
2875 intptr_t buffer_len); 2889 intptr_t buffer_len);
2876 2890
2877 /** 2891 /**
2878 * Gets the library for the root script for the current isolate. 2892 * Gets the library for the root script for the current isolate.
2879 * 2893 *
2880 * If the root script has not yet been set for the current isolate, 2894 * If the root script has not yet been set for the current isolate,
2881 * this function returns Dart_Null(). This function never returns an 2895 * this function returns Dart_Null(). This function never returns an
2882 * error handle. 2896 * error handle.
2883 * 2897 *
2884 * \return Returns the root Library for the current isolate or Dart_Null(). 2898 * \return Returns the root Library for the current isolate or Dart_Null().
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 3275
3262 3276
3263 /** 3277 /**
3264 * Returns whether the VM only supports running from precompiled snapshots and 3278 * Returns whether the VM only supports running from precompiled snapshots and
3265 * not from any other kind of snapshot or from source (that is, the VM was 3279 * not from any other kind of snapshot or from source (that is, the VM was
3266 * compiled with DART_PRECOMPILED_RUNTIME). 3280 * compiled with DART_PRECOMPILED_RUNTIME).
3267 */ 3281 */
3268 DART_EXPORT bool Dart_IsPrecompiledRuntime(); 3282 DART_EXPORT bool Dart_IsPrecompiledRuntime();
3269 3283
3270 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 3284 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/bootstrap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698