Make IsolateChannel's controllers synchronous.
This is slightly more efficient, and also make it easier for other
packages to work around dart-lang/sdk#25745.
R=tjblasi@google.com
Review URL: https://codereview.chromium.org//1690473002 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd74936..05a83e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.1
+
+* Make `IsolateChannel` slightly more efficient.
+
## 1.3.0
* Add `Disconnector`, a transformer that allows the caller to disconnect the
diff --git a/lib/src/isolate_channel.dart b/lib/src/isolate_channel.dart
index 3466d19..dcb52cb 100644
--- a/lib/src/isolate_channel.dart
+++ b/lib/src/isolate_channel.dart
@@ -53,7 +53,8 @@
var subscription;
subscription = receivePort.listen((message) {
if (message is SendPort) {
- var controller = new StreamChannelController(allowForeignErrors: false);
+ var controller = new StreamChannelController(
+ allowForeignErrors: false, sync: true);
new SubscriptionStream<T>(subscription).pipe(controller.local.sink);
controller.local.stream.listen(message.send,
onDone: receivePort.close);
@@ -91,7 +92,8 @@
/// Creates a stream channel that receives messages from [receivePort] and
/// sends them over [sendPort].
factory IsolateChannel(ReceivePort receivePort, SendPort sendPort) {
- var controller = new StreamChannelController(allowForeignErrors: false);
+ var controller = new StreamChannelController(
+ allowForeignErrors: false, sync: true);
receivePort.pipe(controller.local.sink);
controller.local.stream.listen(sendPort.send, onDone: receivePort.close);
return new IsolateChannel._(
diff --git a/pubspec.yaml b/pubspec.yaml
index c787b95..930f744 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: stream_channel
-version: 1.3.0
+version: 1.3.1-dev
description: An abstraction for two-way communication channels.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/stream_channel