Chromium Code Reviews| 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..2be9b6190c12e56d4ea5b5cfef1f6c85bd067888 100644 |
| --- a/runtime/lib/event_loop_patch.dart |
| +++ b/runtime/lib/event_loop_patch.dart |
| @@ -4,7 +4,23 @@ |
| 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) { |
| + // TODO(9001): don't default to using the Timer to enqueue the immediate |
| + // callback. |
| + _createTimer(Duration.ZERO, callback); |
| + return; |
| + } |
| + _EnqueueImmediateFactory._factory(callback); |
| } |
| } |
| + |
| +typedef void _EnqueueImmediateFactoryClosure(void callback()); |
| + |
| +class _EnqueueImmediateFactory { |
|
floitsch
2013/10/11 09:35:37
I think factory is the wrong name.
For timers it w
Anders Johnsen
2013/10/14 10:15:10
Done.
|
| + static _EnqueueImmediateFactoryClosure _factory; |
| +} |
| + |
| +void _setEnqueueImmediateFactoryClosure( |
| + _EnqueueImmediateFactoryClosure closure) { |
| + _EnqueueImmediateFactory._factory = closure; |
| +} |