mirror of
https://gitee.com/openharmony/js_api_module
synced 2024-11-23 12:50:06 +00:00
Modify structure member variable initialization operations
Describe:Add the initialization of timeReq_ to the constructor. issue:https://gitee.com/openharmony/js_worker_module/issues/I556KJ?from=project-issue Signed-off-by: yqhan <hanyuqing2@huawei.com>
This commit is contained in:
parent
0f54d73c4f
commit
bd31821245
@ -15,8 +15,6 @@
|
||||
|
||||
#include "base/compileruntime/js_worker_module/plugin/timer.h"
|
||||
|
||||
#include "base/compileruntime/js_worker_module/helper/napi_helper.h"
|
||||
#include "base/compileruntime/js_worker_module/helper/object_helper.h"
|
||||
#include "utils/log.h"
|
||||
|
||||
namespace CompilerRuntime::WorkerModule::Plugin {
|
||||
@ -165,8 +163,6 @@ napi_value Timer::SetTimeoutInner(napi_env env, napi_callback_info cbinfo, bool
|
||||
napi_ref callbackRef = Helper::NapiHelper::CreateReference(env, argv[0], 1);
|
||||
TimerCallbackInfo* callbackInfo =
|
||||
new TimerCallbackInfo(env, tId, timeout, callbackRef, repeat, callbackArgc, callbackArgv);
|
||||
uv_loop_t* loop = Helper::NapiHelper::GetLibUV(env);
|
||||
uv_timer_init(loop, &callbackInfo->timeReq_);
|
||||
// 5. push callback info into timerTable
|
||||
timerTable[tId] = callbackInfo;
|
||||
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#include <map>
|
||||
#include <uv.h>
|
||||
|
||||
#include "base/compileruntime/js_worker_module/helper/napi_helper.h"
|
||||
#include "base/compileruntime/js_worker_module/helper/object_helper.h"
|
||||
#include "napi/native_api.h"
|
||||
#include "napi/native_node_api.h"
|
||||
|
||||
@ -36,7 +39,10 @@ struct TimerCallbackInfo {
|
||||
bool repeat, size_t argc, napi_ref* argv)
|
||||
: env_(env), tId_(tId), timeout_(timeout), callback_(callback),
|
||||
repeat_(repeat), argc_(argc), argv_(argv)
|
||||
{}
|
||||
{
|
||||
uv_loop_t* loop = Helper::NapiHelper::GetLibUV(env_);
|
||||
uv_timer_init(loop, &timeReq_);
|
||||
}
|
||||
|
||||
~TimerCallbackInfo();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user