summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-03-06 15:24:20 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-03-06 15:25:07 +0100
commit3d20905b7055dec006041c1fda0094bef17c80ee (patch)
tree54cbe6d46dae16bec8894c4781ccba387790c13f
parent3dbbfd78030d07acf9b5d0e9c61113ff315a783a (diff)
downloadandroid-node-v8-3d20905b7055dec006041c1fda0094bef17c80ee.tar.gz
android-node-v8-3d20905b7055dec006041c1fda0094bef17c80ee.tar.bz2
android-node-v8-3d20905b7055dec006041c1fda0094bef17c80ee.zip
handle_wrap: replace unref_ field with flags_ field
Prep work for a follow-up commit that adds support for close callbacks.
-rw-r--r--src/handle_wrap.cc6
-rw-r--r--src/handle_wrap.h4
-rw-r--r--src/node.cc2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index 817a4cfe1c..9c243ea2c9 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -63,7 +63,7 @@ Handle<Value> HandleWrap::Ref(const Arguments& args) {
if (wrap) {
uv_ref(wrap->handle__);
- wrap->unref_ = false;
+ wrap->flags_ &= ~kUnref;
}
return v8::Undefined();
@@ -77,7 +77,7 @@ Handle<Value> HandleWrap::Unref(const Arguments& args) {
if (wrap) {
uv_unref(wrap->handle__);
- wrap->unref_ = true;
+ wrap->flags_ |= kUnref;
}
return v8::Undefined();
@@ -102,7 +102,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
HandleWrap::HandleWrap(Handle<Object> object, uv_handle_t* h) {
- unref_ = false;
+ flags_ = 0;
handle__ = h;
if (h) {
h->data = this;
diff --git a/src/handle_wrap.h b/src/handle_wrap.h
index 951b9386f5..c77ec77f1a 100644
--- a/src/handle_wrap.h
+++ b/src/handle_wrap.h
@@ -70,7 +70,9 @@ class HandleWrap {
// Using double underscore due to handle_ member in tcp_wrap. Probably
// tcp_wrap should rename it's member to 'handle'.
uv_handle_t* handle__;
- bool unref_;
+ unsigned int flags_;
+
+ static const unsigned int kUnref = 1;
};
diff --git a/src/node.cc b/src/node.cc
index 2793d19c62..279bb0c05b 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1382,7 +1382,7 @@ Handle<Value> GetActiveHandles(const Arguments& args) {
ngx_queue_foreach(q, &handle_wrap_queue) {
HandleWrap* w = container_of(q, HandleWrap, handle_wrap_queue_);
- if (w->object_.IsEmpty() || w->unref_) continue;
+ if (w->object_.IsEmpty() || (w->flags_ & HandleWrap::kUnref)) continue;
Local<Value> obj = w->object_->Get(owner_sym);
if (obj->IsUndefined()) obj = *w->object_;
ary->Set(i++, obj);