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

Side by Side Diff: tests/lib/async/event_helper.dart

Issue 12154006: Remove Sink and move CollectionSink to async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove usage of Sink from pub. Created 7 years, 10 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 | « sdk/lib/core/sink.dart ('k') | utils/pub/log.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 event_helper; 5 library event_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 abstract class Event { 9 abstract class Event {
10 void replay(StreamSink sink); 10 void replay(StreamSink sink);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 Events(); 65 Events();
66 Events.fromIterable(Iterable iterable) { 66 Events.fromIterable(Iterable iterable) {
67 for (var value in iterable) add(value); 67 for (var value in iterable) add(value);
68 close(); 68 close();
69 } 69 }
70 70
71 /** Capture events from a stream into a new [Events] object. */ 71 /** Capture events from a stream into a new [Events] object. */
72 factory Events.capture(Stream stream, 72 factory Events.capture(Stream stream,
73 { bool unsubscribeOnError: false }) = CaptureEvents; 73 { bool unsubscribeOnError: false }) = CaptureEvents;
74 74
75 // Sink interface. 75 // StreamSink interface.
76 add(var value) { events.add(new DataEvent(value)); } 76 add(var value) { events.add(new DataEvent(value)); }
77 77
78 void signalError(AsyncError error) { 78 void signalError(AsyncError error) {
79 events.add(new ErrorEvent(error)); 79 events.add(new ErrorEvent(error));
80 } 80 }
81 81
82 void close() { 82 void close() {
83 events.add(const DoneEvent()); 83 events.add(const DoneEvent());
84 } 84 }
85 85
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void resume() { 161 void resume() {
162 subscription.resume(); 162 subscription.resume();
163 } 163 }
164 164
165 void onDone(void action()) { 165 void onDone(void action()) {
166 onDoneSignal.future.whenComplete(action); 166 onDoneSignal.future.whenComplete(action);
167 } 167 }
168 } 168 }
OLDNEW
« no previous file with comments | « sdk/lib/core/sink.dart ('k') | utils/pub/log.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698