| Index: mojo/public/dart/system/lib/src/types.dart
|
| diff --git a/mojo/public/dart/system/lib/src/types.dart b/mojo/public/dart/system/lib/src/types.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c14934ebe38e6b8633639b9818b2c461abda155b
|
| --- /dev/null
|
| +++ b/mojo/public/dart/system/lib/src/types.dart
|
| @@ -0,0 +1,69 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// 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 OK = 0;
|
| + static const int CANCELLED = -1;
|
| + static const int UNKNOWN = -2;
|
| + static const int INVALID_ARGUMENT = -3;
|
| + static const int DEADLINE_EXCEEDED = -4;
|
| + static const int NOT_FOUND = -5;
|
| + static const int ALREADY_EXISTS = -6;
|
| + static const int PERMISSION_DENIED = -7;
|
| + static const int RESOURCE_EXHAUSTED = -8;
|
| + static const int FAILED_PRECONDITION = -9;
|
| + static const int ABORTED = -10;
|
| + static const int OUT_OF_RANGE = -11;
|
| + static const int UNIMPLEMENTED = -12;
|
| + static const int INTERNAL = -13;
|
| + static const int UNAVAILABLE = -14;
|
| + static const int DATA_LOSS = -15;
|
| + static const int BUSY = -16;
|
| + static const int SHOULD_WAIT = -17;
|
| +
|
| + static bool isResult(int value) => (value <= OK) && (value >= SHOULD_WAIT);
|
| +
|
| + static bool isOk(int value) => (value == OK);
|
| + static bool isCancelled(int value) => (value == CANCELLED);
|
| + static bool isUnknown(int value) => (value == UNKNOWN);
|
| + static bool isInvalidArgument(int value) => (value == INVALID_ARGUMENT);
|
| + static bool isDeadlineExceeded(int value) => (value == DEADLINE_EXCEEDED);
|
| + static bool isNotFound(int value) => (value == NOT_FOUND);
|
| + static bool isAlreadExists(int value) => (value == ALREADY_EXISTS);
|
| + static bool isPermissionDenied(int value) => (value == PERMISSION_DENIED);
|
| + static bool isResourceExhausted(int value) => (value == RESOURCE_EXHAUSTED);
|
| + static bool isFailedPrecondition(int value) => (value == FAILED_PRECONDITION);
|
| + static bool isAborted(int value) => (value == ABORTED);
|
| + static bool isOutOfRange(int value) => (value == OUT_OF_RANGE);
|
| + static bool isUnimplemented(int value) => (value == UNIMPLEMENTED);
|
| + static bool isInternal(int value) => (value == INTERNAL);
|
| + static bool isUnavailable(int value) => (value == UNAVAILABLE);
|
| + static bool isDataLoss(int value) => (value == DATA_LOSS);
|
| + static bool isBusy(int value) => (value == BUSY);
|
| + static bool isShouldWait(int value) => (value == SHOULD_WAIT);
|
| +}
|
| +
|
| +
|
| +class MojoHandleSignals {
|
| + static const int NONE = 0;
|
| + static const int READABLE = 1 << 0;
|
| + static const int WRITABLE = 1 << 1;
|
| + static const int READWRITE = READABLE | WRITABLE;
|
| +
|
| + static bool isReadable(int mask) => (mask & READABLE) == READABLE;
|
| + static bool isWritable(int mask) => (mask & WRITABLE) == WRITABLE;
|
| + static bool isReadWrite(int mask) => (mask & READWRITE) == READWRITE;
|
| + static int toggleWrite(int mask) =>
|
| + isWritable(mask) ? (mask & ~WRITABLE) : (mask | WRITABLE);
|
| +}
|
| +
|
| +
|
| +class MojoHandleSignalsState {
|
| + const MojoHandleSignalsState(this.satisfied_signals,
|
| + this.satisfiable_signals);
|
| + final int satisfied_signals;
|
| + final int satisfiable_signals;
|
| +}
|
|
|