GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: node_util.h Lines: 3 3 100.0 %
Date: 2022-12-31 04:22:30 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 GetRef(const v8::FunctionCallbackInfo<v8::Value>& args);
27
  static void IncRef(const v8::FunctionCallbackInfo<v8::Value>& args);
28
  static void DecRef(const v8::FunctionCallbackInfo<v8::Value>& args);
29
30
173
  SET_MEMORY_INFO_NAME(WeakReference)
31
173
  SET_SELF_SIZE(WeakReference)
32
173
  SET_NO_MEMORY_INFO()
33
34
  struct InternalFieldInfo : public node::InternalFieldInfoBase {
35
    SnapshotIndex target;
36
    uint64_t reference_count;
37
  };
38
39
 private:
40
  WeakReference(Environment* env,
41
                v8::Local<v8::Object> object,
42
                v8::Local<v8::Object> target,
43
                uint64_t reference_count);
44
  v8::Global<v8::Object> target_;
45
  uint64_t reference_count_ = 0;
46
47
  SnapshotIndex target_index_ = 0;  // 0 means target_ is not snapshotted
48
};
49
50
}  // namespace util
51
}  // namespace node
52
53
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
54
55
#endif  // SRC_NODE_UTIL_H_