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: 6 6 100.0 %
Date: 2020-08-17 22:13:26 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 "base_object.h"
10
11
namespace node {
12
13
class Environment;
14
15
namespace contextify {
16
class ContextifyContext;
17
}
18
19
namespace loader {
20
21
enum ScriptType : int {
22
  kScript,
23
  kModule,
24
  kFunction,
25
};
26
27
enum HostDefinedOptions : int {
28
  kType = 8,
29
  kID = 9,
30
  kLength = 10,
31
};
32
33
class ModuleWrap : public BaseObject {
34
 public:
35
  enum InternalFields {
36
    kModuleWrapBaseField = BaseObject::kInternalFieldCount,
37
    kURLSlot,
38
    kSyntheticEvaluationStepsSlot,
39
    kContextObjectSlot,  // Object whose creation context is the target Context
40
    kInternalFieldCount
41
  };
42
43
  static void Initialize(v8::Local<v8::Object> target,
44
                         v8::Local<v8::Value> unused,
45
                         v8::Local<v8::Context> context,
46
                         void* priv);
47
  static void HostInitializeImportMetaObjectCallback(
48
      v8::Local<v8::Context> context,
49
      v8::Local<v8::Module> module,
50
      v8::Local<v8::Object> meta);
51
52
166
  void MemoryInfo(MemoryTracker* tracker) const override {
53
166
    tracker->TrackField("resolve_cache", resolve_cache_);
54
166
  }
55
56
32056
  inline uint32_t id() { return id_; }
57
  v8::Local<v8::Context> context() const;
58
  static ModuleWrap* GetFromID(node::Environment*, uint32_t id);
59
60
166
  SET_MEMORY_INFO_NAME(ModuleWrap)
61
166
  SET_SELF_SIZE(ModuleWrap)
62
63
 private:
64
  ModuleWrap(Environment* env,
65
             v8::Local<v8::Object> object,
66
             v8::Local<v8::Module> module,
67
             v8::Local<v8::String> url);
68
  ~ModuleWrap() override;
69
70
  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
71
  static void Link(const v8::FunctionCallbackInfo<v8::Value>& args);
72
  static void Instantiate(const v8::FunctionCallbackInfo<v8::Value>& args);
73
  static void Evaluate(const v8::FunctionCallbackInfo<v8::Value>& args);
74
  static void GetNamespace(const v8::FunctionCallbackInfo<v8::Value>& args);
75
  static void GetStatus(const v8::FunctionCallbackInfo<v8::Value>& args);
76
  static void GetError(const v8::FunctionCallbackInfo<v8::Value>& args);
77
  static void GetStaticDependencySpecifiers(
78
      const v8::FunctionCallbackInfo<v8::Value>& args);
79
80
  static void SetImportModuleDynamicallyCallback(
81
      const v8::FunctionCallbackInfo<v8::Value>& args);
82
  static void SetInitializeImportMetaObjectCallback(
83
      const v8::FunctionCallbackInfo<v8::Value>& args);
84
  static v8::MaybeLocal<v8::Value> SyntheticModuleEvaluationStepsCallback(
85
      v8::Local<v8::Context> context, v8::Local<v8::Module> module);
86
  static void SetSyntheticExport(
87
      const v8::FunctionCallbackInfo<v8::Value>& args);
88
  static void CreateCachedData(const v8::FunctionCallbackInfo<v8::Value>& args);
89
90
  static v8::MaybeLocal<v8::Module> ResolveCallback(
91
      v8::Local<v8::Context> context,
92
      v8::Local<v8::String> specifier,
93
      v8::Local<v8::Module> referrer);
94
  static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
95
96
  v8::Global<v8::Module> module_;
97
  std::unordered_map<std::string, v8::Global<v8::Promise>> resolve_cache_;
98
  contextify::ContextifyContext* contextify_context_ = nullptr;
99
  bool synthetic_ = false;
100
  bool linked_ = false;
101
  uint32_t id_;
102
};
103
104
}  // namespace loader
105
}  // namespace node
106
107
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
108
109
#endif  // SRC_MODULE_WRAP_H_