diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-12-22 13:40:26 -0800 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-12-29 01:56:11 +0100 |
commit | 20ba454ef9e8ff2bb19abb26f9b95265beb98e11 (patch) | |
tree | 484b3a5d4ab97897012ef1e768af9e9ea424600a /src/timer_wrap.cc | |
parent | dd0188ec088fc87ee689e4efa193e241199de615 (diff) | |
download | node-new-20ba454ef9e8ff2bb19abb26f9b95265beb98e11.tar.gz |
Add node::Loop() and don't inc node_isolate.h in *.cc
node::Loop() replaces the NODE_LOOP macro. This avoids hitting
v8::Isolate::GetCurrent() for each loop lookup when HAVE_ISOLATE==0
Diffstat (limited to 'src/timer_wrap.cc')
-rw-r--r-- | src/timer_wrap.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index 82b7ec984e..2b29e5f854 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -21,7 +21,7 @@ #include <node.h> #include <handle_wrap.h> -#include <node_isolate.h> +#include <node_vars.h> #define UNWRAP \ assert(!args.Holder().IsEmpty()); \ @@ -92,7 +92,7 @@ class TimerWrap : public HandleWrap { : HandleWrap(object, (uv_handle_t*) &handle_) { active_ = false; - int r = uv_timer_init(NODE_LOOP(), &handle_); + int r = uv_timer_init(Loop(), &handle_); assert(r == 0); handle_.data = this; @@ -100,11 +100,11 @@ class TimerWrap : public HandleWrap { // uv_timer_init adds a loop reference. (That is, it calls uv_ref.) This // is not the behavior we want in Node. Timers should not increase the // ref count of the loop except when active. - uv_unref(NODE_LOOP()); + uv_unref(Loop()); } ~TimerWrap() { - if (!active_) uv_ref(NODE_LOOP()); + if (!active_) uv_ref(Loop()); } void StateChange() { @@ -114,11 +114,11 @@ class TimerWrap : public HandleWrap { if (!was_active && active_) { // If our state is changing from inactive to active, we // increase the loop's reference count. - uv_ref(NODE_LOOP()); + uv_ref(Loop()); } else if (was_active && !active_) { // If our state is changing from active to inactive, we // decrease the loop's reference count. - uv_unref(NODE_LOOP()); + uv_unref(Loop()); } } @@ -133,7 +133,7 @@ class TimerWrap : public HandleWrap { int r = uv_timer_start(&wrap->handle_, OnTimeout, timeout, repeat); // Error starting the timer. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); wrap->StateChange(); @@ -147,7 +147,7 @@ class TimerWrap : public HandleWrap { int r = uv_timer_stop(&wrap->handle_); - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); wrap->StateChange(); @@ -161,7 +161,7 @@ class TimerWrap : public HandleWrap { int r = uv_timer_again(&wrap->handle_); - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); wrap->StateChange(); @@ -187,7 +187,7 @@ class TimerWrap : public HandleWrap { int64_t repeat = uv_timer_get_repeat(&wrap->handle_); - if (repeat < 0) SetErrno(uv_last_error(NODE_LOOP())); + if (repeat < 0) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(repeat)); } |