Node.js  v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
js_stream.h
Go to the documentation of this file.
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 "env.h"
8 #include "stream_base.h"
9 #include "v8.h"
10 
11 namespace node {
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 
19  ~JSStream();
20 
21  void* Cast() override;
22  bool IsAlive() override;
23  bool IsClosing() override;
24  int ReadStart() override;
25  int ReadStop() override;
26 
27  int DoShutdown(ShutdownWrap* req_wrap) override;
28  int DoWrite(WriteWrap* w,
29  uv_buf_t* bufs,
30  size_t count,
31  uv_stream_t* send_handle) override;
32 
33  size_t self_size() const override { return sizeof(*this); }
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 DoAlloc(const v8::FunctionCallbackInfo<v8::Value>& args);
42  static void DoRead(const v8::FunctionCallbackInfo<v8::Value>& args);
43  static void DoAfterWrite(const v8::FunctionCallbackInfo<v8::Value>& args);
44  static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args);
45  static void EmitEOF(const v8::FunctionCallbackInfo<v8::Value>& args);
46 
47  template <class Wrap>
48  static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args);
49 };
50 
51 } // namespace node
52 
53 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
54 
55 #endif // SRC_JS_STREAM_H_
void Initialize(Local< Object > target, Local< Value > unused, Local< Context > context, void *priv)
Definition: node_http2.cc:1172
MaybeLocal< Object > New(Isolate *isolate, Local< String > string, enum encoding enc)
Definition: node_buffer.cc:241