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

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

Issue 834283003: Update Dart bindings to support updated MojoWait and MojoWaitMany APIs. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixed comment 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/dart/test/core_test.dart ('k') | mojo/public/dart/src/handle_watcher.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/handle.dart
diff --git a/mojo/public/dart/src/handle.dart b/mojo/public/dart/src/handle.dart
index 79acbd70c1e49f4c595877cf10d29fdb2e63dd46..56b673548615fd854e93f6bfa6644e8f00fa0039 100644
--- a/mojo/public/dart/src/handle.dart
+++ b/mojo/public/dart/src/handle.dart
@@ -7,10 +7,10 @@ part of core;
class _MojoHandleNatives {
static int register(MojoHandle handle) native "MojoHandle_Register";
static int close(int handle) native "MojoHandle_Close";
- static int wait(int handle, int signals, int deadline)
+ static List wait(int handle, int signals, int deadline)
native "MojoHandle_Wait";
- static int waitMany(
- List<int> handles, List<int> signals, int num_handles, int deadline)
+ static List waitMany(
+ List<int> handles, List<int> signals, int deadline)
native "MojoHandle_WaitMany";
}
@@ -29,14 +29,14 @@ class RawMojoHandle {
return new MojoResult(result);
}
- MojoResult wait(int signals, int deadline) {
- int result = _MojoHandleNatives.wait(h, signals, deadline);
- return new MojoResult(result);
+ MojoWaitResult wait(int signals, int deadline) {
+ List result = _MojoHandleNatives.wait(h, signals, deadline);
+ return new MojoWaitResult(new MojoResult(result[0]), result[1]);
}
bool _ready(int signal) {
- MojoResult res = wait(signal, 0);
- switch (res) {
+ MojoWaitResult res = wait(signal, 0);
+ switch (res.result) {
case MojoResult.OK:
return true;
case MojoResult.DEADLINE_EXCEEDED:
@@ -53,14 +53,14 @@ class RawMojoHandle {
bool readyRead() => _ready(MojoHandleSignals.READABLE);
bool readyWrite() => _ready(MojoHandleSignals.WRITABLE);
- static int waitMany(List<int> handles,
- List<int> signals,
- int deadline) {
- if (handles.length != signals.length) {
- return MojoResult.kInvalidArgument;
- }
- return _MojoHandleNatives.waitMany(
- handles, signals, handles.length, deadline);
+ static MojoWaitManyResult waitMany(List<int> handles,
+ List<int> signals,
+ int deadline) {
+ List result = _MojoHandleNatives.waitMany(
+ handles, signals, deadline);
+
+ return new MojoWaitManyResult(
+ new MojoResult(result[0]), result[1], result[2]);
}
static MojoResult register(MojoHandle handle) {
« no previous file with comments | « mojo/dart/test/core_test.dart ('k') | mojo/public/dart/src/handle_watcher.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698