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

Unified Diff: runtime/lib/event_loop_patch.dart

Issue 25646004: Add Dart_PostPriority function to dart_api, and use it in runAsync to schedule immediate events in … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More cleanup Created 7 years, 2 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: runtime/lib/event_loop_patch.dart
diff --git a/runtime/lib/event_loop_patch.dart b/runtime/lib/event_loop_patch.dart
index fe04c060bed955d4c596ac7d6bd1a4ffd30eebe6..137c64b6646cf392744c2ac4246db80e7d2b5537 100644
--- a/runtime/lib/event_loop_patch.dart
+++ b/runtime/lib/event_loop_patch.dart
@@ -4,7 +4,21 @@
patch class _AsyncRun {
/* patch */ static void _enqueueImmediate(void callback()) {
- // TODO(9001): don't use the Timer to enqueue the immediate callback.
- _createTimer(Duration.ZERO, callback);
+ if (_EnqueueImmediateFactory._factory == null) {
+ Timer.run(callback);
+ return;
+ }
+ _EnqueueImmediateFactory._factory(callback);
}
}
+
+typedef void _EnqueueImmediateFactoryClosure(void callback());
+
+class _EnqueueImmediateFactory {
+ static _EnqueueImmediateFactoryClosure _factory;
+}
+
+void _setEnqueueImmediateFactoryClosure(
+ _EnqueueImmediateFactoryClosure closure) {
+ _EnqueueImmediateFactory._factory = closure;
+}
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/message.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698