summaryrefslogtreecommitdiff
path: root/src/stream_wrap.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/stream_wrap.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/stream_wrap.cc')
-rw-r--r--src/stream_wrap.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index a274b0bca3..805f7a3f02 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -70,8 +70,7 @@ StreamWrap::StreamWrap(Environment* env,
void StreamWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
#if !defined(_WIN32)
- Environment* env = Environment::GetCurrent(args.GetIsolate());
- HandleScope scope(env->isolate());
+ HandleScope scope(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
int fd = -1;
if (wrap != NULL && wrap->stream() != NULL) {
@@ -181,7 +180,7 @@ size_t StreamWrap::WriteBuffer(Handle<Value> val, uv_buf_t* buf) {
void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
@@ -237,7 +236,7 @@ void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
template <enum encoding encoding>
void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
int err;
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
@@ -365,7 +364,7 @@ void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
@@ -535,7 +534,7 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
void StreamWrap::Shutdown(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args);
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());