@contrast/agent 4.5.2 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/lib/assess/policy/propagators.json +20 -0
  2. package/lib/assess/policy/signatures.json +10 -0
  3. package/lib/core/config/options.js +3 -2
  4. package/lib/core/stacktrace.js +2 -1
  5. package/lib/hooks/frameworks/base.js +8 -2
  6. package/lib/hooks/frameworks/http.js +23 -16
  7. package/lib/hooks/frameworks/http2.js +73 -0
  8. package/lib/hooks/frameworks/index.js +8 -3
  9. package/lib/hooks/http.js +112 -128
  10. package/lib/hooks/require.js +16 -22
  11. package/lib/instrumentation.js +0 -3
  12. package/package.json +12 -15
  13. package/lib/hooks/frameworks/https.js +0 -42
  14. package/node_modules/bindings/LICENSE.md +0 -22
  15. package/node_modules/bindings/README.md +0 -98
  16. package/node_modules/bindings/bindings.js +0 -221
  17. package/node_modules/bindings/package.json +0 -32
  18. package/node_modules/file-uri-to-path/.npmignore +0 -1
  19. package/node_modules/file-uri-to-path/.travis.yml +0 -30
  20. package/node_modules/file-uri-to-path/History.md +0 -21
  21. package/node_modules/file-uri-to-path/LICENSE +0 -20
  22. package/node_modules/file-uri-to-path/README.md +0 -74
  23. package/node_modules/file-uri-to-path/index.d.ts +0 -2
  24. package/node_modules/file-uri-to-path/index.js +0 -66
  25. package/node_modules/file-uri-to-path/package.json +0 -36
  26. package/node_modules/file-uri-to-path/test/test.js +0 -24
  27. package/node_modules/file-uri-to-path/test/tests.json +0 -13
  28. package/node_modules/glossy/LICENSE +0 -19
  29. package/node_modules/glossy/README.md +0 -129
  30. package/node_modules/glossy/index.js +0 -12
  31. package/node_modules/glossy/lib/glossy/parse.js +0 -520
  32. package/node_modules/glossy/lib/glossy/produce.js +0 -459
  33. package/node_modules/glossy/package.json +0 -47
  34. package/node_modules/glossy/test/decide.js +0 -7
  35. package/node_modules/glossy/test/decode_pri.js +0 -24
  36. package/node_modules/glossy/test/parse_3164.js +0 -104
  37. package/node_modules/glossy/test/parse_5424.js +0 -106
  38. package/node_modules/glossy/test/parse_5848.js +0 -40
  39. package/node_modules/glossy/test/parse_8601.js +0 -14
  40. package/node_modules/glossy/test/parse_rfc3339.js +0 -9
  41. package/node_modules/glossy/test/produce.js +0 -162
  42. package/node_modules/glossy/test/runner.js +0 -40
  43. package/node_modules/glossy/test/structure_data.js +0 -24
  44. package/node_modules/nan/CHANGELOG.md +0 -537
  45. package/node_modules/nan/LICENSE.md +0 -13
  46. package/node_modules/nan/README.md +0 -455
  47. package/node_modules/nan/doc/asyncworker.md +0 -146
  48. package/node_modules/nan/doc/buffers.md +0 -54
  49. package/node_modules/nan/doc/callback.md +0 -76
  50. package/node_modules/nan/doc/converters.md +0 -41
  51. package/node_modules/nan/doc/errors.md +0 -226
  52. package/node_modules/nan/doc/json.md +0 -62
  53. package/node_modules/nan/doc/maybe_types.md +0 -583
  54. package/node_modules/nan/doc/methods.md +0 -664
  55. package/node_modules/nan/doc/new.md +0 -147
  56. package/node_modules/nan/doc/node_misc.md +0 -123
  57. package/node_modules/nan/doc/object_wrappers.md +0 -263
  58. package/node_modules/nan/doc/persistent.md +0 -296
  59. package/node_modules/nan/doc/scopes.md +0 -73
  60. package/node_modules/nan/doc/script.md +0 -38
  61. package/node_modules/nan/doc/string_bytes.md +0 -62
  62. package/node_modules/nan/doc/v8_internals.md +0 -199
  63. package/node_modules/nan/doc/v8_misc.md +0 -85
  64. package/node_modules/nan/include_dirs.js +0 -1
  65. package/node_modules/nan/nan.h +0 -2898
  66. package/node_modules/nan/nan_callbacks.h +0 -88
  67. package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
  68. package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
  69. package/node_modules/nan/nan_converters.h +0 -72
  70. package/node_modules/nan/nan_converters_43_inl.h +0 -68
  71. package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
  72. package/node_modules/nan/nan_define_own_property_helper.h +0 -29
  73. package/node_modules/nan/nan_implementation_12_inl.h +0 -430
  74. package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
  75. package/node_modules/nan/nan_json.h +0 -166
  76. package/node_modules/nan/nan_maybe_43_inl.h +0 -356
  77. package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
  78. package/node_modules/nan/nan_new.h +0 -340
  79. package/node_modules/nan/nan_object_wrap.h +0 -156
  80. package/node_modules/nan/nan_persistent_12_inl.h +0 -132
  81. package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
  82. package/node_modules/nan/nan_private.h +0 -73
  83. package/node_modules/nan/nan_string_bytes.h +0 -305
  84. package/node_modules/nan/nan_typedarray_contents.h +0 -96
  85. package/node_modules/nan/nan_weak.h +0 -437
  86. package/node_modules/nan/package.json +0 -41
  87. package/node_modules/nan/tools/1to2.js +0 -412
  88. package/node_modules/nan/tools/README.md +0 -14
  89. package/node_modules/nan/tools/package.json +0 -19
  90. package/node_modules/unix-dgram/LICENSE +0 -13
  91. package/node_modules/unix-dgram/README.md +0 -107
  92. package/node_modules/unix-dgram/binding.gyp +0 -20
  93. package/node_modules/unix-dgram/build/Makefile +0 -324
  94. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
  95. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
  96. package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
  97. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
  98. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
  99. package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
  100. package/node_modules/unix-dgram/build/binding.Makefile +0 -6
  101. package/node_modules/unix-dgram/build/config.gypi +0 -213
  102. package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
  103. package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
  104. package/node_modules/unix-dgram/package.json +0 -36
  105. package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
  106. package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
  107. package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
  108. package/node_modules/unix-dgram/test/test-connect.js +0 -53
  109. package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
  110. package/node_modules/unix-dgram/test/test-send-error.js +0 -26
  111. package/node_modules/winston-syslog/.eslintrc +0 -7
  112. package/node_modules/winston-syslog/.travis.yml +0 -14
  113. package/node_modules/winston-syslog/CHANGELOG.md +0 -9
  114. package/node_modules/winston-syslog/LICENSE +0 -20
  115. package/node_modules/winston-syslog/README.md +0 -135
  116. package/node_modules/winston-syslog/lib/utils.js +0 -26
  117. package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
  118. package/node_modules/winston-syslog/package.json +0 -56
  119. package/node_modules/winston-syslog/test/format-test.js +0 -122
  120. package/node_modules/winston-syslog/test/syslog-test.js +0 -95
  121. package/node_modules/winston-syslog/test/unix-connect-test.js +0 -133
@@ -1,340 +0,0 @@
1
- /*********************************************************************
2
- * NAN - Native Abstractions for Node.js
3
- *
4
- * Copyright (c) 2018 NAN contributors
5
- *
6
- * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
7
- ********************************************************************/
8
-
9
- #ifndef NAN_NEW_H_
10
- #define NAN_NEW_H_
11
-
12
- namespace imp { // scnr
13
-
14
- // TODO(agnat): Generalize
15
- template <typename T> v8::Local<T> To(v8::Local<v8::Integer> i);
16
-
17
- template <>
18
- inline
19
- v8::Local<v8::Integer>
20
- To<v8::Integer>(v8::Local<v8::Integer> i) {
21
- return Nan::To<v8::Integer>(i).ToLocalChecked();
22
- }
23
-
24
- template <>
25
- inline
26
- v8::Local<v8::Int32>
27
- To<v8::Int32>(v8::Local<v8::Integer> i) {
28
- return Nan::To<v8::Int32>(i).ToLocalChecked();
29
- }
30
-
31
- template <>
32
- inline
33
- v8::Local<v8::Uint32>
34
- To<v8::Uint32>(v8::Local<v8::Integer> i) {
35
- return Nan::To<v8::Uint32>(i).ToLocalChecked();
36
- }
37
-
38
- template <typename T> struct FactoryBase {
39
- typedef v8::Local<T> return_t;
40
- };
41
-
42
- template <typename T> struct MaybeFactoryBase {
43
- typedef MaybeLocal<T> return_t;
44
- };
45
-
46
- template <typename T> struct Factory;
47
-
48
- template <>
49
- struct Factory<v8::Array> : FactoryBase<v8::Array> {
50
- static inline return_t New();
51
- static inline return_t New(int length);
52
- };
53
-
54
- template <>
55
- struct Factory<v8::Boolean> : FactoryBase<v8::Boolean> {
56
- static inline return_t New(bool value);
57
- };
58
-
59
- template <>
60
- struct Factory<v8::BooleanObject> : FactoryBase<v8::BooleanObject> {
61
- static inline return_t New(bool value);
62
- };
63
-
64
- template <>
65
- struct Factory<v8::Context> : FactoryBase<v8::Context> {
66
- static inline
67
- return_t
68
- New( v8::ExtensionConfiguration* extensions = NULL
69
- , v8::Local<v8::ObjectTemplate> tmpl = v8::Local<v8::ObjectTemplate>()
70
- , v8::Local<v8::Value> obj = v8::Local<v8::Value>());
71
- };
72
-
73
- template <>
74
- struct Factory<v8::Date> : MaybeFactoryBase<v8::Date> {
75
- static inline return_t New(double value);
76
- };
77
-
78
- template <>
79
- struct Factory<v8::External> : FactoryBase<v8::External> {
80
- static inline return_t New(void *value);
81
- };
82
-
83
- template <>
84
- struct Factory<v8::Function> : FactoryBase<v8::Function> {
85
- static inline
86
- return_t
87
- New( FunctionCallback callback
88
- , v8::Local<v8::Value> data = v8::Local<v8::Value>());
89
- };
90
-
91
- template <>
92
- struct Factory<v8::FunctionTemplate> : FactoryBase<v8::FunctionTemplate> {
93
- static inline
94
- return_t
95
- New( FunctionCallback callback = NULL
96
- , v8::Local<v8::Value> data = v8::Local<v8::Value>()
97
- , v8::Local<v8::Signature> signature = v8::Local<v8::Signature>());
98
- };
99
-
100
- template <>
101
- struct Factory<v8::Number> : FactoryBase<v8::Number> {
102
- static inline return_t New(double value);
103
- };
104
-
105
- template <>
106
- struct Factory<v8::NumberObject> : FactoryBase<v8::NumberObject> {
107
- static inline return_t New(double value);
108
- };
109
-
110
- template <typename T>
111
- struct IntegerFactory : FactoryBase<T> {
112
- typedef typename FactoryBase<T>::return_t return_t;
113
- static inline return_t New(int32_t value);
114
- static inline return_t New(uint32_t value);
115
- };
116
-
117
- template <>
118
- struct Factory<v8::Integer> : IntegerFactory<v8::Integer> {};
119
-
120
- template <>
121
- struct Factory<v8::Int32> : IntegerFactory<v8::Int32> {};
122
-
123
- template <>
124
- struct Factory<v8::Uint32> : FactoryBase<v8::Uint32> {
125
- static inline return_t New(int32_t value);
126
- static inline return_t New(uint32_t value);
127
- };
128
-
129
- template <>
130
- struct Factory<v8::Object> : FactoryBase<v8::Object> {
131
- static inline return_t New();
132
- };
133
-
134
- template <>
135
- struct Factory<v8::ObjectTemplate> : FactoryBase<v8::ObjectTemplate> {
136
- static inline return_t New();
137
- };
138
-
139
- template <>
140
- struct Factory<v8::RegExp> : MaybeFactoryBase<v8::RegExp> {
141
- static inline return_t New(
142
- v8::Local<v8::String> pattern, v8::RegExp::Flags flags);
143
- };
144
-
145
- template <>
146
- struct Factory<v8::Script> : MaybeFactoryBase<v8::Script> {
147
- static inline return_t New( v8::Local<v8::String> source);
148
- static inline return_t New( v8::Local<v8::String> source
149
- , v8::ScriptOrigin const& origin);
150
- };
151
-
152
- template <>
153
- struct Factory<v8::Signature> : FactoryBase<v8::Signature> {
154
- typedef v8::Local<v8::FunctionTemplate> FTH;
155
- static inline return_t New(FTH receiver = FTH());
156
- };
157
-
158
- template <>
159
- struct Factory<v8::String> : MaybeFactoryBase<v8::String> {
160
- static inline return_t New();
161
- static inline return_t New(const char *value, int length = -1);
162
- static inline return_t New(const uint16_t *value, int length = -1);
163
- static inline return_t New(std::string const& value);
164
-
165
- static inline return_t New(v8::String::ExternalStringResource * value);
166
- static inline return_t New(ExternalOneByteStringResource * value);
167
- };
168
-
169
- template <>
170
- struct Factory<v8::StringObject> : FactoryBase<v8::StringObject> {
171
- static inline return_t New(v8::Local<v8::String> value);
172
- };
173
-
174
- } // end of namespace imp
175
-
176
- #if (NODE_MODULE_VERSION >= 12)
177
-
178
- namespace imp {
179
-
180
- template <>
181
- struct Factory<v8::UnboundScript> : MaybeFactoryBase<v8::UnboundScript> {
182
- static inline return_t New( v8::Local<v8::String> source);
183
- static inline return_t New( v8::Local<v8::String> source
184
- , v8::ScriptOrigin const& origin);
185
- };
186
-
187
- } // end of namespace imp
188
-
189
- # include "nan_implementation_12_inl.h"
190
-
191
- #else // NODE_MODULE_VERSION >= 12
192
-
193
- # include "nan_implementation_pre_12_inl.h"
194
-
195
- #endif
196
-
197
- //=== API ======================================================================
198
-
199
- template <typename T>
200
- typename imp::Factory<T>::return_t
201
- New() {
202
- return imp::Factory<T>::New();
203
- }
204
-
205
- template <typename T, typename A0>
206
- typename imp::Factory<T>::return_t
207
- New(A0 arg0) {
208
- return imp::Factory<T>::New(arg0);
209
- }
210
-
211
- template <typename T, typename A0, typename A1>
212
- typename imp::Factory<T>::return_t
213
- New(A0 arg0, A1 arg1) {
214
- return imp::Factory<T>::New(arg0, arg1);
215
- }
216
-
217
- template <typename T, typename A0, typename A1, typename A2>
218
- typename imp::Factory<T>::return_t
219
- New(A0 arg0, A1 arg1, A2 arg2) {
220
- return imp::Factory<T>::New(arg0, arg1, arg2);
221
- }
222
-
223
- template <typename T, typename A0, typename A1, typename A2, typename A3>
224
- typename imp::Factory<T>::return_t
225
- New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) {
226
- return imp::Factory<T>::New(arg0, arg1, arg2, arg3);
227
- }
228
-
229
- // Note(agnat): When passing overloaded function pointers to template functions
230
- // as generic arguments the compiler needs help in picking the right overload.
231
- // These two functions handle New<Function> and New<FunctionTemplate> with
232
- // all argument variations.
233
-
234
- // v8::Function and v8::FunctionTemplate with one or two arguments
235
- template <typename T>
236
- typename imp::Factory<T>::return_t
237
- New( FunctionCallback callback
238
- , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
239
- return imp::Factory<T>::New(callback, data);
240
- }
241
-
242
- // v8::Function and v8::FunctionTemplate with three arguments
243
- template <typename T, typename A2>
244
- typename imp::Factory<T>::return_t
245
- New( FunctionCallback callback
246
- , v8::Local<v8::Value> data = v8::Local<v8::Value>()
247
- , A2 a2 = A2()) {
248
- return imp::Factory<T>::New(callback, data, a2);
249
- }
250
-
251
- // Convenience
252
-
253
- #if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
254
- template <typename T> inline v8::Local<T> New(v8::Handle<T> h);
255
- #endif
256
-
257
- #if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
258
- template <typename T, typename M>
259
- inline v8::Local<T> New(v8::Persistent<T, M> const& p);
260
- #else
261
- template <typename T> inline v8::Local<T> New(v8::Persistent<T> const& p);
262
- #endif
263
- template <typename T, typename M>
264
- inline v8::Local<T> New(Persistent<T, M> const& p);
265
- template <typename T>
266
- inline v8::Local<T> New(Global<T> const& p);
267
-
268
- inline
269
- imp::Factory<v8::Boolean>::return_t
270
- New(bool value) {
271
- return New<v8::Boolean>(value);
272
- }
273
-
274
- inline
275
- imp::Factory<v8::Int32>::return_t
276
- New(int32_t value) {
277
- return New<v8::Int32>(value);
278
- }
279
-
280
- inline
281
- imp::Factory<v8::Uint32>::return_t
282
- New(uint32_t value) {
283
- return New<v8::Uint32>(value);
284
- }
285
-
286
- inline
287
- imp::Factory<v8::Number>::return_t
288
- New(double value) {
289
- return New<v8::Number>(value);
290
- }
291
-
292
- inline
293
- imp::Factory<v8::String>::return_t
294
- New(std::string const& value) { // NOLINT(build/include_what_you_use)
295
- return New<v8::String>(value);
296
- }
297
-
298
- inline
299
- imp::Factory<v8::String>::return_t
300
- New(const char * value, int length) {
301
- return New<v8::String>(value, length);
302
- }
303
-
304
- inline
305
- imp::Factory<v8::String>::return_t
306
- New(const uint16_t * value, int length) {
307
- return New<v8::String>(value, length);
308
- }
309
-
310
- inline
311
- imp::Factory<v8::String>::return_t
312
- New(const char * value) {
313
- return New<v8::String>(value);
314
- }
315
-
316
- inline
317
- imp::Factory<v8::String>::return_t
318
- New(const uint16_t * value) {
319
- return New<v8::String>(value);
320
- }
321
-
322
- inline
323
- imp::Factory<v8::String>::return_t
324
- New(v8::String::ExternalStringResource * value) {
325
- return New<v8::String>(value);
326
- }
327
-
328
- inline
329
- imp::Factory<v8::String>::return_t
330
- New(ExternalOneByteStringResource * value) {
331
- return New<v8::String>(value);
332
- }
333
-
334
- inline
335
- imp::Factory<v8::RegExp>::return_t
336
- New(v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
337
- return New<v8::RegExp>(pattern, flags);
338
- }
339
-
340
- #endif // NAN_NEW_H_
@@ -1,156 +0,0 @@
1
- /*********************************************************************
2
- * NAN - Native Abstractions for Node.js
3
- *
4
- * Copyright (c) 2018 NAN contributors
5
- *
6
- * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
7
- ********************************************************************/
8
-
9
- #ifndef NAN_OBJECT_WRAP_H_
10
- #define NAN_OBJECT_WRAP_H_
11
-
12
- class ObjectWrap {
13
- public:
14
- ObjectWrap() {
15
- refs_ = 0;
16
- }
17
-
18
-
19
- virtual ~ObjectWrap() {
20
- if (persistent().IsEmpty()) {
21
- return;
22
- }
23
-
24
- persistent().ClearWeak();
25
- persistent().Reset();
26
- }
27
-
28
-
29
- template <class T>
30
- static inline T* Unwrap(v8::Local<v8::Object> object) {
31
- assert(!object.IsEmpty());
32
- assert(object->InternalFieldCount() > 0);
33
- // Cast to ObjectWrap before casting to T. A direct cast from void
34
- // to T won't work right when T has more than one base class.
35
- void* ptr = GetInternalFieldPointer(object, 0);
36
- ObjectWrap* wrap = static_cast<ObjectWrap*>(ptr);
37
- return static_cast<T*>(wrap);
38
- }
39
-
40
-
41
- inline v8::Local<v8::Object> handle() const {
42
- return New(handle_);
43
- }
44
-
45
-
46
- inline Persistent<v8::Object>& persistent() {
47
- return handle_;
48
- }
49
-
50
-
51
- protected:
52
- inline void Wrap(v8::Local<v8::Object> object) {
53
- assert(persistent().IsEmpty());
54
- assert(object->InternalFieldCount() > 0);
55
- SetInternalFieldPointer(object, 0, this);
56
- persistent().Reset(object);
57
- MakeWeak();
58
- }
59
-
60
- #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
61
- (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
62
-
63
- inline void MakeWeak() {
64
- persistent().v8::PersistentBase<v8::Object>::SetWeak(
65
- this, WeakCallback, v8::WeakCallbackType::kParameter);
66
- #if NODE_MAJOR_VERSION < 10
67
- // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too.
68
- persistent().MarkIndependent();
69
- #endif
70
- }
71
-
72
- #elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
73
-
74
- inline void MakeWeak() {
75
- persistent().v8::PersistentBase<v8::Object>::SetWeak(this, WeakCallback);
76
- persistent().MarkIndependent();
77
- }
78
-
79
- #else
80
-
81
- inline void MakeWeak() {
82
- persistent().persistent.MakeWeak(this, WeakCallback);
83
- persistent().MarkIndependent();
84
- }
85
-
86
- #endif
87
-
88
- /* Ref() marks the object as being attached to an event loop.
89
- * Refed objects will not be garbage collected, even if
90
- * all references are lost.
91
- */
92
- virtual void Ref() {
93
- assert(!persistent().IsEmpty());
94
- persistent().ClearWeak();
95
- refs_++;
96
- }
97
-
98
- /* Unref() marks an object as detached from the event loop. This is its
99
- * default state. When an object with a "weak" reference changes from
100
- * attached to detached state it will be freed. Be careful not to access
101
- * the object after making this call as it might be gone!
102
- * (A "weak reference" means an object that only has a
103
- * persistent handle.)
104
- *
105
- * DO NOT CALL THIS FROM DESTRUCTOR
106
- */
107
- virtual void Unref() {
108
- assert(!persistent().IsEmpty());
109
- assert(!persistent().IsWeak());
110
- assert(refs_ > 0);
111
- if (--refs_ == 0)
112
- MakeWeak();
113
- }
114
-
115
- int refs_; // ro
116
-
117
- private:
118
- NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap)
119
- #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
120
- (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
121
-
122
- static void
123
- WeakCallback(v8::WeakCallbackInfo<ObjectWrap> const& info) {
124
- ObjectWrap* wrap = info.GetParameter();
125
- assert(wrap->refs_ == 0);
126
- wrap->handle_.Reset();
127
- delete wrap;
128
- }
129
-
130
- #elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
131
-
132
- static void
133
- WeakCallback(v8::WeakCallbackData<v8::Object, ObjectWrap> const& data) {
134
- ObjectWrap* wrap = data.GetParameter();
135
- assert(wrap->refs_ == 0);
136
- assert(wrap->handle_.IsNearDeath());
137
- wrap->handle_.Reset();
138
- delete wrap;
139
- }
140
-
141
- #else
142
-
143
- static void WeakCallback(v8::Persistent<v8::Value> value, void *data) {
144
- ObjectWrap *wrap = static_cast<ObjectWrap*>(data);
145
- assert(wrap->refs_ == 0);
146
- assert(wrap->handle_.IsNearDeath());
147
- wrap->handle_.Reset();
148
- delete wrap;
149
- }
150
-
151
- #endif
152
- Persistent<v8::Object> handle_;
153
- };
154
-
155
-
156
- #endif // NAN_OBJECT_WRAP_H_
@@ -1,132 +0,0 @@
1
- /*********************************************************************
2
- * NAN - Native Abstractions for Node.js
3
- *
4
- * Copyright (c) 2018 NAN contributors
5
- *
6
- * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
7
- ********************************************************************/
8
-
9
- #ifndef NAN_PERSISTENT_12_INL_H_
10
- #define NAN_PERSISTENT_12_INL_H_
11
-
12
- template<typename T, typename M> class Persistent :
13
- public v8::Persistent<T, M> {
14
- public:
15
- inline Persistent() : v8::Persistent<T, M>() {}
16
-
17
- template<typename S> inline Persistent(v8::Local<S> that) :
18
- v8::Persistent<T, M>(v8::Isolate::GetCurrent(), that) {}
19
-
20
- template<typename S, typename M2>
21
- inline
22
- Persistent(const v8::Persistent<S, M2> &that) : // NOLINT(runtime/explicit)
23
- v8::Persistent<T, M2>(v8::Isolate::GetCurrent(), that) {}
24
-
25
- inline void Reset() { v8::PersistentBase<T>::Reset(); }
26
-
27
- template <typename S>
28
- inline void Reset(const v8::Local<S> &other) {
29
- v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
30
- }
31
-
32
- template <typename S>
33
- inline void Reset(const v8::PersistentBase<S> &other) {
34
- v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
35
- }
36
-
37
- template<typename P>
38
- inline void SetWeak(
39
- P *parameter
40
- , typename WeakCallbackInfo<P>::Callback callback
41
- , WeakCallbackType type);
42
-
43
- private:
44
- inline T *operator*() const { return *PersistentBase<T>::persistent; }
45
-
46
- template<typename S, typename M2>
47
- inline void Copy(const Persistent<S, M2> &that) {
48
- TYPE_CHECK(T, S);
49
-
50
- this->Reset();
51
-
52
- if (!that.IsEmpty()) {
53
- this->Reset(that);
54
- M::Copy(that, this);
55
- }
56
- }
57
- };
58
-
59
- #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
60
- (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
61
- template<typename T>
62
- class Global : public v8::Global<T> {
63
- public:
64
- inline Global() : v8::Global<T>() {}
65
-
66
- template<typename S> inline Global(v8::Local<S> that) :
67
- v8::Global<T>(v8::Isolate::GetCurrent(), that) {}
68
-
69
- template<typename S>
70
- inline
71
- Global(const v8::PersistentBase<S> &that) : // NOLINT(runtime/explicit)
72
- v8::Global<S>(v8::Isolate::GetCurrent(), that) {}
73
-
74
- inline void Reset() { v8::PersistentBase<T>::Reset(); }
75
-
76
- template <typename S>
77
- inline void Reset(const v8::Local<S> &other) {
78
- v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
79
- }
80
-
81
- template <typename S>
82
- inline void Reset(const v8::PersistentBase<S> &other) {
83
- v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
84
- }
85
-
86
- template<typename P>
87
- inline void SetWeak(
88
- P *parameter
89
- , typename WeakCallbackInfo<P>::Callback callback
90
- , WeakCallbackType type) {
91
- reinterpret_cast<Persistent<T>*>(this)->SetWeak(
92
- parameter, callback, type);
93
- }
94
- };
95
- #else
96
- template<typename T>
97
- class Global : public v8::UniquePersistent<T> {
98
- public:
99
- inline Global() : v8::UniquePersistent<T>() {}
100
-
101
- template<typename S> inline Global(v8::Local<S> that) :
102
- v8::UniquePersistent<T>(v8::Isolate::GetCurrent(), that) {}
103
-
104
- template<typename S>
105
- inline
106
- Global(const v8::PersistentBase<S> &that) : // NOLINT(runtime/explicit)
107
- v8::UniquePersistent<S>(v8::Isolate::GetCurrent(), that) {}
108
-
109
- inline void Reset() { v8::PersistentBase<T>::Reset(); }
110
-
111
- template <typename S>
112
- inline void Reset(const v8::Local<S> &other) {
113
- v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
114
- }
115
-
116
- template <typename S>
117
- inline void Reset(const v8::PersistentBase<S> &other) {
118
- v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
119
- }
120
-
121
- template<typename P>
122
- inline void SetWeak(
123
- P *parameter
124
- , typename WeakCallbackInfo<P>::Callback callback
125
- , WeakCallbackType type) {
126
- reinterpret_cast<Persistent<T>*>(this)->SetWeak(
127
- parameter, callback, type);
128
- }
129
- };
130
- #endif
131
-
132
- #endif // NAN_PERSISTENT_12_INL_H_