• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SRC_JS_STREAM_H_
2 #define SRC_JS_STREAM_H_
3 
4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5 
6 #include "async_wrap.h"
7 #include "stream_base.h"
8 
9 namespace node {
10 
11 class Environment;
12 
13 class JSStream : public AsyncWrap, public StreamBase {
14  public:
15   static void Initialize(v8::Local<v8::Object> target,
16                          v8::Local<v8::Value> unused,
17                          v8::Local<v8::Context> context,
18                          void* priv);
19 
20   bool IsAlive() override;
21   bool IsClosing() override;
22   int ReadStart() override;
23   int ReadStop() override;
24 
25   int DoShutdown(ShutdownWrap* req_wrap) override;
26   int DoWrite(WriteWrap* w,
27               uv_buf_t* bufs,
28               size_t count,
29               uv_stream_t* send_handle) override;
30 
31   SET_NO_MEMORY_INFO()
32   SET_MEMORY_INFO_NAME(JSStream)
33   SET_SELF_SIZE(JSStream)
34 
35  protected:
36   JSStream(Environment* env, v8::Local<v8::Object> obj);
37 
38   AsyncWrap* GetAsyncWrap() override;
39 
40   static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
41   static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args);
42   static void EmitEOF(const v8::FunctionCallbackInfo<v8::Value>& args);
43 
44   template <class Wrap>
45   static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args);
46 };
47 
48 }  // namespace node
49 
50 #endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
51 
52 #endif  // SRC_JS_STREAM_H_
53