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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/dart_api_impl.cc » ('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 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 * archive that is stored in a Uint8List. 777 * archive that is stored in a Uint8List.
778 * 778 *
779 * If the embedder has no vmservice isolate assets, the callback can be NULL. 779 * If the embedder has no vmservice isolate assets, the callback can be NULL.
780 * 780 *
781 * \return The embedder must return a handle to a Uint8List containing an 781 * \return The embedder must return a handle to a Uint8List containing an
782 * uncompressed tar archive or null. 782 * uncompressed tar archive or null.
783 */ 783 */
784 typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(); 784 typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)();
785 785
786 /** 786 /**
787 * Initializes the VM. 787 * The current version of the Dart_InitializeFlags. Should be incremented every
788 * time Dart_InitializeFlags changes in a binary incompatible way.
789 */
790 #define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000001)
791
792 /**
793 * Describes how to initialize the VM. Used with Dart_Initialize.
788 * 794 *
795 * \param version Identifies the version of the struct used by the client.
796 * should be initialized to DART_INITIALIZE_PARAMS_CURRENT_VERSION.
789 * \param vm_isolate_snapshot A buffer containing a snapshot of the VM isolate 797 * \param vm_isolate_snapshot A buffer containing a snapshot of the VM isolate
790 * or NULL if no snapshot is provided. 798 * or NULL if no snapshot is provided.
791 * \param instructions_snapshot A buffer containing a snapshot of precompiled 799 * \param instructions_snapshot A buffer containing a snapshot of precompiled
792 * instructions, or NULL if no snapshot is provided. 800 * instructions, or NULL if no snapshot is provided.
793 * \param create A function to be called during isolate creation. 801 * \param create A function to be called during isolate creation.
794 * See Dart_IsolateCreateCallback. 802 * See Dart_IsolateCreateCallback.
795 * \param interrupt This parameter has been DEPRECATED.
796 * \param unhandled_exception This parameter has been DEPRECATED.
797 * \param shutdown A function to be called when an isolate is shutdown. 803 * \param shutdown A function to be called when an isolate is shutdown.
798 * See Dart_IsolateShutdownCallback. 804 * See Dart_IsolateShutdownCallback.
799 *
800 * \param get_service_assets A function to be called by the service isolate when 805 * \param get_service_assets A function to be called by the service isolate when
801 * it requires the vmservice assets archive. 806 * it requires the vmservice assets archive.
802 * See Dart_GetVMServiceAssetsArchive. 807 * See Dart_GetVMServiceAssetsArchive.
808 */
809 typedef struct {
810 int32_t version;
811 const uint8_t* vm_isolate_snapshot;
812 const uint8_t* instructions_snapshot;
813 const uint8_t* data_snapshot;
814 Dart_IsolateCreateCallback create;
815 Dart_IsolateShutdownCallback shutdown;
816 Dart_ThreadExitCallback thread_exit;
817 Dart_FileOpenCallback file_open;
818 Dart_FileReadCallback file_read;
819 Dart_FileWriteCallback file_write;
820 Dart_FileCloseCallback file_close;
821 Dart_EntropySource entropy_source;
822 Dart_GetVMServiceAssetsArchive get_service_assets;
823 } Dart_InitializeParams;
824
825 /**
826 * Initializes the VM.
827 *
828 * \param flags A struct containing initialization information. The version
829 * field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION.
803 * 830 *
804 * \return NULL if initialization is successful. Returns an error message 831 * \return NULL if initialization is successful. Returns an error message
805 * otherwise. The caller is responsible for freeing the error message. 832 * otherwise. The caller is responsible for freeing the error message.
806 */ 833 */
807 DART_EXPORT char* Dart_Initialize( 834 DART_EXPORT char* Dart_Initialize(Dart_InitializeParams* params);
808 const uint8_t* vm_isolate_snapshot,
809 const uint8_t* instructions_snapshot,
810 const uint8_t* data_snapshot,
811 Dart_IsolateCreateCallback create,
812 Dart_IsolateInterruptCallback interrupt,
813 Dart_IsolateUnhandledExceptionCallback unhandled_exception,
814 Dart_IsolateShutdownCallback shutdown,
815 Dart_ThreadExitCallback thread_exit,
816 Dart_FileOpenCallback file_open,
817 Dart_FileReadCallback file_read,
818 Dart_FileWriteCallback file_write,
819 Dart_FileCloseCallback file_close,
820 Dart_EntropySource entropy_source,
821 Dart_GetVMServiceAssetsArchive get_service_assets);
822 835
823 /** 836 /**
824 * Cleanup state in the VM before process termination. 837 * Cleanup state in the VM before process termination.
825 * 838 *
826 * \return NULL if cleanup is successful. Returns an error message otherwise. 839 * \return NULL if cleanup is successful. Returns an error message otherwise.
827 * The caller is responsible for freeing the error message. 840 * The caller is responsible for freeing the error message.
828 */ 841 */
829 DART_EXPORT char* Dart_Cleanup(); 842 DART_EXPORT char* Dart_Cleanup();
830 843
831 /** 844 /**
(...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 /** 3174 /**
3162 * Returns whether the VM was initialized with a precompiled snapshot. Only 3175 * Returns whether the VM was initialized with a precompiled snapshot. Only
3163 * valid after Dart_Initialize. 3176 * valid after Dart_Initialize.
3164 * DEPRECATED. This is currently used to disable Platform.executable and 3177 * DEPRECATED. This is currently used to disable Platform.executable and
3165 * Platform.resolvedExecutable under precompilation to prevent process 3178 * Platform.resolvedExecutable under precompilation to prevent process
3166 * spawning tests from becoming fork-bombs. 3179 * spawning tests from becoming fork-bombs.
3167 */ 3180 */
3168 DART_EXPORT bool Dart_IsRunningPrecompiledCode(); 3181 DART_EXPORT bool Dart_IsRunningPrecompiledCode();
3169 3182
3170 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 3183 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« 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