diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2013-06-11 12:52:27 +0200 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2013-06-15 21:44:50 +0200 |
commit | 6978e998ee7c08b3dd10e4cecd2a167696b74317 (patch) | |
tree | 62b4b089a9f3977f18bfde10d570cec0f5200cb4 /src/process_wrap.cc | |
parent | 0495b7031c9a33821e3a518e93911d2832f59d19 (diff) | |
download | android-node-v8-6978e998ee7c08b3dd10e4cecd2a167696b74317.tar.gz android-node-v8-6978e998ee7c08b3dd10e4cecd2a167696b74317.tar.bz2 android-node-v8-6978e998ee7c08b3dd10e4cecd2a167696b74317.zip |
process: abstract out HandleToStream
Originally contributed by @tjfontaine, but modified to be faster and
more generic.
Diffstat (limited to 'src/process_wrap.cc')
-rw-r--r-- | src/process_wrap.cc | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/process_wrap.cc b/src/process_wrap.cc index 02984976d2..4b14464a34 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -21,10 +21,7 @@ #include "node.h" #include "handle_wrap.h" -#include "pipe_wrap.h" -#include "tty_wrap.h" -#include "tcp_wrap.h" -#include "udp_wrap.h" +#include "node_wrap.h" #include <string.h> #include <stdlib.h> @@ -116,21 +113,8 @@ class ProcessWrap : public HandleWrap { PipeWrap::Unwrap(stdio ->Get(String::NewSymbol("handle")).As<Object>())->UVHandle()); } else if (type->Equals(String::NewSymbol("wrap"))) { - uv_stream_t* stream = NULL; - Local<Value> wrapType = stdio->Get(String::NewSymbol("wrapType")); - if (wrapType->Equals(String::NewSymbol("pipe"))) { - stream = reinterpret_cast<uv_stream_t*>(PipeWrap::Unwrap(stdio - ->Get(String::NewSymbol("handle")).As<Object>())->UVHandle()); - } else if (wrapType->Equals(String::NewSymbol("tty"))) { - stream = reinterpret_cast<uv_stream_t*>(TTYWrap::Unwrap(stdio - ->Get(String::NewSymbol("handle")).As<Object>())->UVHandle()); - } else if (wrapType->Equals(String::NewSymbol("tcp"))) { - stream = reinterpret_cast<uv_stream_t*>(TCPWrap::Unwrap(stdio - ->Get(String::NewSymbol("handle")).As<Object>())->UVHandle()); - } else if (wrapType->Equals(String::NewSymbol("udp"))) { - stream = reinterpret_cast<uv_stream_t*>(UDPWrap::Unwrap(stdio - ->Get(String::NewSymbol("handle")).As<Object>())->UVHandle()); - } + uv_stream_t* stream = HandleToStream( + stdio->Get(String::NewSymbol("handle")).As<Object>()); assert(stream != NULL); options->stdio[i].flags = UV_INHERIT_STREAM; |