OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef INCLUDE_DART_API_H_ | 7 #ifndef INCLUDE_DART_API_H_ |
8 #define INCLUDE_DART_API_H_ | 8 #define INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 | 2828 |
2829 | 2829 |
2830 /** | 2830 /** |
2831 * Returns the port that script load requests should be sent on. | 2831 * Returns the port that script load requests should be sent on. |
2832 * | 2832 * |
2833 * \return Returns the port for load requests or ILLEGAL_PORT if the service | 2833 * \return Returns the port for load requests or ILLEGAL_PORT if the service |
2834 * isolate failed to startup or does not support load requests. | 2834 * isolate failed to startup or does not support load requests. |
2835 */ | 2835 */ |
2836 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); | 2836 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); |
2837 | 2837 |
2838 | |
2839 /** | |
2840 * A service request callback function. | |
2841 * | |
2842 * These callbacks, registered by the embedder, are called when the VM receives | |
2843 * a service request it can't handle and the service request command name | |
2844 * matches one of the embedder registered handlers. | |
2845 * | |
2846 * \param method The rpc method name. | |
2847 * \param param_keys Service requests can have key-value pair parameters. The | |
2848 * keys and values are flattened and stored in arrays. | |
2849 * \param param_values The values associated with the keys. | |
2850 * \param num_params The length of the param_keys and param_values arrays. | |
2851 * \param user_data The user_data pointer registered with this handler. | |
2852 * | |
2853 * \return Returns a C string containing a valid JSON object. The returned | |
2854 * pointer will be freed by the VM by calling free. | |
2855 */ | |
2856 typedef const char* (*Dart_ServiceRequestCallback)( | |
2857 const char* method, | |
2858 const char** param_keys, | |
2859 const char** param_values, | |
2860 intptr_t num_params, | |
2861 void* user_data); | |
2862 | |
2863 /** | |
2864 * Register a Dart_ServiceRequestCallback to be called to handle | |
2865 * requests for the named rpc on a specific isolate. The callback will | |
2866 * be invoked with the current isolate set to the request target. | |
2867 * | |
2868 * \param method The name of the method that this callback is responsible for. | |
2869 * \param callback The callback to invoke. | |
2870 * \param user_data The user data passed to the callback. | |
2871 * | |
2872 * NOTE: If multiple callbacks with the same name are registered, only | |
2873 * the last callback registered will be remembered. | |
2874 */ | |
2875 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( | |
2876 const char* method, | |
2877 Dart_ServiceRequestCallback callback, | |
2878 void* user_data); | |
2879 | |
2880 /** | |
2881 * Register a Dart_ServiceRequestCallback to be called to handle | |
2882 * requests for the named rpc. The callback will be invoked without a | |
2883 * current isolate. | |
2884 * | |
2885 * \param method The name of the command that this callback is responsible for. | |
2886 * \param callback The callback to invoke. | |
2887 * \param user_data The user data passed to the callback. | |
2888 * | |
2889 * NOTE: If multiple callbacks with the same name are registered, only | |
2890 * the last callback registered will be remembered. | |
2891 */ | |
2892 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | |
2893 const char* method, | |
2894 Dart_ServiceRequestCallback callback, | |
2895 void* user_data); | |
2896 | |
2897 | |
2898 /** | |
2899 * Add a duration timeline event to the embedder stream for the current isolate. | |
2900 * | |
2901 * \param label The name of the event. | |
2902 * \param start_micros The start of the duration (in microseconds) | |
2903 * \param end_micros The end of the duration (in microseconds) | |
2904 * | |
2905 * NOTE: On Posix platforms you should use gettimeofday and on Windows platforms | |
2906 * you should use GetSystemTimeAsFileTime to get the time values. | |
2907 */ | |
2908 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, | |
2909 int64_t start_micros, | |
2910 int64_t end_micros); | |
2911 | |
2912 /** | |
2913 * Add an instant timeline event to the embedder stream for the current isolate. | |
2914 * | |
2915 * \param label The name of event. | |
2916 * | |
2917 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | |
2918 * this call uses GetSystemTimeAsFileTime to get the current time. | |
2919 */ | |
2920 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label); | |
2921 | |
2922 /** | |
2923 * Adds an asynchronous begin timeline event to the embedder stream for the | |
2924 * current isolate. | |
2925 * | |
2926 * \param label The name of event. | |
2927 * | |
2928 * \return Returns an asynchronous id that must be passed to | |
2929 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. If the asynchronous | |
2930 * id is less than 0 the event was not added to the timeline and subsequent | |
2931 * calls to Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd will become | |
2932 * no-ops. | |
2933 * | |
2934 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | |
2935 * this call uses GetSystemTimeAsFileTime to get the current time. | |
2936 */ | |
2937 DART_EXPORT Dart_Handle Dart_TimelineAsyncBegin(const char* label, | |
2938 int64_t* async_id); | |
2939 | |
2940 | |
2941 /** | |
2942 * Adds an asynchronous instant timeline event to the embedder stream for the | |
2943 * current isolate. | |
2944 * | |
2945 * \param label The name of event. | |
2946 * | |
2947 * \return Returns an asynchronous id that must be passed to | |
2948 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. | |
2949 * | |
2950 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | |
2951 * this call uses GetSystemTimeAsFileTime to get the current time. | |
2952 */ | |
2953 DART_EXPORT Dart_Handle Dart_TimelineAsyncInstant(const char* label, | |
2954 int64_t async_id); | |
2955 | |
2956 | |
2957 /** | |
2958 * Adds an asynchronous end timeline event to the embedder stream for the | |
2959 * current isolate. | |
2960 * | |
2961 * \param label The name of event. | |
2962 * | |
2963 * \return Returns an asynchronous id that must be passed to | |
2964 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. | |
2965 * | |
2966 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | |
2967 * this call uses GetSystemTimeAsFileTime to get the current time. | |
2968 */ | |
2969 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, | |
2970 int64_t async_id); | |
2971 | |
2972 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2838 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |