Node.js  v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
req-wrap.h
Go to the documentation of this file.
1 #ifndef SRC_REQ_WRAP_H_
2 #define SRC_REQ_WRAP_H_
3 
4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5 
6 #include "async-wrap.h"
7 #include "env.h"
8 #include "util.h"
9 #include "v8.h"
10 
11 namespace node {
12 
13 template <typename T>
14 class ReqWrap : public AsyncWrap {
15  public:
16  inline ReqWrap(Environment* env,
17  v8::Local<v8::Object> object,
18  AsyncWrap::ProviderType provider);
19  inline ~ReqWrap() override;
20  inline void Dispatched(); // Call this after the req has been dispatched.
21  T* req() { return &req_; }
22 
23  private:
24  friend class Environment;
25  ListNode<ReqWrap> req_wrap_queue_;
26 
27  protected:
28  // req_wrap_queue_ needs to be at a fixed offset from the start of the class
29  // because it is used by ContainerOf to calculate the address of the embedding
30  // ReqWrap. ContainerOf compiles down to simple, fixed pointer arithmetic.
31  // sizeof(req_) depends on the type of T, so req_wrap_queue_ would
32  // no longer be at a fixed offset if it came after req_.
33  T req_;
34 };
35 
36 } // namespace node
37 
38 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
39 
40 #endif // SRC_REQ_WRAP_H_
uv_fs_t req
Definition: node_file.cc:374