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

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

Issue 125103004: Move service into VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/tools/create_resources.py » ('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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 * C string containing an error message in the case of failures. 654 * C string containing an error message in the case of failures.
655 * 655 *
656 * \return The embedder returns NULL if the creation and 656 * \return The embedder returns NULL if the creation and
657 * initialization was not successful and the isolate if successful. 657 * initialization was not successful and the isolate if successful.
658 */ 658 */
659 typedef Dart_Isolate (*Dart_IsolateCreateCallback)(const char* script_uri, 659 typedef Dart_Isolate (*Dart_IsolateCreateCallback)(const char* script_uri,
660 const char* main, 660 const char* main,
661 void* callback_data, 661 void* callback_data,
662 char** error); 662 char** error);
663 663
664
665 /**
666 * The service isolate creation and initialization callback function.
667 *
668 * This callback, provided by the embedder, is called when the vm
669 * needs to create the service isolate. The callback should create an isolate
670 * by calling Dart_CreateIsolate and prepare the isolate to be used as
671 * the service isolate.
672 *
673 * When the function returns NULL, it is the responsibility of this
674 * function to ensure that Dart_ShutdownIsolate has been called if
675 * required.
676 *
677 * When the function returns NULL, the function should set *error to
678 * a malloc-allocated buffer containing a useful error message. The
679 * caller of this function (the vm) will make sure that the buffer is
680 * freed.
681 *
682 *
683 * \param error A structure into which the embedder can place a
684 * C string containing an error message in the case of failures.
685 *
686 * \return The embedder returns NULL if the creation and
687 * initialization was not successful and the isolate if successful.
688 */
689 typedef Dart_Isolate (*Dart_ServiceIsolateCreateCalback)(void* callback_data,
690 char** error);
691
664 /** 692 /**
665 * An isolate interrupt callback function. 693 * An isolate interrupt callback function.
666 * 694 *
667 * This callback, provided by the embedder, is called when an isolate 695 * This callback, provided by the embedder, is called when an isolate
668 * is interrupted as a result of a call to Dart_InterruptIsolate(). 696 * is interrupted as a result of a call to Dart_InterruptIsolate().
669 * When the callback is called, Dart_CurrentIsolate can be used to 697 * When the callback is called, Dart_CurrentIsolate can be used to
670 * figure out which isolate is being interrupted. 698 * figure out which isolate is being interrupted.
671 * 699 *
672 * \return The embedder returns true if the isolate should continue 700 * \return The embedder returns true if the isolate should continue
673 * execution. If the embedder returns false, the isolate will be 701 * execution. If the embedder returns false, the isolate will be
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 */ 790 */
763 DART_EXPORT bool Dart_Initialize( 791 DART_EXPORT bool Dart_Initialize(
764 Dart_IsolateCreateCallback create, 792 Dart_IsolateCreateCallback create,
765 Dart_IsolateInterruptCallback interrupt, 793 Dart_IsolateInterruptCallback interrupt,
766 Dart_IsolateUnhandledExceptionCallback unhandled_exception, 794 Dart_IsolateUnhandledExceptionCallback unhandled_exception,
767 Dart_IsolateShutdownCallback shutdown, 795 Dart_IsolateShutdownCallback shutdown,
768 Dart_FileOpenCallback file_open, 796 Dart_FileOpenCallback file_open,
769 Dart_FileReadCallback file_read, 797 Dart_FileReadCallback file_read,
770 Dart_FileWriteCallback file_write, 798 Dart_FileWriteCallback file_write,
771 Dart_FileCloseCallback file_close, 799 Dart_FileCloseCallback file_close,
772 Dart_EntropySource entropy_source); 800 Dart_EntropySource entropy_source,
801 Dart_ServiceIsolateCreateCalback service_create);
773 802
774 /** 803 /**
775 * Cleanup state in the VM before process termination. 804 * Cleanup state in the VM before process termination.
776 * 805 *
777 * \return True if cleanup is successful. 806 * \return True if cleanup is successful.
778 */ 807 */
779 DART_EXPORT bool Dart_Cleanup(); 808 DART_EXPORT bool Dart_Cleanup();
780 809
781 /** 810 /**
782 * Sets command line flags. Should be called before Dart_Initialize. 811 * Sets command line flags. Should be called before Dart_Initialize.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id); 1087 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id);
1059 1088
1060 /** 1089 /**
1061 * Gets the ReceivePort for the provided port id, creating it if necessary. 1090 * Gets the ReceivePort for the provided port id, creating it if necessary.
1062 * 1091 *
1063 * Note that there is at most one ReceivePort for a given port id. 1092 * Note that there is at most one ReceivePort for a given port id.
1064 */ 1093 */
1065 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id); 1094 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id);
1066 1095
1067 1096
1097 /**
1098 * Posts an object to the send port.
1099 *
1100 * \param send_port A Dart SendPort.
1101 * \param object An object from the current isolate.
1102 *
1103 * \return Success if no error occurs. Otherwise returns an error handle.
1104 */
1105 DART_EXPORT Dart_Handle Dart_PostMessage(Dart_Handle send_port,
1106 Dart_Handle object);
1107
1068 /* 1108 /*
1069 * ====== 1109 * ======
1070 * Scopes 1110 * Scopes
1071 * ====== 1111 * ======
1072 */ 1112 */
1073 1113
1074 /** 1114 /**
1075 * Enters a new scope. 1115 * Enters a new scope.
1076 * 1116 *
1077 * All new local handles will be created in this scope. Additionally, 1117 * All new local handles will be created in this scope. Additionally,
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 * 'peer'. 2426 * 'peer'.
2387 * 2427 *
2388 * \param object An object. 2428 * \param object An object.
2389 * \param peer A value to store in the peer field. 2429 * \param peer A value to store in the peer field.
2390 * 2430 *
2391 * \return Returns an error if 'object' is a subtype of Null, num, or 2431 * \return Returns an error if 'object' is a subtype of Null, num, or
2392 * bool. 2432 * bool.
2393 */ 2433 */
2394 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2434 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2395 2435
2436
2437 /*
2438 * =======
2439 * Service
2440 * =======
2441 */
2442
2443 /**
2444 * Returns the Service isolate initialized and with the dart:vmservice library
2445 * loaded and booted.
2446 *
2447 * This will call the embedder provided Dart_ServiceIsolateCreateCalback to
2448 * create the isolate.
2449 *
2450 * After obtaining the service isolate the embedder specific glue code can
2451 * be loaded in and the isolate can be run by the embedder.
2452 *
2453 * NOTE: It is not safe to call this from multiple threads concurrently.
2454 *
2455 * \return Returns NULL if an error occurred.
2456 */
2457 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data);
2458
2459
2396 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2460 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/tools/create_resources.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698