summaryrefslogtreecommitdiff
path: root/src/node_zlib.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-10-13 15:19:55 +0200
committerFedor Indutny <fedor@indutny.com>2014-10-13 23:46:46 +0400
commitd3c317e08ac6a624fde8b242905992eafdd954ac (patch)
tree1dd2756855ab5b4513503acc660705fa898c5c64 /src/node_zlib.cc
parentb45d33617b569bf5fa84c9343da9f7d129756968 (diff)
downloadandroid-node-v8-d3c317e08ac6a624fde8b242905992eafdd954ac.tar.gz
android-node-v8-d3c317e08ac6a624fde8b242905992eafdd954ac.tar.bz2
android-node-v8-d3c317e08ac6a624fde8b242905992eafdd954ac.zip
src: attach env directly to api functions
Attach the per-context execution environment directly to API functions. Rationale: * Gets node one step closer to multi-isolate readiness. * Avoids multi-context confusion, e.g. when the caller and callee live in different contexts. * Avoids expensive calls to pthread_getspecific() on platforms where V8 does not know how to use the thread-local storage directly. (Linux, the BSDs.) PR-URL: https://github.com/node-forward/node/pull/18 Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'src/node_zlib.cc')
-rw-r--r--src/node_zlib.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index e3165b2b30..22e62d9fb9 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -219,7 +219,7 @@ class ZCtx : public AsyncWrap {
static void AfterSync(ZCtx* ctx, const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
Local<Integer> avail_out = Integer::New(env->isolate(),
ctx->strm_.avail_out);
Local<Integer> avail_in = Integer::New(env->isolate(),
@@ -365,7 +365,7 @@ class ZCtx : public AsyncWrap {
}
static void New(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
if (args.Length() < 1 || !args[0]->IsInt32()) {
return env->ThrowTypeError("Bad argument");
@@ -595,16 +595,16 @@ void InitZlib(Handle<Object> target,
Handle<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
- Local<FunctionTemplate> z = FunctionTemplate::New(env->isolate(), ZCtx::New);
+ Local<FunctionTemplate> z = env->NewFunctionTemplate(ZCtx::New);
z->InstanceTemplate()->SetInternalFieldCount(1);
- NODE_SET_PROTOTYPE_METHOD(z, "write", ZCtx::Write<true>);
- NODE_SET_PROTOTYPE_METHOD(z, "writeSync", ZCtx::Write<false>);
- NODE_SET_PROTOTYPE_METHOD(z, "init", ZCtx::Init);
- NODE_SET_PROTOTYPE_METHOD(z, "close", ZCtx::Close);
- NODE_SET_PROTOTYPE_METHOD(z, "params", ZCtx::Params);
- NODE_SET_PROTOTYPE_METHOD(z, "reset", ZCtx::Reset);
+ env->SetProtoMethod(z, "write", ZCtx::Write<true>);
+ env->SetProtoMethod(z, "writeSync", ZCtx::Write<false>);
+ env->SetProtoMethod(z, "init", ZCtx::Init);
+ env->SetProtoMethod(z, "close", ZCtx::Close);
+ env->SetProtoMethod(z, "params", ZCtx::Params);
+ env->SetProtoMethod(z, "reset", ZCtx::Reset);
z->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Zlib"));
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Zlib"), z->GetFunction());