From 420be409e45791cc5a4df0bbc95e637c39b32e2c Mon Sep 17 00:00:00 2001 From: zhangsizheng Date: Tue, 29 Apr 2025 17:24:37 +0800 Subject: [PATCH] =?UTF-8?q?Add=20OH=5FJSVM=5FSetDebugOption=E8=93=9D?= =?UTF-8?q?=E9=BB=84=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangsizheng --- ark_runtime/jsvm/jsvm.h | 15 +++++++++++++++ ark_runtime/jsvm/jsvm_types.h | 11 ++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 06f4ce767..f38870737 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -3567,6 +3567,20 @@ JSVM_EXTERN JSVM_Status OH_JSVM_TraceStop(JSVM_OutputStream stream, void* stream JSVM_EXTERN JSVM_Status OH_JSVM_SetHandlerForOOMError(JSVM_VM vm, JSVM_HandlerForOOMError handler); +/** + * @brief This API is used to enable/disable the given debug option for a certain JSVM_Env. + * + * @param env The environment that the API is invoked under. + * @param debugOption The debug option to be changed. + * @param isEnabled Whether to enable or disable the debug option. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if env is NULL.\n + * + * @since 20 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetDebugOption(JSVM_Env env, JSVM_DebugOption debugOption, bool isEnabled); + /** * @brief Set Handler For Fatal Error. If this function is invoked repeatedly, * only the last time takes effect. When handler is null, the previous setting is canceled. @@ -3675,6 +3689,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RemoveHandlerForGC(JSVM_VM vm, JSVM_CBTriggerTimeForGC triggerTime, JSVM_HandlerForGC handler, void* userData); + EXTERN_C_END /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_H */ diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 8432207c5..abf19d57c 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -1008,13 +1008,22 @@ typedef void(JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, JSVM_GCType gcType, JSVM_GCCallbackFlags flags, void* data); - /** * @brief To represent a JavaScript Data type. * * @since 18 */ typedef struct JSVM_Data__* JSVM_Data; + +/** + * @brief Debug options. + * + * @since 20 + */ +typedef enum { + /** Scope check. */ + JSVM_SCOPE_CHECK, +} JSVM_DebugOption; /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */ -- Gitee