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

Side by Side Diff: lib/src/disconnector.dart

Issue 1966893002: Fix all strong-mode errors and warnings. (Closed) Base URL: git@github.com:dart-lang/stream_channel.git@master
Patch Set: Created 4 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
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/isolate_channel.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import '../stream_channel.dart'; 7 import '../stream_channel.dart';
8 8
9 /// Allows the caller to force a channel to disconnect. 9 /// Allows the caller to force a channel to disconnect.
10 /// 10 ///
(...skipping 20 matching lines...) Expand all
31 void disconnect() { 31 void disconnect() {
32 _isDisconnected = true; 32 _isDisconnected = true;
33 for (var sink in _sinks) { 33 for (var sink in _sinks) {
34 sink._disconnect(); 34 sink._disconnect();
35 } 35 }
36 _sinks.clear(); 36 _sinks.clear();
37 } 37 }
38 38
39 StreamChannel<T> bind(StreamChannel<T> channel) { 39 StreamChannel<T> bind(StreamChannel<T> channel) {
40 return channel.changeSink((innerSink) { 40 return channel.changeSink((innerSink) {
41 var sink = new _DisconnectorSink(innerSink); 41 var sink = new _DisconnectorSink<T>(innerSink);
42 42
43 if (_isDisconnected) { 43 if (_isDisconnected) {
44 sink._disconnect(); 44 sink._disconnect();
45 } else { 45 } else {
46 _sinks.add(sink); 46 _sinks.add(sink);
47 } 47 }
48 48
49 return sink; 49 return sink;
50 }); 50 });
51 } 51 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void _disconnect() { 130 void _disconnect() {
131 _isDisconnected = true; 131 _isDisconnected = true;
132 _inner.close(); 132 _inner.close();
133 133
134 if (!_inAddStream) return; 134 if (!_inAddStream) return;
135 _addStreamCompleter.complete(_addStreamSubscription.cancel()); 135 _addStreamCompleter.complete(_addStreamSubscription.cancel());
136 _addStreamCompleter = null; 136 _addStreamCompleter = null;
137 _addStreamSubscription = null; 137 _addStreamSubscription = null;
138 } 138 }
139 } 139 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/isolate_channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698