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

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

Issue 1140263005: Revert "Hide Isolate pointer from embedder" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/vmservice_impl.cc ('k') | runtime/include/dart_debugger_api.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 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #else 58 #else
59 #define DART_EXPORT DART_EXTERN_C 59 #define DART_EXPORT DART_EXTERN_C
60 #endif 60 #endif
61 #else 61 #else
62 #error Tool chain not supported. 62 #error Tool chain not supported.
63 #endif 63 #endif
64 #endif 64 #endif
65 65
66 #include <assert.h> 66 #include <assert.h>
67 67
68
69 /* 68 /*
70 * ======== 69 * =======
71 * Isolates 70 * Handles
72 * ======== 71 * =======
73 */ 72 */
74 73
75 /** 74 /**
76 * A port is used to send or receive inter-isolate messages. It is also used
77 * to identify an isolate (see Dart_Isolate).
78 */
79 typedef int64_t Dart_Port;
80
81
82 /**
83 * An isolate is the unit of concurrency in Dart. Each isolate has 75 * An isolate is the unit of concurrency in Dart. Each isolate has
84 * its own memory and thread of control. No state is shared between 76 * its own memory and thread of control. No state is shared between
85 * isolates. Instead, isolates communicate by message passing. 77 * isolates. Instead, isolates communicate by message passing.
86 * 78 *
87 * Each thread keeps track of its current isolate, which is the 79 * Each thread keeps track of its current isolate, which is the
88 * isolate which is ready to execute on the current thread. The 80 * isolate which is ready to execute on the current thread. The
89 * current isolate may be DART_ILLEGAL_ISOLATE, in which case no isolate is 81 * current isolate may be NULL, in which case no isolate is ready to
90 * ready to execute. Most of the Dart apis require there to be a current 82 * execute. Most of the Dart apis require there to be a current
91 * isolate in order to function without error. The current isolate is 83 * isolate in order to function without error. The current isolate is
92 * set by any call to Dart_CreateIsolate or Dart_EnterIsolate. 84 * set by any call to Dart_CreateIsolate or Dart_EnterIsolate.
93 */ 85 */
94 typedef Dart_Port Dart_Isolate; 86 typedef struct _Dart_Isolate* Dart_Isolate;
95
96 /**
97 * DART_ILLEGAL_ISOLATE is an isolate id that is guaranteed never to be associa ted
98 * with a valid isolate.
99 */
100 #define DART_ILLEGAL_ISOLATE ((Dart_Isolate) 0)
101
102 /*
103 * =======
104 * Handles
105 * =======
106 */
107 87
108 /** 88 /**
109 * An object reference managed by the Dart VM garbage collector. 89 * An object reference managed by the Dart VM garbage collector.
110 * 90 *
111 * Because the garbage collector may move objects, it is unsafe to 91 * Because the garbage collector may move objects, it is unsafe to
112 * refer to objects directly. Instead, we refer to objects through 92 * refer to objects directly. Instead, we refer to objects through
113 * handles, which are known to the garbage collector and updated 93 * handles, which are known to the garbage collector and updated
114 * automatically when the object is moved. Handles should be passed 94 * automatically when the object is moved. Handles should be passed
115 * by value (except in cases like out-parameters) and should never be 95 * by value (except in cases like out-parameters) and should never be
116 * allocated on the heap. 96 * allocated on the heap.
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 * Returns the callback data associated with the current Isolate. This data was 930 * Returns the callback data associated with the current Isolate. This data was
951 * passed to the isolate when it was created. 931 * passed to the isolate when it was created.
952 */ 932 */
953 DART_EXPORT void* Dart_CurrentIsolateData(); 933 DART_EXPORT void* Dart_CurrentIsolateData();
954 934
955 /** 935 /**
956 * Returns the callback data associated with the specified Isolate. This data 936 * Returns the callback data associated with the specified Isolate. This data
957 * was passed to the isolate when it was created. 937 * was passed to the isolate when it was created.
958 * The embedder is responsible for ensuring the consistency of this data 938 * The embedder is responsible for ensuring the consistency of this data
959 * with respect to the lifecycle of an Isolate. 939 * with respect to the lifecycle of an Isolate.
960 *
961 * \return pointer to data or NULL if the isolate could not be found.
962 */ 940 */
963 DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate); 941 DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate);
964 942
965 /** 943 /**
966 * Returns the debugging name for the current isolate. 944 * Returns the debugging name for the current isolate.
967 * 945 *
968 * This name is unique to each isolate and should only be used to make 946 * This name is unique to each isolate and should only be used to make
969 * debugging messages more comprehensible. 947 * debugging messages more comprehensible.
970 */ 948 */
971 DART_EXPORT Dart_Handle Dart_DebugName(); 949 DART_EXPORT Dart_Handle Dart_DebugName();
972 950
973 /** 951 /**
974 * Enters an isolate. After calling this function, 952 * Enters an isolate. After calling this function,
975 * the current isolate will be set to the provided isolate. 953 * the current isolate will be set to the provided isolate.
976 * 954 *
977 * Requires there to be no current isolate. Multiple threads may not be in 955 * Requires there to be no current isolate. Multiple threads may not be in
978 * the same isolate at once. 956 * the same isolate at once.
979 *
980 * \return true if isolate was entered, false otherwise.
981 */ 957 */
982 DART_EXPORT bool Dart_EnterIsolate(Dart_Isolate isolate); 958 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
983 959
984 /** 960 /**
985 * Notifies the VM that the current isolate is about to make a blocking call. 961 * Notifies the VM that the current isolate is about to make a blocking call.
986 */ 962 */
987 DART_EXPORT void Dart_IsolateBlocked(); 963 DART_EXPORT void Dart_IsolateBlocked();
988 964
989 /** 965 /**
990 * Notifies the VM that the current isolate is no longer blocked. 966 * Notifies the VM that the current isolate is no longer blocked.
991 */ 967 */
992 DART_EXPORT void Dart_IsolateUnblocked(); 968 DART_EXPORT void Dart_IsolateUnblocked();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 intptr_t* size); 1033 intptr_t* size);
1058 1034
1059 /** 1035 /**
1060 * Schedules an interrupt for the specified isolate. 1036 * Schedules an interrupt for the specified isolate.
1061 * 1037 *
1062 * When the isolate is interrupted, the isolate interrupt callback 1038 * When the isolate is interrupted, the isolate interrupt callback
1063 * will be invoked with 'isolate' as the current isolate (see 1039 * will be invoked with 'isolate' as the current isolate (see
1064 * Dart_IsolateInterruptCallback). 1040 * Dart_IsolateInterruptCallback).
1065 * 1041 *
1066 * \param isolate The isolate to be interrupted. 1042 * \param isolate The isolate to be interrupted.
1067 *
1068 * \return true if isolate is scheduled to be be interrupted, false otherwise.
1069 */ 1043 */
1070 DART_EXPORT bool Dart_InterruptIsolate(Dart_Isolate isolate); 1044 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate);
1071 1045
1072 /** 1046 /**
1073 * Make isolate runnable. 1047 * Make isolate runnable.
1074 * 1048 *
1075 * When isolates are spawned this function is used to indicate that 1049 * When isolates are spawned this function is used to indicate that
1076 * the creation and initialization (including script loading) of the 1050 * the creation and initialization (including script loading) of the
1077 * isolate is complete and the isolate can start. 1051 * isolate is complete and the isolate can start.
1078 * This function does not expect there to be a current isolate. 1052 * This function does not expect there to be a current isolate.
1079 * 1053 *
1080 * \param isolate The isolate to be made runnable. 1054 * \param isolate The isolate to be made runnable.
1081 *
1082 * \return true if isolate was made runnable, false otherwise.
1083 */ 1055 */
1084 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate); 1056 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate);
1085 1057
1086 1058
1087 /* 1059 /*
1088 * ================== 1060 * ==================
1089 * Messages and Ports 1061 * Messages and Ports
1090 * ================== 1062 * ==================
1091 */ 1063 */
1092 1064
1093 /** 1065 /**
1094 * DART_ILLEGAL_PORT is a port number guaranteed never to be associated with a 1066 * A port is used to send or receive inter-isolate messages
1095 * valid port.
1096 */ 1067 */
1097 #define DART_ILLEGAL_PORT ((Dart_Port) 0) 1068 typedef int64_t Dart_Port;
1069
1070 /**
1071 * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid
1072 * port.
1073 */
1074 #define ILLEGAL_PORT ((Dart_Port) 0)
1098 1075
1099 /** 1076 /**
1100 * A message notification callback. 1077 * A message notification callback.
1101 * 1078 *
1102 * This callback allows the embedder to provide an alternate wakeup 1079 * This callback allows the embedder to provide an alternate wakeup
1103 * mechanism for the delivery of inter-isolate messages. It is the 1080 * mechanism for the delivery of inter-isolate messages. It is the
1104 * responsibility of the embedder to call Dart_HandleMessage to 1081 * responsibility of the embedder to call Dart_HandleMessage to
1105 * process the message. 1082 * process the message.
1106 */ 1083 */
1107 typedef void (*Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate); 1084 typedef void (*Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate);
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 * \param isolate An isolate 2779 * \param isolate An isolate
2803 * 2780 *
2804 * \return Returns true if 'isolate' is the service isolate. 2781 * \return Returns true if 'isolate' is the service isolate.
2805 */ 2782 */
2806 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate); 2783 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate);
2807 2784
2808 2785
2809 /** 2786 /**
2810 * Returns the port that script load requests should be sent on. 2787 * Returns the port that script load requests should be sent on.
2811 * 2788 *
2812 * \return Returns the port for load requests or DART_ILLEGAL_PORT if the 2789 * \return Returns the port for load requests or ILLEGAL_PORT if the service
2813 * service isolate failed to startup or does not support load requests. 2790 * isolate failed to startup or does not support load requests.
2814 */ 2791 */
2815 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); 2792 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort();
2816 2793
2817 2794
2818 /** 2795 /**
2819 * A service request callback function. 2796 * A service request callback function.
2820 * 2797 *
2821 * These callbacks, registered by the embedder, are called when the VM receives 2798 * These callbacks, registered by the embedder, are called when the VM receives
2822 * a service request it can't handle and the service request command name 2799 * a service request it can't handle and the service request command name
2823 * matches one of the embedder registered handlers. 2800 * matches one of the embedder registered handlers.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 * NOTE: If multiple callbacks with the same name are registered, only the 2844 * NOTE: If multiple callbacks with the same name are registered, only the
2868 * last callback registered will be remembered. 2845 * last callback registered will be remembered.
2869 */ 2846 */
2870 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 2847 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
2871 const char* name, 2848 const char* name,
2872 Dart_ServiceRequestCallback callback, 2849 Dart_ServiceRequestCallback callback,
2873 void* user_data); 2850 void* user_data);
2874 2851
2875 2852
2876 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2853 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698