| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 */ | 383 */ |
| 384 typedef bool (*Dart_PostMessageCallback)(Dart_Isolate dest_isolate, | 384 typedef bool (*Dart_PostMessageCallback)(Dart_Isolate dest_isolate, |
| 385 Dart_Port dest_port, | 385 Dart_Port dest_port, |
| 386 Dart_Port reply_port, | 386 Dart_Port reply_port, |
| 387 Dart_Message message); | 387 Dart_Message message); |
| 388 // TODO(turnidge): Add a Dart_ReleaseMessage to hide allocation details. | 388 // TODO(turnidge): Add a Dart_ReleaseMessage to hide allocation details. |
| 389 | 389 |
| 390 const Dart_Port kCloseAllPorts = 0; | 390 const Dart_Port kCloseAllPorts = 0; |
| 391 | 391 |
| 392 /** | 392 /** |
| 393 * A create port callback. |
| 394 * |
| 395 * This callback allows the embedder to receive notification when a |
| 396 * port is created. |
| 397 */ |
| 398 typedef void (*Dart_CreatePortCallback)(Dart_Isolate isolate, |
| 399 Dart_Port port); |
| 400 |
| 401 /** |
| 393 * A close port callback. | 402 * A close port callback. |
| 394 * | 403 * |
| 395 * This callback allows the embedder to receive notification when a | 404 * This callback allows the embedder to receive notification when a |
| 396 * port is closed. The constant 'kCloseAllPorts' is passed as the | 405 * port is closed. The constant 'kCloseAllPorts' is passed as the |
| 397 * 'port' parameter when all active ports are being closed at once. | 406 * 'port' parameter when all active ports are being closed at once. |
| 398 */ | 407 */ |
| 399 typedef void (*Dart_ClosePortCallback)(Dart_Isolate isolate, | 408 typedef void (*Dart_ClosePortCallback)(Dart_Isolate isolate, |
| 400 Dart_Port port); | 409 Dart_Port port); |
| 401 | 410 |
| 402 /** | 411 /** |
| 403 * Allows embedders to provide an alternative mechanism for sending | 412 * Allows embedders to provide an alternative mechanism for sending |
| 404 * inter-isolate messages. This setting only applies to the current | 413 * inter-isolate messages. This setting only applies to the current |
| 405 * isolate. | 414 * isolate. |
| 406 * | 415 * |
| 407 * Most embedders will only call this function once, before isolate | 416 * Most embedders will only call this function once, before isolate |
| 408 * execution begins. If this function is called after isolate | 417 * execution begins. If this function is called after isolate |
| 409 * execution begins, the embedder is responsible for threading issues. | 418 * execution begins, the embedder is responsible for threading issues. |
| 410 */ | 419 */ |
| 411 DART_EXPORT void Dart_SetMessageCallbacks( | 420 DART_EXPORT void Dart_SetMessageCallbacks( |
| 421 Dart_CreatePortCallback create_port_callback, |
| 412 Dart_PostMessageCallback post_message_callback, | 422 Dart_PostMessageCallback post_message_callback, |
| 413 Dart_ClosePortCallback close_port_callback); | 423 Dart_ClosePortCallback close_port_callback); |
| 414 // TODO(turnidge): Consider moving this to isolate creation so that it | 424 // TODO(turnidge): Consider moving this to isolate creation so that it |
| 415 // is impossible to mess up. | 425 // is impossible to mess up. |
| 416 | 426 |
| 417 /** | 427 /** |
| 418 * Handles a message on the current isolate. | 428 * Handles a message on the current isolate. |
| 419 * | 429 * |
| 420 * May generate an unhandled exception error. | 430 * May generate an unhandled exception error. |
| 421 * | 431 * |
| (...skipping 16 matching lines...) Expand all Loading... |
| 438 * | 448 * |
| 439 * This function waits for incoming messages for the current | 449 * This function waits for incoming messages for the current |
| 440 * isolate. As new messages arrive, they are handled using | 450 * isolate. As new messages arrive, they are handled using |
| 441 * Dart_HandleMessage. The routine exits when all ports to the | 451 * Dart_HandleMessage. The routine exits when all ports to the |
| 442 * current isolate are closed. | 452 * current isolate are closed. |
| 443 */ | 453 */ |
| 444 DART_EXPORT Dart_Handle Dart_RunLoop(); | 454 DART_EXPORT Dart_Handle Dart_RunLoop(); |
| 445 // TODO(turnidge): Should this be removed from the public api? | 455 // TODO(turnidge): Should this be removed from the public api? |
| 446 | 456 |
| 447 /** | 457 /** |
| 458 * Creates a Dart_Port and associates it with the current isolate. |
| 459 */ |
| 460 DART_EXPORT Dart_Port Dart_CreatePort(); |
| 461 |
| 462 /** |
| 463 * Does the current isolate have active ports? |
| 464 */ |
| 465 DART_EXPORT bool Dart_IsolateHasActivePorts(); |
| 466 |
| 467 /** |
| 448 * Posts a message for some isolate. The message is built from a raw | 468 * Posts a message for some isolate. The message is built from a raw |
| 449 * array. | 469 * array. |
| 450 * | 470 * |
| 451 * \param port The destination port. | 471 * \param port The destination port. |
| 452 * \param length The length of the data array. | 472 * \param length The length of the data array. |
| 453 * \param data A data array to be sent in the message. | 473 * \param data A data array to be sent in the message. |
| 454 * | 474 * |
| 455 * \return True if the message was posted. | 475 * \return True if the message was posted. |
| 456 */ | 476 */ |
| 457 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, | 477 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 | 1200 |
| 1181 // --- Profiling support ---- | 1201 // --- Profiling support ---- |
| 1182 | 1202 |
| 1183 // External pprof support for gathering and dumping symbolic | 1203 // External pprof support for gathering and dumping symbolic |
| 1184 // information that can be used for better profile reports for | 1204 // information that can be used for better profile reports for |
| 1185 // dynamically generated code. | 1205 // dynamically generated code. |
| 1186 DART_EXPORT void Dart_InitPprofSupport(); | 1206 DART_EXPORT void Dart_InitPprofSupport(); |
| 1187 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 1207 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 1188 | 1208 |
| 1189 #endif // INCLUDE_DART_API_H_ | 1209 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |