GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: node_util.h Lines: 3 3 100.0 %
Date: 2022-08-28 04:20:35 Branches: 0 0 - %

Line Branch Exec Source
1
2
#ifndef SRC_NODE_UTIL_H_
3
#define SRC_NODE_UTIL_H_
4
5
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6
#include "base_object.h"
7
#include "node_snapshotable.h"
8
#include "v8.h"
9
10
namespace node {
11
namespace util {
12
13
class WeakReference : public SnapshotableObject {
14
 public:
15
  SERIALIZABLE_OBJECT_METHODS();
16
17
  static constexpr FastStringKey type_name{"node::util::WeakReference"};
18
  static constexpr EmbedderObjectType type_int =
19
      EmbedderObjectType::k_util_weak_reference;
20
21
  WeakReference(Environment* env,
22
                v8::Local<v8::Object> object,
23
                v8::Local<v8::Object> target);
24
  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
25
  static void Get(const v8::FunctionCallbackInfo<v8::Value>& args);
26
  static void IncRef(const v8::FunctionCallbackInfo<v8::Value>& args);
27
  static void DecRef(const v8::FunctionCallbackInfo<v8::Value>& args);
28
29
78
  SET_MEMORY_INFO_NAME(WeakReference)
30
78
  SET_SELF_SIZE(WeakReference)
31
78
  SET_NO_MEMORY_INFO()
32
33
  struct InternalFieldInfo : public node::InternalFieldInfoBase {
34
    SnapshotIndex target;
35
    uint64_t reference_count;
36
  };
37
38
 private:
39
  WeakReference(Environment* env,
40
                v8::Local<v8::Object> object,
41
                v8::Local<v8::Object> target,
42
                uint64_t reference_count);
43
  v8::Global<v8::Object> target_;
44
  uint64_t reference_count_ = 0;
45
46
  SnapshotIndex target_index_ = 0;  // 0 means target_ is not snapshotted
47
};
48
49
}  // namespace util
50
}  // namespace node
51
52
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
53
54
#endif  // SRC_NODE_UTIL_H_