Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
7f77e8b6
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7f77e8b6
编写于
11月 18, 2022
作者:
H
hekun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the code check
Signed-off-by:
N
hekun
<
hekun18@huawei.com
>
上级
a6f00f1f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
11 addition
and
23 deletion
+11
-23
arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp
arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp
+11
-23
未找到文件。
arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp
浏览文件 @
7f77e8b6
...
@@ -38,7 +38,7 @@ static void add_returned_status(napi_env env,
...
@@ -38,7 +38,7 @@ static void add_returned_status(napi_env env,
napi_value
prop_value
;
napi_value
prop_value
;
if
(
actual_status
!=
expected_status
)
{
if
(
actual_status
!=
expected_status
)
{
snprintf
(
napi_message_string
,
sizeof
(
napi_message_string
),
"Invalid status [%d]"
,
actual_status
);
printf
(
"Invalid status [%d]"
,
actual_status
);
}
}
NAPI_CALL_RETURN_VOID
(
env
,
NAPI_CALL_RETURN_VOID
(
env
,
...
@@ -1396,8 +1396,7 @@ static napi_value napiDefineClass(napi_env env, napi_callback_info info)
...
@@ -1396,8 +1396,7 @@ static napi_value napiDefineClass(napi_env env, napi_callback_info info)
static
napi_value
napiRunScriptPath
(
napi_env
env
,
napi_callback_info
info
)
static
napi_value
napiRunScriptPath
(
napi_env
env
,
napi_callback_info
info
)
{
{
napi_value
value
;
napi_value
value
;
//char const* path = "/index/name";
const
char
*
path
=
"index/page"
;
const
char
*
path
=
"22"
;
napi_status
status
=
napi_run_script_path
(
env
,
path
,
&
value
);
napi_status
status
=
napi_run_script_path
(
env
,
path
,
&
value
);
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"napi_run_script_path ok"
);
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"napi_run_script_path ok"
);
...
@@ -1440,18 +1439,6 @@ static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info in
...
@@ -1440,18 +1439,6 @@ static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info in
return
value
;
return
value
;
}
}
static
void
TsFuncFinalTotalFour
(
napi_env
env
,
void
*
finalizeData
,
void
*
hint
)
{
static
uv_thread_t
guvThreadTest7
;
uv_thread_join
(
&
guvThreadTest7
);
}
static
void
TsFuncCallJsFour
(
napi_env
env
,
napi_value
tsfn_cb
,
void
*
context
,
void
*
data
)
{
int
*
pData
=
(
int
*
)
data
;
printf
(
"TsFuncCallJsFour is %p
\n
"
,
pData
);
}
static
napi_value
napiCreateThreadsafeFunction
(
napi_env
env
,
napi_callback_info
info
)
static
napi_value
napiCreateThreadsafeFunction
(
napi_env
env
,
napi_callback_info
info
)
{
{
napi_threadsafe_function
tsFunc
=
nullptr
;
napi_threadsafe_function
tsFunc
=
nullptr
;
...
@@ -1460,13 +1447,13 @@ static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info
...
@@ -1460,13 +1447,13 @@ static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info
int32_t
callJstCbDataTestId
=
101
;
int32_t
callJstCbDataTestId
=
101
;
int32_t
finalCbtDataTestID
=
1001
;
int32_t
finalCbtDataTestID
=
1001
;
napi_status
status
=
napi_create_threadsafe_function
(
env
,
nullptr
,
nullptr
,
resourceName
,
napi_status
status
=
napi_create_threadsafe_function
(
env
,
nullptr
,
nullptr
,
resourceName
,
0
,
1
,
&
callJstCbDataTestId
,
TsFuncFinalTotalFour
,
0
,
1
,
&
callJstCbDataTestId
,
nullptr
,
&
finalCbtDataTestID
,
TsFuncCallJsFou
r
,
&
tsFunc
);
&
finalCbtDataTestID
,
nullpt
r
,
&
tsFunc
);
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"napi_create_threadsafe_function
"
);
NAPI_ASSERT
(
env
,
status
!=
napi_ok
,
"napi_create_threadsafe_function failed
"
);
napi_acquire_threadsafe_function
(
tsFunc
);
napi_acquire_threadsafe_function
(
tsFunc
);
status
=
napi_unref_threadsafe_function
(
env
,
tsFunc
);
status
=
napi_unref_threadsafe_function
(
env
,
tsFunc
);
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"napi_unref_threadsafe_function
"
);
NAPI_ASSERT
(
env
,
status
!=
napi_ok
,
"napi_unref_threadsafe_function failed
"
);
napi_value
_value
;
napi_value
_value
;
NAPI_CALL
(
env
,
napi_create_int32
(
env
,
0
,
&
_value
));
NAPI_CALL
(
env
,
napi_create_int32
(
env
,
0
,
&
_value
));
...
@@ -1518,11 +1505,12 @@ static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info inf
...
@@ -1518,11 +1505,12 @@ static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info inf
int32_t
callJsCbDataTestId
=
101
;
int32_t
callJsCbDataTestId
=
101
;
int32_t
finalCbDataTestId
=
1001
;
int32_t
finalCbDataTestId
=
1001
;
napi_status
status
=
napi_create_threadsafe_function
(
env
,
nullptr
,
nullptr
,
resourceName
,
napi_status
status
=
napi_create_threadsafe_function
(
env
,
nullptr
,
nullptr
,
resourceName
,
0
,
1
,
&
callJsCbDataTestId
,
TsFuncFinalTotalFour
,
&
finalCbDataTestId
,
TsFuncCallJsFour
,
&
tsFunc
);
0
,
1
,
&
callJsCbDataTestId
,
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"napi_create_threadsafe_function"
);
nullptr
,
&
finalCbDataTestId
,
nullptr
,
&
tsFunc
);
NAPI_ASSERT
(
env
,
status
!=
napi_ok
,
"napi_create_threadsafe_function failed"
);
status
=
napi_ref_threadsafe_function
(
env
,
tsFunc
);
status
=
napi_ref_threadsafe_function
(
env
,
tsFunc
);
NAPI_ASSERT
(
env
,
status
=
=
napi_ok
,
"napi_ref_threadsafe_function"
);
NAPI_ASSERT
(
env
,
status
!
=
napi_ok
,
"napi_ref_threadsafe_function"
);
napi_value
_value
;
napi_value
_value
;
NAPI_CALL
(
env
,
napi_create_int32
(
env
,
0
,
&
_value
));
NAPI_CALL
(
env
,
napi_create_int32
(
env
,
0
,
&
_value
));
...
@@ -1602,7 +1590,7 @@ static napi_value napiFatalerror(napi_env env, napi_callback_info info)
...
@@ -1602,7 +1590,7 @@ static napi_value napiFatalerror(napi_env env, napi_callback_info info)
napi_threadsafe_function
tsfun
=
static_cast
<
napi_threadsafe_function
>
(
data
);
napi_threadsafe_function
tsfun
=
static_cast
<
napi_threadsafe_function
>
(
data
);
if
(
napi_release_threadsafe_function
(
tsfun
,
napi_tsfn_release
)
==
napi_ok
)
{
if
(
napi_release_threadsafe_function
(
tsfun
,
napi_tsfn_release
)
==
napi_ok
)
{
napi_fatal_error
(
"ReleaseThreadsafeFunction"
,
napi_fatal_error
(
"ReleaseThreadsafeFunction"
,
NAPI_AUTO_LENGTH
,
"napi_release_threadsafe_function failed"
,
NAPI_AUTO_LENGTH
);
NAPI_AUTO_LENGTH
,
"napi_release_threadsafe_function failed"
,
NAPI_AUTO_LENGTH
);
}
}
napi_value
_value
;
napi_value
_value
;
NAPI_CALL
(
env
,
napi_create_int32
(
env
,
0
,
&
_value
));
NAPI_CALL
(
env
,
napi_create_int32
(
env
,
0
,
&
_value
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录