mirror of https://github.com/electron/electron
39 lines
1.7 KiB
Diff
39 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
Date: Wed, 12 Oct 2022 21:25:49 +0200
|
|
Subject: Pass OOMDetails to OOMErrorCallback
|
|
|
|
Introduced in https://chromium-review.googlesource.com/c/v8/v8/+/3647827.
|
|
|
|
This patch can be removed when Electron updates to Node.js v20.
|
|
|
|
diff --git a/src/node_errors.cc b/src/node_errors.cc
|
|
index e58e45be7bbb642f2277361d6312d444cfa27d16..54402bd5663666425b17fd267ba05ba7b800791c 100644
|
|
--- a/src/node_errors.cc
|
|
+++ b/src/node_errors.cc
|
|
@@ -521,9 +521,9 @@ static void ReportFatalException(Environment* env,
|
|
ABORT();
|
|
}
|
|
|
|
-[[noreturn]] void OOMErrorHandler(const char* location, bool is_heap_oom) {
|
|
+[[noreturn]] void OOMErrorHandler(const char* location, const v8::OOMDetails& details) {
|
|
const char* message =
|
|
- is_heap_oom ? "Allocation failed - JavaScript heap out of memory"
|
|
+ details.is_heap_oom ? "Allocation failed - JavaScript heap out of memory"
|
|
: "Allocation failed - process out of memory";
|
|
if (location) {
|
|
FPrintF(stderr, "FATAL ERROR: %s %s\n", location, message);
|
|
diff --git a/src/node_errors.h b/src/node_errors.h
|
|
index cc336536af0170e63cf9ccde99f9fa0a0be3f216..1687eed35717ae385aedad952c03ebab4f0f3bf7 100644
|
|
--- a/src/node_errors.h
|
|
+++ b/src/node_errors.h
|
|
@@ -21,7 +21,7 @@ void AppendExceptionLine(Environment* env,
|
|
|
|
[[noreturn]] void FatalError(const char* location, const char* message);
|
|
[[noreturn]] void OnFatalError(const char* location, const char* message);
|
|
-[[noreturn]] void OOMErrorHandler(const char* location, bool is_heap_oom);
|
|
+[[noreturn]] void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
|
|
|
|
// Helpers to construct errors similar to the ones provided by
|
|
// lib/internal/errors.js.
|