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: 0 6 0.0 %
Date: 2019-02-01 22:03:38 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
};
24
25
enum HostDefinedOptions : int {
26
  kType = 8,
27
  kID = 9,
28
  kLength = 10,
29
};
30
31
v8::Maybe<url::URL> Resolve(Environment* env,
32
                            const std::string& specifier,
33
                            const url::URL& base,
34
                            PackageMainCheck read_pkg_json = CheckMain);
35
36
class ModuleWrap : public BaseObject {
37
 public:
38
  static const std::string EXTENSIONS[];
39
  static void Initialize(v8::Local<v8::Object> target,
40
                         v8::Local<v8::Value> unused,
41
                         v8::Local<v8::Context> context,
42
                         void* priv);
43
  static void HostInitializeImportMetaObjectCallback(
44
      v8::Local<v8::Context> context,
45
      v8::Local<v8::Module> module,
46
      v8::Local<v8::Object> meta);
47
48
  void MemoryInfo(MemoryTracker* tracker) const override {
49
    tracker->TrackField("url", url_);
50
    tracker->TrackField("resolve_cache", resolve_cache_);
51
  }
52
53
  inline uint32_t id() { return id_; }
54
  static ModuleWrap* GetFromID(node::Environment*, uint32_t id);
55
56
  SET_MEMORY_INFO_NAME(ModuleWrap)
57
  SET_SELF_SIZE(ModuleWrap)
58
59
 private:
60
  ModuleWrap(Environment* env,
61
             v8::Local<v8::Object> object,
62
             v8::Local<v8::Module> module,
63
             v8::Local<v8::String> url);
64
  ~ModuleWrap();
65
66
  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
67
  static void Link(const v8::FunctionCallbackInfo<v8::Value>& args);
68
  static void Instantiate(const v8::FunctionCallbackInfo<v8::Value>& args);
69
  static void Evaluate(const v8::FunctionCallbackInfo<v8::Value>& args);
70
  static void Namespace(const v8::FunctionCallbackInfo<v8::Value>& args);
71
  static void GetStatus(const v8::FunctionCallbackInfo<v8::Value>& args);
72
  static void GetError(const v8::FunctionCallbackInfo<v8::Value>& args);
73
  static void GetStaticDependencySpecifiers(
74
      const v8::FunctionCallbackInfo<v8::Value>& args);
75
76
  static void Resolve(const v8::FunctionCallbackInfo<v8::Value>& args);
77
  static void SetImportModuleDynamicallyCallback(
78
      const v8::FunctionCallbackInfo<v8::Value>& args);
79
  static void SetInitializeImportMetaObjectCallback(
80
      const v8::FunctionCallbackInfo<v8::Value>& args);
81
  static v8::MaybeLocal<v8::Module> ResolveCallback(
82
      v8::Local<v8::Context> context,
83
      v8::Local<v8::String> specifier,
84
      v8::Local<v8::Module> referrer);
85
  static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
86
87
  Persistent<v8::Module> module_;
88
  Persistent<v8::String> url_;
89
  bool linked_ = false;
90
  std::unordered_map<std::string, Persistent<v8::Promise>> resolve_cache_;
91
  Persistent<v8::Context> context_;
92
  uint32_t id_;
93
};
94
95
}  // namespace loader
96
}  // namespace node
97
98
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
99
100
#endif  // SRC_MODULE_WRAP_H_