Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 99827feca124fa311af84bd143464dd7926b06ad..d3fc0fe348fbffb7aefbe0a7fb6553fc4ad45251 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -3918,6 +3918,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. |
@@ -4174,6 +4176,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&); |