mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
8db489cb10
Change-Id: Ie84529ef3d41d55c29c9a4bf2c84a69e3dbcaa0f Reviewed-on: https://dart-review.googlesource.com/c/93429 Auto-Submit: Samir Jindel <sjindel@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Samir Jindel <sjindel@google.com>
33 lines
909 B
Dart
33 lines
909 B
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// part of "async_patch.dart";
|
|
|
|
@patch
|
|
class _AsyncRun {
|
|
@patch
|
|
static void _scheduleImmediate(void callback()) {
|
|
if (_ScheduleImmediate._closure == null) {
|
|
throw new UnsupportedError("Microtasks are not supported");
|
|
}
|
|
_ScheduleImmediate._closure(callback);
|
|
}
|
|
}
|
|
|
|
typedef void _ScheduleImmediateClosure(void callback());
|
|
|
|
class _ScheduleImmediate {
|
|
static _ScheduleImmediateClosure _closure;
|
|
}
|
|
|
|
@pragma("vm:entry-point", "call")
|
|
void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) {
|
|
_ScheduleImmediate._closure = closure;
|
|
}
|
|
|
|
@pragma("vm:entry-point", "call")
|
|
void _ensureScheduleImmediate() {
|
|
_AsyncRun._scheduleImmediate(_startMicrotaskLoop);
|
|
}
|