Skip to content

Commit 91cee73

Browse files
romanklrvagg
authored andcommitted
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: #2547 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 993c22f commit 91cee73

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/node_zlib.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class ZCtx : public AsyncWrap {
142142
Bytef *in;
143143
Bytef *out;
144144
size_t in_off, in_len, out_off, out_len;
145+
Environment* env = ctx->env();
145146

146147
if (args[1]->IsNull()) {
147148
// just a flush
@@ -152,7 +153,7 @@ class ZCtx : public AsyncWrap {
152153
} else {
153154
CHECK(Buffer::HasInstance(args[1]));
154155
Local<Object> in_buf;
155-
in_buf = args[1]->ToObject(args.GetIsolate());
156+
in_buf = args[1]->ToObject(env->isolate());
156157
in_off = args[2]->Uint32Value();
157158
in_len = args[3]->Uint32Value();
158159

@@ -161,7 +162,7 @@ class ZCtx : public AsyncWrap {
161162
}
162163

163164
CHECK(Buffer::HasInstance(args[4]));
164-
Local<Object> out_buf = args[4]->ToObject(args.GetIsolate());
165+
Local<Object> out_buf = args[4]->ToObject(env->isolate());
165166
out_off = args[5]->Uint32Value();
166167
out_len = args[6]->Uint32Value();
167168
CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf)));
@@ -199,7 +200,7 @@ class ZCtx : public AsyncWrap {
199200

200201

201202
static void AfterSync(ZCtx* ctx, const FunctionCallbackInfo<Value>& args) {
202-
Environment* env = Environment::GetCurrent(args);
203+
Environment* env = ctx->env();
203204
Local<Integer> avail_out = Integer::New(env->isolate(),
204205
ctx->strm_.avail_out);
205206
Local<Integer> avail_in = Integer::New(env->isolate(),

0 commit comments

Comments
 (0)