mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
handle_wrap: replace unref_ field with flags_ field
Prep work for a follow-up commit that adds support for close callbacks.
This commit is contained in:
1 parent
3dbbfd7803
commit
3d20905b70
3 files changed
+7
-5
No files matched your search
+3
-3
@@ -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;
|
||||
|
||||
+3
-1
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user