Commit 2916cf59 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[API] Remove legacy OOM callback

This is deprecated since 10.5 and replaced by the new callback which
receives more OOM details.

R=mlippautz@chromium.org

Bug: chromium:1323177
Change-Id: I9385da33c3d9227144ebc47d6dddae702701ff82
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3789509Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82033}
parent d476a037
......@@ -217,10 +217,6 @@ using AddHistogramSampleCallback = void (*)(void* histogram, int sample);
using FatalErrorCallback = void (*)(const char* location, const char* message);
using LegacyOOMErrorCallback V8_DEPRECATED(
"Use OOMErrorCallback (https://crbug.com/1323177)") =
void (*)(const char* location, bool is_heap_oom);
struct OOMDetails {
bool is_heap_oom = false;
const char* detail = nullptr;
......
......@@ -284,9 +284,6 @@ class V8_EXPORT V8 {
*/
static void SetFatalMemoryErrorCallback(OOMErrorCallback callback);
V8_DEPRECATED("Use OOMErrorCallback (https://crbug.com/1323177)")
static void SetFatalMemoryErrorCallback(LegacyOOMErrorCallback callback);
/**
* Get statistics about the shared memory usage.
*/
......
......@@ -290,9 +290,6 @@ class V8_EXPORT Isolate {
FatalErrorCallback fatal_error_callback = nullptr;
OOMErrorCallback oom_error_callback = nullptr;
V8_DEPRECATED("Use oom_error_callback (https://crbug.com/1323177)")
LegacyOOMErrorCallback legacy_oom_error_callback = nullptr;
/**
* The following parameter is experimental and may change significantly.
* This is currently for internal testing.
......@@ -1470,10 +1467,6 @@ class V8_EXPORT Isolate {
/** Set the callback to invoke in case of fatal errors. */
void SetFatalErrorHandler(FatalErrorCallback that);
/** Set the callback to invoke in case of OOM errors (deprecated). */
V8_DEPRECATED("Use OOMErrorCallback (https://crbug.com/1323177)")
void SetOOMErrorHandler(LegacyOOMErrorCallback that);
/** Set the callback to invoke in case of OOM errors. */
void SetOOMErrorHandler(OOMErrorCallback that);
......
......@@ -171,13 +171,6 @@
namespace v8 {
// Redefine LegacyOOMErrorCallback here for internal usage. We still need to
// support it but it is deprecated so would trigger warnings.
// TODO(chromium:1323177): Remove this.
using DeprecatedLegacyOOMErrorCallback = void (*)(const char* location,
bool is_heap_oom);
static DeprecatedLegacyOOMErrorCallback g_legacy_oom_error_callback = nullptr;
static OOMErrorCallback g_oom_error_callback = nullptr;
static ScriptOrigin GetScriptOriginForScript(i::Isolate* i_isolate,
......@@ -235,9 +228,6 @@ void i::V8::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location,
// Give the embedder a chance to handle the condition. If it doesn't,
// just crash.
if (g_oom_error_callback) g_oom_error_callback(location, details);
if (g_legacy_oom_error_callback) {
g_legacy_oom_error_callback(location, details.is_heap_oom);
}
FATAL("Fatal process out of memory: %s", location);
UNREACHABLE();
}
......@@ -313,9 +303,6 @@ void i::V8::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location,
}
Utils::ReportOOMFailure(i_isolate, location, details);
if (g_oom_error_callback) g_oom_error_callback(location, details);
if (g_legacy_oom_error_callback) {
g_legacy_oom_error_callback(location, details.is_heap_oom);
}
// If the fatal error handler returns, we stop execution.
FATAL("API fatal error handler returned after process out of memory");
}
......@@ -347,8 +334,6 @@ void Utils::ReportOOMFailure(i::Isolate* i_isolate, const char* location,
const OOMDetails& details) {
if (auto oom_callback = i_isolate->oom_behavior()) {
oom_callback(location, details);
} else if (auto legacy_oom_callback = i_isolate->legacy_oom_behavior()) {
legacy_oom_callback(location, details.is_heap_oom);
} else {
// TODO(wfh): Remove this fallback once Blink is setting OOM handler. See
// crbug.com/614440.
......@@ -6175,11 +6160,6 @@ void v8::V8::SetFatalMemoryErrorCallback(
g_oom_error_callback = oom_error_callback;
}
void v8::V8::SetFatalMemoryErrorCallback(
v8::LegacyOOMErrorCallback legacy_oom_error_callback) {
g_legacy_oom_error_callback = legacy_oom_error_callback;
}
void v8::V8::SetEntropySource(EntropySource entropy_source) {
base::RandomNumberGenerator::SetEntropySource(entropy_source);
}
......@@ -8702,8 +8682,6 @@ void Isolate::Initialize(Isolate* v8_isolate,
#endif
if (params.oom_error_callback) {
v8_isolate->SetOOMErrorHandler(params.oom_error_callback);
} else if (params.legacy_oom_error_callback) {
v8_isolate->SetOOMErrorHandler(params.legacy_oom_error_callback);
}
#if __clang__
#pragma clang diagnostic pop
......@@ -9445,8 +9423,6 @@ size_t Isolate::CopyCodePages(size_t capacity, MemoryRange* code_pages_out) {
CALLBACK_SETTER(FatalErrorHandler, FatalErrorCallback, exception_behavior)
CALLBACK_SETTER(OOMErrorHandler, OOMErrorCallback, oom_behavior)
CALLBACK_SETTER(OOMErrorHandler, DeprecatedLegacyOOMErrorCallback,
legacy_oom_behavior)
CALLBACK_SETTER(ModifyCodeGenerationFromStringsCallback,
ModifyCodeGenerationFromStringsCallback2,
modify_code_gen_callback2)
......
......@@ -487,16 +487,9 @@ V8_EXPORT_PRIVATE void FreeCurrentEmbeddedBlob();
using DebugObjectCache = std::vector<Handle<HeapObject>>;
// Redefine LegacyOOMErrorCallback here for internal usage. We still need to
// support it but it is deprecated so would trigger warnings.
// TODO(chromium:1323177): Remove this.
using DeprecatedLegacyOOMErrorCallback = void (*)(const char* location,
bool is_heap_oom);
#define ISOLATE_INIT_LIST(V) \
/* Assembler state. */ \
V(FatalErrorCallback, exception_behavior, nullptr) \
V(DeprecatedLegacyOOMErrorCallback, legacy_oom_behavior, nullptr) \
V(OOMErrorCallback, oom_behavior, nullptr) \
V(LogEventCallback, event_logger, nullptr) \
V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, nullptr) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment