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

Side by Side Diff: sdk/lib/io/stream_util.dart

Issue 11740027: Rename unsubscribe to cancel. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Fix error message. Created 7 years, 11 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) 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 part of dart.io; 5 part of dart.io;
6 6
7 abstract class _BaseDataInputStream { 7 abstract class _BaseDataInputStream {
8 int available(); 8 int available();
9 9
10 List<int> read([int len]) { 10 List<int> read([int len]) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 213
214 class _InputStreamController extends StreamController<List<int>> { 214 class _InputStreamController extends StreamController<List<int>> {
215 _InputStreamController(InputStream this._inputStream) { 215 _InputStreamController(InputStream this._inputStream) {
216 _inputStream.onClosed = close; 216 _inputStream.onClosed = close;
217 _inputStream.onError = (error) => signalError(new AsyncError(error)); 217 _inputStream.onError = (error) => signalError(new AsyncError(error));
218 } 218 }
219 219
220 void onPauseStateChange() { 220 void onPauseStateChange() {
221 if (isPaused) { 221 if (isPaused) {
222 unlisten(); 222 _unlisten();
223 } else { 223 } else {
224 listen(); 224 _listen();
225 } 225 }
226 } 226 }
227 227
228 void onSubscriptionStateChange() { 228 void onSubscriptionStateChange() {
229 if (hasSubscribers) listen(); 229 if (hasSubscribers) _listen();
230 // TODO(ajohnsen): Else destroy? 230 // TODO(ajohnsen): Else destroy?
231 } 231 }
232 232
233 void listen() { 233 void _listen() {
234 _inputStream.onData = () { 234 _inputStream.onData = () {
235 add(_inputStream.read()); 235 add(_inputStream.read());
236 }; 236 };
237 } 237 }
238 238
239 void unlisten() { 239 void _unlisten() {
240 _inputStream.onData = null; 240 _inputStream.onData = null;
241 } 241 }
242 242
243 InputStream _inputStream; 243 InputStream _inputStream;
244 } 244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698