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

Unified Diff: include/v8.h

Issue 102063004: Introduce API to temporarily interrupt long running JavaScript code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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.cc » ('j') | test/cctest/test-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 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&);
« no previous file with comments | « no previous file | src/api.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698