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

Side by Side Diff: pkg/barback/lib/src/utils.dart

Issue 19841002: Remove calls to [new Future] work around issue 11911. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change. Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/transform.dart ('k') | pkg/barback/test/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library barback.utils; 5 library barback.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 /// Converts a number in the range [0-255] to a two digit hex string. 9 /// Converts a number in the range [0-255] to a two digit hex string.
10 /// 10 ///
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 /// any code to run, as long as it's not waiting on some external event. 94 /// any code to run, as long as it's not waiting on some external event.
95 Future pumpEventQueue([int times=20]) { 95 Future pumpEventQueue([int times=20]) {
96 if (times == 0) return new Future.value(); 96 if (times == 0) return new Future.value();
97 // We use a delayed future to allow runAsync events to finish. The 97 // We use a delayed future to allow runAsync events to finish. The
98 // Future.value or Future() constructors use runAsync themselves and would 98 // Future.value or Future() constructors use runAsync themselves and would
99 // therefore not wait for runAsync callbacks that are scheduled after invoking 99 // therefore not wait for runAsync callbacks that are scheduled after invoking
100 // this method. 100 // this method.
101 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); 101 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
102 } 102 }
103 103
104 /// Like [new Future], but avoids issue 11911 by using [new Future.value] under
105 /// the covers.
106 Future newFuture(callback()) => new Future.value().then((_) => callback());
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/transform.dart ('k') | pkg/barback/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698