mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-27 02:50:40 +00:00
commit
3cda3d3bc1
@ -58,8 +58,13 @@ bool JsPrintCallback::Call(napi_env env, void *data, uv_after_work_cb afterCallb
|
||||
return false;
|
||||
}
|
||||
work->data = data;
|
||||
uv_queue_work_with_qos(
|
||||
loop, work, [](uv_work_t *work) {}, afterCallback, uv_qos_user_initiated);
|
||||
int retVal = uv_queue_work_with_qos(loop, work,
|
||||
[](uv_work_t *work) {}, afterCallback, uv_qos_user_initiated);
|
||||
if (retVal != 0) {
|
||||
PRINT_HILOGE("Failed to create uv work");
|
||||
delete work;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,13 @@ bool JsPrintExtension::Callback(std::string funcName)
|
||||
delete param;
|
||||
delete work;
|
||||
};
|
||||
JsPrintCallback::Call(env, workParam, afterCallback);
|
||||
bool ret = JsPrintCallback::Call(env, workParam, afterCallback);
|
||||
if (!ret) {
|
||||
delete workParam;
|
||||
workParam = nullptr;
|
||||
PRINT_HILOGE("Callback fail, delete param");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -379,7 +385,13 @@ bool JsPrintExtension::Callback(const std::string funcName, const std::string &p
|
||||
delete param;
|
||||
delete work;
|
||||
};
|
||||
JsPrintCallback::Call(env, workParam, afterCallback);
|
||||
bool ret = JsPrintCallback::Call(env, workParam, afterCallback);
|
||||
if (!ret) {
|
||||
delete workParam;
|
||||
workParam = nullptr;
|
||||
PRINT_HILOGE("Callback fail, delete param");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -419,7 +431,13 @@ bool JsPrintExtension::Callback(const std::string funcName, const Print::PrintJo
|
||||
delete param;
|
||||
delete work;
|
||||
};
|
||||
JsPrintCallback::Call(env, workParam, afterCallback);
|
||||
bool ret = JsPrintCallback::Call(env, workParam, afterCallback);
|
||||
if (!ret) {
|
||||
delete workParam;
|
||||
workParam = nullptr;
|
||||
PRINT_HILOGE("Callback fail, delete param");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user