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

Unified Diff: src/v8natives.js

Issue 154283002: V8 Microtask Queue & API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: pre-review Created 6 years, 10 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
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index c1955cfdf7b71eb41e11af3e312992e0305922f1..3f993a2444951de9791b0008c1177ffd5971177a 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1906,7 +1906,16 @@ function RunMicrotasks() {
RunMicrotasks.queue = new InternalArray;
for (var i = 0; i < microtasks.length; i++) {
- microtasks[i]();
+ var microtask = microtasks[i];
+ if (typeof microtask === 'function')
+ microtask();
+ else
+ %RunExternalMicrotask(microtask);
}
}
}
+
+function EnqueueExternalMicrotask(handler) {
+ %SetMicrotaskPending(true);
+ RunMicrotasks.queue.push(handler);
+}

Powered by Google App Engine
This is Rietveld 408576698