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