diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-07-08 02:42:07 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-07-14 16:04:43 +0300 |
commit | e2f9dc6e5a82392dad4f4451fa56edd178ac0e8f (patch) | |
tree | 0b80e520662e74e8832335eaedd0552bcae5f7fe /src/timer_wrap.h | |
parent | 18667ac6f54a4a2a781f1cf6380ac0660196e5e5 (diff) |
src: remove user_data from TimerWrap
There’s no point in having an opaque user data pointer when we’re
already using `std::function`.
PR-URL: https://github.com/nodejs/node/pull/34252
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/timer_wrap.h')
-rw-r--r-- | src/timer_wrap.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/timer_wrap.h b/src/timer_wrap.h index c75e17b776b..263562f2a13 100644 --- a/src/timer_wrap.h +++ b/src/timer_wrap.h @@ -14,9 +14,9 @@ namespace node { // Utility class that makes working with libuv timers a bit easier. class TimerWrap final : public MemoryRetainer { public: - using TimerCb = std::function<void(void*)>; + using TimerCb = std::function<void()>; - TimerWrap(Environment* env, TimerCb fn, void* user_data); + TimerWrap(Environment* env, const TimerCb& fn); TimerWrap(const TimerWrap&) = delete; inline Environment* env() const { return env_; } @@ -43,7 +43,6 @@ class TimerWrap final : public MemoryRetainer { Environment* env_; TimerCb fn_; uv_timer_t timer_; - void* user_data_ = nullptr; friend std::unique_ptr<TimerWrap>::deleter_type; }; @@ -52,8 +51,7 @@ class TimerWrapHandle : public MemoryRetainer { public: TimerWrapHandle( Environment* env, - TimerWrap::TimerCb fn, - void* user_data = nullptr); + const TimerWrap::TimerCb& fn); TimerWrapHandle(const TimerWrapHandle&) = delete; |