Commit e08f7ae5 authored by Kevin Babbitt's avatar Kevin Babbitt Committed by V8 LUCI CQ

Allow setting fatal error callbacks during Isolate initialization

This will enable proper reporting of OOM errors during snapshot
deserialization, for example https://crbug.com/614440#c27.

Bug: chromium:614440
Change-Id: I226fb763d2630d0b21f7552070ed1a4cc222f69b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3445203Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#79055}
parent 318719a1
......@@ -282,6 +282,12 @@ class V8_EXPORT Isolate {
int embedder_wrapper_type_index = -1;
int embedder_wrapper_object_index = -1;
/**
* Callbacks to invoke in case of fatal or OOM errors.
*/
FatalErrorCallback fatal_error_callback = nullptr;
OOMErrorCallback oom_error_callback = nullptr;
/**
* The following parameter is experimental and may change significantly.
* This is currently for internal testing.
......
......@@ -8591,6 +8591,15 @@ void Isolate::Initialize(Isolate* isolate,
} else {
i_isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob());
}
if (params.fatal_error_callback) {
isolate->SetFatalErrorHandler(params.fatal_error_callback);
}
if (params.oom_error_callback) {
isolate->SetOOMErrorHandler(params.oom_error_callback);
}
if (params.counter_lookup_callback) {
isolate->SetCounterFunction(params.counter_lookup_callback);
}
......
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