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

Unified Diff: mojo/public/dart/src/data_pipe.dart

Issue 800523004: Dart: Simplifies the handle watcher. Various cleanups and bugfixes. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: cleanup Created 5 years, 11 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
« no previous file with comments | « mojo/public/dart/src/codec.dart ('k') | mojo/public/dart/src/handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/data_pipe.dart
diff --git a/mojo/public/dart/src/data_pipe.dart b/mojo/public/dart/src/data_pipe.dart
index 665285de4a953d5b8a3287300240e5ebe31e13ce..44acee957e629bcff8af1c45996ca170a77c4c07 100644
--- a/mojo/public/dart/src/data_pipe.dart
+++ b/mojo/public/dart/src/data_pipe.dart
@@ -34,7 +34,7 @@ class MojoDataPipeProducer {
static const int FLAG_NONE = 0;
static const int FLAG_ALL_OR_NONE = 1 << 0;
- RawMojoHandle handle;
+ MojoHandle handle;
MojoResult status;
final int element_bytes;
@@ -96,14 +96,14 @@ class MojoDataPipeConsumer {
static const int FLAG_ALL_OR_NONE = 1 << 0;
static const int FLAG_MAY_DISCARD = 1 << 1;
static const int FLAG_QUERY = 1 << 2;
+ static const int FLAG_PEEK = 1 << 3;
- RawMojoHandle handle;
+ MojoHandle handle;
MojoResult status;
final int element_bytes;
- MojoDataPipeConsumer(this.handle,
- this.status,
- this.element_bytes);
+ MojoDataPipeConsumer(
+ this.handle, [this.status = MojoResult.OK, this.element_bytes = 1]);
int read(ByteData data, [int num_bytes = -1, int flags = 0]) {
if (handle == null) {
@@ -123,7 +123,7 @@ class MojoDataPipeConsumer {
return result[1];
}
- ByteData beginRead(int buffer_bytes, [int flags = 0]) {
+ ByteData beginRead([int buffer_bytes = 0, int flags = 0]) {
if (handle == null) {
status = MojoResult.INVALID_ARGUMENT;
return null;
@@ -150,6 +150,8 @@ class MojoDataPipeConsumer {
status = new MojoResult(result);
return status;
}
+
+ int query() => read(null, 0, FLAG_QUERY);
}
@@ -178,8 +180,8 @@ class MojoDataPipe {
return null;
}
assert((result is List) && (result.length == 3));
- RawMojoHandle producer_handle = new RawMojoHandle(result[1]);
- RawMojoHandle consumer_handle = new RawMojoHandle(result[2]);
+ MojoHandle producer_handle = new MojoHandle(result[1]);
+ MojoHandle consumer_handle = new MojoHandle(result[2]);
MojoDataPipe pipe = new MojoDataPipe._internal();
pipe.producer = new MojoDataPipeProducer(
producer_handle, new MojoResult(result[0]), element_bytes);
« no previous file with comments | « mojo/public/dart/src/codec.dart ('k') | mojo/public/dart/src/handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698