Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ The hooks to access V8 internals—including GC and statistics—are different a
- <a href="doc/v8_internals.md#api_nan_set_counter_function"><b><code>Nan::SetCounterFunction()</code></b></a>
- <a href="doc/v8_internals.md#api_nan_set_create_histogram_function"><b><code>Nan::SetCreateHistogramFunction()</code></b></a>
- <a href="doc/v8_internals.md#api_nan_set_add_histogram_sample_function"><b><code>Nan::SetAddHistogramSampleFunction()</code></b></a>
- <a href="doc/v8_internals.md#api_nan_idle_notification"><b><code>Nan::IdleNotification()</code></b></a>
- <a href="doc/v8_internals.md#api_nan_idle_notification"><del><b><code>Nan::IdleNotification()</code></b></del></a>
- <a href="doc/v8_internals.md#api_nan_low_memory_notification"><b><code>Nan::LowMemoryNotification()</code></b></a>
- <a href="doc/v8_internals.md#api_nan_context_disposed_notification"><b><code>Nan::ContextDisposedNotification()</code></b></a>
- <a href="doc/v8_internals.md#api_nan_get_internal_field_pointer"><b><code>Nan::GetInternalFieldPointer()</code></b></a>
Expand Down
8 changes: 4 additions & 4 deletions doc/v8_internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The hooks to access V8 internals—including GC and statistics—are different a
- <a href="#api_nan_set_counter_function"><b><code>Nan::SetCounterFunction()</code></b></a>
- <a href="#api_nan_set_create_histogram_function"><b><code>Nan::SetCreateHistogramFunction()</code></b></a>
- <a href="#api_nan_set_add_histogram_sample_function"><b><code>Nan::SetAddHistogramSampleFunction()</code></b></a>
- <a href="#api_nan_idle_notification"><b><code>Nan::IdleNotification()</code></b></a>
- <a href="#api_nan_idle_notification"><del><b><code>Nan::IdleNotification()</code></b></del></a>
- <a href="#api_nan_low_memory_notification"><b><code>Nan::LowMemoryNotification()</code></b></a>
- <a href="#api_nan_context_disposed_notification"><b><code>Nan::ContextDisposedNotification()</code></b></a>
- <a href="#api_nan_get_internal_field_pointer"><b><code>Nan::GetInternalFieldPointer()</code></b></a>
Expand Down Expand Up @@ -128,15 +128,15 @@ void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb)
Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea).

<a name="api_nan_idle_notification"></a>
### Nan::IdleNotification()
### <del>Nan::IdleNotification()</del>

Signature:

```c++
bool Nan::IdleNotification(int idle_time_in_ms)
NAN_DEPRECATED bool Nan::IdleNotification(int idle_time_in_ms)
```

Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version.
Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. Removed in V8 12.7.41.

<a name="api_nan_low_memory_notification"></a>
### Nan::LowMemoryNotification()
Expand Down
64 changes: 61 additions & 3 deletions nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,14 +694,21 @@ inline uv_loop_t* GetCurrentEventLoop() {
v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb);
}

#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
#if defined(V8_MAJOR_VERSION) && \
(V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && \
V8_MINOR_VERSION >= 7))
NAN_DEPRECATED inline bool IdleNotification(int) {
return true;
}
# elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
inline bool IdleNotification(int idle_time_in_ms) {
NAN_DEPRECATED inline bool IdleNotification(int idle_time_in_ms) {
return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
idle_time_in_ms * 0.001);
}
# else
inline bool IdleNotification(int idle_time_in_ms) {
NAN_DEPRECATED inline bool IdleNotification(int idle_time_in_ms) {
return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms);
}
#endif
Expand Down Expand Up @@ -1546,41 +1553,92 @@ typedef void NAN_SETTER_RETURN_TYPE;

typedef const PropertyCallbackInfo<v8::Value>&
NAN_PROPERTY_GETTER_ARGS_TYPE;
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_PROPERTY_GETTER_RETURN_TYPE;
#else
typedef void NAN_PROPERTY_GETTER_RETURN_TYPE;
#endif

#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef const PropertyCallbackInfo<void>&
NAN_PROPERTY_SETTER_ARGS_TYPE;
typedef v8::Intercepted NAN_PROPERTY_SETTER_RETURN_TYPE;
#else
typedef const PropertyCallbackInfo<v8::Value>&
NAN_PROPERTY_SETTER_ARGS_TYPE;
typedef void NAN_PROPERTY_SETTER_RETURN_TYPE;
#endif

typedef const PropertyCallbackInfo<v8::Array>&
NAN_PROPERTY_ENUMERATOR_ARGS_TYPE;
typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE;

typedef const PropertyCallbackInfo<v8::Boolean>&
NAN_PROPERTY_DELETER_ARGS_TYPE;

#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_PROPERTY_DELETER_RETURN_TYPE;
#else
typedef void NAN_PROPERTY_DELETER_RETURN_TYPE;
#endif


typedef const PropertyCallbackInfo<v8::Integer>&
NAN_PROPERTY_QUERY_ARGS_TYPE;
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_PROPERTY_QUERY_RETURN_TYPE;
#else
typedef void NAN_PROPERTY_QUERY_RETURN_TYPE;
#endif

typedef const PropertyCallbackInfo<v8::Value>& NAN_INDEX_GETTER_ARGS_TYPE;
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_INDEX_GETTER_RETURN_TYPE;
#else
typedef void NAN_INDEX_GETTER_RETURN_TYPE;
#endif


#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef const PropertyCallbackInfo<void>& NAN_INDEX_SETTER_ARGS_TYPE;
typedef v8::Intercepted NAN_INDEX_SETTER_RETURN_TYPE;
#else
typedef const PropertyCallbackInfo<v8::Value>& NAN_INDEX_SETTER_ARGS_TYPE;
typedef void NAN_INDEX_SETTER_RETURN_TYPE;
#endif

typedef const PropertyCallbackInfo<v8::Array>&
NAN_INDEX_ENUMERATOR_ARGS_TYPE;
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_INDEX_ENUMERATOR_RETURN_TYPE;
#else
typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE;
#endif

typedef const PropertyCallbackInfo<v8::Boolean>&
NAN_INDEX_DELETER_ARGS_TYPE;
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_INDEX_DELETER_RETURN_TYPE;
#else
typedef void NAN_INDEX_DELETER_RETURN_TYPE;
#endif

typedef const PropertyCallbackInfo<v8::Integer>&
NAN_INDEX_QUERY_ARGS_TYPE;
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted NAN_INDEX_QUERY_RETURN_TYPE;
#else
typedef void NAN_INDEX_QUERY_RETURN_TYPE;
#endif

#define NAN_METHOD(name) \
Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info)
Expand Down
38 changes: 37 additions & 1 deletion nan_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,51 @@ typedef void(*SetterCallback)(
v8::Local<v8::String>,
v8::Local<v8::Value>,
const PropertyCallbackInfo<void>&);

#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted(*PropertyGetterCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Value>&);
typedef v8::Intercepted(*PropertySetterCallback)(
v8::Local<v8::String>,
v8::Local<v8::Value>,
const PropertyCallbackInfo<void>&);
#else
typedef void(*PropertyGetterCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Value>&);
typedef void(*PropertySetterCallback)(
v8::Local<v8::String>,
v8::Local<v8::Value>,
const PropertyCallbackInfo<v8::Value>&);
#endif
typedef void(*PropertyEnumeratorCallback)
(const PropertyCallbackInfo<v8::Array>&);
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
typedef v8::Intercepted(*PropertyDeleterCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Boolean>&);
typedef v8::Intercepted(*PropertyQueryCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Integer>&);
typedef v8::Intercepted(*IndexGetterCallback)(
uint32_t,
const PropertyCallbackInfo<v8::Value>&);
typedef v8::Intercepted(*IndexSetterCallback)(
uint32_t,
v8::Local<v8::Value>,
const PropertyCallbackInfo<void>&);
typedef v8::Intercepted(*IndexEnumeratorCallback)
(const PropertyCallbackInfo<v8::Array>&);
typedef v8::Intercepted(*IndexDeleterCallback)(
uint32_t,
const PropertyCallbackInfo<v8::Boolean>&);
typedef v8::Intercepted(*IndexQueryCallback)(
uint32_t,
const PropertyCallbackInfo<v8::Integer>&);
#else
typedef void(*PropertyDeleterCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Boolean>&);
Expand All @@ -50,7 +86,7 @@ typedef void(*IndexDeleterCallback)(
typedef void(*IndexQueryCallback)(
uint32_t,
const PropertyCallbackInfo<v8::Integer>&);

#endif
namespace imp {
#if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION)
typedef v8::Local<v8::AccessorSignature> Sig;
Expand Down
Loading