Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
09a5d287
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,发现更多精彩内容 >>
提交
09a5d287
编写于
11月 11, 2022
作者:
“
“zhangboyuan”
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipc告警处理
Signed-off-by:
N
“zhangboyuan”
<
zhangboyuan1@huawei.com
>
上级
8285463f
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
221 addition
and
221 deletion
+221
-221
ipc/native/src/core/include/ipc_thread_skeleton.h
ipc/native/src/core/include/ipc_thread_skeleton.h
+2
-2
ipc/native/src/core/source/buffer_object.cpp
ipc/native/src/core/source/buffer_object.cpp
+10
-10
ipc/native/src/mock/include/dbinder_base_invoker.h
ipc/native/src/mock/include/dbinder_base_invoker.h
+16
-16
ipc/native/src/mock/source/binder_invoker.cpp
ipc/native/src/mock/source/binder_invoker.cpp
+4
-4
ipc/native/src/napi/include/napi_ashmem.h
ipc/native/src/napi/include/napi_ashmem.h
+4
-4
ipc/native/src/napi/include/napi_message_parcel.h
ipc/native/src/napi/include/napi_message_parcel.h
+61
-61
ipc/native/src/napi/include/napi_message_sequence.h
ipc/native/src/napi/include/napi_message_sequence.h
+61
-61
ipc/native/src/napi/include/napi_remote_object.h
ipc/native/src/napi/include/napi_remote_object.h
+2
-2
ipc/native/src/napi/include/napi_rpc_error.h
ipc/native/src/napi/include/napi_rpc_error.h
+1
-1
ipc/native/src/napi/src/napi_message_option.cpp
ipc/native/src/napi/src/napi_message_option.cpp
+1
-1
ipc/native/src/napi/src/napi_message_parcel.cpp
ipc/native/src/napi/src/napi_message_parcel.cpp
+26
-26
ipc/native/src/napi/src/napi_message_sequence.cpp
ipc/native/src/napi/src/napi_message_sequence.cpp
+8
-8
ipc/native/src/napi/src/napi_remote_object.cpp
ipc/native/src/napi/src/napi_remote_object.cpp
+17
-17
ipc/native/src/napi/src/napi_remote_proxy.cpp
ipc/native/src/napi/src/napi_remote_proxy.cpp
+6
-6
ipc/native/src/napi/src/napi_rpc_native_module.cpp
ipc/native/src/napi/src/napi_rpc_native_module.cpp
+2
-2
未找到文件。
ipc/native/src/core/include/ipc_thread_skeleton.h
浏览文件 @
09a5d287
...
...
@@ -47,9 +47,9 @@ public:
static
IRemoteInvoker
*
GetProxyInvoker
(
IRemoteObject
*
object
);
// Joint Current thread into IPC Work Group
void
JoinWorkThread
(
int
prot
o
);
void
JoinWorkThread
(
int
prot
);
// Quit current thread from IPC work group.
void
StopWorkThread
(
int
prot
o
);
void
StopWorkThread
(
int
prot
);
private:
static
pthread_key_t
TLSKey_
;
...
...
ipc/native/src/core/source/buffer_object.cpp
浏览文件 @
09a5d287
...
...
@@ -90,23 +90,23 @@ char *BufferObject::GetSendBufferAndLock(uint32_t size)
}
sendMutex_
.
lock
();
if
(
needSize
>
sendBuffSize_
)
{
char
*
newBuffer
_
=
new
(
std
::
nothrow
)
char
[
needSize
];
if
(
newBuffer
_
==
nullptr
)
{
char
*
newBuffer
=
new
(
std
::
nothrow
)
char
[
needSize
];
if
(
newBuffer
==
nullptr
)
{
sendMutex_
.
unlock
();
return
nullptr
;
}
if
((
sendBuffer_
!=
nullptr
)
&&
(
sendBuffSize_
!=
0
))
{
int
memcpyResult
=
memcpy_s
(
newBuffer
_
,
needSize
,
sendBuffer_
,
sendBuffSize_
);
int
memcpyResult
=
memcpy_s
(
newBuffer
,
needSize
,
sendBuffer_
,
sendBuffSize_
);
if
(
memcpyResult
!=
0
)
{
delete
[]
newBuffer
_
;
delete
[]
newBuffer
;
sendMutex_
.
unlock
();
return
nullptr
;
}
}
delete
[]
sendBuffer_
;
sendBuffer_
=
newBuffer
_
;
sendBuffer_
=
newBuffer
;
sendBuffSize_
=
needSize
;
}
...
...
@@ -122,23 +122,23 @@ char *BufferObject::GetReceiveBufferAndLock(uint32_t size)
}
recvMutex_
.
lock
();
if
(
needSize
>
recvBuffSize_
)
{
char
*
newBuffer
_
=
new
(
std
::
nothrow
)
char
[
needSize
];
if
(
newBuffer
_
==
nullptr
)
{
char
*
newBuffer
=
new
(
std
::
nothrow
)
char
[
needSize
];
if
(
newBuffer
==
nullptr
)
{
recvMutex_
.
unlock
();
return
nullptr
;
}
if
((
receiveBuffer_
!=
nullptr
)
&&
(
recvBuffSize_
!=
0
))
{
int
memcpyResult
=
memcpy_s
(
newBuffer
_
,
needSize
,
receiveBuffer_
,
recvBuffSize_
);
int
memcpyResult
=
memcpy_s
(
newBuffer
,
needSize
,
receiveBuffer_
,
recvBuffSize_
);
if
(
memcpyResult
!=
0
)
{
delete
[]
newBuffer
_
;
delete
[]
newBuffer
;
recvMutex_
.
unlock
();
return
nullptr
;
}
}
delete
[]
receiveBuffer_
;
receiveBuffer_
=
newBuffer
_
;
receiveBuffer_
=
newBuffer
;
recvBuffSize_
=
needSize
;
}
...
...
ipc/native/src/mock/include/dbinder_base_invoker.h
浏览文件 @
09a5d287
...
...
@@ -108,12 +108,12 @@ private:
int
WaitForReply
(
uint64_t
seqNumber
,
MessageParcel
*
reply
,
std
::
shared_ptr
<
T
>
sessionObject
,
int
userWaitTime
);
void
ProcessTransaction
(
dbinder_transaction_data
*
tr
,
uint32_t
listenFd
);
void
ProcessReply
(
dbinder_transaction_data
*
tr
,
uint32_t
listenFd
);
bool
IRemoteObjectTranslate
(
char
*
dataBuffer
,
binder_size_t
buffer
_s
ize
,
MessageParcel
&
data
,
uint32_t
socketId
,
bool
IRemoteObjectTranslate
(
char
*
dataBuffer
,
binder_size_t
buffer
S
ize
,
MessageParcel
&
data
,
uint32_t
socketId
,
std
::
shared_ptr
<
T
>
sessionObject
);
bool
TranslateRawData
(
char
*
dataBuffer
,
MessageParcel
&
data
,
uint32_t
socketId
);
std
::
shared_ptr
<
T
>
GetSessionObject
(
uint32_t
handle
,
uint32_t
socketId
);
uint64_t
GetUniqueSeqNumber
(
int
cmd
);
void
ConstructTransData
(
dbinder_transaction_data
&
T
ransData
,
size_t
totalSize
,
uint64_t
seqNum
,
int
cmd
,
__u32
code
,
void
ConstructTransData
(
dbinder_transaction_data
&
t
ransData
,
size_t
totalSize
,
uint64_t
seqNum
,
int
cmd
,
__u32
code
,
__u32
flags
);
bool
ProcessRawData
(
std
::
shared_ptr
<
T
>
sessionObject
,
MessageParcel
&
data
,
uint64_t
seqNum
);
std
::
shared_ptr
<
dbinder_transaction_data
>
ProcessNormalData
(
std
::
shared_ptr
<
T
>
sessionObject
,
MessageParcel
&
data
,
...
...
@@ -227,7 +227,7 @@ bool DBinderBaseInvoker<T>::TranslateRemoteHandleType(flat_binder_object *binder
/* check data parcel contains object, if yes, get its session as payload of socket packet */
template
<
class
T
>
bool
DBinderBaseInvoker
<
T
>::
IRemoteObjectTranslate
(
char
*
dataBuffer
,
binder_size_t
buffer
_s
ize
,
MessageParcel
&
data
,
bool
DBinderBaseInvoker
<
T
>::
IRemoteObjectTranslate
(
char
*
dataBuffer
,
binder_size_t
buffer
S
ize
,
MessageParcel
&
data
,
uint32_t
socketId
,
std
::
shared_ptr
<
T
>
sessionObject
)
{
if
(
data
.
GetOffsetsSize
()
<=
0
||
dataBuffer
==
nullptr
)
{
...
...
@@ -236,7 +236,7 @@ bool DBinderBaseInvoker<T>::IRemoteObjectTranslate(char *dataBuffer, binder_size
uint32_t
totalSize
=
0
;
binder_size_t
*
binderObjectsOffsets
=
reinterpret_cast
<
binder_size_t
*>
(
data
.
GetObjectOffsets
());
uint32_t
offsetOfSession
=
buffer
_s
ize
+
data
.
GetOffsetsSize
()
*
sizeof
(
binder_size_t
);
uint32_t
offsetOfSession
=
buffer
S
ize
+
data
.
GetOffsetsSize
()
*
sizeof
(
binder_size_t
);
char
*
flatOffset
=
dataBuffer
+
offsetOfSession
;
for
(
size_t
i
=
0
;
i
<
data
.
GetOffsetsSize
();
i
++
)
{
...
...
@@ -353,20 +353,20 @@ template <class T> uint64_t DBinderBaseInvoker<T>::GetUniqueSeqNumber(int cmd)
}
template
<
class
T
>
void
DBinderBaseInvoker
<
T
>::
ConstructTransData
(
dbinder_transaction_data
&
T
ransData
,
size_t
totalSize
,
uint64_t
seqNum
,
void
DBinderBaseInvoker
<
T
>::
ConstructTransData
(
dbinder_transaction_data
&
t
ransData
,
size_t
totalSize
,
uint64_t
seqNum
,
int
cmd
,
__u32
code
,
__u32
flags
)
{
T
ransData
.
sizeOfSelf
=
totalSize
;
T
ransData
.
magic
=
DBINDER_MAGICWORD
;
T
ransData
.
version
=
VERSION_NUM
;
T
ransData
.
cmd
=
cmd
;
T
ransData
.
code
=
code
;
T
ransData
.
flags
=
flags
;
T
ransData
.
cookie
=
0
;
T
ransData
.
seqNumber
=
seqNum
;
T
ransData
.
buffer_size
=
0
;
T
ransData
.
offsets_size
=
0
;
T
ransData
.
offsets
=
0
;
t
ransData
.
sizeOfSelf
=
totalSize
;
t
ransData
.
magic
=
DBINDER_MAGICWORD
;
t
ransData
.
version
=
VERSION_NUM
;
t
ransData
.
cmd
=
cmd
;
t
ransData
.
code
=
code
;
t
ransData
.
flags
=
flags
;
t
ransData
.
cookie
=
0
;
t
ransData
.
seqNumber
=
seqNum
;
t
ransData
.
buffer_size
=
0
;
t
ransData
.
offsets_size
=
0
;
t
ransData
.
offsets
=
0
;
}
template
<
class
T
>
...
...
ipc/native/src/mock/source/binder_invoker.cpp
浏览文件 @
09a5d287
...
...
@@ -350,7 +350,7 @@ void BinderInvoker::OnBinderDied()
void
BinderInvoker
::
OnAcquireObject
(
uint32_t
cmd
)
{
bool
P
arcelResult
=
false
;
bool
p
arcelResult
=
false
;
uintptr_t
refsPointer
=
input_
.
ReadPointer
();
uintptr_t
objectPointer
=
input_
.
ReadPointer
();
RefBase
*
refs
=
reinterpret_cast
<
IRemoteObject
*>
(
refsPointer
);
...
...
@@ -362,13 +362,13 @@ void BinderInvoker::OnAcquireObject(uint32_t cmd)
size_t
rewindPos
=
output_
.
GetWritePosition
();
if
(
cmd
==
BR_ACQUIRE
)
{
refs
->
IncStrongRef
(
this
);
P
arcelResult
=
output_
.
WriteInt32
(
BC_ACQUIRE_DONE
);
p
arcelResult
=
output_
.
WriteInt32
(
BC_ACQUIRE_DONE
);
}
else
{
refs
->
IncWeakRef
(
this
);
P
arcelResult
=
output_
.
WriteInt32
(
BC_INCREFS_DONE
);
p
arcelResult
=
output_
.
WriteInt32
(
BC_INCREFS_DONE
);
}
if
(
!
P
arcelResult
||
!
output_
.
WritePointer
(
refsPointer
))
{
if
(
!
p
arcelResult
||
!
output_
.
WritePointer
(
refsPointer
))
{
if
(
!
output_
.
RewindWrite
(
rewindPos
))
{
output_
.
FlushBuffer
();
}
...
...
ipc/native/src/napi/include/napi_ashmem.h
浏览文件 @
09a5d287
...
...
@@ -44,7 +44,7 @@ public:
}
static
napi_value
AshmemExport
(
napi_env
env
,
napi_value
exports
);
private:
static
napi_value
Ashmem_JS_Constructor
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
Ashmem_JS_Constructor
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
CloseAshmem
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
CreateAshmem
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
Create
(
napi_env
env
,
napi_callback_info
info
);
...
...
@@ -64,9 +64,9 @@ private:
static
napi_value
WriteToAshmem
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
WriteAshmem
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetAshmemFromExisting
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetAshmemConstructor
(
napi_env
env
,
napi_value
*
info
);
static
napi_value
getNewAshmemConstructor
(
napi_env
env
,
napi_value
&
info
,
int32_t
fd
,
uint32_t
size
);
static
napi_value
CheckWriteAshmemParams
(
napi_env
env
,
size_t
argc
,
napi_value
*
info
);
static
napi_value
GetAshmemConstructor
(
napi_env
env
,
napi_value
*
argv
);
static
napi_value
getNewAshmemConstructor
(
napi_env
env
,
napi_value
&
constructor
,
int32_t
fd
,
uint32_t
size
);
static
napi_value
CheckWriteAshmemParams
(
napi_env
env
,
size_t
argc
,
napi_value
*
argv
);
static
napi_value
TransferByteToJsData
(
napi_env
env
,
uint32_t
size
,
const
void
*
result
);
sptr
<
Ashmem
>
ashmem_
;
...
...
ipc/native/src/napi/include/napi_message_parcel.h
浏览文件 @
09a5d287
...
...
@@ -32,68 +32,68 @@ public:
static
napi_value
Export
(
napi_env
env
,
napi_value
exports
);
private:
// Napi methods and properties
static
napi_value
JS_create
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_reclaim
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeRemoteObject
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readRemoteObject
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeInterfaceToken
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readInterfaceToken
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getSize
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getCapacity
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_setSize
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_setCapacity
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getWritableBytes
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getReadableBytes
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getReadPosition
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getWritePosition
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_rewindWrite
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_rewindRead
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeNoException
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readException
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_create
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_reclaim
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeRemoteObject
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readRemoteObject
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeInterfaceToken
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readInterfaceToken
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getSize
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getCapacity
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_setSize
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_setCapacity
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getWritableBytes
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getReadableBytes
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getReadPosition
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getWritePosition
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_rewindWrite
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_rewindRead
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeNoException
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readException
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeByte
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeShort
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeInt
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeLong
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeFloat
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeDouble
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeBoolean
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeChar
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeString
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeSequenceable
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeByteArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeShortArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeIntArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeLongArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeFloatArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeDoubleArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeBooleanArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeCharArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeStringArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeSequenceableArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeRemoteObjectArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeByte
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeShort
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeInt
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeLong
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeFloat
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeDouble
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeBoolean
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeChar
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeString
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeSequenceable
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeByteArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeShortArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeIntArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeLongArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeFloatArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeDoubleArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeBooleanArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeCharArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeStringArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeSequenceableArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeRemoteObjectArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readByte
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readShort
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readInt
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readLong
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readFloat
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readDouble
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readBoolean
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readChar
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readString
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readSequenceable
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readByteArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readShortArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readIntArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readLongArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readFloatArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readDoubleArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readBooleanArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readCharArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readStringArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readSequenceableArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readRemoteObjectArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readByte
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readShort
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readInt
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readLong
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readFloat
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readDouble
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readBoolean
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readChar
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readString
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readSequenceable
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readByteArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readShortArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readIntArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readLongArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readFloatArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readDoubleArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readBooleanArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readCharArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readStringArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readSequenceableArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readRemoteObjectArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_CloseFileDescriptor
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_DupFileDescriptor
(
napi_env
env
,
napi_callback_info
info
);
...
...
@@ -106,7 +106,7 @@ private:
static
napi_value
JS_WriteRawData
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_ReadRawData
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_constructor
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_constructor
(
napi_env
env
,
napi_callback_info
info
);
static
void
release
(
MessageParcel
*
parcel
);
napi_env
env_
=
nullptr
;
...
...
ipc/native/src/napi/include/napi_message_sequence.h
浏览文件 @
09a5d287
...
...
@@ -33,68 +33,68 @@ public:
static
napi_value
Export
(
napi_env
env
,
napi_value
exports
);
private:
// Napi methods and properties
static
napi_value
JS_create
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_reclaim
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeRemoteObject
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readRemoteObject
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeInterfaceToken
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readInterfaceToken
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getSize
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getCapacity
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_setSize
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_setCapacity
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getWritableBytes
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getReadableBytes
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getReadPosition
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_getWritePosition
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_rewindWrite
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_rewindRead
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeNoException
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readException
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_create
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_reclaim
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeRemoteObject
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readRemoteObject
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeInterfaceToken
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readInterfaceToken
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getSize
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getCapacity
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_setSize
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_setCapacity
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getWritableBytes
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getReadableBytes
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getReadPosition
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_getWritePosition
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_rewindWrite
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_rewindRead
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeNoException
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readException
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeByte
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeShort
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeInt
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeLong
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeFloat
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeDouble
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeBoolean
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeChar
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeString
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeParcelable
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeByteArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeShortArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeIntArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeLongArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeFloatArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeDoubleArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeBooleanArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeCharArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeStringArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeParcelableArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeRemoteObjectArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_writeByte
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeShort
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeInt
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeLong
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeFloat
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeDouble
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeBoolean
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeChar
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeString
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeParcelable
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeByteArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeShortArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeIntArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeLongArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeFloatArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeDoubleArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeBooleanArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeCharArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeStringArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeParcelableArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_writeRemoteObjectArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readByte
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readShort
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readInt
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readLong
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readFloat
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readDouble
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readBoolean
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readChar
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readString
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readParcelable
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readByteArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readShortArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readIntArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readLongArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readFloatArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readDoubleArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readBooleanArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readCharArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readStringArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readParcelableArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readRemoteObjectArray
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_readByte
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readShort
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readInt
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readLong
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readFloat
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readDouble
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readBoolean
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readChar
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readString
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readParcelable
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readByteArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readShortArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readIntArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readLongArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readFloatArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readDoubleArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readBooleanArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readCharArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readStringArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readParcelableArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_readRemoteObjectArray
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_CloseFileDescriptor
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_DupFileDescriptor
(
napi_env
env
,
napi_callback_info
info
);
...
...
@@ -107,7 +107,7 @@ private:
static
napi_value
JS_WriteRawData
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_ReadRawData
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JS_constructor
(
napi_env
env
,
napi_callback_info
cb
info
);
static
napi_value
JS_constructor
(
napi_env
env
,
napi_callback_info
info
);
static
void
release
(
MessageParcel
*
parcel
);
static
napi_value
JS_checkWriteByteArrayArgs
(
napi_env
env
,
size_t
argc
,
napi_value
*
argv
,
uint32_t
&
arrayLength
);
...
...
ipc/native/src/napi/include/napi_remote_object.h
浏览文件 @
09a5d287
...
...
@@ -38,11 +38,11 @@ EXTERN_C_END
*/
class
NAPIDeathRecipient
:
public
IRemoteObject
::
DeathRecipient
{
public:
explicit
NAPIDeathRecipient
(
napi_env
env
,
napi_value
jsRecipient
);
explicit
NAPIDeathRecipient
(
napi_env
env
,
napi_value
js
Death
Recipient
);
void
OnRemoteDied
(
const
wptr
<
IRemoteObject
>
&
object
)
override
;
bool
Matches
(
napi_value
jsRecipien
t
);
bool
Matches
(
napi_value
objec
t
);
protected:
virtual
~
NAPIDeathRecipient
();
...
...
ipc/native/src/napi/include/napi_rpc_error.h
浏览文件 @
09a5d287
...
...
@@ -49,7 +49,7 @@ public:
NapiError
()
{};
NapiError
(
int32_t
errorCode
)
:
errorCode_
(
errorCode
)
{};
napi_value
GetError
(
napi_env
&
env
)
const
;
napi_value
ThrowError
(
napi_env
&
env
,
int32_t
errorC
ode
=
-
1
);
napi_value
ThrowError
(
napi_env
&
env
,
int32_t
c
ode
=
-
1
);
inline
void
Error
(
int32_t
errorCode
)
{
errorCode_
=
(
errorCode
!=
-
1
)
?
errorCode
:
errorCode_
;
...
...
ipc/native/src/napi/src/napi_message_option.cpp
浏览文件 @
09a5d287
...
...
@@ -98,7 +98,7 @@ napi_value NapiOhosRpcMessageOptionSetAsync(napi_env env, napi_callback_info inf
MessageOption
*
option
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
option
);
NAPI_ASSERT
(
env
,
option
!=
nullptr
,
"failed to get native message option"
);
option
->
SetFlags
(
static_cast
<
int32_t
>
(
flags
));
option
->
SetFlags
(
static_cast
<
int32_t
>
(
flags
));
napi_value
result
=
nullptr
;
napi_get_undefined
(
env
,
&
result
);
return
result
;
...
...
ipc/native/src/napi/src/napi_message_parcel.cpp
浏览文件 @
09a5d287
...
...
@@ -919,7 +919,7 @@ napi_value NAPI_MessageParcel::JS_readByte(napi_env env, napi_callback_info info
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int8_t
value
=
napiParcel
->
nativeParcel_
->
ReadInt8
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -934,7 +934,7 @@ napi_value NAPI_MessageParcel::JS_readShort(napi_env env, napi_callback_info inf
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int16_t
value
=
napiParcel
->
nativeParcel_
->
ReadInt16
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -949,7 +949,7 @@ napi_value NAPI_MessageParcel::JS_readInt(napi_env env, napi_callback_info info)
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int32_t
value
=
napiParcel
->
nativeParcel_
->
ReadInt32
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -964,7 +964,7 @@ napi_value NAPI_MessageParcel::JS_readLong(napi_env env, napi_callback_info info
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int64_t
value
=
napiParcel
->
nativeParcel_
->
ReadInt64
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -979,7 +979,7 @@ napi_value NAPI_MessageParcel::JS_readFloat(napi_env env, napi_callback_info inf
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
double
value
=
napiParcel
->
nativeParcel_
->
ReadDouble
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -994,7 +994,7 @@ napi_value NAPI_MessageParcel::JS_readDouble(napi_env env, napi_callback_info in
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
double
value
=
napiParcel
->
nativeParcel_
->
ReadDouble
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1009,7 +1009,7 @@ napi_value NAPI_MessageParcel::JS_readBoolean(napi_env env, napi_callback_info i
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int8_t
value
=
napiParcel
->
nativeParcel_
->
ReadInt8
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1024,7 +1024,7 @@ napi_value NAPI_MessageParcel::JS_readChar(napi_env env, napi_callback_info info
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
uint8_t
value
=
napiParcel
->
nativeParcel_
->
ReadUint8
();
napi_value
result
=
nullptr
;
...
...
@@ -1039,7 +1039,7 @@ napi_value NAPI_MessageParcel::JS_readString(napi_env env, napi_callback_info in
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
std
::
u16string
parcelString
=
napiParcel
->
nativeParcel_
->
ReadString16
();
std
::
string
outString
=
Str16ToStr8
(
parcelString
.
c_str
());
...
...
@@ -1056,7 +1056,7 @@ napi_value NAPI_MessageParcel::JS_getSize(napi_env env, napi_callback_info info)
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
size_t
value
=
napiParcel
->
nativeParcel_
->
GetDataSize
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1072,7 +1072,7 @@ napi_value NAPI_MessageParcel::JS_getCapacity(napi_env env, napi_callback_info i
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
size_t
value
=
napiParcel
->
nativeParcel_
->
GetDataCapacity
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1143,7 +1143,7 @@ napi_value NAPI_MessageParcel::JS_getWritableBytes(napi_env env, napi_callback_i
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
size_t
value
=
napiParcel
->
nativeParcel_
->
GetWritableBytes
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1159,7 +1159,7 @@ napi_value NAPI_MessageParcel::JS_getReadableBytes(napi_env env, napi_callback_i
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
size_t
value
=
napiParcel
->
nativeParcel_
->
GetReadableBytes
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1175,7 +1175,7 @@ napi_value NAPI_MessageParcel::JS_getReadPosition(napi_env env, napi_callback_in
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
size_t
value
=
napiParcel
->
nativeParcel_
->
GetReadPosition
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1217,7 +1217,7 @@ napi_value NAPI_MessageParcel::JS_getWritePosition(napi_env env, napi_callback_i
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
size_t
value
=
napiParcel
->
nativeParcel_
->
GetWritePosition
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1861,7 +1861,7 @@ napi_value NAPI_MessageParcel::JS_readSequenceable(napi_env env, napi_callback_i
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int32_t
len
=
napiParcel
->
nativeParcel_
->
ReadInt32
();
if
(
len
>
0
)
{
...
...
@@ -1952,7 +1952,7 @@ napi_value NAPI_MessageParcel::JS_readRemoteObject(napi_env env, napi_callback_i
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
sptr
<
IRemoteObject
>
value
=
napiParcel
->
nativeParcel_
->
ReadRemoteObject
();
napi_value
napiValue
=
NAPI_ohos_rpc_CreateJsRemoteObject
(
env
,
value
);
...
...
@@ -2002,7 +2002,7 @@ napi_value NAPI_MessageParcel::JS_readInterfaceToken(napi_env env, napi_callback
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
std
::
u16string
parcelString
=
napiParcel
->
nativeParcel_
->
ReadInterfaceToken
();
std
::
string
outString
=
Str16ToStr8
(
parcelString
.
c_str
());
...
...
@@ -2054,7 +2054,7 @@ napi_value NAPI_MessageParcel::JS_ContainFileDescriptors(napi_env env, napi_call
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
bool
result
=
napiParcel
->
nativeParcel_
->
ContainFileDescriptors
();
napi_value
napiValue
=
nullptr
;
NAPI_CALL
(
env
,
napi_get_boolean
(
env
,
result
,
&
napiValue
));
...
...
@@ -2075,7 +2075,7 @@ napi_value NAPI_MessageParcel::JS_WriteFileDescriptor(napi_env env, napi_callbac
napi_get_value_int32
(
env
,
argv
[
0
],
&
fd
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
bool
result
=
napiParcel
->
nativeParcel_
->
WriteFileDescriptor
(
fd
);
napi_value
napiValue
=
nullptr
;
NAPI_CALL
(
env
,
napi_get_boolean
(
env
,
result
,
&
napiValue
));
...
...
@@ -2089,7 +2089,7 @@ napi_value NAPI_MessageParcel::JS_ReadFileDescriptor(napi_env env, napi_callback
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
int32_t
result
=
napiParcel
->
nativeParcel_
->
ReadFileDescriptor
();
napi_value
napiValue
;
napi_create_int32
(
env
,
result
,
&
napiValue
);
...
...
@@ -2135,7 +2135,7 @@ napi_value NAPI_MessageParcel::JS_ReadAshmem(napi_env env, napi_callback_info in
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
sptr
<
Ashmem
>
nativeAshmem
=
napiParcel
->
nativeParcel_
->
ReadAshmem
();
napi_value
global
=
nullptr
;
napi_status
status
=
napi_get_global
(
env
,
&
global
);
...
...
@@ -2188,7 +2188,7 @@ napi_value NAPI_MessageParcel::JS_WriteRawData(napi_env env, napi_callback_info
napi_get_value_int32
(
env
,
argv
[
1
],
&
size
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
bool
result
=
napiParcel
->
nativeParcel_
->
WriteRawData
(
array
.
data
(),
size
*
BYTE_SIZE_32
);
napi_value
napiValue
=
nullptr
;
NAPI_CALL
(
env
,
napi_get_boolean
(
env
,
result
,
&
napiValue
));
...
...
@@ -2209,9 +2209,9 @@ napi_value NAPI_MessageParcel::JS_ReadRawData(napi_env env, napi_callback_info i
napi_get_value_int32
(
env
,
argv
[
0
],
&
arraySize
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
const
void
*
rawData
=
napiParcel
->
nativeParcel_
->
ReadRawData
(
arraySize
*
BYTE_SIZE_32
);
NAPI_ASSERT_BASE
(
env
,
rawData
!=
nullptr
,
"rawData is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
rawData
!=
nullptr
,
"rawData is null"
,
nullptr
);
// [c++] rawData -> byteBuffer()[js]
napi_value
result
=
nullptr
;
if
(
arraySize
<=
0
)
{
...
...
@@ -2235,7 +2235,7 @@ napi_value NAPI_MessageParcel::JS_GetRawDataCapacity(napi_env env, napi_callback
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageParcel
*
napiParcel
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiParcel
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiParcel
!=
nullptr
,
"napiParcel is null"
,
nullptr
);
uint32_t
result
=
napiParcel
->
nativeParcel_
->
GetRawDataCapacity
();
napi_value
napiValue
;
napi_create_uint32
(
env
,
result
,
&
napiValue
);
...
...
ipc/native/src/napi/src/napi_message_sequence.cpp
浏览文件 @
09a5d287
...
...
@@ -1346,7 +1346,7 @@ napi_value NAPI_MessageSequence::JS_getSize(napi_env env, napi_callback_info inf
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
size_t
value
=
napiSequence
->
nativeParcel_
->
GetDataSize
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1362,7 +1362,7 @@ napi_value NAPI_MessageSequence::JS_getCapacity(napi_env env, napi_callback_info
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
size_t
value
=
napiSequence
->
nativeParcel_
->
GetDataCapacity
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1457,7 +1457,7 @@ napi_value NAPI_MessageSequence::JS_getWritableBytes(napi_env env, napi_callback
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
size_t
value
=
napiSequence
->
nativeParcel_
->
GetWritableBytes
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1473,7 +1473,7 @@ napi_value NAPI_MessageSequence::JS_getReadableBytes(napi_env env, napi_callback
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
size_t
value
=
napiSequence
->
nativeParcel_
->
GetReadableBytes
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1489,7 +1489,7 @@ napi_value NAPI_MessageSequence::JS_getReadPosition(napi_env env, napi_callback_
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
size_t
value
=
napiSequence
->
nativeParcel_
->
GetReadPosition
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -1543,7 +1543,7 @@ napi_value NAPI_MessageSequence::JS_getWritePosition(napi_env env, napi_callback
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
size_t
value
=
napiSequence
->
nativeParcel_
->
GetWritePosition
();
napi_value
napiValue
=
nullptr
;
...
...
@@ -2500,7 +2500,7 @@ napi_value NAPI_MessageSequence::JS_ContainFileDescriptors(napi_env env, napi_ca
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
bool
result
=
napiSequence
->
nativeParcel_
->
ContainFileDescriptors
();
napi_value
napiValue
=
nullptr
;
NAPI_CALL
(
env
,
napi_get_boolean
(
env
,
result
,
&
napiValue
));
...
...
@@ -2788,7 +2788,7 @@ napi_value NAPI_MessageSequence::JS_GetRawDataCapacity(napi_env env, napi_callba
napi_get_cb_info
(
env
,
info
,
&
argc
,
nullptr
,
&
thisVar
,
nullptr
);
NAPI_MessageSequence
*
napiSequence
=
nullptr
;
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
napiSequence
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
0
);
NAPI_ASSERT_BASE
(
env
,
napiSequence
!=
nullptr
,
"napiSequence is null"
,
nullptr
);
uint32_t
result
=
napiSequence
->
nativeParcel_
->
GetRawDataCapacity
();
napi_value
napiValue
;
napi_create_uint32
(
env
,
result
,
&
napiValue
);
...
...
ipc/native/src/napi/src/napi_remote_object.cpp
浏览文件 @
09a5d287
...
...
@@ -445,7 +445,7 @@ napi_value NAPIRemoteObject::ThenCallback(napi_env env, napi_callback_info info)
napi_value
NAPIRemoteObject
::
CatchCallback
(
napi_env
env
,
napi_callback_info
info
)
{
ZLOGI
(
LOG_LABEL
,
"Async onReomteReuqest's return
_v
al is rejected"
);
ZLOGI
(
LOG_LABEL
,
"Async onReomteReuqest's return
V
al is rejected"
);
size_t
argc
=
1
;
napi_value
argv
[
1
]
=
{
nullptr
};
void
*
data
=
nullptr
;
...
...
@@ -668,8 +668,8 @@ int NAPIRemoteObject::OnJsRemoteRequest(CallbackParam *jsParam)
// start to call onRemoteRequest
size_t
argc2
=
4
;
napi_value
argv2
[]
=
{
jsCode
,
jsData
,
jsReply
,
jsOption
};
napi_value
return
_v
al
;
napi_status
ret
=
napi_call_function
(
param
->
env
,
thisVar
,
onRemoteRequest
,
argc2
,
argv2
,
&
return
_v
al
);
napi_value
return
V
al
;
napi_status
ret
=
napi_call_function
(
param
->
env
,
thisVar
,
onRemoteRequest
,
argc2
,
argv2
,
&
return
V
al
);
// Reset old calling pid, uid, device id
NAPI_RemoteObject_resetOldCallingInfo
(
param
->
env
,
oldCallingInfo
);
...
...
@@ -683,11 +683,11 @@ int NAPIRemoteObject::OnJsRemoteRequest(CallbackParam *jsParam)
ZLOGD
(
LOG_LABEL
,
"call js onRemoteRequest done"
);
// Check whether return_val is Promise
bool
returnIsPromise
=
false
;
//
napi_is_promise
(
param
->
env
,
return
_v
al
,
&
returnIsPromise
);
napi_is_promise
(
param
->
env
,
return
V
al
,
&
returnIsPromise
);
if
(
!
returnIsPromise
)
{
ZLOGD
(
LOG_LABEL
,
"onRemoteRequest is synchronous"
);
bool
result
=
false
;
napi_get_value_bool
(
param
->
env
,
return
_v
al
,
&
result
);
napi_get_value_bool
(
param
->
env
,
return
V
al
,
&
result
);
if
(
!
result
)
{
ZLOGE
(
LOG_LABEL
,
"OnRemoteRequest res:%{public}s"
,
result
?
"true"
:
"false"
);
param
->
result
=
ERR_UNKNOWN_TRANSACTION
;
...
...
@@ -700,22 +700,22 @@ int NAPIRemoteObject::OnJsRemoteRequest(CallbackParam *jsParam)
ZLOGD
(
LOG_LABEL
,
"onRemoteRequest is asynchronous"
);
// Create promiseThen
napi_value
promiseThen
=
nullptr
;
napi_get_named_property
(
param
->
env
,
return
_v
al
,
"then"
,
&
promiseThen
);
napi_get_named_property
(
param
->
env
,
return
V
al
,
"then"
,
&
promiseThen
);
if
(
promiseThen
==
nullptr
)
{
ZLOGE
(
LOG_LABEL
,
"get promiseThen failed"
);
param
->
result
=
-
1
;
break
;
}
napi_value
then
_v
alue
;
ret
=
napi_create_function
(
param
->
env
,
"thenCallback"
,
NAPI_AUTO_LENGTH
,
ThenCallback
,
param
,
&
then
_v
alue
);
napi_value
then
V
alue
;
ret
=
napi_create_function
(
param
->
env
,
"thenCallback"
,
NAPI_AUTO_LENGTH
,
ThenCallback
,
param
,
&
then
V
alue
);
if
(
ret
!=
napi_ok
)
{
ZLOGE
(
LOG_LABEL
,
"thenCallback got exception"
);
param
->
result
=
ERR_UNKNOWN_TRANSACTION
;
break
;
}
// Start to call promiseThen
napi_value
then
_return_v
alue
;
ret
=
napi_call_function
(
param
->
env
,
return
_val
,
promiseThen
,
1
,
&
then_value
,
&
then_return_v
alue
);
napi_value
then
ReturnV
alue
;
ret
=
napi_call_function
(
param
->
env
,
return
Val
,
promiseThen
,
1
,
&
thenValue
,
&
thenReturnV
alue
);
if
(
ret
!=
napi_ok
)
{
ZLOGE
(
LOG_LABEL
,
"PromiseThen got exception"
);
param
->
result
=
ERR_UNKNOWN_TRANSACTION
;
...
...
@@ -723,23 +723,23 @@ int NAPIRemoteObject::OnJsRemoteRequest(CallbackParam *jsParam)
}
// Create promiseCatch
napi_value
promiseCatch
=
nullptr
;
napi_get_named_property
(
param
->
env
,
return
_v
al
,
"catch"
,
&
promiseCatch
);
napi_get_named_property
(
param
->
env
,
return
V
al
,
"catch"
,
&
promiseCatch
);
if
(
promiseCatch
==
nullptr
)
{
ZLOGE
(
LOG_LABEL
,
"get promiseCatch failed"
);
param
->
result
=
-
1
;
break
;
}
napi_value
catch
_v
alue
;
napi_value
catch
V
alue
;
ret
=
napi_create_function
(
param
->
env
,
"catchCallback"
,
NAPI_AUTO_LENGTH
,
CatchCallback
,
param
,
&
catch
_v
alue
);
NAPI_AUTO_LENGTH
,
CatchCallback
,
param
,
&
catch
V
alue
);
if
(
ret
!=
napi_ok
)
{
ZLOGE
(
LOG_LABEL
,
"catchCallback got exception"
);
param
->
result
=
ERR_UNKNOWN_TRANSACTION
;
break
;
}
// Start to call promiseCatch
napi_value
catch
_return_v
alue
;
ret
=
napi_call_function
(
param
->
env
,
return
_val
,
promiseCatch
,
1
,
&
catch_value
,
&
catch_return_v
alue
);
napi_value
catch
ReturnV
alue
;
ret
=
napi_call_function
(
param
->
env
,
return
Val
,
promiseCatch
,
1
,
&
catchValue
,
&
catchReturnV
alue
);
if
(
ret
!=
napi_ok
)
{
ZLOGE
(
LOG_LABEL
,
"PromiseCatch got exception"
);
param
->
result
=
ERR_UNKNOWN_TRANSACTION
;
...
...
@@ -1361,7 +1361,7 @@ napi_value NAPI_RemoteObject_getInterfaceDescriptor(napi_env env, napi_callback_
{
napi_value
result
=
nullptr
;
napi_value
thisVar
=
nullptr
;
napi_get_cb_info
(
env
,
info
,
0
,
nullptr
,
&
thisVar
,
nullptr
);
napi_get_cb_info
(
env
,
info
,
nullptr
,
nullptr
,
&
thisVar
,
nullptr
);
sptr
<
IRemoteObject
>
nativeObject
=
NAPI_ohos_rpc_getNativeRemoteObject
(
env
,
thisVar
);
std
::
u16string
descriptor
=
nativeObject
->
GetObjectDescriptor
();
napi_create_string_utf8
(
env
,
Str16ToStr8
(
descriptor
).
c_str
(),
NAPI_AUTO_LENGTH
,
&
result
);
...
...
@@ -1372,7 +1372,7 @@ napi_value NAPI_RemoteObject_getDescriptor(napi_env env, napi_callback_info info
{
napi_value
result
=
nullptr
;
napi_value
thisVar
=
nullptr
;
napi_get_cb_info
(
env
,
info
,
0
,
nullptr
,
&
thisVar
,
nullptr
);
napi_get_cb_info
(
env
,
info
,
nullptr
,
nullptr
,
&
thisVar
,
nullptr
);
sptr
<
IRemoteObject
>
nativeObject
=
NAPI_ohos_rpc_getNativeRemoteObject
(
env
,
thisVar
);
if
(
nativeObject
==
nullptr
)
{
ZLOGE
(
LOG_LABEL
,
"native stub object is nullptr"
);
...
...
ipc/native/src/napi/src/napi_remote_proxy.cpp
浏览文件 @
09a5d287
...
...
@@ -96,9 +96,9 @@ void NAPIDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &object)
napi_value
onRemoteDied
=
nullptr
;
napi_get_named_property
(
param
->
env
,
jsDeathRecipient
,
"onRemoteDied"
,
&
onRemoteDied
);
NAPI_ASSERT_RETURN_VOID
(
param
->
env
,
onRemoteDied
!=
nullptr
,
"failed to get property onRemoteDied"
);
napi_value
return
_v
al
=
nullptr
;
napi_call_function
(
param
->
env
,
jsDeathRecipient
,
onRemoteDied
,
0
,
nullptr
,
&
return
_v
al
);
if
(
return
_v
al
==
nullptr
)
{
napi_value
return
V
al
=
nullptr
;
napi_call_function
(
param
->
env
,
jsDeathRecipient
,
onRemoteDied
,
0
,
nullptr
,
&
return
V
al
);
if
(
return
V
al
==
nullptr
)
{
ZLOGE
(
LOG_LABEL
,
"failed to call function onRemoteDied"
);
}
delete
param
;
...
...
@@ -775,7 +775,7 @@ napi_value NAPI_RemoteProxy_unregisterDeathRecipient(napi_env env, napi_callback
napi_value
NAPI_RemoteProxy_getInterfaceDescriptor
(
napi_env
env
,
napi_callback_info
info
)
{
napi_value
thisVar
=
nullptr
;
napi_get_cb_info
(
env
,
info
,
0
,
0
,
&
thisVar
,
nullptr
);
napi_get_cb_info
(
env
,
info
,
nullptr
,
nullptr
,
&
thisVar
,
nullptr
);
NAPIRemoteProxyHolder
*
holder
=
nullptr
;
napi_status
status
=
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
holder
);
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"failed to get proxy holder"
);
...
...
@@ -798,7 +798,7 @@ napi_value NAPI_RemoteProxy_getInterfaceDescriptor(napi_env env, napi_callback_i
napi_value
NAPI_RemoteProxy_getDescriptor
(
napi_env
env
,
napi_callback_info
info
)
{
napi_value
thisVar
=
nullptr
;
napi_get_cb_info
(
env
,
info
,
0
,
0
,
&
thisVar
,
nullptr
);
napi_get_cb_info
(
env
,
info
,
nullptr
,
nullptr
,
&
thisVar
,
nullptr
);
NAPIRemoteProxyHolder
*
holder
=
nullptr
;
napi_status
status
=
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
holder
);
if
(
status
!=
napi_ok
)
{
...
...
@@ -828,7 +828,7 @@ napi_value NAPI_RemoteProxy_isObjectDead(napi_env env, napi_callback_info info)
{
ZLOGI
(
LOG_LABEL
,
"call isObjectDead"
);
napi_value
thisVar
=
nullptr
;
napi_get_cb_info
(
env
,
info
,
0
,
0
,
&
thisVar
,
nullptr
);
napi_get_cb_info
(
env
,
info
,
nullptr
,
nullptr
,
&
thisVar
,
nullptr
);
NAPIRemoteProxyHolder
*
holder
=
nullptr
;
napi_status
status
=
napi_unwrap
(
env
,
thisVar
,
(
void
**
)
&
holder
);
NAPI_ASSERT
(
env
,
status
==
napi_ok
,
"failed to get proxy holder"
);
...
...
ipc/native/src/napi/src/napi_rpc_native_module.cpp
浏览文件 @
09a5d287
...
...
@@ -26,7 +26,7 @@
namespace
OHOS
{
EXTERN_C_START
static
napi_value
r
pcExport
(
napi_env
env
,
napi_value
exports
)
static
napi_value
R
pcExport
(
napi_env
env
,
napi_value
exports
)
{
NAPI_MessageParcel
::
Export
(
env
,
exports
);
NAPI_MessageSequence
::
Export
(
env
,
exports
);
...
...
@@ -43,5 +43,5 @@ EXTERN_C_END
/*
* Module register function
*/
NAPI_MODULE
(
rpc
,
r
pcExport
)
NAPI_MODULE
(
rpc
,
R
pcExport
)
}
// namesapce OHOS
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录