• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup ArkTS_Napi_NativeModule
18  * @{
19  *
20  *
21  * @brief Provides native api of ArkTS native module.
22  *
23  * @since 10
24  */
25 
26 /**
27  * @file common.h
28  *
29  * @brief Defines common enum types of ArkTS native module.
30  *
31  * @kit ArkTS
32  * @library libace_napi.z.so
33  * @syscap SystemCapability.ArkUI.ArkUI.Napi
34  * @since 10
35  * @version 1.0
36  */
37 
38 #ifndef FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H
39 #define FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H
40 
41 typedef enum {
42     napi_qos_background = 0,
43     napi_qos_utility = 1,
44     napi_qos_default = 2,
45     napi_qos_user_initiated = 3,
46 } napi_qos_t;
47 
48 /**
49  * @brief Indicates the running mode of the native event loop in an asynchronous native thread.
50  *
51  * @since 12
52  */
53 typedef enum {
54     /**
55      * In this mode, the current asynchronous thread will be blocked and events of native event loop will
56      * be processed.
57      */
58     napi_event_mode_default = 0,
59 
60     /**
61      * In this mode, the current asynchronous thread will not be blocked. If there are events in the event loop,
62      * only one event will be processed and then the event loop will stop. If there are no events in the loop,
63      * the event loop will stop immediately.
64      */
65     napi_event_mode_nowait = 1,
66 } napi_event_mode;
67 
68 /**
69  * @brief Indicates the priority of a task dispatched from native thread to ArkTS thread.
70  *
71  * @since 12
72  */
73 typedef enum {
74     /**
75      * The immediate priority tasks should be promptly processed whenever feasible.
76      */
77     napi_priority_immediate = 0,
78     /**
79      * The high priority tasks, as sorted by their handle time, should be prioritized over tasks with low priority.
80      */
81     napi_priority_high = 1,
82     /**
83      * The low priority tasks, as sorted by their handle time, should be processed before idle priority tasks.
84      */
85     napi_priority_low = 2,
86     /**
87      * The idle priority tasks should be processed immediately only if there are no other priority tasks.
88      */
89     napi_priority_idle = 3,
90 } napi_task_priority;
91 
92 /** @} */
93 #endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H */
94