| OLD | NEW |
| 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 /** \mainpage Dart Embedding API Reference | 8 /** \mainpage Dart Embedding API Reference |
| 9 * | 9 * |
| 10 * Dart is a class-based programming language for creating structured | 10 * Dart is a class-based programming language for creating structured |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 * Exits an isolate. After this call, Dart_CurrentIsolate will | 337 * Exits an isolate. After this call, Dart_CurrentIsolate will |
| 338 * return NULL. | 338 * return NULL. |
| 339 * | 339 * |
| 340 * Requires there to be a current isolate. | 340 * Requires there to be a current isolate. |
| 341 */ | 341 */ |
| 342 DART_EXPORT void Dart_ExitIsolate(); | 342 DART_EXPORT void Dart_ExitIsolate(); |
| 343 // TODO(turnidge): We don't want users of the api to be able to exit a | 343 // TODO(turnidge): We don't want users of the api to be able to exit a |
| 344 // "pure" dart isolate. Implement and document. | 344 // "pure" dart isolate. Implement and document. |
| 345 | 345 |
| 346 /** | 346 /** |
| 347 * Creates a snapshot of the state of the current isolate. | 347 * Creates a full snapshot of the current isolate heap. |
| 348 * |
| 349 * A full snapshot is a compact representation of the dart heap state and |
| 350 * can be used for fast initialization of an isolate. A Snapshot of the heap |
| 351 * can only be created before any dart code has executed. |
| 352 * |
| 353 * Requires there to be a current isolate. |
| 354 * |
| 355 * \param buffer Returns a pointer to a buffer containing the |
| 356 * snapshot. This buffer is scope allocated and is only valid |
| 357 * until the next call to Dart_ExitScope. |
| 358 * \param size Returns the size of the buffer. |
| 359 * |
| 360 * \return A valid handle if no error occurs during the operation. |
| 348 */ | 361 */ |
| 349 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** snaphot_buffer, | 362 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, |
| 350 intptr_t* snapshot_size); | 363 intptr_t* size); |
| 364 |
| 365 /** |
| 366 * Creates a snapshot of the specified application script. |
| 367 * |
| 368 * A script snapshot can be used for implementing fast startup of applications |
| 369 * (skips the script tokenizing and parsing process). A Snapshot of the script |
| 370 * can only be created before any dart code has executed. |
| 371 * |
| 372 * Requires there to be a current isolate. |
| 373 * |
| 374 * \param library An application script for which a snapshot is to be |
| 375 * created. |
| 376 * \param buffer Returns a pointer to a buffer containing |
| 377 * the snapshot. This buffer is scope allocated and is only valid |
| 378 * until the next call to Dart_ExitScope. |
| 379 * \param size Returns the size of the buffer. |
| 380 * |
| 381 * \return A valid handle if no error occurs during the operation. |
| 382 */ |
| 383 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(Dart_Handle library, |
| 384 uint8_t** buffer, |
| 385 intptr_t* size); |
| 386 |
| 351 | 387 |
| 352 // --- Messages and Ports --- | 388 // --- Messages and Ports --- |
| 353 | 389 |
| 354 /** | 390 /** |
| 355 * Messages are used to communicate between isolates. | 391 * Messages are used to communicate between isolates. |
| 356 */ | 392 */ |
| 357 typedef struct _Dart_Message* Dart_Message; | 393 typedef struct _Dart_Message* Dart_Message; |
| 358 | 394 |
| 359 /** | 395 /** |
| 360 * A port is used to send or receive inter-isolate messages | 396 * A port is used to send or receive inter-isolate messages |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 /** | 1253 /** |
| 1218 * Loads the root script for the current isolate. | 1254 * Loads the root script for the current isolate. |
| 1219 * | 1255 * |
| 1220 * TODO(turnidge): Document. | 1256 * TODO(turnidge): Document. |
| 1221 */ | 1257 */ |
| 1222 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 1258 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
| 1223 Dart_Handle source, | 1259 Dart_Handle source, |
| 1224 Dart_LibraryTagHandler handler); | 1260 Dart_LibraryTagHandler handler); |
| 1225 | 1261 |
| 1226 /** | 1262 /** |
| 1263 * Loads the root script for current isolate from a snapshot. |
| 1264 * |
| 1265 * \param buffer A buffer which contains a snapshot of the script. |
| 1266 * |
| 1267 * \return If no error occurs, the Library object corresponding to the root |
| 1268 * script is returned. Otherwise an error handle is returned. |
| 1269 **/ |
| 1270 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer); |
| 1271 |
| 1272 /** |
| 1227 * Forces all loaded classes and functions to be compiled eagerly in | 1273 * Forces all loaded classes and functions to be compiled eagerly in |
| 1228 * the current isolate.. | 1274 * the current isolate.. |
| 1229 * | 1275 * |
| 1230 * TODO(turnidge): Document. | 1276 * TODO(turnidge): Document. |
| 1231 */ | 1277 */ |
| 1232 DART_EXPORT Dart_Handle Dart_CompileAll(); | 1278 DART_EXPORT Dart_Handle Dart_CompileAll(); |
| 1233 | 1279 |
| 1234 /** | 1280 /** |
| 1235 * Is this object a Library? | 1281 * Is this object a Library? |
| 1236 */ | 1282 */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 | 1321 |
| 1276 // --- Profiling support ---- | 1322 // --- Profiling support ---- |
| 1277 | 1323 |
| 1278 // External pprof support for gathering and dumping symbolic | 1324 // External pprof support for gathering and dumping symbolic |
| 1279 // information that can be used for better profile reports for | 1325 // information that can be used for better profile reports for |
| 1280 // dynamically generated code. | 1326 // dynamically generated code. |
| 1281 DART_EXPORT void Dart_InitPprofSupport(); | 1327 DART_EXPORT void Dart_InitPprofSupport(); |
| 1282 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 1328 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 1283 | 1329 |
| 1284 #endif // INCLUDE_DART_API_H_ | 1330 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |