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

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: 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
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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 * 2835 *
2835 * \return If no error occurs, the Library object corresponding to the root 2836 * \return If no error occurs, the Library object corresponding to the root
2836 * script is returned. Otherwise an error handle is returned. 2837 * script is returned. Otherwise an error handle is returned.
2837 */ 2838 */
2838 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, 2839 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
2839 intptr_t buffer_len); 2840 intptr_t buffer_len);
2840 2841
2841 /** 2842 /**
2842 * Loads a dart application which was compiled to a Kernel binary. 2843 * Loads a dart application which was compiled to a Kernel binary.
2843 * 2844 *
2844 * \param buffer A buffer which contains a Kernel binary. 2845 * \param kernel_program The `dart::kernel::Program` object returned by .
Kevin Millikin (Google) 2016/11/22 15:51:17 Missing the name of the function that returns the
kustermann 2016/11/23 08:31:46 Done.
2845 * \param buffer_len Length of the passed in buffer. 2846 *
2847 * The VM will take ownership of the `kernel_program` object.
2846 * 2848 *
2847 * \return If no error occurs, the Library object corresponding to the root 2849 * \return If no error occurs, the Library object corresponding to the root
2848 * script is returned. Otherwise an error handle is returned. 2850 * script is returned. Otherwise an error handle is returned.
2849 */ 2851 */
2850 DART_EXPORT Dart_Handle Dart_LoadKernel(const uint8_t* buffer, 2852 DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program);
2851 intptr_t buffer_len); 2853
2854
2855 /**
2856 * Lonstructs a kernel program form a binary.
Kevin Millikin (Google) 2016/11/22 15:51:17 Lonstructs == Load + constructs?
kustermann 2016/11/23 08:31:46 Precisely! Done
2857 *
2858 * \param buffer The start of a memory buffer containing the binary format.
2859 * \param buffer_len The length of the memory buffer.
2860 *
2861 * \return kernel_program The `dart::kernel::Program` object.
2862 */
2863 DART_EXPORT void* Dart_ParseKernelBinary(const uint8_t* buffer,
Kevin Millikin (Google) 2016/11/22 15:51:17 I don't think of this as parsing. Deserializing,
kustermann 2016/11/23 08:31:46 Then I'll go with ReadKernelBinary ("load" is alre
2864 intptr_t buffer_len);
2852 2865
2853 /** 2866 /**
2854 * Gets the library for the root script for the current isolate. 2867 * Gets the library for the root script for the current isolate.
2855 * 2868 *
2856 * If the root script has not yet been set for the current isolate, 2869 * If the root script has not yet been set for the current isolate,
2857 * this function returns Dart_Null(). This function never returns an 2870 * this function returns Dart_Null(). This function never returns an
2858 * error handle. 2871 * error handle.
2859 * 2872 *
2860 * \return Returns the root Library for the current isolate or Dart_Null(). 2873 * \return Returns the root Library for the current isolate or Dart_Null().
2861 */ 2874 */
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 3243
3231 3244
3232 /** 3245 /**
3233 * Returns whether the VM only supports running from precompiled snapshots and 3246 * Returns whether the VM only supports running from precompiled snapshots and
3234 * not from any other kind of snapshot or from source (that is, the VM was 3247 * not from any other kind of snapshot or from source (that is, the VM was
3235 * compiled with DART_PRECOMPILED_RUNTIME). 3248 * compiled with DART_PRECOMPILED_RUNTIME).
3236 */ 3249 */
3237 DART_EXPORT bool Dart_IsPrecompiledRuntime(); 3250 DART_EXPORT bool Dart_IsPrecompiledRuntime();
3238 3251
3239 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 3252 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698