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

Unified Diff: third_party/mojo/src/mojo/public/dart/src/event_stream.dart

Issue 1029113005: Update mojo sdk to rev cb6c5abfadfea0ca73dca466e2894554ac1ae144 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 9 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
Index: third_party/mojo/src/mojo/public/dart/src/event_stream.dart
diff --git a/third_party/mojo/src/mojo/public/dart/src/event_stream.dart b/third_party/mojo/src/mojo/public/dart/src/event_stream.dart
index 645334e835ac2460fc7389acd84814f99dc0252a..712d0259f8308868891e9a6f65bdb2b3d612e7ee 100644
--- a/third_party/mojo/src/mojo/public/dart/src/event_stream.dart
+++ b/third_party/mojo/src/mojo/public/dart/src/event_stream.dart
@@ -64,7 +64,8 @@ class MojoEventStream extends Stream<List<int>> {
_controller.addStream(_receivePort).whenComplete(_controller.close);
if (_signals != MojoHandleSignals.NONE) {
- var res = MojoHandleWatcher.add(_handle, _sendPort, _signals.value);
+ var res = new MojoResult(
+ MojoHandleWatcher.add(_handle.h, _sendPort, _signals.value));
if (!res.isOk) {
throw "MojoHandleWatcher add failed: $res";
}
@@ -78,7 +79,8 @@ class MojoEventStream extends Stream<List<int>> {
void enableSignals(MojoHandleSignals signals) {
_signals = signals;
if (_isListening) {
- var res = MojoHandleWatcher.add(_handle, _sendPort, signals.value);
+ var res = new MojoResult(
+ MojoHandleWatcher.add(_handle.h, _sendPort, signals.value));
if (!res.isOk) {
throw "MojoHandleWatcher add failed: $res";
}
@@ -92,11 +94,13 @@ class MojoEventStream extends Stream<List<int>> {
Future _handleWatcherClose() {
assert(_handle != null);
- return MojoHandleWatcher.close(_handle, wait: true).then((_) {
+ assert(MojoHandle._removeUnclosedHandle(_handle));
+ return MojoHandleWatcher.close(_handle.h, wait: true).then((r) {
if (_receivePort != null) {
_receivePort.close();
_receivePort = null;
}
+ return new MojoResult(r);
});
}
@@ -118,12 +122,13 @@ class MojoEventStream extends Stream<List<int>> {
void _onPauseStateChange() {
if (_controller.isPaused) {
- var res = MojoHandleWatcher.remove(_handle);
+ var res = new MojoResult(MojoHandleWatcher.remove(_handle.h));
if (!res.isOk) {
throw "MojoHandleWatcher add failed: $res";
}
} else {
- var res = MojoHandleWatcher.add(_handle, _sendPort, _signals.value);
+ var res = new MojoResult(
+ MojoHandleWatcher.add(_handle.h, _sendPort, _signals.value));
if (!res.isOk) {
throw "MojoHandleWatcher add failed: $res";
}
@@ -200,21 +205,24 @@ class MojoEventStreamListener {
assert(_eventStream.readyWrite);
handleWrite();
}
- if (_isOpen) {
+ if (!signalsReceived.isPeerClosed) {
_eventStream.enableSignals(signalsWatched);
}
_isInHandler = false;
if (signalsReceived.isPeerClosed) {
- if (onError != null) {
- onError();
- }
- close();
+ // nodefer is true here because there is no need to wait to close until
+ // outstanding messages are sent. The other side is gone.
+ close(nodefer: true).then((_) {
+ if (onError != null) {
+ onError();
+ }
+ });
}
}, onDone: close);
return subscription;
}
- Future close() {
+ Future close({bool nodefer: false}) {
var result;
_isOpen = false;
_endpoint = null;

Powered by Google App Engine
This is Rietveld 408576698