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

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

Issue 291843011: Run pub tests against older versions of barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 7 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
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 import 'dart:typed_data'; 8 import 'dart:typed_data';
9 9
10 import 'package:stack_trace/stack_trace.dart'; 10 import 'package:stack_trace/stack_trace.dart';
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 subscription = callback().listen(controller.add, 301 subscription = callback().listen(controller.add,
302 onError: controller.addError, 302 onError: controller.addError,
303 onDone: controller.close); 303 onDone: controller.close);
304 }, 304 },
305 onCancel: () => subscription.cancel(), 305 onCancel: () => subscription.cancel(),
306 onPause: () => subscription.pause(), 306 onPause: () => subscription.pause(),
307 onResume: () => subscription.resume(), 307 onResume: () => subscription.resume(),
308 sync: true); 308 sync: true);
309 return controller.stream; 309 return controller.stream;
310 } 310 }
311
312 /// Creates a single-subscription stream from a broadcast stream.
313 ///
314 /// The returned stream will enqueue events from [broadcast] until a listener is
315 /// attached, then pipe events to that listener.
316 Stream broadcastToSingleSubscription(Stream broadcast) {
317 if (!broadcast.isBroadcast) return broadcast;
318
319 // TODO(nweiz): Implement this using a transformer when issues 18588 and 18586
320 // are fixed.
321 var subscription;
322 var controller = new StreamController(onCancel: () => subscription.cancel());
323 subscription = broadcast.listen(controller.add,
324 onError: controller.addError,
325 onDone: controller.close);
326 return controller.stream;
327 }
OLDNEW
« no previous file with comments | « third_party/pkg/barback-0.13.0/lib/src/transformer_group.dart ('k') | third_party/pkg/barback-0.13.0/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698