mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-23 07:50:24 +00:00
commit
a34a8711a0
@ -113,13 +113,13 @@ void *IPCWorkThread::ThreadHandler(void *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IRemoteInvoker *invoker = IPCThreadSkeleton::GetRemoteInvoker(param->proto);
|
||||
std::string basicName = MakeBasicThreadName(param->proto, param->index);
|
||||
std::string threadName = basicName + "_" + std::to_string(syscall(SYS_gettid));
|
||||
int32_t ret = prctl(PR_SET_NAME, threadName.c_str());
|
||||
if (ret != 0) {
|
||||
ZLOGE(LOG_LABEL, "set thread name:%{public}s fail, ret:%{public}d", threadName.c_str(), ret);
|
||||
} else {
|
||||
IRemoteInvoker *invoker = IPCThreadSkeleton::GetRemoteInvoker(param->proto);
|
||||
ZLOGI(LOG_LABEL, "proto:%{public}d policy:%{public}d name:%{public}s invoker:%{public}u",
|
||||
param->proto, param->policy, threadName.c_str(), ProcessSkeleton::ConvertAddr(invoker));
|
||||
}
|
||||
@ -131,8 +131,8 @@ void *IPCWorkThread::ThreadHandler(void *args)
|
||||
if (current != nullptr) {
|
||||
current->OnThreadTerminated(basicName);
|
||||
}
|
||||
ZLOGW(LOG_LABEL, "exit, proto:%{public}d policy:%{public}d name:%{public}s",
|
||||
param->proto, param->policy, threadName.c_str());
|
||||
ZLOGI(LOG_LABEL, "exit, proto:%{public}d policy:%{public}d name:%{public}s invoker:%{public}u",
|
||||
param->proto, param->policy, threadName.c_str(), ProcessSkeleton::ConvertAddr(invoker));
|
||||
delete param;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ bool MessageParcel::Append(MessageParcel &data)
|
||||
{
|
||||
size_t dataSize = data.GetDataSize();
|
||||
if (dataSize == 0) {
|
||||
ZLOGE(LOG_LABEL, "no data to append");
|
||||
ZLOGI(LOG_LABEL, "no data to append");
|
||||
return true;
|
||||
}
|
||||
uintptr_t dataPtr = data.GetData();
|
||||
|
@ -135,7 +135,7 @@ bool ProcessSkeleton::DetachObject(IRemoteObject *object, const std::u16string &
|
||||
}
|
||||
|
||||
if (iterator->second.GetRefPtr() != object) {
|
||||
ZLOGD(LOG_LABEL, "can not erase it because addr if different, "
|
||||
ZLOGI(LOG_LABEL, "can not erase it because addr if different, "
|
||||
"desc:%{public}s, recorded object:%{public}u, detach object:%{public}u",
|
||||
ConvertToSecureDesc(Str16ToStr8(descriptor)).c_str(), ConvertAddr(iterator->second.GetRefPtr()),
|
||||
ConvertAddr(object));
|
||||
@ -172,13 +172,8 @@ bool ProcessSkeleton::AttachObject(IRemoteObject *object, const std::u16string &
|
||||
}
|
||||
}
|
||||
auto result = objects_.insert_or_assign(descriptor, wp);
|
||||
if (result.second) {
|
||||
ZLOGD(LOG_LABEL, "attach %{public}d desc:%{public}s inserted",
|
||||
ConvertAddr(object), ConvertToSecureDesc(Str16ToStr8(descriptor)).c_str());
|
||||
} else {
|
||||
ZLOGW(LOG_LABEL, "attach %{public}d desc:%{public}s assign",
|
||||
ConvertAddr(object), ConvertToSecureDesc(Str16ToStr8(descriptor)).c_str());
|
||||
}
|
||||
ZLOGD(LOG_LABEL, "attach %{public}u desc:%{public}s type:%{public}s",
|
||||
ConvertAddr(object), ConvertToSecureDesc(Str16ToStr8(descriptor)).c_str(), result.second ? "insert" : "assign");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -211,12 +206,12 @@ sptr<IRemoteObject> ProcessSkeleton::QueryObject(const std::u16string &descripto
|
||||
}
|
||||
std::u16string desc;
|
||||
if (!IsValidObject(remoteObject, desc)) {
|
||||
ZLOGD(LOG_LABEL, "object %{public}d is inValid", ConvertAddr(remoteObject));
|
||||
ZLOGD(LOG_LABEL, "object %{public}u is inValid", ConvertAddr(remoteObject));
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!remoteObject->AttemptIncStrong(this)) {
|
||||
ZLOGD(LOG_LABEL, "object %{public}d AttemptIncStrong failed", ConvertAddr(remoteObject));
|
||||
ZLOGD(LOG_LABEL, "object %{public}u AttemptIncStrong failed", ConvertAddr(remoteObject));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,12 @@ BinderInvoker::BinderInvoker()
|
||||
reinterpret_cast<uintptr_t>(this) };
|
||||
input_.SetDataCapacity(IPC_DEFAULT_PARCEL_SIZE);
|
||||
binderConnector_ = BinderConnector::GetInstance();
|
||||
ZLOGD(LABEL, ":%{public}u", ProcessSkeleton::ConvertAddr(this));
|
||||
}
|
||||
|
||||
BinderInvoker::~BinderInvoker()
|
||||
{
|
||||
ZLOGD(LABEL, ":%{public}u", ProcessSkeleton::ConvertAddr(this));
|
||||
auto current = ProcessSkeleton::GetInstance();
|
||||
if (current != nullptr) {
|
||||
current->DetachInvokerProcInfo(true);
|
||||
@ -1011,7 +1013,7 @@ int BinderInvoker::HandleCommands(uint32_t cmd)
|
||||
{
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
int error = HandleCommandsInner(cmd);
|
||||
if (error != ERR_NONE) {
|
||||
if (error != ERR_NONE && error != -ERR_TIMED_OUT) {
|
||||
if (ProcessSkeleton::IsPrint(error, lastErr_, lastErrCnt_)) {
|
||||
ZLOGE(LABEL, "HandleCommands cmd:%{public}u error:%{public}d", cmd, error);
|
||||
PrintParcelData(input_, "input_");
|
||||
|
@ -415,7 +415,6 @@ napi_value NAPI_RemoteProxy_checkRegisterDeathRecipientArgs(napi_env env, size_t
|
||||
|
||||
napi_value NAPI_RemoteProxy_registerDeathRecipient(napi_env env, napi_callback_info info)
|
||||
{
|
||||
ZLOGI(LOG_LABEL, "register death recipient");
|
||||
size_t argc = 2;
|
||||
napi_value argv[ARGV_LENGTH_2] = { 0 };
|
||||
napi_value thisVar = nullptr;
|
||||
@ -450,20 +449,19 @@ napi_value NAPI_RemoteProxy_registerDeathRecipient(napi_env env, napi_callback_i
|
||||
}
|
||||
|
||||
sptr<NAPIDeathRecipient> nativeRecipient = new NAPIDeathRecipient(env, argv[ARGV_INDEX_0]);
|
||||
if (target->AddDeathRecipient(nativeRecipient)) {
|
||||
bool ret = target->AddDeathRecipient(nativeRecipient);
|
||||
if (ret) {
|
||||
NAPIDeathRecipientList *list = proxyHolder->list_;
|
||||
if (list->Add(nativeRecipient)) {
|
||||
ZLOGD(LOG_LABEL, "register recipient success");
|
||||
}
|
||||
list->Add(nativeRecipient);
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_get_undefined(env, &result);
|
||||
ZLOGI(LOG_LABEL, "%{public}s", ret ? "succ" : "fail");
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value NAPI_RemoteProxy_removeDeathRecipient(napi_env env, napi_callback_info info)
|
||||
{
|
||||
ZLOGI(LOG_LABEL, "remove death recipient");
|
||||
size_t argc = 2;
|
||||
napi_value argv[ARGV_LENGTH_2] = { 0 };
|
||||
napi_value thisVar = nullptr;
|
||||
@ -504,14 +502,14 @@ napi_value NAPI_RemoteProxy_removeDeathRecipient(napi_env env, napi_callback_inf
|
||||
napi_get_boolean(env, false, &result);
|
||||
return result;
|
||||
}
|
||||
target->RemoveDeathRecipient(nativeRecipient);
|
||||
bool ret = target->RemoveDeathRecipient(nativeRecipient);
|
||||
if (list->Remove(nativeRecipient)) {
|
||||
napi_get_boolean(env, true, &result);
|
||||
return result;
|
||||
} else {
|
||||
napi_get_boolean(env, false, &result);
|
||||
return result;
|
||||
}
|
||||
ZLOGI(LOG_LABEL, "%{public}s", ret ? "succ" : "fail");
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value NAPI_RemoteProxy_checkUnregisterDeathRecipientArgs(napi_env env, size_t argc, napi_value* argv)
|
||||
@ -643,7 +641,7 @@ napi_value NAPI_RemoteProxy_getDescriptor(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value NAPI_RemoteProxy_isObjectDead(napi_env env, napi_callback_info info)
|
||||
{
|
||||
ZLOGI(LOG_LABEL, "call isObjectDead");
|
||||
ZLOGD(LOG_LABEL, "call isObjectDead");
|
||||
napi_value thisVar = nullptr;
|
||||
napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr);
|
||||
NAPIRemoteProxyHolder *holder = nullptr;
|
||||
|
@ -956,7 +956,7 @@ napi_value NAPIAshmem::Ashmem_JS_Constructor(napi_env env, napi_callback_info in
|
||||
napi_status status = napi_wrap(
|
||||
env, thisVar, napiAshmem,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
ZLOGI(LOG_LABEL, "Ashmem destructed by js callback");
|
||||
ZLOGD(LOG_LABEL, "Ashmem destructed by js callback");
|
||||
delete (reinterpret_cast<NAPIAshmem *>(data));
|
||||
},
|
||||
nullptr, nullptr);
|
||||
|
@ -367,7 +367,7 @@ static void OnJsRemoteRequestCallBack(uv_work_t *work, int status)
|
||||
uint64_t curTime = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch()).count());
|
||||
|
||||
ZLOGD(LOG_LABEL, "enter thread pool time:%{public}" PRIu64, curTime);
|
||||
ZLOGI(LOG_LABEL, "enter thread pool time:%{public}" PRIu64, curTime);
|
||||
CallbackParam *param = reinterpret_cast<CallbackParam *>(work->data);
|
||||
napi_handle_scope scope = nullptr;
|
||||
napi_open_handle_scope(param->env, &scope);
|
||||
|
@ -37,7 +37,7 @@ void NAPIDeathRecipient::AfterWorkCallback(uv_work_t *work, int status)
|
||||
ZLOGE(LOG_LABEL, "work or work->data is nullptr");
|
||||
return;
|
||||
}
|
||||
ZLOGI(LOG_LABEL, "start to call onRemoteDied");
|
||||
ZLOGD(LOG_LABEL, "start to call onRemoteDied");
|
||||
OnRemoteDiedParam *param = reinterpret_cast<OnRemoteDiedParam *>(work->data);
|
||||
napi_handle_scope scope = nullptr;
|
||||
napi_open_handle_scope(param->env, &scope);
|
||||
|
Loading…
Reference in New Issue
Block a user