GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/module_wrap.h Lines: 1 6 16.7 %
Date: 2019-02-23 22:23:05 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef SRC_MODULE_WRAP_H_
2
#define SRC_MODULE_WRAP_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include <unordered_map>
7
#include <string>
8
#include <vector>
9
#include "node_url.h"
10
#include "base_object-inl.h"
11
12
namespace node {
13
namespace loader {
14
15
enum PackageMainCheck : bool {
16
    CheckMain = true,
17
    IgnoreMain = false
18
};
19
20
enum ScriptType : int {
21
  kScript,
22
  kModule,
23
  kFunction,
24
};
25
26
enum HostDefinedOptions : int {
27
  kType = 8,
28
  kID = 9,
29
  kLength = 10,
30
};
31
32
v8::Maybe<url::URL> Resolve(Environment* env,
33
                            const std::string& specifier,
34
                            const url::URL& base,
35
                            PackageMainCheck read_pkg_json = CheckMain);
36
37
class ModuleWrap : public BaseObject {
38
 public:
39
  static const std::string EXTENSIONS[];
40
  static void Initialize(v8::Local<v8::Object> target,
41
                         v8::Local<v8::Value> unused,
42
                         v8::Local<v8::Context> context,
43
                         void* priv);
44
  static void HostInitializeImportMetaObjectCallback(
45
      v8::Local<v8::Context> context,
46
      v8::Local<v8::Module> module,
47
      v8::Local<v8::Object> meta);
48
49
  void MemoryInfo(MemoryTracker* tracker) const override {
50
    tracker->TrackField("url", url_);
51
    tracker->TrackField("resolve_cache", resolve_cache_);
52
  }
53
54
260
  inline uint32_t id() { return id_; }
55
  static ModuleWrap* GetFromID(node::Environment*, uint32_t id);
56
57
  SET_MEMORY_INFO_NAME(ModuleWrap)
58
  SET_SELF_SIZE(ModuleWrap)
59
60
 private:
61
  ModuleWrap(Environment* env,
62
             v8::Local<v8::Object> object,
63
             v8::Local<v8::Module> module,
64
             v8::Local<v8::String> url);
65
  ~ModuleWrap() override;
66
67
  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
68
  static void Link(const v8::FunctionCallbackInfo<v8::Value>& args);
69
  static void Instantiate(const v8::FunctionCallbackInfo<v8::Value>& args);
70
  static void Evaluate(const v8::FunctionCallbackInfo<v8::Value>& args);
71
  static void Namespace(const v8::FunctionCallbackInfo<v8::Value>& args);
72
  static void GetStatus(const v8::FunctionCallbackInfo<v8::Value>& args);
73
  static void GetError(const v8::FunctionCallbackInfo<v8::Value>& args);
74
  static void GetStaticDependencySpecifiers(
75
      const v8::FunctionCallbackInfo<v8::Value>& args);
76
77
  static void Resolve(const v8::FunctionCallbackInfo<v8::Value>& args);
78
  static void SetImportModuleDynamicallyCallback(
79
      const v8::FunctionCallbackInfo<v8::Value>& args);
80
  static void SetInitializeImportMetaObjectCallback(
81
      const v8::FunctionCallbackInfo<v8::Value>& args);
82
  static v8::MaybeLocal<v8::Module> ResolveCallback(
83
      v8::Local<v8::Context> context,
84
      v8::Local<v8::String> specifier,
85
      v8::Local<v8::Module> referrer);
86
  static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
87
88
  Persistent<v8::Module> module_;
89
  Persistent<v8::String> url_;
90
  bool linked_ = false;
91
  std::unordered_map<std::string, Persistent<v8::Promise>> resolve_cache_;
92
  Persistent<v8::Context> context_;
93
  uint32_t id_;
94
};
95
96
}  // namespace loader
97
}  // namespace node
98
99
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
100
101
#endif  // SRC_MODULE_WRAP_H_