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/node_stat_watcher.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/node_stat_watcher.cc')
-rw-r--r--src/node_stat_watcher.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc
index 3d6c4b189d6..8f82bc357e2 100644
--- a/src/node_stat_watcher.cc
+++ b/src/node_stat_watcher.cc
@@ -46,13 +46,12 @@ using v8::Value;
void StatWatcher::Initialize(Environment* env, Handle<Object> target) {
HandleScope scope(env->isolate());
- Local<FunctionTemplate> t = FunctionTemplate::New(env->isolate(),
- StatWatcher::New);
+ Local<FunctionTemplate> t = env->NewFunctionTemplate(StatWatcher::New);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "StatWatcher"));
- NODE_SET_PROTOTYPE_METHOD(t, "start", StatWatcher::Start);
- NODE_SET_PROTOTYPE_METHOD(t, "stop", StatWatcher::Stop);
+ env->SetProtoMethod(t, "start", StatWatcher::Start);
+ env->SetProtoMethod(t, "stop", StatWatcher::Stop);
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "StatWatcher"),
t->GetFunction());
@@ -99,7 +98,7 @@ void StatWatcher::Callback(uv_fs_poll_t* handle,
void StatWatcher::New(const FunctionCallbackInfo<Value>& args) {
CHECK(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
new StatWatcher(env, args.This());
}