@ -54,9 +54,9 @@ using v8::Object;
using v8 : : Value ;
void StreamWrap : : Initialize ( Local < Object > target ,
Local < Value > unused ,
Local < Context > context ) {
void Libuv StreamWrap: : Initialize ( Local < Object > target ,
Local < Value > unused ,
Local < Context > context ) {
Environment * env = Environment : : GetCurrent ( context ) ;
auto is_construct_call_callback =
@ -85,10 +85,10 @@ void StreamWrap::Initialize(Local<Object> target,
}
StreamWrap : : StreamWrap ( Environment * env ,
Local < Object > object ,
uv_stream_t * stream ,
AsyncWrap : : ProviderType provider )
Libuv StreamWrap: : Libuv StreamWrap( Environment * env ,
Local < Object > object ,
uv_stream_t * stream ,
AsyncWrap : : ProviderType provider )
: HandleWrap ( env ,
object ,
reinterpret_cast < uv_handle_t * > ( stream ) ,
@ -101,15 +101,15 @@ StreamWrap::StreamWrap(Environment* env,
}
void StreamWrap : : AddMethods ( Environment * env ,
v8 : : Local < v8 : : FunctionTemplate > target ,
int flags ) {
void Libuv StreamWrap: : AddMethods ( Environment * env ,
v8 : : Local < v8 : : FunctionTemplate > target ,
int flags ) {
env - > SetProtoMethod ( target , " setBlocking " , SetBlocking ) ;
StreamBase : : AddMethods < StreamWrap > ( env , target , flags ) ;
StreamBase : : AddMethods < Libuv StreamWrap> ( env , target , flags ) ;
}
int StreamWrap : : GetFD ( ) {
int Libuv StreamWrap: : GetFD ( ) {
int fd = - 1 ;
# if !defined(_WIN32)
if ( stream ( ) ! = nullptr )
@ -119,32 +119,32 @@ int StreamWrap::GetFD() {
}
bool StreamWrap : : IsAlive ( ) {
bool Libuv StreamWrap: : IsAlive ( ) {
return HandleWrap : : IsAlive ( this ) ;
}
bool StreamWrap : : IsClosing ( ) {
bool Libuv StreamWrap: : IsClosing ( ) {
return uv_is_closing ( reinterpret_cast < uv_handle_t * > ( stream ( ) ) ) ;
}
void * StreamWrap : : Cast ( ) {
void * Libuv StreamWrap: : Cast ( ) {
return reinterpret_cast < void * > ( this ) ;
}
AsyncWrap * StreamWrap : : GetAsyncWrap ( ) {
AsyncWrap * Libuv StreamWrap: : GetAsyncWrap ( ) {
return static_cast < AsyncWrap * > ( this ) ;
}
bool StreamWrap : : IsIPCPipe ( ) {
bool Libuv StreamWrap: : IsIPCPipe ( ) {
return is_named_pipe_ipc ( ) ;
}
void StreamWrap : : UpdateWriteQueueSize ( ) {
void Libuv StreamWrap: : UpdateWriteQueueSize ( ) {
HandleScope scope ( env ( ) - > isolate ( ) ) ;
Local < Integer > write_queue_size =
Integer : : NewFromUnsigned ( env ( ) - > isolate ( ) , stream ( ) - > write_queue_size ) ;
@ -152,20 +152,20 @@ void StreamWrap::UpdateWriteQueueSize() {
}
int StreamWrap : : ReadStart ( ) {
int Libuv StreamWrap: : ReadStart ( ) {
return uv_read_start ( stream ( ) , OnAlloc , OnRead ) ;
}
int StreamWrap : : ReadStop ( ) {
int Libuv StreamWrap: : ReadStop ( ) {
return uv_read_stop ( stream ( ) ) ;
}
void StreamWrap : : OnAlloc ( uv_handle_t * handle ,
void Libuv StreamWrap: : OnAlloc ( uv_handle_t * handle ,
size_t suggested_size ,
uv_buf_t * buf ) {
StreamWrap * wrap = static_cast < StreamWrap * > ( handle - > data ) ;
Libuv StreamWrap* wrap = static_cast < Libuv StreamWrap* > ( handle - > data ) ;
HandleScope scope ( wrap - > env ( ) - > isolate ( ) ) ;
Context : : Scope context_scope ( wrap - > env ( ) - > context ( ) ) ;
@ -175,14 +175,14 @@ void StreamWrap::OnAlloc(uv_handle_t* handle,
}
void StreamWrap : : OnAllocImpl ( size_t size , uv_buf_t * buf , void * ctx ) {
void Libuv StreamWrap: : OnAllocImpl ( size_t size , uv_buf_t * buf , void * ctx ) {
buf - > base = node : : Malloc ( size ) ;
buf - > len = size ;
}
template < class WrapType , class UVType >
static Local < Object > AcceptHandle ( Environment * env , StreamWrap * parent ) {
static Local < Object > AcceptHandle ( Environment * env , Libuv StreamWrap* parent ) {
EscapableHandleScope scope ( env - > isolate ( ) ) ;
Local < Object > wrap_obj ;
UVType * handle ;
@ -202,11 +202,11 @@ static Local<Object> AcceptHandle(Environment* env, StreamWrap* parent) {
}
void StreamWrap : : OnReadImpl ( ssize_t nread ,
void Libuv StreamWrap: : OnReadImpl ( ssize_t nread ,
const uv_buf_t * buf ,
uv_handle_type pending ,
void * ctx ) {
StreamWrap * wrap = static_cast < StreamWrap * > ( ctx ) ;
Libuv StreamWrap* wrap = static_cast < Libuv StreamWrap* > ( ctx ) ;
Environment * env = wrap - > env ( ) ;
HandleScope handle_scope ( env - > isolate ( ) ) ;
Context : : Scope context_scope ( env - > context ( ) ) ;
@ -244,10 +244,10 @@ void StreamWrap::OnReadImpl(ssize_t nread,
}
void StreamWrap : : OnRead ( uv_stream_t * handle ,
void Libuv StreamWrap: : OnRead ( uv_stream_t * handle ,
ssize_t nread ,
const uv_buf_t * buf ) {
StreamWrap * wrap = static_cast < StreamWrap * > ( handle - > data ) ;
Libuv StreamWrap* wrap = static_cast < Libuv StreamWrap* > ( handle - > data ) ;
HandleScope scope ( wrap - > env ( ) - > isolate ( ) ) ;
Context : : Scope context_scope ( wrap - > env ( ) - > context ( ) ) ;
uv_handle_type type = UV_UNKNOWN_HANDLE ;
@ -273,8 +273,8 @@ void StreamWrap::OnRead(uv_stream_t* handle,
}
void StreamWrap : : SetBlocking ( const FunctionCallbackInfo < Value > & args ) {
StreamWrap * wrap ;
void Libuv StreamWrap: : SetBlocking ( const FunctionCallbackInfo < Value > & args ) {
Libuv StreamWrap* wrap ;
ASSIGN_OR_RETURN_UNWRAP ( & wrap , args . Holder ( ) ) ;
CHECK_GT ( args . Length ( ) , 0 ) ;
@ -286,7 +286,7 @@ void StreamWrap::SetBlocking(const FunctionCallbackInfo<Value>& args) {
}
int StreamWrap : : DoShutdown ( ShutdownWrap * req_wrap ) {
int Libuv StreamWrap: : DoShutdown ( ShutdownWrap * req_wrap ) {
int err ;
err = uv_shutdown ( req_wrap - > req ( ) , stream ( ) , AfterShutdown ) ;
req_wrap - > Dispatched ( ) ;
@ -294,7 +294,7 @@ int StreamWrap::DoShutdown(ShutdownWrap* req_wrap) {
}
void StreamWrap : : AfterShutdown ( uv_shutdown_t * req , int status ) {
void Libuv StreamWrap: : AfterShutdown ( uv_shutdown_t * req , int status ) {
ShutdownWrap * req_wrap = ShutdownWrap : : from_req ( req ) ;
CHECK_NE ( req_wrap , nullptr ) ;
HandleScope scope ( req_wrap - > env ( ) - > isolate ( ) ) ;
@ -307,7 +307,7 @@ void StreamWrap::AfterShutdown(uv_shutdown_t* req, int status) {
// values, shifting their base and decrementing their length. This is
// required in order to skip the data that was successfully written via
// uv_try_write().
int StreamWrap : : DoTryWrite ( uv_buf_t * * bufs , size_t * count ) {
int Libuv StreamWrap: : DoTryWrite ( uv_buf_t * * bufs , size_t * count ) {
int err ;
size_t written ;
uv_buf_t * vbufs = * bufs ;
@ -343,7 +343,7 @@ int StreamWrap::DoTryWrite(uv_buf_t** bufs, size_t* count) {
}
int StreamWrap : : DoWrite ( WriteWrap * w ,
int Libuv StreamWrap: : DoWrite ( WriteWrap * w ,
uv_buf_t * bufs ,
size_t count ,
uv_stream_t * send_handle ) {
@ -372,7 +372,7 @@ int StreamWrap::DoWrite(WriteWrap* w,
}
void StreamWrap : : AfterWrite ( uv_write_t * req , int status ) {
void Libuv StreamWrap: : AfterWrite ( uv_write_t * req , int status ) {
WriteWrap * req_wrap = WriteWrap : : from_req ( req ) ;
CHECK_NE ( req_wrap , nullptr ) ;
HandleScope scope ( req_wrap - > env ( ) - > isolate ( ) ) ;
@ -381,11 +381,12 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
}
void StreamWrap : : OnAfterWriteImpl ( WriteWrap * w , void * ctx ) {
StreamWrap * wrap = static_cast < StreamWrap * > ( ctx ) ;
void Libuv StreamWrap: : OnAfterWriteImpl ( WriteWrap * w , void * ctx ) {
Libuv StreamWrap* wrap = static_cast < Libuv StreamWrap* > ( ctx ) ;
wrap - > UpdateWriteQueueSize ( ) ;
}
} // namespace node
NODE_MODULE_CONTEXT_AWARE_BUILTIN ( stream_wrap , node : : StreamWrap : : Initialize )
NODE_MODULE_CONTEXT_AWARE_BUILTIN ( stream_wrap ,
node : : LibuvStreamWrap : : Initialize )