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

Unified Diff: third_party/mojo/src/mojo/public/dart/src/types.dart

Issue 1019173002: Update mojo sdk to rev 7214b7ec7d27563b2666afad86cf1c5895c56c18 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep permission service alive if embedder drops requests Created 5 years, 9 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
Index: third_party/mojo/src/mojo/public/dart/src/types.dart
diff --git a/third_party/mojo/src/mojo/public/dart/src/types.dart b/third_party/mojo/src/mojo/public/dart/src/types.dart
index 49f0398acc27315c9c5725fe4abb2fa8a2bc65fe..0af3c2813c68f640c7fca0e104ce6fc916690f51 100644
--- a/third_party/mojo/src/mojo/public/dart/src/types.dart
+++ b/third_party/mojo/src/mojo/public/dart/src/types.dart
@@ -2,10 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
part of core;
-
class MojoResult {
static const int kOk = 0;
static const int kCancelled = -1;
@@ -51,24 +49,42 @@ class MojoResult {
factory MojoResult(int value) {
switch (value) {
- case kOk: return OK;
- case kCancelled: return CANCELLED;
- case kUnknown: return UNKNOWN;
- case kInvalidArgument: return INVALID_ARGUMENT;
- case kDeadlineExceeded: return DEADLINE_EXCEEDED;
- case kNotFound: return NOT_FOUND;
- case kAlreadyExists: return ALREADY_EXISTS;
- case kPermissionDenied: return PERMISSION_DENIED;
- case kResourceExhausted: return RESOURCE_EXHAUSTED;
- case kFailedPrecondition: return FAILED_PRECONDITION;
- case kAborted: return ABORTED;
- case kOutOfRange: return OUT_OF_RANGE;
- case kUnimplemented: return UNIMPLEMENTED;
- case kInternal: return INTERNAL;
- case kUnavailable: return UNAVAILABLE;
- case kDataLoss: return DATA_LOSS;
- case kBusy: return BUSY;
- case kShouldWait: return SHOULD_WAIT;
+ case kOk:
+ return OK;
+ case kCancelled:
+ return CANCELLED;
+ case kUnknown:
+ return UNKNOWN;
+ case kInvalidArgument:
+ return INVALID_ARGUMENT;
+ case kDeadlineExceeded:
+ return DEADLINE_EXCEEDED;
+ case kNotFound:
+ return NOT_FOUND;
+ case kAlreadyExists:
+ return ALREADY_EXISTS;
+ case kPermissionDenied:
+ return PERMISSION_DENIED;
+ case kResourceExhausted:
+ return RESOURCE_EXHAUSTED;
+ case kFailedPrecondition:
+ return FAILED_PRECONDITION;
+ case kAborted:
+ return ABORTED;
+ case kOutOfRange:
+ return OUT_OF_RANGE;
+ case kUnimplemented:
+ return UNIMPLEMENTED;
+ case kInternal:
+ return INTERNAL;
+ case kUnavailable:
+ return UNAVAILABLE;
+ case kDataLoss:
+ return DATA_LOSS;
+ case kBusy:
+ return BUSY;
+ case kShouldWait:
+ return SHOULD_WAIT;
default:
throw 'Invalid Mojo result';
}
@@ -95,30 +111,48 @@ class MojoResult {
String toString() {
switch (value) {
- case kOk: return "OK";
- case kCancelled: return "CANCELLED";
- case kUnknown: return "UNKNOWN";
- case kInvalidArgument: return "INVALID_ARGUMENT";
- case kDeadlineExceeded: return "DEADLINE_EXCEEDED";
- case kNotFound: return "NOT_FOUND";
- case kAlreadyExists: return "ALREADY_EXISTS";
- case kPermissionDenied: return "PERMISSION_DENIED";
- case kResourceExhausted: return "RESOURCE_EXHAUSTED";
- case kFailedPrecondition: return "FAILED_PRECONDITION";
- case kAborted: return "ABORTED";
- case kOutOfRange: return "OUT_OF_RANGE";
- case kUnimplemented: return "UNIMPLEMENTED";
- case kInternal: return "INTERNAL";
- case kUnavailable: return "UNAVAILABLE";
- case kDataLoss: return "DATA_LOSS";
- case kBusy: return "BUSY";
- case kShouldWait: return "SHOULD_WAIT";
- default: return "<invalid result>";
+ case kOk:
+ return "OK";
+ case kCancelled:
+ return "CANCELLED";
+ case kUnknown:
+ return "UNKNOWN";
+ case kInvalidArgument:
+ return "INVALID_ARGUMENT";
+ case kDeadlineExceeded:
+ return "DEADLINE_EXCEEDED";
+ case kNotFound:
+ return "NOT_FOUND";
+ case kAlreadyExists:
+ return "ALREADY_EXISTS";
+ case kPermissionDenied:
+ return "PERMISSION_DENIED";
+ case kResourceExhausted:
+ return "RESOURCE_EXHAUSTED";
+ case kFailedPrecondition:
+ return "FAILED_PRECONDITION";
+ case kAborted:
+ return "ABORTED";
+ case kOutOfRange:
+ return "OUT_OF_RANGE";
+ case kUnimplemented:
+ return "UNIMPLEMENTED";
+ case kInternal:
+ return "INTERNAL";
+ case kUnavailable:
+ return "UNAVAILABLE";
+ case kDataLoss:
+ return "DATA_LOSS";
+ case kBusy:
+ return "BUSY";
+ case kShouldWait:
+ return "SHOULD_WAIT";
+ default:
+ return "<invalid result>";
}
}
}
-
class MojoHandleSignals {
static const int kNone = 0;
static const int kReadable = 1 << 0;
@@ -126,6 +160,7 @@ class MojoHandleSignals {
static const int kPeerClosed = 1 << 2;
static const int kReadWrite = kReadable | kWritable;
static const int kAll = kReadable | kWritable | kPeerClosed;
+ static const int kBitfieldSize = 3;
static const NONE = const MojoHandleSignals._(kNone);
static const READABLE = const MojoHandleSignals._(kReadable);
@@ -142,13 +177,20 @@ class MojoHandleSignals {
factory MojoHandleSignals(int value) {
switch (value) {
- case kNone: return NONE;
- case kReadable: return READABLE;
- case kWritable: return WRITABLE;
- case kPeerClosed: return PEER_CLOSED;
- case kReadWrite: return READWRITE;
- case kPeerClosed | kReadable: return PEER_CLOSED_READABLE;
- case kAll: return ALL;
+ case kNone:
+ return NONE;
+ case kReadable:
+ return READABLE;
+ case kWritable:
+ return WRITABLE;
+ case kPeerClosed:
+ return PEER_CLOSED;
+ case kReadWrite:
+ return READWRITE;
+ case kPeerClosed | kReadable:
+ return PEER_CLOSED_READABLE;
+ case kAll:
+ return ALL;
default:
throw 'Invalid handle signal: $value';
}
@@ -160,6 +202,7 @@ class MojoHandleSignals {
bool get isPeerClosed => (value & kPeerClosed) == kPeerClosed;
bool get isReadWrite => (value & kReadWrite) == kReadWrite;
bool get isAll => (this == ALL);
+ bool get isValid => (value & kAll) == value;
MojoHandleSignals operator +(MojoHandleSignals other) {
return new MojoHandleSignals(value | other.value);
@@ -170,41 +213,43 @@ class MojoHandleSignals {
}
String toString() {
- switch (value) {
- case kNone: return "NONE";
- case kReadable: return "READABLE";
- case kWritable: return "WRITABLE";
- case kPeerClosed: return "PEER_CLOSED";
- case kReadWrite: return "READWRITE";
- case kPeerClosed | kReadable: return "PEER_CLOSED_READABLE";
- case kAll: return "ALL";
- default: return "<invalid signals>";
+ if (isNone) {
+ return "(None)";
+ }
+ if (!isValid) {
+ return "(INVALID)";
}
+ List<String> signals = [];
+ if (isReadable) signals.add("Readable");
+ if (isWritable) signals.add("Writable");
+ if (isPeerClosed) signals.add("PeerClosed");
+ return "(" + signals.join(", ") + ")";
}
}
-
class MojoHandleSignalsState {
- MojoHandleSignalsState(this.satisfied_signals,
- this.satisfiable_signals);
+ MojoHandleSignalsState(this.satisfied_signals, this.satisfiable_signals);
final int satisfied_signals;
final int satisfiable_signals;
+ String toString() => (new MojoHandleSignals(satisfied_signals)).toString();
}
-
class MojoWaitResult {
MojoWaitResult(this.result, this.state);
final MojoResult result;
MojoHandleSignalsState state;
+ String toString() => "MojoWaitResult(result: $result, state: $state)";
}
-
class MojoWaitManyResult {
MojoWaitManyResult(this.result, this.index, this.states);
final MojoResult result;
final int index;
List<MojoHandleSignalsState> states;
-
+
bool get isIndexValid => (this.index != null);
bool get areSignalStatesValid => (this.states != null);
+
+ String toString() =>
+ "MojoWaitManyResult(" "result: $result, idx: $index, state: ${states[index]})";
}
« no previous file with comments | « third_party/mojo/src/mojo/public/dart/src/stub.dart ('k') | third_party/mojo/src/mojo/public/go/bindings/async_waiter.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698