Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 62319203f418c4522b103b3d54ced4e43f09971b..b1a1ed59268a5e828632667cec87ec260654914b 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -5350,6 +5350,13 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT |
uint16_t class_id) {} |
}; |
+/** |
+ * Memory pressure level for the MemoryPressureNotification. |
+ * kNone hints V8 that there is no memory pressure. |
+ * kModerate hints V8 to speed up incremental garbage collection. |
+ * kCritical hints V8 to free memory as soon as possible. |
+ */ |
+enum class MemoryPressureLevel { kNone, kModerate, kCritical }; |
/** |
* Isolate represents an isolated instance of the V8 engine. V8 isolates have |
@@ -5591,6 +5598,14 @@ class V8_EXPORT Isolate { |
AbortOnUncaughtExceptionCallback callback); |
/** |
+ * Optional notification that the system is running low on memory. |
+ * V8 uses these notifications to guide heuristics. |
+ * It is allowed to call this function from another thread while |
+ * the isolate is executing long running JavaScript code. |
+ */ |
+ void MemoryPressureNotification(MemoryPressureLevel level); |
+ |
+ /** |
* Methods below this point require holding a lock (using Locker) in |
* a multi-threaded environment. |
*/ |