Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New breakage #974

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
36 changes: 32 additions & 4 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 @@ -2557,7 +2564,11 @@ NAN_DEPRECATED inline void SetAccessor(
obj->SetInternalField(imp::kDataIndex, data);
}

#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 5))
tpl->SetNativeDataProperty(
#else
tpl->SetAccessor(
#endif
name
, getter_
, setter_
Expand Down Expand Up @@ -2605,7 +2616,11 @@ inline void SetAccessor(
obj->SetInternalField(imp::kDataIndex, data);
}

#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 5))
tpl->SetNativeDataProperty(
#else
tpl->SetAccessor(
#endif
name
, getter_
, setter_
Expand Down Expand Up @@ -2651,6 +2666,18 @@ inline bool SetAccessor(
}

#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
#if defined(V8_MAJOR_VERSION) && \
(V8_MAJOR_VERSION > 12 || \
(V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && \
V8_MINOR_VERSION >= 5))
return obj->SetNativeDataProperty(
GetCurrentContext()
, name
, getter_
, setter_
, dataobj
, attribute).FromMaybe(false);
#else
return obj->SetAccessor(
GetCurrentContext()
, name
Expand All @@ -2659,6 +2686,7 @@ inline bool SetAccessor(
, dataobj
, settings
, attribute).FromMaybe(false);
#endif
#else
return obj->SetAccessor(
name
Expand Down Expand Up @@ -2686,7 +2714,7 @@ inline void SetNamedPropertyHandler(
setter ? imp::PropertySetterCallbackWrapper : 0;
imp::NativePropertyQuery query_ =
query ? imp::PropertyQueryCallbackWrapper : 0;
imp::NativePropertyDeleter *deleter_ =
imp::NativePropertyDeleter deleter_ =
deleter ? imp::PropertyDeleterCallbackWrapper : 0;
imp::NativePropertyEnumerator enumerator_ =
enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0;
Expand Down
Loading