| 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;
|
| +}
|
|
|