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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 * | 438 * |
439 * This function waits for incoming messages for the current | 439 * This function waits for incoming messages for the current |
440 * isolate. As new messages arrive, they are handled using | 440 * isolate. As new messages arrive, they are handled using |
441 * Dart_HandleMessage. The routine exits when all ports to the | 441 * Dart_HandleMessage. The routine exits when all ports to the |
442 * current isolate are closed. | 442 * current isolate are closed. |
443 */ | 443 */ |
444 DART_EXPORT Dart_Handle Dart_RunLoop(); | 444 DART_EXPORT Dart_Handle Dart_RunLoop(); |
445 // TODO(turnidge): Should this be removed from the public api? | 445 // TODO(turnidge): Should this be removed from the public api? |
446 | 446 |
447 /** | 447 /** |
448 * Gets the main Dart_Port for the current isolate. | |
449 */ | |
450 DART_EXPORT Dart_Port Dart_GetMainPort(); | |
451 | |
452 /** | |
453 * Does the current isolate have live ReceivePorts? | |
454 * | |
455 * A port is live when it has not been closed and when | |
456 * ReceivePort.receive() has been called to install a receive handler. | |
457 */ | |
458 DART_EXPORT bool Dart_HasLivePorts(); | |
459 | |
460 /** | |
448 * Posts a message for some isolate. The message is built from a raw | 461 * Posts a message for some isolate. The message is built from a raw |
449 * array. | 462 * array. |
450 * | 463 * |
451 * \param port The destination port. | 464 * \param port The destination port. |
452 * \param length The length of the data array. | 465 * \param length The length of the data array. |
453 * \param data A data array to be sent in the message. | 466 * \param data A data array to be sent in the message. |
454 * | 467 * |
455 * \return True if the message was posted. | 468 * \return True if the message was posted. |
456 */ | 469 */ |
457 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, | 470 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, |
458 intptr_t length, | 471 intptr_t length, |
459 intptr_t* data); | 472 intptr_t* data); |
460 // TODO(turnidge): Should this be intptr_t or some fixed length type? | 473 // TODO(turnidge): Should this be intptr_t or some fixed length type? |
461 // TODO(turnidge): Reverse length/data for consistency. | 474 // TODO(turnidge): Reverse length/data for consistency. |
462 | 475 |
463 /** | 476 /** |
464 * Posts a message for some isolate. The message is a serialized | 477 * Posts a message for some isolate. The message is a serialized |
465 * object. | 478 * object. |
466 * | 479 * |
467 * Requires there to be a current isolate. | 480 * Requires there to be a current isolate. |
468 * | 481 * |
469 * \param port The destination port. | 482 * \param port The destination port. |
470 * \param object An object from the current isolate. | 483 * \param object An object from the current isolate. |
471 * | 484 * |
472 * \return True if the message was posted. | 485 * \return True if the message was posted. |
473 */ | 486 */ |
474 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle object); | 487 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle object); |
475 | 488 |
489 /** | |
490 * Returns a new SendPort with the provided id. | |
491 */ | |
492 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port); | |
siva
2011/11/24 00:52:31
If I call this function multiple times with the sa
turnidge
2011/11/29 01:01:31
Discussed offline, multiple SendPorts will work.
| |
493 | |
494 /** | |
495 * Returns a new ReceivePort with the provided id. | |
496 */ | |
497 DART_EXPORT Dart_Handle Dart_NewReceivePort(Dart_Port port); | |
siva
2011/11/24 00:52:31
Ditto comment on multiple receive ports.
turnidge
2011/11/29 01:01:31
Multiple ReceivePorts don't work. Added a comment
| |
498 | |
476 // --- Scopes ---- | 499 // --- Scopes ---- |
477 | 500 |
478 /** | 501 /** |
479 * Enters a new scope. | 502 * Enters a new scope. |
480 * | 503 * |
481 * All new local handles will be created in this scope. Additionally, | 504 * All new local handles will be created in this scope. Additionally, |
482 * some functions may return "scope allocated" memory which is only | 505 * some functions may return "scope allocated" memory which is only |
483 * valid within this scope. | 506 * valid within this scope. |
484 * | 507 * |
485 * Requires there to be a current isolate. | 508 * Requires there to be a current isolate. |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 | 1227 |
1205 // --- Profiling support ---- | 1228 // --- Profiling support ---- |
1206 | 1229 |
1207 // External pprof support for gathering and dumping symbolic | 1230 // External pprof support for gathering and dumping symbolic |
1208 // information that can be used for better profile reports for | 1231 // information that can be used for better profile reports for |
1209 // dynamically generated code. | 1232 // dynamically generated code. |
1210 DART_EXPORT void Dart_InitPprofSupport(); | 1233 DART_EXPORT void Dart_InitPprofSupport(); |
1211 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 1234 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
1212 | 1235 |
1213 #endif // INCLUDE_DART_API_H_ | 1236 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |