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

Unified Diff: sdk/lib/_internal/compiler/js_lib/async_patch.dart

Issue 550843003: Add support for setImmediate on IE. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test. Created 6 years, 3 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
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/js_lib/async_patch.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/async_patch.dart b/sdk/lib/_internal/compiler/js_lib/async_patch.dart
index 88ab1d0479a5dbbf8f3f721c8f460868ec73f943..e0813ad617708b28d9658366c8ed923d710ef781 100644
--- a/sdk/lib/_internal/compiler/js_lib/async_patch.dart
+++ b/sdk/lib/_internal/compiler/js_lib/async_patch.dart
@@ -63,10 +63,9 @@ class _AsyncRun {
JS('', '#.firstChild ? #.removeChild(#): #.appendChild(#)',
div, div, span, div, span);
};
-
+ } else if (JS('', 'self.setImmediate') != null) {
+ return _scheduleImmediateWithSetImmediate;
}
- // TODO(9002): don't use the Timer to enqueue the immediate callback.
- // Also check for other JS options like setImmediate.
// TODO(20055): We should use DOM promises when available.
return _scheduleImmediateWithTimer;
}
@@ -81,6 +80,16 @@ class _AsyncRun {
convertDartClosureToJS(internalCallback, 0));
}
+ static void _scheduleImmediateWithSetImmediate(void callback()) {
+ internalCallback() {
+ leaveJsAsync();
+ callback();
+ };
+ enterJsAsync();
+ JS('void', 'self.setImmediate(#)',
+ convertDartClosureToJS(internalCallback, 0));
+ }
+
static void _scheduleImmediateWithTimer(void callback()) {
Timer._createTimer(Duration.ZERO, callback);
}
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698