!56 Modify structure member variable initialization operations

Merge pull request !56 from hyq5234/master
This commit is contained in:
openharmony_ci
2022-04-28 11:49:20 +00:00
committed by Gitee
2 changed files with 7 additions and 5 deletions
-4
View File
@@ -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;
+7 -1
View File
@@ -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();
};