From 0e57aafbb1c4ad9c8157bfe7f5718e867861492e Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 7 May 2012 23:30:55 +0200 Subject: Optimize writing strings with Socket.write --- src/stream_wrap.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/stream_wrap.h') diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 278fda7827..40947d5085 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -35,11 +35,15 @@ class StreamWrap : public HandleWrap { static void Initialize(v8::Handle target); // JavaScript functions - static v8::Handle Write(const v8::Arguments& args); static v8::Handle ReadStart(const v8::Arguments& args); static v8::Handle ReadStop(const v8::Arguments& args); static v8::Handle Shutdown(const v8::Arguments& args); + static v8::Handle WriteBuffer(const v8::Arguments& args); + static v8::Handle WriteAsciiString(const v8::Arguments& args); + static v8::Handle WriteUtf8String(const v8::Arguments& args); + static v8::Handle WriteUcs2String(const v8::Arguments& args); + protected: StreamWrap(v8::Handle object, uv_stream_t* stream); virtual ~StreamWrap() { } @@ -61,6 +65,9 @@ class StreamWrap : public HandleWrap { static void OnReadCommon(uv_stream_t* handle, ssize_t nread, uv_buf_t buf, uv_handle_type pending); + template + static v8::Handle WriteStringImpl(const v8::Arguments& args); + size_t slab_offset_; uv_stream_t* stream_; }; -- cgit v1.2.1