From 57707e2490c46dfb97673d73e4bf602a9a2877c0 Mon Sep 17 00:00:00 2001 From: Roman Klauke Date: Tue, 25 Aug 2015 21:17:36 +0200 Subject: [PATCH] src: use ZCtxt as a source for v8::Isolates Other methods like `After` already use ZCtxt as the source for Enviroment/ v8::Isolate objects, this commit applies the same style to the other missing methods (`After sync` and `Write`) PR-URL: https://github.com/nodejs/node/pull/2547 Reviewed-By: Fedor Indutny Reviewed-By: Trevor Norris Reviewed-By: Jeremiah Senkpiel --- src/node_zlib.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 50c7a90..da60d44 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -141,6 +141,7 @@ class ZCtx : public AsyncWrap { Bytef *in; Bytef *out; size_t in_off, in_len, out_off, out_len; + Environment* env = ctx->env(); if (args[1]->IsNull()) { // just a flush @@ -151,7 +152,7 @@ class ZCtx : public AsyncWrap { } else { CHECK(Buffer::HasInstance(args[1])); Local in_buf; - in_buf = args[1]->ToObject(args.GetIsolate()); + in_buf = args[1]->ToObject(env->isolate()); in_off = args[2]->Uint32Value(); in_len = args[3]->Uint32Value(); @@ -160,7 +161,7 @@ class ZCtx : public AsyncWrap { } CHECK(Buffer::HasInstance(args[4])); - Local out_buf = args[4]->ToObject(args.GetIsolate()); + Local out_buf = args[4]->ToObject(env->isolate()); out_off = args[5]->Uint32Value(); out_len = args[6]->Uint32Value(); CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf))); @@ -198,7 +199,7 @@ class ZCtx : public AsyncWrap { static void AfterSync(ZCtx* ctx, const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); + Environment* env = ctx->env(); Local avail_out = Integer::New(env->isolate(), ctx->strm_.avail_out); Local avail_in = Integer::New(env->isolate(), -- 2.7.4