We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 404a4db commit 1ae1489Copy full SHA for 1ae1489
5 files changed
src/req_wrap.h
@@ -0,0 +1,35 @@
1
+#ifndef REQ_WRAP_H_
2
+#define REQ_WRAP_H_
3
+
4
+namespace node {
5
6
+template <typename T>
7
+class ReqWrap {
8
+ public:
9
+ ReqWrap() {
10
+ v8::HandleScope scope;
11
+ object_ = v8::Persistent<v8::Object>::New(v8::Object::New());
12
+ }
13
14
+ ~ReqWrap() {
15
+ // Assert that someone has called Dispatched()
16
+ assert(req_.data == this);
17
+ assert(!object_.IsEmpty());
18
+ object_.Dispose();
19
+ object_.Clear();
20
21
22
+ // Call this after the req has been dispatched.
23
+ void Dispatched() {
24
+ req_.data = this;
25
26
27
+ v8::Persistent<v8::Object> object_;
28
+ T req_;
29
+};
30
31
32
+} // namespace node
33
34
35
+#endif // REQ_WRAP_H_
0 commit comments