| 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_TOOLS_API_H_ | 5 #ifndef INCLUDE_DART_TOOLS_API_H_ |
| 6 #define INCLUDE_DART_TOOLS_API_H_ | 6 #define INCLUDE_DART_TOOLS_API_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 /** \mainpage Dart Tools Embedding API Reference | 10 /** \mainpage Dart Tools Embedding API Reference |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 * the last callback registered will be remembered. | 800 * the last callback registered will be remembered. |
| 801 */ | 801 */ |
| 802 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 802 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 803 const char* method, | 803 const char* method, |
| 804 Dart_ServiceRequestCallback callback, | 804 Dart_ServiceRequestCallback callback, |
| 805 void* user_data); | 805 void* user_data); |
| 806 | 806 |
| 807 | 807 |
| 808 /* | 808 /* |
| 809 * ======== | 809 * ======== |
| 810 * Event Streams |
| 811 * ======== |
| 812 */ |
| 813 |
| 814 /** |
| 815 * A callback invoked when the VM service gets a request to listen to |
| 816 * some stream. |
| 817 * |
| 818 * \return Returns true iff the embedder supports the named stream id. |
| 819 */ |
| 820 typedef bool (*Dart_ServiceStreamListenCallback)(const char* stream_id); |
| 821 |
| 822 /** |
| 823 * A callback invoked when the VM service gets a request to cancel |
| 824 * some stream. |
| 825 */ |
| 826 typedef void (*Dart_ServiceStreamCancelCallback)(const char* stream_id); |
| 827 |
| 828 /** |
| 829 * Adds VM service stream callbacks. |
| 830 * |
| 831 * \param listen_callback A function pointer to a listen callback function. |
| 832 * A listen callback function should not be already set when this function |
| 833 * is called. A NULL value removes the existing listen callback function |
| 834 * if any. |
| 835 * |
| 836 * \param cancel_callback A function pointer to a cancel callback function. |
| 837 * A cancel callback function should not be already set when this function |
| 838 * is called. A NULL value removes the existing cancel callback function |
| 839 * if any. |
| 840 * |
| 841 * \return Success if the callbacks were added. Otherwise, returns an |
| 842 * error handle. |
| 843 */ |
| 844 DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks( |
| 845 Dart_ServiceStreamListenCallback listen_callback, |
| 846 Dart_ServiceStreamCancelCallback cancel_callback); |
| 847 |
| 848 /** |
| 849 * Sends a data event to clients of the VM Service. |
| 850 * |
| 851 * A data event is used to pass an array of bytes to subscribed VM |
| 852 * Service clients. For example, in the standalone embedder, this is |
| 853 * function used to provide WriteEvents on the Stdout and Stderr |
| 854 * streams. |
| 855 * |
| 856 * If the embedder passes in a stream id for which no client is |
| 857 * subscribed, then the event is ignored. |
| 858 * |
| 859 * \param stream_id The id of the stream on which to post the event. |
| 860 * |
| 861 * \param event_kind A string identifying what kind of event this is. |
| 862 * For example, 'WriteEvent'. |
| 863 * |
| 864 * \param bytes A pointer to an array of bytes. |
| 865 * |
| 866 * \param bytes_length The length of the byte array. |
| 867 * |
| 868 * \return Success if the arguments are well formed. Otherwise, returns an |
| 869 * error handle. |
| 870 */ |
| 871 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, |
| 872 const char* event_kind, |
| 873 const uint8_t* bytes, |
| 874 intptr_t bytes_length); |
| 875 |
| 876 /* |
| 877 * ======== |
| 810 * Timeline | 878 * Timeline |
| 811 * ======== | 879 * ======== |
| 812 */ | 880 */ |
| 813 | 881 |
| 814 /** | 882 /** |
| 815 * Add a duration timeline event to the embedder stream for the current isolate. | 883 * Add a duration timeline event to the embedder stream for the current isolate. |
| 816 * | 884 * |
| 817 * \param label The name of the event. | 885 * \param label The name of the event. |
| 818 * \param start_micros The start of the duration (in microseconds) | 886 * \param start_micros The start of the duration (in microseconds) |
| 819 * \param end_micros The end of the duration (in microseconds) | 887 * \param end_micros The end of the duration (in microseconds) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 * \return Returns an asynchronous id that must be passed to | 949 * \return Returns an asynchronous id that must be passed to |
| 882 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. | 950 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. |
| 883 * | 951 * |
| 884 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | 952 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms |
| 885 * this call uses GetSystemTimeAsFileTime to get the current time. | 953 * this call uses GetSystemTimeAsFileTime to get the current time. |
| 886 */ | 954 */ |
| 887 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, | 955 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, |
| 888 int64_t async_id); | 956 int64_t async_id); |
| 889 | 957 |
| 890 #endif // INCLUDE_DART_TOOLS_API_H_ | 958 #endif // INCLUDE_DART_TOOLS_API_H_ |
| OLD | NEW |