GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/req_wrap.h Lines: 1 1 100.0 %
Date: 2019-01-07 12:15:22 Branches: 0 0 - %

Line Branch Exec Source
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
  // Call this after the req has been dispatched, if that did not already
21
  // happen by using Dispatch().
22
  inline void Dispatched();
23
  // Call this after a request has finished, if re-using this object is planned.
24
  inline void Reset();
25
490517
  T* req() { return &req_; }
26
  inline void Cancel();
27
28
  static ReqWrap* from_req(T* req);
29
30
  template <typename LibuvFunction, typename... Args>
31
  inline int Dispatch(LibuvFunction fn, Args... args);
32
33
 private:
34
  friend class Environment;
35
  friend int GenDebugSymbols();
36
  template <typename ReqT, typename U>
37
  friend struct MakeLibuvRequestCallback;
38
39
  ListNode<ReqWrap> req_wrap_queue_;
40
41
  typedef void (*callback_t)();
42
  callback_t original_callback_ = nullptr;
43
44
 protected:
45
  // req_wrap_queue_ needs to be at a fixed offset from the start of the class
46
  // because it is used by ContainerOf to calculate the address of the embedding
47
  // ReqWrap. ContainerOf compiles down to simple, fixed pointer arithmetic. It
48
  // is also used by src/node_postmortem_metadata.cc to calculate offsets and
49
  // generate debug symbols for ReqWrap, which assumes that the position of
50
  // members in memory are predictable. sizeof(req_) depends on the type of T,
51
  // so req_wrap_queue_ would no longer be at a fixed offset if it came after
52
  // req_. For more information please refer to
53
  // `doc/guides/node-postmortem-support.md`
54
  T req_;
55
};
56
57
}  // namespace node
58
59
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
60
61
#endif  // SRC_REQ_WRAP_H_