Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 815f43db7b2fb392ec521940c3b43821f190196b..3a814f14b73b02073cb0666e339647ac70d3ee53 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -4117,6 +4117,8 @@ enum GCCallbackFlags { |
typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); |
typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); |
+typedef void (*InterruptCallback)(Isolate* isolate, void* data); |
+ |
/** |
* Collection of V8 heap information. |
@@ -4377,6 +4379,23 @@ class V8_EXPORT Isolate { |
*/ |
void RemoveGCEpilogueCallback(GCEpilogueCallback callback); |
+ /** |
+ * Request V8 to interrupt long running JavaScript code and invoke |
+ * the given |callback| passing the given |data| to it. After |callback| |
+ * returns control will be returned to the JavaScript code. |
+ * At any given moment V8 can remember only a single callback for the very |
+ * last interrupt request. |
+ * Can be called from another thread without acquiring a |Locker|. |
+ * Registered |callback| must not reenter interrupted Isolate. |
+ */ |
+ void RequestInterrupt(InterruptCallback callback, void* data); |
+ |
+ /** |
+ * Clear interrupt request created by |RequestInterrupt|. |
+ * Can be called from another thread without acquiring a |Locker|. |
+ */ |
+ void ClearInterrupt(); |
+ |
private: |
Isolate(); |
Isolate(const Isolate&); |