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