| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 316871f commit 2000072
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,11 +38,11 @@ void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) { | |||
| 38 | 38 | } | |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | - void HandleWrap::IsRefed(const FunctionCallbackInfo<Value>& args) { | ||
| 41 | + void HandleWrap::Unrefed(const FunctionCallbackInfo<Value>& args) { | ||
| 42 | 42 | HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); | |
| 43 | 43 | ||
| 44 | - bool refed = IsAlive(wrap) && (wrap->flags_ & kUnref) == 0; | ||
| 45 | - args.GetReturnValue().Set(refed); | ||
| 44 | + bool unrefed = wrap->flags_ & kUnref == 1; | ||
| 45 | + args.GetReturnValue().Set(unrefed); | ||
| 46 | 46 | } | |
| 47 | 47 | ||
| 48 | 48 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ class HandleWrap : public AsyncWrap { | |||
| 35 | 35 | static void Close(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 36 | 36 | static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 37 | 37 | static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 38 | - static void IsRefed(const v8::FunctionCallbackInfo<v8::Value>& args); | ||
| 38 | + static void Unrefed(const v8::FunctionCallbackInfo<v8::Value>& args); | ||
| 39 | 39 | ||
| 40 | 40 | static inline bool IsAlive(const HandleWrap* wrap) { | |
| 41 | 41 | return wrap != nullptr && wrap->GetHandle() != nullptr; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,7 +80,7 @@ void PipeWrap::Initialize(Local<Object> target, | |||
| 80 | 80 | env->SetProtoMethod(t, "close", HandleWrap::Close); | |
| 81 | 81 | env->SetProtoMethod(t, "unref", HandleWrap::Unref); | |
| 82 | 82 | env->SetProtoMethod(t, "ref", HandleWrap::Ref); | |
| 83 | - env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed); | ||
| 83 | + env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed); | ||
| 84 | 84 | ||
| 85 | 85 | StreamWrap::AddMethods(env, t); | |
| 86 | 86 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,7 +40,7 @@ class ProcessWrap : public HandleWrap { | |||
| 40 | 40 | ||
| 41 | 41 | env->SetProtoMethod(constructor, "ref", HandleWrap::Ref); | |
| 42 | 42 | env->SetProtoMethod(constructor, "unref", HandleWrap::Unref); | |
| 43 | - env->SetProtoMethod(constructor, "isRefed", HandleWrap::IsRefed); | ||
| 43 | + env->SetProtoMethod(constructor, "unrefed", HandleWrap::Unrefed); | ||
| 44 | 44 | ||
| 45 | 45 | target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Process"), | |
| 46 | 46 | constructor->GetFunction()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,7 @@ class SignalWrap : public HandleWrap { | |||
| 32 | 32 | env->SetProtoMethod(constructor, "close", HandleWrap::Close); | |
| 33 | 33 | env->SetProtoMethod(constructor, "ref", HandleWrap::Ref); | |
| 34 | 34 | env->SetProtoMethod(constructor, "unref", HandleWrap::Unref); | |
| 35 | - env->SetProtoMethod(constructor, "isRefed", HandleWrap::IsRefed); | ||
| 35 | + env->SetProtoMethod(constructor, "unrefed", HandleWrap::Unrefed); | ||
| 36 | 36 | env->SetProtoMethod(constructor, "start", Start); | |
| 37 | 37 | env->SetProtoMethod(constructor, "stop", Stop); | |
| 38 | 38 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,7 +87,7 @@ void TCPWrap::Initialize(Local<Object> target, | |||
| 87 | 87 | ||
| 88 | 88 | env->SetProtoMethod(t, "ref", HandleWrap::Ref); | |
| 89 | 89 | env->SetProtoMethod(t, "unref", HandleWrap::Unref); | |
| 90 | - env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed); | ||
| 90 | + env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed); | ||
| 91 | 91 | ||
| 92 | 92 | StreamWrap::AddMethods(env, t, StreamBase::kFlagHasWritev); | |
| 93 | 93 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ class TimerWrap : public HandleWrap { | |||
| 39 | 39 | env->SetProtoMethod(constructor, "close", HandleWrap::Close); | |
| 40 | 40 | env->SetProtoMethod(constructor, "ref", HandleWrap::Ref); | |
| 41 | 41 | env->SetProtoMethod(constructor, "unref", HandleWrap::Unref); | |
| 42 | - env->SetProtoMethod(constructor, "isRefed", HandleWrap::IsRefed); | ||
| 42 | + env->SetProtoMethod(constructor, "unrefed", HandleWrap::Unrefed); | ||
| 43 | 43 | ||
| 44 | 44 | env->SetProtoMethod(constructor, "start", Start); | |
| 45 | 45 | env->SetProtoMethod(constructor, "stop", Stop); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ void TTYWrap::Initialize(Local<Object> target, | |||
| 36 | 36 | ||
| 37 | 37 | env->SetProtoMethod(t, "close", HandleWrap::Close); | |
| 38 | 38 | env->SetProtoMethod(t, "unref", HandleWrap::Unref); | |
| 39 | - env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed); | ||
| 39 | + env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed); | ||
| 40 | 40 | ||
| 41 | 41 | StreamWrap::AddMethods(env, t, StreamBase::kFlagNoShutdown); | |
| 42 | 42 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,7 +108,7 @@ void UDPWrap::Initialize(Local<Object> target, | |||
| 108 | 108 | ||
| 109 | 109 | env->SetProtoMethod(t, "ref", HandleWrap::Ref); | |
| 110 | 110 | env->SetProtoMethod(t, "unref", HandleWrap::Unref); | |
| 111 | - env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed); | ||
| 111 | + env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed); | ||
| 112 | 112 | ||
| 113 | 113 | target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "UDP"), t->GetFunction()); | |
| 114 | 114 | env->set_udp_constructor_function(t->GetFunction()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,16 +9,18 @@ function makeAssert(message) { | |||
| 9 | 9 | strictEqual(actual, expected, message); | |
| 10 | 10 | }; | |
| 11 | 11 | } | |
| 12 | - const assert = makeAssert('isRefed() not working on tty_wrap'); | ||
| 12 | + const assert = makeAssert('unrefed() not working on tty_wrap'); | ||
| 13 | 13 | ||
| 14 | 14 | if (process.argv[2] === 'child') { | |
| 15 | 15 | // Test tty_wrap in piped child to guarentee stdin being a TTY. | |
| 16 | 16 | const ReadStream = require('tty').ReadStream; | |
| 17 | 17 | const tty = new ReadStream(0); | |
| 18 | - assert(Object.getPrototypeOf(tty._handle).hasOwnProperty('isRefed'), true); | ||
| 19 | - assert(tty._handle.isRefed(), true); | ||
| 18 | + assert(Object.getPrototypeOf(tty._handle).hasOwnProperty('unrefed'), true); | ||
| 19 | + assert(tty._handle.unrefed(), false); | ||
| 20 | 20 | tty.unref(); | |
| 21 | - assert(tty._handle.isRefed(), false); | ||
| 21 | + assert(tty._handle.unrefed(), true); | ||
| 22 | + tty._handle.close(); | ||
| 23 | + assert(tty._handle.unrefed(), true); | ||
| 22 | 24 | return; | |
| 23 | 25 | } | |
| 24 | 26 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments