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

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

Issue 50073007: fix barback and polymer build warnings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
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 /// A pair of values. 9 /// A pair of values.
10 class Pair<E, F> { 10 class Pair<E, F> {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 /// any code to run, as long as it's not waiting on some external event. 168 /// any code to run, as long as it's not waiting on some external event.
169 Future pumpEventQueue([int times=20]) { 169 Future pumpEventQueue([int times=20]) {
170 if (times == 0) return new Future.value(); 170 if (times == 0) return new Future.value();
171 // We use a delayed future to allow microtask events to finish. The 171 // We use a delayed future to allow microtask events to finish. The
172 // Future.value or Future() constructors use scheduleMicrotask themselves and 172 // Future.value or Future() constructors use scheduleMicrotask themselves and
173 // would therefore not wait for microtask callbacks that are scheduled after 173 // would therefore not wait for microtask callbacks that are scheduled after
174 // invoking this method. 174 // invoking this method.
175 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); 175 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
176 } 176 }
177 177
178 /// Like [new Future], but avoids issue 11911 by using [new Future.value] under 178 /// Like `new Future`, but avoids issue 11911 by using `new Future.value` under
179 /// the covers. 179 /// the covers.
180 // TODO(jmesserly): doc comment changed to due 14601.
Jennifer Messerly 2013/10/30 00:59:29 https://code.google.com/p/dart/issues/detail?id=14
180 Future newFuture(callback()) => new Future.value().then((_) => callback()); 181 Future newFuture(callback()) => new Future.value().then((_) => callback());
181 182
182 /// Returns a buffered stream that will emit the same values as the stream 183 /// Returns a buffered stream that will emit the same values as the stream
183 /// returned by [future] once [future] completes. If [future] completes to an 184 /// returned by [future] once [future] completes. If [future] completes to an
184 /// error, the return value will emit that error and then close. 185 /// error, the return value will emit that error and then close.
185 Stream futureStream(Future<Stream> future) { 186 Stream futureStream(Future<Stream> future) {
186 var controller = new StreamController(sync: true); 187 var controller = new StreamController(sync: true);
187 future.then((stream) { 188 future.then((stream) {
188 stream.listen( 189 stream.listen(
189 controller.add, 190 controller.add,
190 onError: controller.addError, 191 onError: controller.addError,
191 onDone: controller.close); 192 onDone: controller.close);
192 }).catchError((e, stackTrace) { 193 }).catchError((e, stackTrace) {
193 controller.addError(e, stackTrace); 194 controller.addError(e, stackTrace);
194 controller.close(); 195 controller.close();
195 }); 196 });
196 return controller.stream; 197 return controller.stream;
197 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698