summaryrefslogtreecommitdiff
path: root/src/req_wrap.h
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2017-11-14 13:34:52 +0100
committerDaniel Bevenius <daniel.bevenius@gmail.com>2017-11-17 12:49:20 +0100
commitb58a1cd70a2ccc97bb97bba4464d2b5aaecf5ab5 (patch)
tree0c3a8f21c48f56326b21d1b7dccfbb41a49206bc /src/req_wrap.h
parenta515e593f397cd60c9f52c4365cba29a85ce232e (diff)
downloadandroid-node-v8-b58a1cd70a2ccc97bb97bba4464d2b5aaecf5ab5.tar.gz
android-node-v8-b58a1cd70a2ccc97bb97bba4464d2b5aaecf5ab5.tar.bz2
android-node-v8-b58a1cd70a2ccc97bb97bba4464d2b5aaecf5ab5.zip
src: rename req-wrap -> req_wrap
This commit renames req-wrap to req_wrap consitency with other c++ source files. PR-URL: https://github.com/nodejs/node/pull/17022 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'src/req_wrap.h')
-rw-r--r--src/req_wrap.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/req_wrap.h b/src/req_wrap.h
new file mode 100644
index 0000000000..83baf9d2a3
--- /dev/null
+++ b/src/req_wrap.h
@@ -0,0 +1,40 @@
+#ifndef SRC_REQ_WRAP_H_
+#define SRC_REQ_WRAP_H_
+
+#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
+
+#include "async_wrap.h"
+#include "env.h"
+#include "util.h"
+#include "v8.h"
+
+namespace node {
+
+template <typename T>
+class ReqWrap : public AsyncWrap {
+ public:
+ inline ReqWrap(Environment* env,
+ v8::Local<v8::Object> object,
+ AsyncWrap::ProviderType provider);
+ inline ~ReqWrap() override;
+ inline void Dispatched(); // Call this after the req has been dispatched.
+ T* req() { return &req_; }
+
+ private:
+ friend class Environment;
+ ListNode<ReqWrap> req_wrap_queue_;
+
+ protected:
+ // req_wrap_queue_ needs to be at a fixed offset from the start of the class
+ // because it is used by ContainerOf to calculate the address of the embedding
+ // ReqWrap. ContainerOf compiles down to simple, fixed pointer arithmetic.
+ // sizeof(req_) depends on the type of T, so req_wrap_queue_ would
+ // no longer be at a fixed offset if it came after req_.
+ T req_;
+};
+
+} // namespace node
+
+#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
+
+#endif // SRC_REQ_WRAP_H_