summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremiah Senkpiel <fishrock123@rocketmail.com>2016-05-03 10:47:10 -0400
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-05-11 17:43:48 -0400
commit96a9439fd2c9577a735d6abf01990b45b836fba2 (patch)
tree76d999709f1d7aa41830c081fa0107aefb180f41 /src
parent738a1d639f8d59dccc600c67f63f1566c30306f8 (diff)
downloadandroid-node-v8-96a9439fd2c9577a735d6abf01990b45b836fba2.tar.gz
android-node-v8-96a9439fd2c9577a735d6abf01990b45b836fba2.tar.bz2
android-node-v8-96a9439fd2c9577a735d6abf01990b45b836fba2.zip
Revert "handle_wrap: IsRefed -> Unrefed, no isAlive check"
This reverts commit 9bb5a5e2a127010807f5b8a8bf4cf34109271c55. This API is not suitable because it depended on being able to potentially access the handle's flag after the handle was already cleaned up. Since this is not actually possible (obviously, oops) this newer API no longer makes much sense, and the older API is more suitable. API comparison: IsRefed -> Has a strong reference AND is alive. (Deterministic) Unrefed -> Has a weak reference OR is dead. (Less deterministic) Refs: https://github.com/nodejs/node/pull/6395 Refs: https://github.com/nodejs/node/pull/6204 Refs: https://github.com/nodejs/node/pull/6401 Refs: https://github.com/nodejs/node/pull/6382 Fixes: https://github.com/nodejs/node/pull/6381 PR-URL: https://github.com/nodejs/node/pull/6546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Conflicts: src/handle_wrap.cc test/parallel/test-handle-wrap-isrefed-tty.js test/parallel/test-handle-wrap-isrefed.js
Diffstat (limited to 'src')
-rw-r--r--src/handle_wrap.cc4
-rw-r--r--src/handle_wrap.h2
-rw-r--r--src/pipe_wrap.cc2
-rw-r--r--src/process_wrap.cc2
-rw-r--r--src/signal_wrap.cc2
-rw-r--r--src/tcp_wrap.cc2
-rw-r--r--src/timer_wrap.cc2
-rw-r--r--src/tty_wrap.cc2
-rw-r--r--src/udp_wrap.cc2
9 files changed, 10 insertions, 10 deletions
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index b82449989d..d28b6959c8 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -33,9 +33,9 @@ void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) {
}
-void HandleWrap::Unrefed(const FunctionCallbackInfo<Value>& args) {
+void HandleWrap::IsRefed(const FunctionCallbackInfo<Value>& args) {
HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());
- args.GetReturnValue().Set(!HasRef(wrap));
+ args.GetReturnValue().Set(HasRef(wrap));
}
diff --git a/src/handle_wrap.h b/src/handle_wrap.h
index ef37cf9e34..506358c140 100644
--- a/src/handle_wrap.h
+++ b/src/handle_wrap.h
@@ -35,7 +35,7 @@ class HandleWrap : public AsyncWrap {
static void Close(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void Unrefed(const v8::FunctionCallbackInfo<v8::Value>& args);
+ static void IsRefed(const v8::FunctionCallbackInfo<v8::Value>& args);
static inline bool IsAlive(const HandleWrap* wrap) {
return wrap != nullptr && wrap->state_ != kClosed;
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc
index 43df5cb715..25080041c2 100644
--- a/src/pipe_wrap.cc
+++ b/src/pipe_wrap.cc
@@ -80,7 +80,7 @@ void PipeWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "close", HandleWrap::Close);
env->SetProtoMethod(t, "unref", HandleWrap::Unref);
env->SetProtoMethod(t, "ref", HandleWrap::Ref);
- env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed);
StreamWrap::AddMethods(env, t);
diff --git a/src/process_wrap.cc b/src/process_wrap.cc
index b804d9f35e..0b7ad41b61 100644
--- a/src/process_wrap.cc
+++ b/src/process_wrap.cc
@@ -40,7 +40,7 @@ class ProcessWrap : public HandleWrap {
env->SetProtoMethod(constructor, "ref", HandleWrap::Ref);
env->SetProtoMethod(constructor, "unref", HandleWrap::Unref);
- env->SetProtoMethod(constructor, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(constructor, "isRefed", HandleWrap::IsRefed);
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Process"),
constructor->GetFunction());
diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc
index a008b083f0..ca5201d81a 100644
--- a/src/signal_wrap.cc
+++ b/src/signal_wrap.cc
@@ -32,7 +32,7 @@ class SignalWrap : public HandleWrap {
env->SetProtoMethod(constructor, "close", HandleWrap::Close);
env->SetProtoMethod(constructor, "ref", HandleWrap::Ref);
env->SetProtoMethod(constructor, "unref", HandleWrap::Unref);
- env->SetProtoMethod(constructor, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(constructor, "isRefed", HandleWrap::IsRefed);
env->SetProtoMethod(constructor, "start", Start);
env->SetProtoMethod(constructor, "stop", Stop);
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index d1cc99e756..4e8617af2d 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -87,7 +87,7 @@ void TCPWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "ref", HandleWrap::Ref);
env->SetProtoMethod(t, "unref", HandleWrap::Unref);
- env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed);
StreamWrap::AddMethods(env, t, StreamBase::kFlagHasWritev);
diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc
index b2c41ebf73..4a1cd3716a 100644
--- a/src/timer_wrap.cc
+++ b/src/timer_wrap.cc
@@ -39,7 +39,7 @@ class TimerWrap : public HandleWrap {
env->SetProtoMethod(constructor, "close", HandleWrap::Close);
env->SetProtoMethod(constructor, "ref", HandleWrap::Ref);
env->SetProtoMethod(constructor, "unref", HandleWrap::Unref);
- env->SetProtoMethod(constructor, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(constructor, "isRefed", HandleWrap::IsRefed);
env->SetProtoMethod(constructor, "start", Start);
env->SetProtoMethod(constructor, "stop", Stop);
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index e7acedd27a..5a1d333c3d 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -36,7 +36,7 @@ void TTYWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "close", HandleWrap::Close);
env->SetProtoMethod(t, "unref", HandleWrap::Unref);
- env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed);
StreamWrap::AddMethods(env, t, StreamBase::kFlagNoShutdown);
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index b5f3a3cf54..ac087f395a 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -108,7 +108,7 @@ void UDPWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "ref", HandleWrap::Ref);
env->SetProtoMethod(t, "unref", HandleWrap::Unref);
- env->SetProtoMethod(t, "unrefed", HandleWrap::Unrefed);
+ env->SetProtoMethod(t, "isRefed", HandleWrap::IsRefed);
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "UDP"), t->GetFunction());
env->set_udp_constructor_function(t->GetFunction());