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

Unified Diff: mojo/public/dart/mojo/lib/src/fill_data.dart

Issue 1414483010: Dart: Use a RawReceivePort to receive events for Mojo handles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge 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
Index: mojo/public/dart/mojo/lib/src/fill_data.dart
diff --git a/mojo/public/dart/mojo/lib/src/fill_data.dart b/mojo/public/dart/mojo/lib/src/fill_data.dart
index 848efc2db81e043857fa61b3db39cfb0c779d555..d860f4baf403ad4bc6c2bd62ec443f903cb06683 100644
--- a/mojo/public/dart/mojo/lib/src/fill_data.dart
+++ b/mojo/public/dart/mojo/lib/src/fill_data.dart
@@ -7,11 +7,11 @@ part of core;
class DataPipeFiller {
final MojoDataPipeProducer _producer;
final ByteData _data;
- MojoEventStream _eventStream;
+ MojoEventHandler _eventHandler;
int _dataPosition;
DataPipeFiller(this._producer, this._data) {
- _eventStream = new MojoEventStream(_producer.handle);
+ _eventHandler = new MojoEventHandler(_producer.handle);
_dataPosition = 0;
}
@@ -30,18 +30,18 @@ class DataPipeFiller {
}
void fill() {
- _eventStream.enableWriteEvents();
- _eventStream.listen((List<int> event) {
+ _eventHandler.enableWriteEvents();
+ _eventHandler.handleEvents((List<int> event) {
var mojoSignals = new MojoHandleSignals(event[1]);
if (mojoSignals.isWritable) {
MojoResult result = _doWrite();
if (_dataPosition >= _data.lengthInBytes || !result.isOk) {
- _eventStream.close();
- _eventStream = null;
+ _eventHandler.close();
+ _eventHandler = null;
}
} else if (mojoSignals.isPeerClosed) {
- _eventStream.close();
- _eventStream = null;
+ _eventHandler.close();
+ _eventHandler = null;
} else {
throw 'Unexpected handle event: $mojoSignals';
}

Powered by Google App Engine
This is Rietveld 408576698