Chromium Code Reviews

Unified Diff: sdk/lib/async/event_loop.dart

Issue 26151002: Rename runAsync to scheduleMicrotask. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/utils.dart ('k') | sdk/lib/async/future.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/event_loop.dart
diff --git a/sdk/lib/async/event_loop.dart b/sdk/lib/async/event_loop.dart
index 94137da655b61c61739078757e06e6c8a36c0a9d..42c25ecdbce26ea8f2741eb05c1e497bed612445 100644
--- a/sdk/lib/async/event_loop.dart
+++ b/sdk/lib/async/event_loop.dart
@@ -43,21 +43,21 @@ void _scheduleAsyncCallback(callback) {
* or DOM events).
*
* Warning: it is possible to starve the DOM by registering asynchronous
- * callbacks through this method. For example the following program will
- * run the callbacks without ever giving the Timer callback a chance to execute:
+ * callbacks through this method. For example the following program runs
+ * the callbacks without ever giving the Timer callback a chance to execute:
*
* Timer.run(() { print("executed"); }); // Will never be executed;
* foo() {
- * asyncRun(foo); // Schedules [foo] in front of other events.
+ * scheduleMicrotask(foo); // Schedules [foo] in front of other events.
* }
* main() {
* foo();
* }
*/
-void runAsync(void callback()) {
+void scheduleMicrotask(void callback()) {
if (Zone.current == Zone.ROOT) {
- // No need to bind the callback. We know that the root's runAsync will
- // be invoked in the root zone.
+ // No need to bind the callback. We know that the root's scheduleMicrotask
+ // will be invoked in the root zone.
Zone.current.scheduleMicrotask(callback);
return;
}
@@ -65,6 +65,14 @@ void runAsync(void callback()) {
Zone.current.bindCallback(callback, runGuarded: true));
}
+/**
+ * *DEPRECATED*. Use [scheduleMicrotask] instead.
+ */
+@deprecated
+void runAsync(void callback()) {
+ scheduleMicrotask(callback);
+}
+
class _AsyncRun {
/** Enqueues the given callback before any other event in the event-loop. */
external static void _enqueueImmediate(void callback());
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/utils.dart ('k') | sdk/lib/async/future.dart » ('j') | no next file with comments »

Powered by Google App Engine