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

Unified Diff: sdk/lib/async/collection_sink.dart

Issue 14051005: Remove deprecated CollectionSink and Stream.pipeInto. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/async/async_sources.gypi ('k') | sdk/lib/async/stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/collection_sink.dart
diff --git a/sdk/lib/async/collection_sink.dart b/sdk/lib/async/collection_sink.dart
deleted file mode 100644
index 4ecb831529173a4e1429689aaa3617763bac3b15..0000000000000000000000000000000000000000
--- a/sdk/lib/async/collection_sink.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.async;
-
-typedef void _CollectionSinkCallback<T>(Collection<T> collection);
-typedef void _CollectionSinkErrorCallback(AsyncError error);
-
-/**
- * EventSink that stores incoming data in a collection.
- *
- * *Deprecated*.
- */
-class CollectionSink<T> extends StreamSink<T> {
- // TODO(8997): Implement EventSink instead.
- final Collection<T> collection;
- final _CollectionSinkCallback<T> _callback;
- final _CollectionSinkErrorCallback _errorCallback;
- bool _isClosed = false;
-
- /**
- * Create a sink that stores incoming values in a collection.
- *
- * The [collection] is the collection to add the values to.
- *
- * If [callback] is provided, then it's called with the collection as arugment
- * when the sink's [close] method is called.
- */
- CollectionSink(this.collection,
- { void onClose(Collection<T> collection),
- void onError(AsyncError error) })
- : this._callback = onClose,
- this._errorCallback = onError;
-
- add(T value) {
- if (_isClosed) throw new StateError("Adding to closed sink");
- collection.add(value);
- }
-
- void addError(AsyncError error) {
- if (_isClosed) throw new StateError("Adding error to closed sink");
- if (_errorCallback != null) _errorCallback(error);
- }
-
- void close() {
- if (_isClosed) throw new StateError("Closing closed sink");
- _isClosed = true;
- if (_callback != null) _callback(collection);
- }
-}
« no previous file with comments | « sdk/lib/async/async_sources.gypi ('k') | sdk/lib/async/stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698