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

Unified Diff: examples/dart/netcat/lib/main.dart

Issue 1439993003: Dart: Avoid MojoResult and MojoHandleSignals constructors. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | mojo/dart/embedder/io/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/dart/netcat/lib/main.dart
diff --git a/examples/dart/netcat/lib/main.dart b/examples/dart/netcat/lib/main.dart
index 4cef6a6fd573971e7e2017b7c03f6aaeb16c7823..83b47e3d563c34d258e766c119bd9e094b2f1cf7 100644
--- a/examples/dart/netcat/lib/main.dart
+++ b/examples/dart/netcat/lib/main.dart
@@ -124,11 +124,11 @@ class Connector {
}
void _onSocketReceiverEvent(List<int> event) {
- var mojoSignals = new MojoHandleSignals(event[1]);
+ int mojoSignals = event[1];
var shouldShutDown = false;
- if (mojoSignals.isReadable) {
+ if (MojoHandleSignals.isReadable(mojoSignals)) {
var numBytesRead = _socketReceiver.read(_readBuffer);
- if (_socketReceiver.status.isOk) {
+ if (_socketReceiver.status == MojoResult.kOk) {
assert(numBytesRead > 0);
_terminal.ptr
.write(_readBuffer.buffer.asUint8List(0, numBytesRead), 0,
@@ -140,10 +140,11 @@ class Connector {
} else {
shouldShutDown = true;
}
- } else if (mojoSignals.isPeerClosed) {
+ } else if (MojoHandleSignals.isPeerClosed(mojoSignals)) {
shouldShutDown = true;
} else {
- throw 'Unexpected handle event: $mojoSignals';
+ String signals = MojoHandleSignals.string(mojoSignals);
+ throw 'Unexpected handle event: $signals';
}
if (shouldShutDown) {
_shutDown();
« no previous file with comments | « no previous file | mojo/dart/embedder/io/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698