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

Line Branch Exec Source
1
#ifndef SRC_NODE_BINDING_H_
2
#define SRC_NODE_BINDING_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#if defined(__POSIX__)
7
#include <dlfcn.h>
8
#endif
9
10
#include "node.h"
11
#define NAPI_EXPERIMENTAL
12
#include "node_api.h"
13
#include "util.h"
14
#include "uv.h"
15
#include "v8.h"
16
17
enum {
18
  NM_F_BUILTIN = 1 << 0,
19
  NM_F_LINKED = 1 << 1,
20
  NM_F_INTERNAL = 1 << 2,
21
};
22
23
#define NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, priv, flags)           \
24
  static node::node_module _module = {                                         \
25
      NODE_MODULE_VERSION,                                                     \
26
      flags,                                                                   \
27
      nullptr,                                                                 \
28
      __FILE__,                                                                \
29
      nullptr,                                                                 \
30
      (node::addon_context_register_func)(regfunc),                            \
31
      NODE_STRINGIFY(modname),                                                 \
32
      priv,                                                                    \
33
      nullptr};                                                                \
34
  void _register_##modname() { node_module_register(&_module); }
35
36
#define NODE_BUILTIN_MODULE_CONTEXT_AWARE(modname, regfunc)                    \
37
  NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_BUILTIN)
38
39
void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
40
                                    v8::Local<v8::Value> module,
41
                                    v8::Local<v8::Context> context,
42
                                    napi_addon_register_func init);
43
44
namespace node {
45
46
#define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc)                   \
47
  NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_INTERNAL)
48
49
// Globals per process
50
// This is set by node::Init() which is used by embedders
51
extern bool node_is_initialized;
52
53
namespace binding {
54
55
58
class DLib {
56
 public:
57
#ifdef __POSIX__
58
  static const int kDefaultFlags = RTLD_LAZY;
59
#else
60
  static const int kDefaultFlags = 0;
61
#endif
62
63
  DLib(const char* filename, int flags);
64
65
  bool Open();
66
  void Close();
67
  void* GetSymbolAddress(const char* name);
68
69
  const std::string filename_;
70
  const int flags_;
71
  std::string errmsg_;
72
  void* handle_;
73
#ifndef __POSIX__
74
  uv_lib_t lib_;
75
#endif
76
77
 private:
78
  DISALLOW_COPY_AND_ASSIGN(DLib);
79
};
80
81
// Call _register<module_name> functions for all of
82
// the built-in modules. Because built-in modules don't
83
// use the __attribute__((constructor)). Need to
84
// explicitly call the _register* functions.
85
void RegisterBuiltinModules();
86
void GetBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
87
void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
88
void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
89
void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args);
90
91
}  // namespace binding
92
93
}  // namespace node
94
95
#include "node_binding.h"
96
97
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
98
#endif  // SRC_NODE_BINDING_H_