mirror of
https://gitee.com/openharmony/commonlibrary_ets_utils
synced 2024-11-23 07:20:14 +00:00
Signed-off-by: caolili123 <caolili14@huawei.com>
This commit is contained in:
parent
92e9641d88
commit
4b473bb0c6
@ -27,7 +27,7 @@ using namespace Commonlibrary::Concurrent::Common::Helper;
|
||||
static constexpr char EXECUTE_STR[] = "execute";
|
||||
static constexpr char SEQ_RUNNER_ID_STR[] = "seqRunnerId";
|
||||
|
||||
void SequenceRunner::SeqRunnerConstructorInner(napi_env env, napi_value &thisVar, SequenceRunner *seqRunner)
|
||||
bool SequenceRunner::SeqRunnerConstructorInner(napi_env env, napi_value &thisVar, SequenceRunner *seqRunner)
|
||||
{
|
||||
// update seqRunner.seqRunnerId
|
||||
uint64_t seqRunnerId = reinterpret_cast<uint64_t>(seqRunner);
|
||||
@ -46,7 +46,9 @@ void SequenceRunner::SeqRunnerConstructorInner(napi_env env, napi_value &thisVar
|
||||
if (status != napi_ok) {
|
||||
HILOG_ERROR("taskpool::SeqRunnerConstructorInner napi_wrap return value is %{public}d", status);
|
||||
SequenceRunnerDestructor(env, seqRunner, nullptr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
napi_value SequenceRunner::SeqRunnerConstructor(napi_env env, napi_callback_info cbinfo)
|
||||
@ -100,7 +102,10 @@ napi_value SequenceRunner::SeqRunnerConstructor(napi_env env, napi_callback_info
|
||||
napi_create_reference(env, thisVar, 0, &seqRunner->seqRunnerRef_);
|
||||
}
|
||||
|
||||
SeqRunnerConstructorInner(env, thisVar, seqRunner);
|
||||
if (!SeqRunnerConstructorInner(env, thisVar, seqRunner)) {
|
||||
HILOG_ERROR("taskpool:: SeqRunnerConstructorInner failed");
|
||||
return nullptr;
|
||||
}
|
||||
return thisVar;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
|
||||
static void ExecuteTaskImmediately(uint64_t taskId, Priority priority);
|
||||
static void SequenceRunnerDestructor(napi_env env, void* data, void* hint);
|
||||
static void SeqRunnerConstructorInner(napi_env env, napi_value &thisVar, SequenceRunner *seqRunner);
|
||||
static bool SeqRunnerConstructorInner(napi_env env, napi_value &thisVar, SequenceRunner *seqRunner);
|
||||
|
||||
friend class NativeEngineTest;
|
||||
public:
|
||||
|
@ -100,6 +100,10 @@ napi_value CreateTaskObject(napi_env env, TaskType taskType = TaskType::TASK,
|
||||
delete obj;
|
||||
}
|
||||
}, nullptr, nullptr) != napi_ok) {
|
||||
if (args != nullptr) {
|
||||
delete[] args;
|
||||
args = nullptr;
|
||||
}
|
||||
delete task;
|
||||
task = nullptr;
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user