void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- FSEventWrap* wrap = UnwrapObject<FSEventWrap>(args.This());
+ FSEventWrap* wrap = Unwrap<FSEventWrap>(args.This());
if (args.Length() < 1 || !args[0]->IsString()) {
return ThrowTypeError("Bad arguments");
void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- FSEventWrap* wrap = UnwrapObject<FSEventWrap>(args.This());
+ FSEventWrap* wrap = Unwrap<FSEventWrap>(args.This());
if (wrap == NULL || wrap->initialized_ == false)
return;
void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- HandleWrap* wrap = UnwrapObject<HandleWrap>(args.This());
+ HandleWrap* wrap = Unwrap<HandleWrap>(args.This());
if (wrap != NULL && wrap->handle__ != NULL) {
uv_ref(wrap->handle__);
void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- HandleWrap* wrap = UnwrapObject<HandleWrap>(args.This());
+ HandleWrap* wrap = Unwrap<HandleWrap>(args.This());
if (wrap != NULL && wrap->handle__ != NULL) {
uv_unref(wrap->handle__);
void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- HandleWrap* wrap = UnwrapObject<HandleWrap>(args.This());
+ HandleWrap* wrap = Unwrap<HandleWrap>(args.This());
// guard against uninitialized handle or double close
if (wrap == NULL || wrap->handle__ == NULL)
handle__->data = this;
HandleScope scope(node_isolate);
persistent().Reset(node_isolate, object);
- WrapObject<HandleWrap>(object, this);
+ Wrap<HandleWrap>(object, this);
QUEUE_INSERT_TAIL(&handle_wrap_queue, &handle_wrap_queue_);
}
HandleScope scope(node_isolate);
Local<Object> wrapper =
env->script_data_constructor_function()->NewInstance();
- WrapObject<ContextifyContext>(wrapper, this);
+ Wrap<ContextifyContext>(wrapper, this);
return scope.Close(wrapper);
}
HandleScope scope(node_isolate);
ContextifyContext* ctx =
- UnwrapObject<ContextifyContext>(args.Data().As<Object>());
+ Unwrap<ContextifyContext>(args.Data().As<Object>());
Local<Object> sandbox = PersistentToLocal(node_isolate, ctx->sandbox_);
Local<Value> rv = sandbox->GetRealNamedProperty(property);
HandleScope scope(node_isolate);
ContextifyContext* ctx =
- UnwrapObject<ContextifyContext>(args.Data().As<Object>());
+ Unwrap<ContextifyContext>(args.Data().As<Object>());
PersistentToLocal(node_isolate, ctx->sandbox_)->Set(property, value);
}
HandleScope scope(node_isolate);
ContextifyContext* ctx =
- UnwrapObject<ContextifyContext>(args.Data().As<Object>());
+ Unwrap<ContextifyContext>(args.Data().As<Object>());
Local<Object> sandbox = PersistentToLocal(node_isolate, ctx->sandbox_);
Local<Object> proxy_global = PersistentToLocal(node_isolate,
HandleScope scope(node_isolate);
ContextifyContext* ctx =
- UnwrapObject<ContextifyContext>(args.Data().As<Object>());
+ Unwrap<ContextifyContext>(args.Data().As<Object>());
bool success = PersistentToLocal(node_isolate,
ctx->sandbox_)->Delete(property);
HandleScope scope(node_isolate);
ContextifyContext* ctx =
- UnwrapObject<ContextifyContext>(args.Data().As<Object>());
+ Unwrap<ContextifyContext>(args.Data().As<Object>());
Local<Object> sandbox = PersistentToLocal(node_isolate, ctx->sandbox_);
args.GetReturnValue().Set(sandbox->GetPropertyNames());
}
ContextifyScript* wrapped_script =
- UnwrapObject<ContextifyScript>(args.This());
+ Unwrap<ContextifyScript>(args.This());
Local<Script> script = PersistentToLocal(node_isolate,
wrapped_script->script_);
void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
OPENSSL_CONST SSL_METHOD *method = SSLv23_method();
void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
unsigned int len = args.Length();
if (len != 1 && len != 2) {
void SecureContext::SetCert(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1) {
return ThrowTypeError("Bad parameter");
bool newCAStore = false;
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1) {
return ThrowTypeError("Bad parameter");
void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1) {
return ThrowTypeError("Bad parameter");
void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
assert(sc->ca_store_ == NULL);
void SecureContext::SetCiphers(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1 || !args[0]->IsString()) {
return ThrowTypeError("Bad parameter");
void SecureContext::SetOptions(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1 || !args[0]->IntegerValue()) {
return ThrowTypeError("Bad parameter");
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1 || !args[0]->IsString()) {
return ThrowTypeError("Bad parameter");
void SecureContext::SetSessionTimeout(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() != 1 || !args[0]->IsInt32()) {
return ThrowTypeError("Bad parameter");
void SecureContext::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
sc->FreeCTXMem();
}
char* pass = NULL;
bool ret = false;
- SecureContext* sc = UnwrapObject<SecureContext>(args.This());
+ SecureContext* sc = Unwrap<SecureContext>(args.This());
if (args.Length() < 1) {
return ThrowTypeError("Bad parameter");
#if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_CTX_get_tlsext_ticket_keys)
HandleScope handle_scope(args.GetIsolate());
- SecureContext* wrap = UnwrapObject<SecureContext>(args.This());
+ SecureContext* wrap = Unwrap<SecureContext>(args.This());
Local<Object> buff = Buffer::New(wrap->env(), 48);
if (SSL_CTX_get_tlsext_ticket_keys(wrap->ctx_,
return ThrowTypeError("Bad argument");
}
- SecureContext* wrap = UnwrapObject<SecureContext>(args.This());
+ SecureContext* wrap = Unwrap<SecureContext>(args.This());
if (SSL_CTX_set_tlsext_ticket_keys(wrap->ctx_,
Buffer::Data(args[0]),
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
Environment* env = w->env();
Local<Object> info = Object::New();
void SSLWrap<Base>::GetSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
SSL_SESSION* sess = SSL_get_session(w->ssl_);
if (sess == NULL)
void SSLWrap<Base>::SetSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
if (args.Length() < 1 ||
(!args[0]->IsString() && !Buffer::HasInstance(args[0]))) {
void SSLWrap<Base>::LoadSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
Environment* env = w->env();
if (args.Length() >= 1 && Buffer::HasInstance(args[0])) {
template <class Base>
void SSLWrap<Base>::IsSessionReused(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
bool yes = SSL_session_reused(w->ssl_);
args.GetReturnValue().Set(yes);
}
template <class Base>
void SSLWrap<Base>::ReceivedShutdown(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
bool yes = SSL_get_shutdown(w->ssl_) == SSL_RECEIVED_SHUTDOWN;
args.GetReturnValue().Set(yes);
}
template <class Base>
void SSLWrap<Base>::EndParser(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
w->hello_parser_.End();
}
void SSLWrap<Base>::Renegotiate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
ClearErrorOnReturn clear_error_on_return;
(void) &clear_error_on_return; // Silence unused variable warning.
template <class Base>
void SSLWrap<Base>::IsInitFinished(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
bool yes = SSL_is_init_finished(w->ssl_);
args.GetReturnValue().Set(yes);
}
void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
// XXX(indutny) Do this check in JS land?
X509* peer_cert = SSL_get_peer_certificate(w->ssl_);
void SSLWrap<Base>::GetCurrentCipher(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
Environment* env = w->env();
OPENSSL_CONST SSL_CIPHER* c = SSL_get_current_cipher(w->ssl_);
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
if (w->is_client()) {
if (w->selected_npn_proto_.IsEmpty() == false) {
void SSLWrap<Base>::SetNPNProtocols(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = UnwrapObject<Base>(args.This());
+ Base* w = Unwrap<Base>(args.This());
if (args.Length() < 1 || !Buffer::HasInstance(args[0]))
return ThrowTypeError("Must give a Buffer as first argument");
env->secure_context_constructor_template();
if (secure_context_constructor_template->HasInstance(ret)) {
conn->sniContext_.Reset(node_isolate, ret);
- SecureContext* sc = UnwrapObject<SecureContext>(ret.As<Object>());
+ SecureContext* sc = Unwrap<SecureContext>(ret.As<Object>());
SSL_set_SSL_CTX(s, sc->ctx_);
} else {
return SSL_TLSEXT_ERR_NOACK;
return ThrowError("First argument must be a crypto module Credentials");
}
- SecureContext* sc = UnwrapObject<SecureContext>(args[0]->ToObject());
+ SecureContext* sc = Unwrap<SecureContext>(args[0]->ToObject());
Environment* env = sc->env();
bool is_server = args[1]->BooleanValue();
void Connection::EncIn(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (args.Length() < 3) {
return ThrowTypeError("Takes 3 parameters");
void Connection::ClearOut(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (args.Length() < 3) {
return ThrowTypeError("Takes 3 parameters");
void Connection::ClearPending(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
int bytes_pending = BIO_pending(conn->bio_read_);
args.GetReturnValue().Set(bytes_pending);
}
void Connection::EncPending(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
int bytes_pending = BIO_pending(conn->bio_write_);
args.GetReturnValue().Set(bytes_pending);
}
void Connection::EncOut(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (args.Length() < 3) {
return ThrowTypeError("Takes 3 parameters");
void Connection::ClearIn(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (args.Length() < 3) {
return ThrowTypeError("Takes 3 parameters");
void Connection::Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
int rv = 0;
if (!SSL_is_init_finished(conn->ssl_)) {
void Connection::Shutdown(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (conn->ssl_ == NULL) {
return args.GetReturnValue().Set(false);
void Connection::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (conn->ssl_ != NULL) {
SSL_free(conn->ssl_);
void Connection::GetServername(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (conn->is_server() && !conn->servername_.IsEmpty()) {
args.GetReturnValue().Set(conn->servername_);
void Connection::SetSNICallback(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Connection* conn = UnwrapObject<Connection>(args.This());
+ Connection* conn = Unwrap<Connection>(args.This());
if (args.Length() < 1 || !args[0]->IsFunction()) {
return ThrowError("Must give a Function as first argument");
void CipherBase::Init(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- CipherBase* cipher = UnwrapObject<CipherBase>(args.This());
+ CipherBase* cipher = Unwrap<CipherBase>(args.This());
if (args.Length() < 2 ||
!(args[0]->IsString() && Buffer::HasInstance(args[1]))) {
void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- CipherBase* cipher = UnwrapObject<CipherBase>(args.This());
+ CipherBase* cipher = Unwrap<CipherBase>(args.This());
if (args.Length() < 3 || !args[0]->IsString()) {
return ThrowError("Must give cipher-type, key, and iv as argument");
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- CipherBase* cipher = UnwrapObject<CipherBase>(args.This());
+ CipherBase* cipher = Unwrap<CipherBase>(args.This());
ASSERT_IS_STRING_OR_BUFFER(args[0]);
void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- CipherBase* cipher = UnwrapObject<CipherBase>(args.This());
+ CipherBase* cipher = Unwrap<CipherBase>(args.This());
cipher->SetAutoPadding(args.Length() < 1 || args[0]->BooleanValue());
}
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- CipherBase* cipher = UnwrapObject<CipherBase>(args.This());
+ CipherBase* cipher = Unwrap<CipherBase>(args.This());
unsigned char* out_value = NULL;
int out_len = -1;
void Hmac::HmacInit(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Hmac* hmac = UnwrapObject<Hmac>(args.This());
+ Hmac* hmac = Unwrap<Hmac>(args.This());
if (args.Length() < 2 || !args[0]->IsString()) {
return ThrowError("Must give hashtype string, key as arguments");
void Hmac::HmacUpdate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Hmac* hmac = UnwrapObject<Hmac>(args.This());
+ Hmac* hmac = Unwrap<Hmac>(args.This());
ASSERT_IS_STRING_OR_BUFFER(args[0]);
void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Hmac* hmac = UnwrapObject<Hmac>(args.This());
+ Hmac* hmac = Unwrap<Hmac>(args.This());
enum encoding encoding = BUFFER;
if (args.Length() >= 1) {
void Hash::HashUpdate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Hash* hash = UnwrapObject<Hash>(args.This());
+ Hash* hash = Unwrap<Hash>(args.This());
ASSERT_IS_STRING_OR_BUFFER(args[0]);
void Hash::HashDigest(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Hash* hash = UnwrapObject<Hash>(args.This());
+ Hash* hash = Unwrap<Hash>(args.This());
if (!hash->initialised_) {
return ThrowError("Not initialized");
void Sign::SignInit(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Sign* sign = UnwrapObject<Sign>(args.This());
+ Sign* sign = Unwrap<Sign>(args.This());
if (args.Length() == 0 || !args[0]->IsString()) {
return ThrowError("Must give signtype string as argument");
void Sign::SignUpdate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Sign* sign = UnwrapObject<Sign>(args.This());
+ Sign* sign = Unwrap<Sign>(args.This());
ASSERT_IS_STRING_OR_BUFFER(args[0]);
void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Sign* sign = UnwrapObject<Sign>(args.This());
+ Sign* sign = Unwrap<Sign>(args.This());
unsigned char* md_value;
unsigned int md_len;
void Verify::VerifyInit(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Verify* verify = UnwrapObject<Verify>(args.This());
+ Verify* verify = Unwrap<Verify>(args.This());
if (args.Length() == 0 || !args[0]->IsString()) {
return ThrowError("Must give verifytype string as argument");
void Verify::VerifyUpdate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Verify* verify = UnwrapObject<Verify>(args.This());
+ Verify* verify = Unwrap<Verify>(args.This());
ASSERT_IS_STRING_OR_BUFFER(args[0]);
void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Verify* verify = UnwrapObject<Verify>(args.This());
+ Verify* verify = Unwrap<Verify>(args.This());
ASSERT_IS_BUFFER(args[0]);
char* kbuf = Buffer::Data(args[0]);
void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::GetPrime(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::GetGenerator(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::SetPublicKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void DiffieHellman::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- DiffieHellman* diffieHellman = UnwrapObject<DiffieHellman>(args.This());
+ DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.This());
if (!diffieHellman->initialised_) {
return ThrowError("Not initialized");
void Certificate::VerifySpkac(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Certificate* certificate = UnwrapObject<Certificate>(args.This());
+ Certificate* certificate = Unwrap<Certificate>(args.This());
bool i = false;
if (args.Length() < 1)
void Certificate::ExportPublicKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Certificate* certificate = UnwrapObject<Certificate>(args.This());
+ Certificate* certificate = Unwrap<Certificate>(args.This());
if (args.Length() < 1)
return ThrowTypeError("Missing argument");
void Certificate::ExportChallenge(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Certificate* crt = UnwrapObject<Certificate>(args.This());
+ Certificate* crt = Unwrap<Certificate>(args.This());
if (args.Length() < 1)
return ThrowTypeError("Missing argument");
static void Execute(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Parser* parser = UnwrapObject<Parser>(args.This());
+ Parser* parser = Unwrap<Parser>(args.This());
assert(parser->current_buffer_.IsEmpty());
assert(parser->current_buffer_len_ == 0);
assert(parser->current_buffer_data_ == NULL);
static void Finish(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Parser* parser = UnwrapObject<Parser>(args.This());
+ Parser* parser = Unwrap<Parser>(args.This());
assert(parser->current_buffer_.IsEmpty());
parser->got_exception_ = false;
static_cast<http_parser_type>(args[0]->Int32Value());
assert(type == HTTP_REQUEST || type == HTTP_RESPONSE);
- Parser* parser = UnwrapObject<Parser>(args.This());
+ Parser* parser = Unwrap<Parser>(args.This());
// Should always be called from the same context.
assert(env == parser->env());
parser->Init(type);
static void Pause(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- Parser* parser = UnwrapObject<Parser>(args.This());
+ Parser* parser = Unwrap<Parser>(args.This());
// Should always be called from the same context.
assert(env == parser->env());
http_parser_pause(&parser->parser_, should_pause);
assert(args.Length() == 3);
HandleScope scope(node_isolate);
- StatWatcher* wrap = UnwrapObject<StatWatcher>(args.This());
+ StatWatcher* wrap = Unwrap<StatWatcher>(args.This());
String::Utf8Value path(args[0]);
const bool persistent = args[1]->BooleanValue();
const uint32_t interval = args[2]->Uint32Value();
void StatWatcher::Stop(const FunctionCallbackInfo<Value>& args) {
- StatWatcher* wrap = UnwrapObject<StatWatcher>(args.This());
+ StatWatcher* wrap = Unwrap<StatWatcher>(args.This());
Environment* env = wrap->env();
Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
do { \
if (env->tcp_constructor_template().IsEmpty() == false && \
env->tcp_constructor_template()->HasInstance(obj)) { \
- TCPWrap* const wrap = UnwrapObject<TCPWrap>(obj); \
+ TCPWrap* const wrap = Unwrap<TCPWrap>(obj); \
BODY \
} else if (env->tty_constructor_template().IsEmpty() == false && \
env->tty_constructor_template()->HasInstance(obj)) { \
- TTYWrap* const wrap = UnwrapObject<TTYWrap>(obj); \
+ TTYWrap* const wrap = Unwrap<TTYWrap>(obj); \
BODY \
} else if (env->pipe_constructor_template().IsEmpty() == false && \
env->pipe_constructor_template()->HasInstance(obj)) { \
- PipeWrap* const wrap = UnwrapObject<PipeWrap>(obj); \
+ PipeWrap* const wrap = Unwrap<PipeWrap>(obj); \
BODY \
} \
} while (0)
static void Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- ZCtx* ctx = UnwrapObject<ZCtx>(args.This());
+ ZCtx* ctx = Unwrap<ZCtx>(args.This());
ctx->Close();
}
HandleScope scope(node_isolate);
assert(args.Length() == 7);
- ZCtx* ctx = UnwrapObject<ZCtx>(args.This());
+ ZCtx* ctx = Unwrap<ZCtx>(args.This());
assert(ctx->init_done_ && "write before init");
assert(ctx->mode_ != NONE && "already finalized");
assert((args.Length() == 4 || args.Length() == 5) &&
"init(windowBits, level, memLevel, strategy, [dictionary])");
- ZCtx* ctx = UnwrapObject<ZCtx>(args.This());
+ ZCtx* ctx = Unwrap<ZCtx>(args.This());
int windowBits = args[0]->Uint32Value();
assert((windowBits >= 8 && windowBits <= 15) && "invalid windowBits");
assert(args.Length() == 2 && "params(level, strategy)");
- ZCtx* ctx = UnwrapObject<ZCtx>(args.This());
+ ZCtx* ctx = Unwrap<ZCtx>(args.This());
Params(ctx, args[0]->Int32Value(), args[1]->Int32Value());
}
static void Reset(const FunctionCallbackInfo<Value> &args) {
HandleScope scope(node_isolate);
- ZCtx* ctx = UnwrapObject<ZCtx>(args.This());
+ ZCtx* ctx = Unwrap<ZCtx>(args.This());
Reset(ctx);
SetDictionary(ctx);
void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This());
+ PipeWrap* wrap = Unwrap<PipeWrap>(args.This());
String::AsciiValue name(args[0]);
int err = uv_pipe_bind(&wrap->handle_, *name);
void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This());
+ PipeWrap* wrap = Unwrap<PipeWrap>(args.This());
int instances = args[0]->Int32Value();
void PipeWrap::Listen(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This());
+ PipeWrap* wrap = Unwrap<PipeWrap>(args.This());
int backlog = args[0]->Int32Value();
int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_),
env->pipe_constructor_template()->GetFunction()->NewInstance();
// Unwrap the client javascript object.
- PipeWrap* wrap = UnwrapObject<PipeWrap>(client_obj);
+ PipeWrap* wrap = Unwrap<PipeWrap>(client_obj);
uv_stream_t* client_handle = reinterpret_cast<uv_stream_t*>(&wrap->handle_);
if (uv_accept(handle, client_handle))
return;
void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This());
+ PipeWrap* wrap = Unwrap<PipeWrap>(args.This());
int fd = args[0]->Int32Value();
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(args.GetIsolate());
- PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This());
+ PipeWrap* wrap = Unwrap<PipeWrap>(args.This());
assert(args[0]->IsObject());
assert(args[1]->IsString());
Local<Object> handle = stdio->Get(handle_key).As<Object>();
options->stdio[i].data.stream =
reinterpret_cast<uv_stream_t*>(
- UnwrapObject<PipeWrap>(handle)->UVHandle());
+ Unwrap<PipeWrap>(handle)->UVHandle());
} else if (type->Equals(FIXED_ONE_BYTE_STRING(node_isolate, "wrap"))) {
Local<String> handle_key =
FIXED_ONE_BYTE_STRING(node_isolate, "handle");
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- ProcessWrap* wrap = UnwrapObject<ProcessWrap>(args.This());
+ ProcessWrap* wrap = Unwrap<ProcessWrap>(args.This());
Local<Object> js_options = args[0]->ToObject();
static void Kill(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- ProcessWrap* wrap = UnwrapObject<ProcessWrap>(args.This());
+ ProcessWrap* wrap = Unwrap<ProcessWrap>(args.This());
int signal = args[0]->Int32Value();
int err = uv_process_kill(&wrap->process_, signal);
static void Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SignalWrap* wrap = UnwrapObject<SignalWrap>(args.This());
+ SignalWrap* wrap = Unwrap<SignalWrap>(args.This());
int signum = args[0]->Int32Value();
int err = uv_signal_start(&wrap->handle_, OnSignal, signum);
static void Stop(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- SignalWrap* wrap = UnwrapObject<SignalWrap>(args.This());
+ SignalWrap* wrap = Unwrap<SignalWrap>(args.This());
int err = uv_signal_stop(&wrap->handle_);
args.GetReturnValue().Set(err);
void StreamWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
#if !defined(_WIN32)
HandleScope scope(node_isolate);
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
int fd = -1;
if (wrap != NULL && wrap->stream() != NULL) {
fd = wrap->stream()->io_watcher.fd;
void StreamWrap::ReadStart(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
int err;
if (wrap->is_named_pipe_ipc()) {
void StreamWrap::ReadStop(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
int err = uv_read_stop(wrap->stream());
args.GetReturnValue().Set(err);
if (wrap_obj.IsEmpty())
return Local<Object>();
- WrapType* wrap = UnwrapObject<WrapType>(wrap_obj);
+ WrapType* wrap = Unwrap<WrapType>(wrap_obj);
handle = wrap->UVHandle();
if (uv_accept(pipe, reinterpret_cast<uv_stream_t*>(handle)))
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
assert(args[0]->IsObject());
assert(Buffer::HasInstance(args[1]));
HandleScope handle_scope(args.GetIsolate());
int err;
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
assert(args[0]->IsObject());
assert(args[1]->IsString());
if (args[2]->IsObject()) {
Local<Object> send_handle_obj = args[2].As<Object>();
- HandleWrap* wrap = UnwrapObject<HandleWrap>(send_handle_obj);
+ HandleWrap* wrap = Unwrap<HandleWrap>(send_handle_obj);
send_handle = wrap->GetHandle();
// Reference StreamWrap instance to prevent it from being garbage
// collected before `AfterWrite` is called.
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
assert(args[0]->IsObject());
assert(args[1]->IsArray());
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- StreamWrap* wrap = UnwrapObject<StreamWrap>(args.This());
+ StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
assert(args[0]->IsObject());
Local<Object> req_wrap_obj = args[0].As<Object>();
HandleScope handle_scope(args.GetIsolate());
struct sockaddr_storage address;
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
assert(args[0]->IsObject());
Local<Object> out = args[0].As<Object>();
HandleScope handle_scope(args.GetIsolate());
struct sockaddr_storage address;
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
assert(args[0]->IsObject());
Local<Object> out = args[0].As<Object>();
void TCPWrap::SetNoDelay(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
int enable = static_cast<int>(args[0]->BooleanValue());
int err = uv_tcp_nodelay(&wrap->handle_, enable);
void TCPWrap::SetKeepAlive(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
int enable = args[0]->Int32Value();
unsigned int delay = args[1]->Uint32Value();
void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
bool enable = args[0]->BooleanValue();
int err = uv_tcp_simultaneous_accepts(&wrap->handle_, enable);
void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
int fd = args[0]->IntegerValue();
uv_tcp_open(&wrap->handle_, fd);
}
void TCPWrap::Bind(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
String::AsciiValue ip_address(args[0]);
int port = args[1]->Int32Value();
void TCPWrap::Bind6(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
String::AsciiValue ip6_address(args[0]);
int port = args[1]->Int32Value();
void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
int backlog = args[0]->Int32Value();
int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_),
Local<Object> client_obj = Instantiate(env);
// Unwrap the client javascript object.
- TCPWrap* wrap = UnwrapObject<TCPWrap>(client_obj);
+ TCPWrap* wrap = Unwrap<TCPWrap>(client_obj);
uv_stream_t* client_handle = reinterpret_cast<uv_stream_t*>(&wrap->handle_);
if (uv_accept(handle, client_handle))
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
assert(args[0]->IsObject());
assert(args[1]->IsString());
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- TCPWrap* wrap = UnwrapObject<TCPWrap>(args.This());
+ TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
assert(args[0]->IsObject());
assert(args[1]->IsString());
static void Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TimerWrap* wrap = UnwrapObject<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
int64_t timeout = args[0]->IntegerValue();
int64_t repeat = args[1]->IntegerValue();
static void Stop(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TimerWrap* wrap = UnwrapObject<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
int err = uv_timer_stop(&wrap->handle_);
args.GetReturnValue().Set(err);
static void Again(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TimerWrap* wrap = UnwrapObject<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
int err = uv_timer_again(&wrap->handle_);
args.GetReturnValue().Set(err);
static void SetRepeat(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TimerWrap* wrap = UnwrapObject<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
int64_t repeat = args[0]->IntegerValue();
uv_timer_set_repeat(&wrap->handle_, repeat);
static void GetRepeat(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TimerWrap* wrap = UnwrapObject<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
int64_t repeat = uv_timer_get_repeat(&wrap->handle_);
args.GetReturnValue().Set(static_cast<double>(repeat));
Kind kind,
Handle<Object> sc,
StreamWrapCallbacks* old)
- : SSLWrap<TLSCallbacks>(env, UnwrapObject<SecureContext>(sc), kind),
+ : SSLWrap<TLSCallbacks>(env, Unwrap<SecureContext>(sc), kind),
StreamWrapCallbacks(old),
enc_in_(NULL),
enc_out_(NULL),
shutdown_(false) {
// Persist SecureContext
- sc_ = UnwrapObject<SecureContext>(sc);
+ sc_ = Unwrap<SecureContext>(sc);
sc_handle_.Reset(node_isolate, sc);
Local<Object> object = env->tls_wrap_constructor_function()->NewInstance();
persistent().Reset(node_isolate, object);
- WrapObject<TLSCallbacks>(object, this);
+ node::Wrap<TLSCallbacks>(object, this);
// Initialize queue for clearIn writes
QUEUE_INIT(&write_item_queue_);
void TLSCallbacks::Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TLSCallbacks* wrap = UnwrapObject<TLSCallbacks>(args.This());
+ TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.This());
if (wrap->started_)
return ThrowError("Already started.");
void TLSCallbacks::SetVerifyMode(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TLSCallbacks* wrap = UnwrapObject<TLSCallbacks>(args.This());
+ TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.This());
if (args.Length() < 2 || !args[0]->IsBoolean() || !args[1]->IsBoolean())
return ThrowTypeError("Bad arguments, expected two booleans");
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TLSCallbacks* wrap = UnwrapObject<TLSCallbacks>(args.This());
+ TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.This());
wrap->enable_session_callbacks();
EnableHelloParser(args);
void TLSCallbacks::EnableHelloParser(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TLSCallbacks* wrap = UnwrapObject<TLSCallbacks>(args.This());
+ TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.This());
wrap->hello_parser_.Start(SSLWrap<TLSCallbacks>::OnClientHello,
OnClientHelloParseEnd,
void TLSCallbacks::GetServername(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TLSCallbacks* wrap = UnwrapObject<TLSCallbacks>(args.This());
+ TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.This());
const char* servername = SSL_get_servername(wrap->ssl_,
TLSEXT_NAMETYPE_host_name);
void TLSCallbacks::SetServername(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TLSCallbacks* wrap = UnwrapObject<TLSCallbacks>(args.This());
+ TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.This());
if (args.Length() < 1 || !args[0]->IsString())
return ThrowTypeError("First argument should be a string");
p->sni_context_.Dispose();
p->sni_context_.Reset(node_isolate, ctx);
- SecureContext* sc = UnwrapObject<SecureContext>(ctx.As<Object>());
+ SecureContext* sc = Unwrap<SecureContext>(ctx.As<Object>());
SSL_set_SSL_CTX(s, sc->ctx_);
}
void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TTYWrap* wrap = UnwrapObject<TTYWrap>(args.This());
+ TTYWrap* wrap = Unwrap<TTYWrap>(args.This());
assert(args[0]->IsArray());
int width, height;
void TTYWrap::SetRawMode(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- TTYWrap* wrap = UnwrapObject<TTYWrap>(args.This());
+ TTYWrap* wrap = Unwrap<TTYWrap>(args.This());
int err = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue());
args.GetReturnValue().Set(err);
void UDPWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
#if !defined(_WIN32)
HandleScope scope(node_isolate);
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
int fd = (wrap == NULL) ? -1 : wrap->handle_.io_watcher.fd;
args.GetReturnValue().Set(fd);
#endif
void UDPWrap::DoBind(const FunctionCallbackInfo<Value>& args, int family) {
HandleScope scope(node_isolate);
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
// bind(ip, port, flags)
assert(args.Length() == 3);
#define X(name, fn) \
void UDPWrap::name(const FunctionCallbackInfo<Value>& args) { \
HandleScope scope(node_isolate); \
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This()); \
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This()); \
assert(args.Length() == 1); \
int flag = args[0]->Int32Value(); \
int err = fn(&wrap->handle_, flag); \
void UDPWrap::SetMembership(const FunctionCallbackInfo<Value>& args,
uv_membership membership) {
HandleScope scope(node_isolate);
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
assert(args.Length() == 2);
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
// send(req, buffer, offset, length, port, address)
assert(args[0]->IsObject());
void UDPWrap::RecvStart(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
int err = uv_udp_recv_start(&wrap->handle_, OnAlloc, OnRecv);
// UV_EALREADY means that the socket is already bound but that's okay
void UDPWrap::RecvStop(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
int r = uv_udp_recv_stop(&wrap->handle_);
args.GetReturnValue().Set(r);
HandleScope handle_scope(args.GetIsolate());
struct sockaddr_storage address;
- UDPWrap* wrap = UnwrapObject<UDPWrap>(args.This());
+ UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
assert(args[0]->IsObject());
Local<Object> obj = args[0].As<Object>();
}
template <typename TypeName>
-void WrapObject(v8::Local<v8::Object> object, TypeName* pointer) {
+void Wrap(v8::Local<v8::Object> object, TypeName* pointer) {
assert(!object.IsEmpty());
assert(object->InternalFieldCount() > 0);
object->SetAlignedPointerInInternalField(0, pointer);
}
template <typename TypeName>
-TypeName* UnwrapObject(v8::Local<v8::Object> object) {
+TypeName* Unwrap(v8::Local<v8::Object> object) {
assert(!object.IsEmpty());
assert(object->InternalFieldCount() > 0);
void* pointer = object->GetAlignedPointerFromInternalField(0);
const unsigned char* data,
int length = -1);
-inline static void WrapObject(v8::Local<v8::Object> object, void* pointer);
+inline void Wrap(v8::Local<v8::Object> object, void* pointer);
template <typename TypeName>
-inline static TypeName* UnwrapObject(v8::Local<v8::Object> object);
+inline TypeName* Unwrap(v8::Local<v8::Object> object);
} // namespace node
weak_object_.MarkIndependent();
// The pointer is resolved as void*.
- WrapObject<WeakObject>(object, this);
+ Wrap<WeakObject>(object, this);
MakeWeak();
}