src: use ZCtxt as a source for v8::Isolates · nodejs/node@57707e2

Original file line numberDiff line numberDiff line change

@@ -141,6 +141,7 @@ class ZCtx : public AsyncWrap {

141141

Bytef *in;

142142

Bytef *out;

143143

size_t in_off, in_len, out_off, out_len;

144+

Environment* env = ctx->env();

144145
145146

if (args[1]->IsNull()) {

146147

// just a flush

@@ -151,7 +152,7 @@ class ZCtx : public AsyncWrap {

151152

} else {

152153

CHECK(Buffer::HasInstance(args[1]));

153154

Local<Object> in_buf;

154-

in_buf = args[1]->ToObject(args.GetIsolate());

155+

in_buf = args[1]->ToObject(env->isolate());

155156

in_off = args[2]->Uint32Value();

156157

in_len = args[3]->Uint32Value();

157158

@@ -160,7 +161,7 @@ class ZCtx : public AsyncWrap {

160161

}

161162
162163

CHECK(Buffer::HasInstance(args[4]));

163-

Local<Object> out_buf = args[4]->ToObject(args.GetIsolate());

164+

Local<Object> out_buf = args[4]->ToObject(env->isolate());

164165

out_off = args[5]->Uint32Value();

165166

out_len = args[6]->Uint32Value();

166167

CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf)));

@@ -198,7 +199,7 @@ class ZCtx : public AsyncWrap {

198199
199200
200201

static void AfterSync(ZCtx* ctx, const FunctionCallbackInfo<Value>& args) {

201-

Environment* env = Environment::GetCurrent(args);

202+

Environment* env = ctx->env();

202203

Local<Integer> avail_out = Integer::New(env->isolate(),

203204

ctx->strm_.avail_out);

204205

Local<Integer> avail_in = Integer::New(env->isolate(),