Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-10-13 17:19:55 +0400
committerFedor Indutny <fedor@indutny.com>2014-10-13 23:46:46 +0400
commitd3c317e08ac6a624fde8b242905992eafdd954ac (patch)
tree1dd2756855ab5b4513503acc660705fa898c5c64 /src/signal_wrap.cc
parentb45d33617b569bf5fa84c9343da9f7d129756968 (diff)
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/signal_wrap.cc')
-rw-r--r--src/signal_wrap.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc
index e187f91c7ba..1d32f7af0f0 100644
--- a/src/signal_wrap.cc
+++ b/src/signal_wrap.cc
@@ -47,16 +47,15 @@ class SignalWrap : public HandleWrap {
Handle<Value> unused,
Handle<Context> context) {
Environment* env = Environment::GetCurrent(context);
- Local<FunctionTemplate> constructor = FunctionTemplate::New(env->isolate(),
- New);
+ Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Signal"));
- NODE_SET_PROTOTYPE_METHOD(constructor, "close", HandleWrap::Close);
- NODE_SET_PROTOTYPE_METHOD(constructor, "ref", HandleWrap::Ref);
- NODE_SET_PROTOTYPE_METHOD(constructor, "unref", HandleWrap::Unref);
- NODE_SET_PROTOTYPE_METHOD(constructor, "start", Start);
- NODE_SET_PROTOTYPE_METHOD(constructor, "stop", Stop);
+ env->SetProtoMethod(constructor, "close", HandleWrap::Close);
+ env->SetProtoMethod(constructor, "ref", HandleWrap::Ref);
+ env->SetProtoMethod(constructor, "unref", HandleWrap::Unref);
+ env->SetProtoMethod(constructor, "start", Start);
+ env->SetProtoMethod(constructor, "stop", Stop);
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Signal"),
constructor->GetFunction());
@@ -68,7 +67,7 @@ class SignalWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
CHECK(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
new SignalWrap(env, args.This());
}