diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-10-13 17:19:55 +0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-10-13 23:46:46 +0400 |
commit | d3c317e08ac6a624fde8b242905992eafdd954ac (patch) | |
tree | 1dd2756855ab5b4513503acc660705fa898c5c64 /src/spawn_sync.cc | |
parent | b45d33617b569bf5fa84c9343da9f7d129756968 (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/spawn_sync.cc')
-rw-r--r-- | src/spawn_sync.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index ea491be1759..3cd33ef466c 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -356,13 +356,13 @@ void SyncProcessStdioPipe::CloseCallback(uv_handle_t* handle) { void SyncProcessRunner::Initialize(Handle<Object> target, Handle<Value> unused, Handle<Context> context) { - NODE_SET_METHOD(target, "spawn", Spawn); + Environment* env = Environment::GetCurrent(context); + env->SetMethod(target, "spawn", Spawn); } void SyncProcessRunner::Spawn(const FunctionCallbackInfo<Value>& args) { - Isolate* isolate = args.GetIsolate(); - SyncProcessRunner p(Environment::GetCurrent(isolate)); + SyncProcessRunner p(Environment::GetCurrent(args)); Local<Value> result = p.Run(args[0]); args.GetReturnValue().Set(result); } |