Commit 1ab83e66 authored by Ian Hickson's avatar Ian Hickson

Merge pull request #894 from Hixie/rev

rev the engine
parents cb1ee0f6 ab901beb
...@@ -7,8 +7,8 @@ dependencies: ...@@ -7,8 +7,8 @@ dependencies:
collection: '>=1.1.3 <2.0.0' collection: '>=1.1.3 <2.0.0'
intl: '>=0.12.4+2 <0.13.0' intl: '>=0.12.4+2 <0.13.0'
material_design_icons: '>=0.0.3 <0.1.0' material_design_icons: '>=0.0.3 <0.1.0'
sky_engine: 0.0.70 sky_engine: 0.0.71
sky_services: 0.0.70 sky_services: 0.0.71
vector_math: '>=1.4.3 <2.0.0' vector_math: '>=1.4.3 <2.0.0'
# To pin the transitive dependency through mojo_sdk. # To pin the transitive dependency through mojo_sdk.
......
...@@ -32,27 +32,27 @@ class PipeToFile { ...@@ -32,27 +32,27 @@ class PipeToFile {
Future<int> drain() { Future<int> drain() {
Completer<int> completer = new Completer(); Completer<int> completer = new Completer();
// TODO(mpcomplete): Is it legit to pass an async callback to subscribe? _events.subscribe((int signal) {
_events.subscribe((List<int> event) async { (() async {
int signal = event[1]; if (MojoHandleSignals.isReadable(signal)) {
if (MojoHandleSignals.isReadable(signal)) { int result = await _doRead();
int result = await _doRead(); if (result != MojoResult.kOk) {
if (result != MojoResult.kOk) { _events.close();
_events = null;
_outputStream.close();
completer.complete(result);
} else {
_events.enableReadEvents();
}
} else if (MojoHandleSignals.isPeerClosed(signal)) {
_events.close(); _events.close();
_events = null; _events = null;
_outputStream.close(); _outputStream.close();
completer.complete(result); completer.complete(MojoResult.kOk);
} else { } else {
_events.enableReadEvents(); throw 'Unexpected handle event: ${MojoHandleSignals.string(signal)}';
} }
} else if (MojoHandleSignals.isPeerClosed(signal)) { })();
_events.close();
_events = null;
_outputStream.close();
completer.complete(MojoResult.kOk);
} else {
throw 'Unexpected handle event: ${MojoHandleSignals.string(signal)}';
}
}); });
return completer.future; return completer.future;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment