electron/patches/nan/remove_deprecated_v8_isolat...

29 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Thu, 6 Jun 2024 15:16:49 -0400
Subject: Remove deprecated v8::Isolate::IdleNotificationDeadline
See https://chromium-review.googlesource.com/c/v8/v8/+/5539852
Also https://github.com/nodejs/nan/issues/953#issuecomment-1791163429
diff --git a/nan.h b/nan.h
index 42285328055ddb7c76548258f3c4847d2c278ad6..9a9112afe0cc94ce58ed3cce9763ace7c160a932 100644
--- a/nan.h
+++ b/nan.h
@@ -684,7 +684,13 @@ 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 > 11 || \
+ (V8_MAJOR_VERSION == 11 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+ inline bool IdleNotification(int idle_time_in_ms) {
+ v8::Isolate::GetCurrent()->MemoryPressureNotification(v8::MemoryPressureLevel::kModerate);
+ 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) {
return v8::Isolate::GetCurrent()->IdleNotificationDeadline(