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

Unified Diff: runtime/include/dart_api.h

Issue 2223463003: Switch Dart_Initialize to use a struct (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: More typos Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/include/dart_api.h
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 627e80f6baaa12153cbe26e7b896dda61db11fcf..25d86110d5bf3aabeee1e076e70eb1495ff5c073 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -784,41 +784,54 @@ typedef bool (*Dart_EntropySource)(uint8_t* buffer, intptr_t length);
typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)();
/**
- * Initializes the VM.
+ * The current version of the Dart_InitializeFlags. Should be incremented every
+ * time Dart_InitializeFlags changes in a binary incompatible way.
+ */
+#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000001)
+
+/**
+ * Describes how to initialize the VM. Used with Dart_Initialize.
*
+ * \param version Identifies the version of the struct used by the client.
+ * should be initialized to DART_INITIALIZE_PARAMS_CURRENT_VERSION.
* \param vm_isolate_snapshot A buffer containing a snapshot of the VM isolate
* or NULL if no snapshot is provided.
* \param instructions_snapshot A buffer containing a snapshot of precompiled
* instructions, or NULL if no snapshot is provided.
* \param create A function to be called during isolate creation.
* See Dart_IsolateCreateCallback.
- * \param interrupt This parameter has been DEPRECATED.
- * \param unhandled_exception This parameter has been DEPRECATED.
* \param shutdown A function to be called when an isolate is shutdown.
* See Dart_IsolateShutdownCallback.
- *
* \param get_service_assets A function to be called by the service isolate when
* it requires the vmservice assets archive.
* See Dart_GetVMServiceAssetsArchive.
+ */
+typedef struct {
+ int32_t version;
+ const uint8_t* vm_isolate_snapshot;
+ const uint8_t* instructions_snapshot;
+ const uint8_t* data_snapshot;
+ Dart_IsolateCreateCallback create;
+ Dart_IsolateShutdownCallback shutdown;
+ Dart_ThreadExitCallback thread_exit;
+ Dart_FileOpenCallback file_open;
+ Dart_FileReadCallback file_read;
+ Dart_FileWriteCallback file_write;
+ Dart_FileCloseCallback file_close;
+ Dart_EntropySource entropy_source;
+ Dart_GetVMServiceAssetsArchive get_service_assets;
+} Dart_InitializeParams;
+
+/**
+ * Initializes the VM.
+ *
+ * \param flags A struct containing initialization information. The version
+ * field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION.
*
* \return NULL if initialization is successful. Returns an error message
* otherwise. The caller is responsible for freeing the error message.
*/
-DART_EXPORT char* Dart_Initialize(
- const uint8_t* vm_isolate_snapshot,
- const uint8_t* instructions_snapshot,
- const uint8_t* data_snapshot,
- Dart_IsolateCreateCallback create,
- Dart_IsolateInterruptCallback interrupt,
- Dart_IsolateUnhandledExceptionCallback unhandled_exception,
- Dart_IsolateShutdownCallback shutdown,
- Dart_ThreadExitCallback thread_exit,
- Dart_FileOpenCallback file_open,
- Dart_FileReadCallback file_read,
- Dart_FileWriteCallback file_write,
- Dart_FileCloseCallback file_close,
- Dart_EntropySource entropy_source,
- Dart_GetVMServiceAssetsArchive get_service_assets);
+DART_EXPORT char* Dart_Initialize(Dart_InitializeParams* params);
/**
* Cleanup state in the VM before process termination.
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698