OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 * figure out which isolate is being interrupted. | 615 * figure out which isolate is being interrupted. |
616 * | 616 * |
617 * \return The embedder returns true if the isolate should continue | 617 * \return The embedder returns true if the isolate should continue |
618 * execution. If the embedder returns false, the isolate will be | 618 * execution. If the embedder returns false, the isolate will be |
619 * unwound (currently unimplemented). | 619 * unwound (currently unimplemented). |
620 */ | 620 */ |
621 typedef bool (*Dart_IsolateInterruptCallback)(); | 621 typedef bool (*Dart_IsolateInterruptCallback)(); |
622 // TODO(turnidge): Define and implement unwinding. | 622 // TODO(turnidge): Define and implement unwinding. |
623 | 623 |
624 /** | 624 /** |
| 625 * An isolate unhandled exception callback function. |
| 626 * |
| 627 * This callback, provided by the embedder, is called when an |
| 628 * unhandled exception is thrown during isolate execution. |
| 629 * When the callback is called, Dart_CurrentIsolate can be used to |
| 630 * figure out which isolate was running when the exception was |
| 631 * thrown. |
| 632 * |
| 633 * \param error The unhandled exception. This handle's scope is |
| 634 * only valid until the embedder returns from this callback. |
| 635 */ |
| 636 typedef void (*Dart_IsolateUnhandledExceptionCallback)(Dart_Handle error); |
| 637 |
| 638 /** |
625 * An isolate shutdown callback function. | 639 * An isolate shutdown callback function. |
626 * | 640 * |
627 * This callback, provided by the embedder, is called after the vm | 641 * This callback, provided by the embedder, is called after the vm |
628 * shuts down an isolate. Since the isolate has been shut down, it is | 642 * shuts down an isolate. Since the isolate has been shut down, it is |
629 * not safe to enter the isolate or use it to run any Dart code. | 643 * not safe to enter the isolate or use it to run any Dart code. |
630 * | 644 * |
631 * This function should be used to dispose of native resources that | 645 * This function should be used to dispose of native resources that |
632 * are allocated to an isolate in order to avoid leaks. | 646 * are allocated to an isolate in order to avoid leaks. |
633 * | 647 * |
634 * \param callback_data The same callback data which was passed to the | 648 * \param callback_data The same callback data which was passed to the |
635 * isolate when it was created. | 649 * isolate when it was created. |
636 * | 650 * |
637 */ | 651 */ |
638 typedef void (*Dart_IsolateShutdownCallback)(void* callback_data); | 652 typedef void (*Dart_IsolateShutdownCallback)(void* callback_data); |
639 | 653 |
640 /** | 654 /** |
641 * Initializes the VM. | 655 * Initializes the VM. |
642 * | 656 * |
643 * \param create A function to be called during isolate creation. | 657 * \param create A function to be called during isolate creation. |
644 * See Dart_IsolateCreateCallback. | 658 * See Dart_IsolateCreateCallback. |
645 * \param interrupt A function to be called when an isolate is interrupted. | 659 * \param interrupt A function to be called when an isolate is interrupted. |
646 * See Dart_IsolateInterruptCallback. | 660 * See Dart_IsolateInterruptCallback. |
| 661 * \param unhandled_exception A function to be called if an isolate has an |
| 662 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. |
| 663 * \param shutdown A function to be called when an isolate is shutdown. |
| 664 * See Dart_IsolateShutdownCallback. |
647 * | 665 * |
648 * \return True if initialization is successful. | 666 * \return True if initialization is successful. |
649 */ | 667 */ |
650 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, | 668 DART_EXPORT bool Dart_Initialize( |
651 Dart_IsolateInterruptCallback interrupt, | 669 Dart_IsolateCreateCallback create, |
652 Dart_IsolateShutdownCallback shutdown); | 670 Dart_IsolateInterruptCallback interrupt, |
| 671 Dart_IsolateUnhandledExceptionCallback unhandled_exception, |
| 672 Dart_IsolateShutdownCallback shutdown); |
653 | 673 |
654 /** | 674 /** |
655 * Sets command line flags. Should be called before Dart_Initialize. | 675 * Sets command line flags. Should be called before Dart_Initialize. |
656 * | 676 * |
657 * \param argc The length of the arguments array. | 677 * \param argc The length of the arguments array. |
658 * \param argv An array of arguments. | 678 * \param argv An array of arguments. |
659 * | 679 * |
660 * \return True if VM flags set successfully. | 680 * \return True if VM flags set successfully. |
661 */ | 681 */ |
662 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); | 682 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 * | 2791 * |
2772 * \param object An object. | 2792 * \param object An object. |
2773 * \param peer A value to store in the peer field. | 2793 * \param peer A value to store in the peer field. |
2774 * | 2794 * |
2775 * \return Returns an error if 'object' is a subtype of Null, num, or | 2795 * \return Returns an error if 'object' is a subtype of Null, num, or |
2776 * bool. | 2796 * bool. |
2777 */ | 2797 */ |
2778 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2798 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
2779 | 2799 |
2780 #endif // INCLUDE_DART_API_H_ | 2800 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |