11cb0ef41Sopenharmony_ci#ifndef SRC_JS_STREAM_H_ 21cb0ef41Sopenharmony_ci#define SRC_JS_STREAM_H_ 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci#include "async_wrap.h" 71cb0ef41Sopenharmony_ci#include "stream_base.h" 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_cinamespace node { 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciclass Environment; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciclass JSStream : public AsyncWrap, public StreamBase { 141cb0ef41Sopenharmony_ci public: 151cb0ef41Sopenharmony_ci static void Initialize(v8::Local<v8::Object> target, 161cb0ef41Sopenharmony_ci v8::Local<v8::Value> unused, 171cb0ef41Sopenharmony_ci v8::Local<v8::Context> context, 181cb0ef41Sopenharmony_ci void* priv); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci bool IsAlive() override; 211cb0ef41Sopenharmony_ci bool IsClosing() override; 221cb0ef41Sopenharmony_ci int ReadStart() override; 231cb0ef41Sopenharmony_ci int ReadStop() override; 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci int DoShutdown(ShutdownWrap* req_wrap) override; 261cb0ef41Sopenharmony_ci int DoWrite(WriteWrap* w, 271cb0ef41Sopenharmony_ci uv_buf_t* bufs, 281cb0ef41Sopenharmony_ci size_t count, 291cb0ef41Sopenharmony_ci uv_stream_t* send_handle) override; 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci SET_NO_MEMORY_INFO() 321cb0ef41Sopenharmony_ci SET_MEMORY_INFO_NAME(JSStream) 331cb0ef41Sopenharmony_ci SET_SELF_SIZE(JSStream) 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci protected: 361cb0ef41Sopenharmony_ci JSStream(Environment* env, v8::Local<v8::Object> obj); 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci AsyncWrap* GetAsyncWrap() override; 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci static void New(const v8::FunctionCallbackInfo<v8::Value>& args); 411cb0ef41Sopenharmony_ci static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args); 421cb0ef41Sopenharmony_ci static void EmitEOF(const v8::FunctionCallbackInfo<v8::Value>& args); 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ci template <class Wrap> 451cb0ef41Sopenharmony_ci static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args); 461cb0ef41Sopenharmony_ci}; 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci} // namespace node 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci#endif // SRC_JS_STREAM_H_ 53