11cb0ef41Sopenharmony_ci#ifndef SRC_TIMER_WRAP_INL_H_ 21cb0ef41Sopenharmony_ci#define SRC_TIMER_WRAP_INL_H_ 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci#include "timer_wrap.h" 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <utility> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#include "env.h" 111cb0ef41Sopenharmony_ci#include "uv.h" 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cinamespace node { 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_citemplate <typename... Args> 161cb0ef41Sopenharmony_ciinline TimerWrap::TimerWrap(Environment* env, Args&&... args) 171cb0ef41Sopenharmony_ci : env_(env), fn_(std::forward<Args>(args)...) { 181cb0ef41Sopenharmony_ci uv_timer_init(env->event_loop(), &timer_); 191cb0ef41Sopenharmony_ci timer_.data = this; 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_citemplate <typename... Args> 231cb0ef41Sopenharmony_ciinline TimerWrapHandle::TimerWrapHandle(Environment* env, Args&&... args) { 241cb0ef41Sopenharmony_ci timer_ = new TimerWrap(env, std::forward<Args>(args)...); 251cb0ef41Sopenharmony_ci env->AddCleanupHook(CleanupHook, this); 261cb0ef41Sopenharmony_ci} 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci} // namespace node 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci#endif // SRC_TIMER_WRAP_INL_H_ 33