diff options
Diffstat (limited to 'src/pipe_wrap.cc')
-rw-r--r-- | src/pipe_wrap.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 3f196017891..e8bfadb0faf 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -36,6 +36,7 @@ namespace node { using v8::Boolean; using v8::Context; +using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; @@ -59,13 +60,13 @@ uv_pipe_t* PipeWrap::UVHandle() { Local<Object> PipeWrap::Instantiate(Environment* env) { - HandleScope handle_scope(env->isolate()); + EscapableHandleScope handle_scope(env->isolate()); assert(!env->pipe_constructor_template().IsEmpty()); Local<Function> constructor = env->pipe_constructor_template()->GetFunction(); assert(!constructor.IsEmpty()); Local<Object> instance = constructor->NewInstance(); assert(!instance.IsEmpty()); - return handle_scope.Close(instance); + return handle_scope.Escape(instance); } @@ -74,7 +75,7 @@ void PipeWrap::Initialize(Handle<Object> target, Handle<Context> context) { Environment* env = Environment::GetCurrent(context); - Local<FunctionTemplate> t = FunctionTemplate::New(New); + Local<FunctionTemplate> t = FunctionTemplate::New(env->isolate(), New); t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Pipe")); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -147,7 +148,7 @@ void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) { PipeWrap* wrap = Unwrap<PipeWrap>(args.This()); - String::AsciiValue name(args[0]); + String::Utf8Value name(args[0]); int err = uv_pipe_bind(&wrap->handle_, *name); args.GetReturnValue().Set(err); } @@ -195,8 +196,8 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) { assert(pipe_wrap->persistent().IsEmpty() == false); Local<Value> argv[] = { - Integer::New(status, env->isolate()), - Undefined() + Integer::New(env->isolate(), status), + Undefined(env->isolate()) }; if (status != 0) { @@ -244,11 +245,11 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) { Local<Object> req_wrap_obj = req_wrap->object(); Local<Value> argv[5] = { - Integer::New(status, env->isolate()), + Integer::New(env->isolate(), status), wrap->object(), req_wrap_obj, - Boolean::New(readable), - Boolean::New(writable) + Boolean::New(env->isolate(), readable), + Boolean::New(env->isolate(), writable) }; req_wrap->MakeCallback(env->oncomplete_string(), ARRAY_SIZE(argv), argv); @@ -268,7 +269,7 @@ void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) { int err = uv_pipe_open(&wrap->handle_, fd); if (err != 0) - ThrowException(UVException(err, "uv_pipe_open")); + env->isolate()->ThrowException(UVException(err, "uv_pipe_open")); } @@ -282,7 +283,7 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { assert(args[1]->IsString()); Local<Object> req_wrap_obj = args[0].As<Object>(); - String::AsciiValue name(args[1]); + String::Utf8Value name(args[1]); ConnectWrap* req_wrap = new ConnectWrap(env, req_wrap_obj, |