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

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

Issue 8380020: Refactor the dart api a bit: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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/socket.cc ('k') | runtime/vm/dart_api_impl.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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef INCLUDE_DART_API_H_ 5 #ifndef INCLUDE_DART_API_H_
6 #define INCLUDE_DART_API_H_ 6 #define INCLUDE_DART_API_H_
7 7
8 #ifdef __cplusplus 8 #ifdef __cplusplus
9 #define DART_EXTERN_C extern "C" 9 #define DART_EXTERN_C extern "C"
10 #else 10 #else
(...skipping 27 matching lines...) Expand all
38 #else 38 #else
39 #error Tool chain not supported. 39 #error Tool chain not supported.
40 #endif 40 #endif
41 #endif 41 #endif
42 42
43 #include <assert.h> 43 #include <assert.h>
44 44
45 typedef void* Dart_Isolate; 45 typedef void* Dart_Isolate;
46 typedef void* Dart_Handle; 46 typedef void* Dart_Handle;
47 typedef void* Dart_NativeArguments; 47 typedef void* Dart_NativeArguments;
48 typedef enum {
49 kRetCIntptr = 0,
50 kRetCBool,
51 kRetCString,
52 kRetObject,
53 kRetCInt64,
54 kRetCDouble,
55 kRetLibSpec,
56 } Dart_ReturnType;
57
58 typedef struct {
59 Dart_ReturnType type_;
60 union {
61 intptr_t int_value;
62 bool bool_value;
63 const char* str_value;
64 Dart_Handle obj_value;
65 int64_t int64_value;
66 double double_value;
67 } retval_;
68 } Dart_Result;
69 48
70 typedef enum { 49 typedef enum {
71 kLibraryTag = 0, 50 kLibraryTag = 0,
72 kImportTag, 51 kImportTag,
73 kSourceTag, 52 kSourceTag,
74 kCanonicalizeUrl, 53 kCanonicalizeUrl,
75 } Dart_LibraryTag; 54 } Dart_LibraryTag;
76 55
77 typedef void Dart_Snapshot; 56 typedef void Dart_Snapshot;
78 57
79 typedef int64_t Dart_Port; 58 typedef int64_t Dart_Port;
80 typedef void* Dart_Message; 59 typedef void* Dart_Message;
81 60
82 // Allow the embedder to intercept isolate creation. Both at startup 61 // Allow the embedder to intercept isolate creation. Both at startup
83 // and when spawning new isolates from Dart code. The result returned 62 // and when spawning new isolates from Dart code. The result returned
84 // from this callback is handed to all isolates spawned from the 63 // from this callback is handed to all isolates spawned from the
85 // isolate currently being initialized. 64 // isolate currently being initialized.
86 // 65 //
87 // Return NULL if an error is encountered. The isolate being 66 // Return NULL if an error is encountered. The isolate being
88 // initialized will be shutdown. No Dart code will execute before it 67 // initialized will be shutdown. No Dart code will execute before it
89 // is shutdown. 68 // is shutdown.
90 // 69 //
91 // TODO(iposva): Pass a specification of the app file being spawned. 70 // TODO(iposva): Pass a specification of the app file being spawned.
92 typedef void* (*Dart_IsolateInitCallback)(void* data); 71 typedef void* (*Dart_IsolateInitCallback)(void* data);
93 72
94 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); 73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments);
95 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, 74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name,
96 int num_of_arguments); 75 int num_of_arguments);
97 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, 76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag,
98 Dart_Handle library, 77 Dart_Handle library,
99 Dart_Handle url); 78 Dart_Handle url);
100 79
101 // TODO(iposva): This is a placeholder for the eventual external Dart API. 80 // TODO(iposva): This is a placeholder for the eventual external Dart API.
102 81
103 // Return value handling after a Dart API call. 82 // Return value handling after a Dart API call.
104 DART_EXPORT bool Dart_IsValidResult(const Dart_Result& result); 83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& result);
105 84
106 inline intptr_t Dart_GetResultAsCIntptr(const Dart_Result& result) { 85 DART_EXPORT const char* Dart_GetError(const Dart_Handle& result);
107 assert(result.type_ == kRetCIntptr); // Valid to access result as C int. 86 DART_EXPORT Dart_Handle Dart_Error(const char* value);
108 return result.retval_.int_value;
109 }
110 inline Dart_Result Dart_ResultAsCIntptr(intptr_t value) {
111 Dart_Result result;
112 result.type_ = kRetCIntptr;
113 result.retval_.int_value = value;
114 return result;
115 }
116 inline bool Dart_GetResultAsCBoolean(const Dart_Result& result) {
117 assert(result.type_ == kRetCBool); // Valid to access result as C bool.
118 return result.retval_.bool_value;
119 }
120 inline Dart_Result Dart_ResultAsCBoolean(bool value) {
121 Dart_Result result;
122 result.type_ = kRetCBool;
123 result.retval_.bool_value = value;
124 return result;
125 }
126 inline const char* Dart_GetResultAsCString(const Dart_Result& result) {
127 assert(result.type_ == kRetCString); // Valid to access result as C string.
128 return result.retval_.str_value;
129 }
130 inline Dart_Result Dart_ResultAsCString(const char* value) {
131 // Assumes passed in string value will be available on return.
132 Dart_Result result;
133 result.type_ = kRetCString;
134 result.retval_.str_value = value;
135 return result;
136 }
137 inline Dart_Handle Dart_GetResult(const Dart_Result& result) {
138 assert(result.type_ == kRetObject); // Valid to access result as Dart obj.
139 return result.retval_.obj_value;
140 }
141 inline Dart_Result Dart_ResultAsObject(Dart_Handle value) {
142 Dart_Result result;
143 result.type_ = kRetObject;
144 result.retval_.obj_value = value;
145 return result;
146 }
147 inline int64_t Dart_GetResultAsCInt64(const Dart_Result& result) {
148 assert(result.type_ == kRetCInt64); // Valid to access result as C int64_t.
149 return result.retval_.int64_value;
150 }
151 inline Dart_Result Dart_ResultAsCInt64(int64_t value) {
152 Dart_Result result;
153 result.type_ = kRetCInt64;
154 result.retval_.int64_value = value;
155 return result;
156 }
157 inline double Dart_GetResultAsCDouble(const Dart_Result& result) {
158 assert(result.type_ == kRetCDouble); // Valid to access result as C double.
159 return result.retval_.double_value;
160 }
161 inline Dart_Result Dart_ResultAsCDouble(double value) {
162 Dart_Result result;
163 result.type_ = kRetCDouble;
164 result.retval_.double_value = value;
165 return result;
166 }
167 DART_EXPORT const char* Dart_GetErrorCString(const Dart_Result& result);
168 DART_EXPORT Dart_Result Dart_ErrorResult(const char* value);
169 87
170 88
171 // Initialize the VM with commmand line flags. 89 // Initialize the VM with commmand line flags.
172 DART_EXPORT bool Dart_Initialize(int argc, char** argv, 90 DART_EXPORT bool Dart_Initialize(int argc, char** argv,
173 Dart_IsolateInitCallback callback); 91 Dart_IsolateInitCallback callback);
174 92
175 93
176 // Isolate handling. 94 // Isolate handling.
177 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, 95 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot,
178 void* data); 96 void* data);
179 DART_EXPORT void Dart_ShutdownIsolate(); 97 DART_EXPORT void Dart_ShutdownIsolate();
180 98
181 DART_EXPORT Dart_Isolate Dart_CurrentIsolate(); 99 DART_EXPORT Dart_Isolate Dart_CurrentIsolate();
182 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate); 100 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
183 DART_EXPORT void Dart_ExitIsolate(); 101 DART_EXPORT void Dart_ExitIsolate();
184 102
185 // A convenience routine which processes any incoming messages for the 103 // A convenience routine which processes any incoming messages for the
186 // current isolate. The routine exits when all ports to the current 104 // current isolate. The routine exits when all ports to the current
187 // isolate are closed. 105 // isolate are closed.
188 // 106 //
189 // This routine may only be used when the embedder has not provided an 107 // This routine may only be used when the embedder has not provided an
190 // alternate message delivery mechanism with Dart_SetPostMessageCallback. 108 // alternate message delivery mechanism with Dart_SetPostMessageCallback.
191 DART_EXPORT Dart_Result Dart_RunLoop(); 109 DART_EXPORT Dart_Handle Dart_RunLoop();
192 110
193 // Messages/ports 111 // Messages/ports
194 112
195 // A post message callback allows the embedder to provide an alternate 113 // A post message callback allows the embedder to provide an alternate
196 // delivery mechanism for inter-isolate messages. It is the 114 // delivery mechanism for inter-isolate messages. It is the
197 // responsibility of the embedder to call Dart_HandleMessage to 115 // responsibility of the embedder to call Dart_HandleMessage to
198 // process the message. 116 // process the message.
199 // 117 //
200 // If there is no reply port, then the constant 'kNoReplyPort' is 118 // If there is no reply port, then the constant 'kNoReplyPort' is
201 // passed as the 'reply_port' parameter. 119 // passed as the 'reply_port' parameter.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Dart_PostMessageCallback post_message_callback, 154 Dart_PostMessageCallback post_message_callback,
237 Dart_ClosePortCallback close_port_callback); 155 Dart_ClosePortCallback close_port_callback);
238 156
239 // Handle a message on the current isolate. 157 // Handle a message on the current isolate.
240 DART_EXPORT void Dart_HandleMessage(Dart_Port dest_port, 158 DART_EXPORT void Dart_HandleMessage(Dart_Port dest_port,
241 Dart_Port reply_port, 159 Dart_Port reply_port,
242 Dart_Message dart_message); 160 Dart_Message dart_message);
243 161
244 162
245 // Object. 163 // Object.
246 DART_EXPORT Dart_Result Dart_ObjectToString(Dart_Handle object); 164 DART_EXPORT Dart_Handle Dart_ObjectToString(Dart_Handle object);
247 DART_EXPORT bool Dart_IsNull(Dart_Handle object); 165 DART_EXPORT bool Dart_IsNull(Dart_Handle object);
248 166
249 167
250 // Returns true if the two objects are equal. 168 // Returns true if the two objects are equal.
251 DART_EXPORT Dart_Result Dart_Objects_Equal(Dart_Handle obj1, Dart_Handle obj2); 169 DART_EXPORT Dart_Handle Dart_Objects_Equal(Dart_Handle obj1,
170 Dart_Handle obj2,
171 bool* value);
252 172
253 173
254 // Classes. 174 // Classes.
255 DART_EXPORT Dart_Result Dart_GetClass(Dart_Handle library, Dart_Handle name); 175 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, Dart_Handle name);
256 DART_EXPORT Dart_Result Dart_IsInstanceOf(Dart_Handle object, Dart_Handle cls); 176 DART_EXPORT Dart_Handle Dart_IsInstanceOf(Dart_Handle object,
177 Dart_Handle cls,
178 bool* value);
257 179
258 180
259 // Number. 181 // Number.
260 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); 182 DART_EXPORT bool Dart_IsNumber(Dart_Handle object);
261 183
262 184
263 // Integer. 185 // Integer.
264 DART_EXPORT bool Dart_IsInteger(Dart_Handle object); 186 DART_EXPORT bool Dart_IsInteger(Dart_Handle object);
265 DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value); 187 DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value);
266 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* value); 188 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* value);
267 DART_EXPORT Dart_Result Dart_IntegerValue(Dart_Handle integer); 189 DART_EXPORT Dart_Handle Dart_IntegerValue(Dart_Handle integer, int64_t* value);
268 DART_EXPORT Dart_Result Dart_IntegerFitsIntoInt64(Dart_Handle integer); 190 DART_EXPORT Dart_Handle Dart_IntegerValueHexCString(Dart_Handle integer,
191 const char** value);
192 DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer,
193 bool* value);
269 194
270 195
271 // Boolean. 196 // Boolean.
272 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object); 197 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object);
273 DART_EXPORT Dart_Handle Dart_NewBoolean(bool value); 198 DART_EXPORT Dart_Handle Dart_NewBoolean(bool value);
274 DART_EXPORT Dart_Result Dart_BooleanValue(Dart_Handle bool_object); 199 DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle bool_object, bool* value);
275 200
276 201
277 // Double. 202 // Double.
278 DART_EXPORT bool Dart_IsDouble(Dart_Handle object); 203 DART_EXPORT bool Dart_IsDouble(Dart_Handle object);
279 DART_EXPORT Dart_Handle Dart_NewDouble(double value); 204 DART_EXPORT Dart_Handle Dart_NewDouble(double value);
280 DART_EXPORT Dart_Result Dart_DoubleValue(Dart_Handle integer); 205 DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle integer, double* result);
281 206
282 207
283 // String. 208 // String.
284 DART_EXPORT bool Dart_IsString(Dart_Handle object); 209 DART_EXPORT bool Dart_IsString(Dart_Handle object);
285 210
286 DART_EXPORT Dart_Result Dart_StringLength(Dart_Handle str); 211 DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t* len);
287 212
288 DART_EXPORT Dart_Handle Dart_NewString(const char* str); 213 DART_EXPORT Dart_Handle Dart_NewString(const char* str);
289 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, 214 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints,
290 intptr_t length); 215 intptr_t length);
291 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints, 216 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints,
292 intptr_t length); 217 intptr_t length);
293 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, 218 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints,
294 intptr_t length); 219 intptr_t length);
295 220
296 // The functions below test whether the object is a String and its codepoints 221 // The functions below test whether the object is a String and its codepoints
297 // all fit into 8 or 16 bits respectively. 222 // all fit into 8 or 16 bits respectively.
298 DART_EXPORT bool Dart_IsString8(Dart_Handle object); 223 DART_EXPORT bool Dart_IsString8(Dart_Handle object);
299 DART_EXPORT bool Dart_IsString16(Dart_Handle object); 224 DART_EXPORT bool Dart_IsString16(Dart_Handle object);
300 225
301 DART_EXPORT Dart_Result Dart_StringGet8(Dart_Handle str, 226 DART_EXPORT Dart_Handle Dart_StringGet8(Dart_Handle str,
302 uint8_t* codepoints, 227 uint8_t* codepoints,
303 intptr_t length); 228 intptr_t* length);
304 DART_EXPORT Dart_Result Dart_StringGet16(Dart_Handle str, 229 DART_EXPORT Dart_Handle Dart_StringGet16(Dart_Handle str,
305 uint16_t* codepoints, 230 uint16_t* codepoints,
306 intptr_t length); 231 intptr_t* length);
307 DART_EXPORT Dart_Result Dart_StringGet32(Dart_Handle str, 232 DART_EXPORT Dart_Handle Dart_StringGet32(Dart_Handle str,
308 uint32_t* codepoints, 233 uint32_t* codepoints,
309 intptr_t length); 234 intptr_t* length);
310 235
311 DART_EXPORT Dart_Result Dart_StringToCString(Dart_Handle str); 236 DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str,
237 const char** result);
312 238
313 239
314 // Array. 240 // Array.
315 DART_EXPORT bool Dart_IsArray(Dart_Handle object); 241 DART_EXPORT bool Dart_IsArray(Dart_Handle object);
316 DART_EXPORT Dart_Handle Dart_NewArray(intptr_t length); 242 DART_EXPORT Dart_Handle Dart_NewArray(intptr_t length);
317 DART_EXPORT Dart_Result Dart_GetLength(Dart_Handle array); 243 DART_EXPORT Dart_Handle Dart_GetLength(Dart_Handle array, intptr_t* len);
318 DART_EXPORT Dart_Result Dart_ArrayGetAt(Dart_Handle array, 244 DART_EXPORT Dart_Handle Dart_ArrayGetAt(Dart_Handle array,
319 intptr_t index); 245 intptr_t index);
320 DART_EXPORT Dart_Result Dart_ArrayGet(Dart_Handle array, 246 DART_EXPORT Dart_Handle Dart_ArrayGet(Dart_Handle array,
321 intptr_t offset, 247 intptr_t offset,
322 uint8_t* native_array, 248 uint8_t* native_array,
323 intptr_t length); 249 intptr_t length);
324 DART_EXPORT Dart_Result Dart_ArraySetAt(Dart_Handle array, 250 DART_EXPORT Dart_Handle Dart_ArraySetAt(Dart_Handle array,
325 intptr_t index, 251 intptr_t index,
326 Dart_Handle value); 252 Dart_Handle value);
327 DART_EXPORT Dart_Result Dart_ArraySet(Dart_Handle array, 253 DART_EXPORT Dart_Handle Dart_ArraySet(Dart_Handle array,
328 intptr_t offset, 254 intptr_t offset,
329 uint8_t* native_array, 255 uint8_t* native_array,
330 intptr_t length); 256 intptr_t length);
331 257
332 // Closure. 258 // Closure.
333 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); 259 DART_EXPORT bool Dart_IsClosure(Dart_Handle object);
334 // DEPRECATED: The API below is a temporary hack. 260 // DEPRECATED: The API below is a temporary hack.
335 DART_EXPORT Dart_Result Dart_ClosureSmrck(Dart_Handle object); 261 DART_EXPORT int64_t Dart_ClosureSmrck(Dart_Handle object);
336 DART_EXPORT void Dart_ClosureSetSmrck(Dart_Handle object, int64_t value); 262 DART_EXPORT void Dart_ClosureSetSmrck(Dart_Handle object, int64_t value);
337 263
338 264
339 // Invocation of methods. 265 // Invocation of methods.
340 DART_EXPORT Dart_Result Dart_InvokeStatic(Dart_Handle library, 266 DART_EXPORT Dart_Handle Dart_InvokeStatic(Dart_Handle library,
341 Dart_Handle class_name, 267 Dart_Handle class_name,
342 Dart_Handle function_name, 268 Dart_Handle function_name,
343 int number_of_arguments, 269 int number_of_arguments,
344 Dart_Handle* arguments); 270 Dart_Handle* arguments);
345 DART_EXPORT Dart_Result Dart_InvokeDynamic(Dart_Handle receiver, 271 DART_EXPORT Dart_Handle Dart_InvokeDynamic(Dart_Handle receiver,
346 Dart_Handle function_name, 272 Dart_Handle function_name,
347 int number_of_arguments, 273 int number_of_arguments,
348 Dart_Handle* arguments); 274 Dart_Handle* arguments);
349 DART_EXPORT Dart_Result Dart_InvokeClosure(Dart_Handle closure, 275 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure,
350 int number_of_arguments, 276 int number_of_arguments,
351 Dart_Handle* arguments); 277 Dart_Handle* arguments);
352 278
353 279
354 // Interaction with native methods. 280 // Interaction with native methods.
355 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, 281 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args,
356 int index); 282 int index);
357 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args); 283 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args);
358 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, 284 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args,
359 Dart_Handle retval); 285 Dart_Handle retval);
360 286
361 // Library. 287 // Library.
362 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object); 288 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object);
363 DART_EXPORT Dart_Result Dart_LibraryUrl(Dart_Handle library); 289 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library);
364 DART_EXPORT Dart_Result Dart_LibraryImportLibrary(Dart_Handle library, 290 DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library,
365 Dart_Handle import); 291 Dart_Handle import);
366 292
367 DART_EXPORT Dart_Result Dart_LookupLibrary(Dart_Handle url); 293 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url);
368 294
369 DART_EXPORT Dart_Result Dart_LoadLibrary(Dart_Handle url, 295 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
370 Dart_Handle source); 296 Dart_Handle source);
371 DART_EXPORT Dart_Result Dart_LoadSource(Dart_Handle library, 297 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
372 Dart_Handle url, 298 Dart_Handle url,
373 Dart_Handle source); 299 Dart_Handle source);
374 DART_EXPORT Dart_Result Dart_SetNativeResolver( 300 DART_EXPORT Dart_Handle Dart_SetNativeResolver(
375 Dart_Handle library, 301 Dart_Handle library,
376 Dart_NativeEntryResolver resolver); 302 Dart_NativeEntryResolver resolver);
377 303
378 304
379 // Script handling. 305 // Script handling.
380 DART_EXPORT Dart_Result Dart_LoadScript(Dart_Handle url, 306 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
381 Dart_Handle source, 307 Dart_Handle source,
382 Dart_LibraryTagHandler handler); 308 Dart_LibraryTagHandler handler);
383 309
384 // Compile all loaded classes and functions eagerly. 310 // Compile all loaded classes and functions eagerly.
385 DART_EXPORT Dart_Result Dart_CompileAll(); 311 DART_EXPORT Dart_Handle Dart_CompileAll();
386 312
387 // Exception related. 313 // Exception related.
388 DART_EXPORT bool Dart_ExceptionOccurred(Dart_Handle result); 314 DART_EXPORT bool Dart_ExceptionOccurred(Dart_Handle result);
389 DART_EXPORT Dart_Result Dart_GetException(Dart_Handle result); 315 DART_EXPORT Dart_Handle Dart_GetException(Dart_Handle result);
390 DART_EXPORT Dart_Result Dart_GetStacktrace(Dart_Handle unhandled_exception); 316 DART_EXPORT Dart_Handle Dart_GetStacktrace(Dart_Handle unhandled_exception);
391 DART_EXPORT Dart_Result Dart_ThrowException(Dart_Handle exception); 317 DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception);
392 DART_EXPORT Dart_Result Dart_ReThrowException(Dart_Handle exception, 318 DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception,
393 Dart_Handle stacktrace); 319 Dart_Handle stacktrace);
394 320
395 // Global Handles and Scope for local handles and zone based memory allocation. 321 // Global Handles and Scope for local handles and zone based memory allocation.
396 DART_EXPORT void Dart_EnterScope(); 322 DART_EXPORT void Dart_EnterScope();
397 DART_EXPORT void Dart_ExitScope(); 323 DART_EXPORT void Dart_ExitScope();
398 324
399 DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object); 325 DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object);
400 DART_EXPORT Dart_Handle Dart_MakeWeakPersistentHandle(Dart_Handle object); 326 DART_EXPORT Dart_Handle Dart_MakeWeakPersistentHandle(Dart_Handle object);
401 DART_EXPORT Dart_Handle Dart_MakePersistentHandle(Dart_Handle object); 327 DART_EXPORT Dart_Handle Dart_MakePersistentHandle(Dart_Handle object);
402 DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object); 328 DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object);
403 329
404 // Fields. 330 // Fields.
405 DART_EXPORT Dart_Result Dart_GetStaticField(Dart_Handle cls, Dart_Handle name); 331 DART_EXPORT Dart_Handle Dart_GetStaticField(Dart_Handle cls, Dart_Handle name);
406 DART_EXPORT Dart_Result Dart_SetStaticField(Dart_Handle cls, 332 DART_EXPORT Dart_Handle Dart_SetStaticField(Dart_Handle cls,
407 Dart_Handle name, 333 Dart_Handle name,
408 Dart_Handle value); 334 Dart_Handle value);
409 DART_EXPORT Dart_Result Dart_GetInstanceField(Dart_Handle obj, 335 DART_EXPORT Dart_Handle Dart_GetInstanceField(Dart_Handle obj,
410 Dart_Handle name); 336 Dart_Handle name);
411 DART_EXPORT Dart_Result Dart_SetInstanceField(Dart_Handle obj, 337 DART_EXPORT Dart_Handle Dart_SetInstanceField(Dart_Handle obj,
412 Dart_Handle name, 338 Dart_Handle name,
413 Dart_Handle value); 339 Dart_Handle value);
414 340
415 // Native fields. 341 // Native fields.
416 DART_EXPORT Dart_Result Dart_CreateNativeWrapperClass(Dart_Handle library, 342 DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library,
417 Dart_Handle class_name, 343 Dart_Handle class_name,
418 int field_count); 344 int field_count);
419 DART_EXPORT Dart_Result Dart_GetNativeInstanceField(Dart_Handle obj, 345 DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj,
420 int index); 346 int index,
421 DART_EXPORT Dart_Result Dart_SetNativeInstanceField(Dart_Handle obj, 347 intptr_t* value);
348 DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj,
422 int index, 349 int index,
423 intptr_t value); 350 intptr_t value);
424 351
425 // Snapshot creation. 352 // Snapshot creation.
426 DART_EXPORT Dart_Result Dart_CreateSnapshot(uint8_t** snaphot_buffer, 353 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** snaphot_buffer,
427 intptr_t* snapshot_size); 354 intptr_t* snapshot_size);
428 355
429 // Message communication. 356 // Message communication.
430 DART_EXPORT Dart_Result Dart_PostIntArray(Dart_Port port, 357 DART_EXPORT bool Dart_PostIntArray(Dart_Port port,
431 int field_count, 358 int field_count,
432 intptr_t* data); 359 intptr_t* data);
433 360
434 DART_EXPORT Dart_Result Dart_Post(Dart_Port port, Dart_Handle value); 361 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle value);
435 362
436 // External pprof support for gathering and dumping symbolic information 363 // External pprof support for gathering and dumping symbolic information
437 // that can be used for better profile reports for dynamically generated 364 // that can be used for better profile reports for dynamically generated
438 // code. 365 // code.
439 DART_EXPORT void Dart_InitPprofSupport(); 366 DART_EXPORT void Dart_InitPprofSupport();
440 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); 367 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size);
441 368
442 // Check set vm flags. 369 // Check set vm flags.
443 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); 370 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name);
444 371
445 #endif // INCLUDE_DART_API_H_ 372 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « runtime/bin/socket.cc ('k') | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698