Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
2ac152a3
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
大约 1 年 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ac152a3
编写于
7月 24, 2023
作者:
1
18392170496
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix mem leak
Signed-off-by:
N
18392170496
<
magentang4@huawei.com
>
上级
ca9eb554
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
14 deletion
+9
-14
ipc/native/src/napi_common/include/napi_remote_object_holder.h
...ative/src/napi_common/include/napi_remote_object_holder.h
+0
-5
ipc/native/src/napi_common/include/napi_remote_object_internal.h
...ive/src/napi_common/include/napi_remote_object_internal.h
+0
-6
ipc/native/src/napi_common/source/napi_remote_object.cpp
ipc/native/src/napi_common/source/napi_remote_object.cpp
+5
-3
ipc/native/src/napi_common/source/napi_remote_object_holder.cpp
...tive/src/napi_common/source/napi_remote_object_holder.cpp
+4
-0
未找到文件。
ipc/native/src/napi_common/include/napi_remote_object_holder.h
浏览文件 @
2ac152a3
...
...
@@ -62,11 +62,6 @@ public:
return
descriptor_
;
};
struct
DeleteJsRefParam
{
napi_env
env
;
napi_ref
thisVarRef
;
};
private:
std
::
mutex
mutex_
;
napi_env
env_
=
nullptr
;
...
...
ipc/native/src/napi_common/include/napi_remote_object_internal.h
浏览文件 @
2ac152a3
...
...
@@ -63,12 +63,6 @@ private:
ThreadLockInfo
*
lockInfo
;
int
result
;
};
struct
OperateJsRefParam
{
napi_env
env
;
napi_ref
thisVarRef
;
napi_ref
outRef
;
ThreadLockInfo
*
lockInfo
;
};
int
OnJsRemoteRequest
(
CallbackParam
*
jsParam
);
};
...
...
ipc/native/src/napi_common/source/napi_remote_object.cpp
浏览文件 @
2ac152a3
...
...
@@ -44,9 +44,11 @@ static const uint64_t HITRACE_TAG_RPC = (1ULL << 46); // RPC and IPC tag.
static
std
::
atomic
<
int32_t
>
bytraceId
=
1000
;
static
NapiError
napiErr
;
static
constexpr
int
WAIT_TIMEOUT_MS
=
1000
;
struct
Dele
teJsRefParam
{
struct
Opera
teJsRefParam
{
napi_env
env
;
napi_ref
thisVarRef
;
napi_ref
outRef
;
ThreadLockInfo
*
lockInfo
;
};
template
<
class
T
>
...
...
@@ -107,14 +109,14 @@ static void RemoteObjectHolderRefCb(napi_env env, void *data, void *hint)
napi_get_uv_event_loop
(
workerEnv
,
&
loop
);
uv_work_t
*
work
=
new
(
std
::
nothrow
)
uv_work_t
;
NAPI_ASSERT_RETURN_VOID
(
workerEnv
,
work
!=
nullptr
,
"cb failed to new work"
);
DeleteJsRefParam
*
param
=
new
Dele
teJsRefParam
{
OperateJsRefParam
*
param
=
new
Opera
teJsRefParam
{
.
env
=
workerEnv
,
.
thisVarRef
=
ref
};
work
->
data
=
reinterpret_cast
<
void
*>
(
param
);
uv_queue_work
(
loop
,
work
,
[](
uv_work_t
*
work
)
{},
[](
uv_work_t
*
work
,
int
status
)
{
ZLOGD
(
LOG_LABEL
,
"RemoteObjectHolderRefCb decrease on uv work thread"
);
DeleteJsRefParam
*
param
=
reinterpret_cast
<
Dele
teJsRefParam
*>
(
work
->
data
);
OperateJsRefParam
*
param
=
reinterpret_cast
<
Opera
teJsRefParam
*>
(
work
->
data
);
napi_handle_scope
scope
=
nullptr
;
napi_open_handle_scope
(
param
->
env
,
&
scope
);
DecreaseJsObjectRef
(
param
->
env
,
param
->
thisVarRef
);
...
...
ipc/native/src/napi_common/source/napi_remote_object_holder.cpp
浏览文件 @
2ac152a3
...
...
@@ -22,6 +22,10 @@
namespace
OHOS
{
static
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LOG_LABEL
=
{
LOG_CORE
,
LOG_ID_IPC
,
"napi_remoteObject_holder"
};
struct
DeleteJsRefParam
{
napi_env
env
;
napi_ref
thisVarRef
;
};
NAPIRemoteObjectHolder
::
NAPIRemoteObjectHolder
(
napi_env
env
,
const
std
::
u16string
&
descriptor
,
napi_value
thisVar
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录