Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: include/v8.h

Issue 2139873002: V8: Add API to report OOM to embedder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.h » ('j') | src/api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index c3c7743dfdde5952ceef702e8e0d32d988480242..e60485431471c6a3999f1dea9ae46aa9a956810c 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5012,6 +5012,7 @@ class V8_EXPORT ResourceConstraints {
typedef void (*FatalErrorCallback)(const char* location, const char* message);
+typedef void (*OOMErrorCallback)(const char* location, bool is_heap_oom);
typedef void (*MessageCallback)(Local<Message> message, Local<Value> error);
@@ -6326,6 +6327,9 @@ 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. */
+ void SetOOMErrorHandler(OOMErrorCallback that);
+
/**
* Set the callback to invoke to check if code generation from
* strings should be allowed.
@@ -6460,6 +6464,11 @@ class V8_EXPORT V8 {
"Use isolate version",
void SetFatalErrorHandler(FatalErrorCallback that));
+ /** Set the callback to invoke in case of OOM errors. */
+ V8_INLINE static V8_DEPRECATED(
+ "Use isolate version",
+ void SetOOMErrorHandler(OOMErrorCallback that));
jochen (gone - plz use gerrit) 2016/07/12 15:11:30 don't add that
Will Harris 2016/07/12 15:42:53 Done.
+
/**
* Set the callback to invoke to check if code generation from
* strings should be allowed.
@@ -8872,6 +8881,10 @@ void V8::SetFatalErrorHandler(FatalErrorCallback callback) {
isolate->SetFatalErrorHandler(callback);
}
+void V8::SetOOMErrorHandler(OOMErrorCallback callback) {
+ Isolate* isolate = Isolate::GetCurrent();
+ isolate->SetOOMErrorHandler(callback);
+}
void V8::RemoveGCPrologueCallback(GCCallback callback) {
Isolate* isolate = Isolate::GetCurrent();
« no previous file with comments | « no previous file | src/api.h » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698