Index: mojo/public/java/org/chromium/mojo/system/Handle.java |
diff --git a/mojo/public/java/org/chromium/mojo/system/Handle.java b/mojo/public/java/org/chromium/mojo/system/Handle.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8d83f7e13caf4137171d6a137ef64849a697fef7 |
--- /dev/null |
+++ b/mojo/public/java/org/chromium/mojo/system/Handle.java |
@@ -0,0 +1,89 @@ |
+// 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. |
+ |
+package org.chromium.mojo.system; |
+ |
+/** |
+ * TODO(qsr): Insert description here. |
+ */ |
+public interface Handle { |
+ |
+ /** |
+ * TODO(qsr): |
+ */ |
+ public static final long DEADLINE_INFINITE = -1; |
viettrungluu
2014/04/08 22:35:19
I think my preference would be to move this, WaitF
|
+ |
+ /** |
+ * Flag for the wait operations on handles. |
+ */ |
+ public static class WaitFlags extends Flags<WaitFlags> { |
+ /** |
+ * TODO(qsr): |
+ * |
+ * @param flags |
+ */ |
+ protected WaitFlags(int flags) { |
+ super(flags); |
+ } |
+ |
+ private static final int FLAG_NONE = 0; |
+ private static final int FLAG_READABLE = 1 << 0; |
+ private static final int FLAG_WRITABLE = 1 << 1; |
+ private static final int FLAG_ALL = ~0; |
+ |
+ /** |
+ * Change the readable bit of this flag. |
+ * |
+ * @param readable the new value of the readable bit. |
+ * @return this. |
+ */ |
+ public WaitFlags readable(boolean readable) { |
+ return setFlag(FLAG_READABLE, readable); |
+ } |
+ |
+ /** |
+ * Change the writable bit of this flag. |
+ * |
+ * @param writable the new value of the writable bit. |
+ * @return this. |
+ */ |
+ public WaitFlags writable(boolean writable) { |
+ return setFlag(FLAG_WRITABLE, writable); |
+ } |
+ |
+ /** |
+ * @return a flag with no bit set. |
+ */ |
+ public static WaitFlags none() { |
+ return new WaitFlags(FLAG_NONE); |
+ } |
+ |
+ /** |
+ * @return a flag with all bits set. |
+ */ |
+ public static WaitFlags all() { |
+ return new WaitFlags(FLAG_ALL); |
+ } |
+ } |
+ |
+ /** |
+ * TODO(qsr): |
+ */ |
+ public void close(); |
+ |
+ /** |
+ * TODO(qsr): |
+ * |
+ * @param flags |
+ * @param deadline |
+ */ |
+ public void wait(WaitFlags flags, long deadline); |
+ |
+ /** |
+ * TODO(qsr): |
+ * |
+ * @return TODO(qsr) |
+ */ |
+ public boolean isValid(); |
+} |