Skip to content

Commit 57707e2

Browse files
romanklFishrock123
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 5df5d04 commit 57707e2

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
@@ -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(),

0 commit comments

Comments
 (0)