Index: mojo/public/java/src/org/chromium/mojo/system/MessagePipeHandle.java |
diff --git a/mojo/public/java/src/org/chromium/mojo/system/MessagePipeHandle.java b/mojo/public/java/src/org/chromium/mojo/system/MessagePipeHandle.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a19431b44c1935f611d37aea59fd834e6e3415ec |
--- /dev/null |
+++ b/mojo/public/java/src/org/chromium/mojo/system/MessagePipeHandle.java |
@@ -0,0 +1,101 @@ |
+// 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; |
+ |
+import java.nio.ByteBuffer; |
+import java.util.List; |
+ |
+/** |
+ * TODO(qsr): Insert description here. |
+ */ |
+public interface MessagePipeHandle extends Handle { |
+ /** |
+ * Flag for the write operations on MessagePipeHandle . |
+ */ |
+ public static class WriteFlags extends Flags<WriteFlags> { |
+ private static final int FLAG_NONE = 0; |
+ |
+ /** |
+ * Dedicated constructor. |
+ * |
+ * @param flags initial value of the flag. |
+ */ |
+ private WriteFlags(int flags) { |
+ super(flags); |
+ } |
+ |
+ /** |
+ * @return a flag with no bit set. |
+ */ |
+ public static WriteFlags none() { |
+ return new WriteFlags(FLAG_NONE); |
+ } |
+ } |
+ |
+ /** |
+ * Flag for the read operations on MessagePipeHandle. |
+ */ |
+ public static class ReadFlags extends Flags<ReadFlags> { |
+ private static final int FLAG_NONE = 0; |
+ private static final int FLAG_MAY_DISCARD = 1 << 0; |
+ |
+ /** |
+ * Dedicated constructor. |
+ * |
+ * @param flags initial value of the flag. |
+ */ |
+ private ReadFlags(int flags) { |
+ super(flags); |
+ } |
+ |
+ /** |
+ * Change the may-discard bit of this flag. |
+ * |
+ * @param mayDiscard the new value of the may-discard bit. |
+ * @return this. |
+ */ |
+ public ReadFlags mayDiscard(boolean mayDiscard) { |
+ return setFlag(FLAG_MAY_DISCARD, mayDiscard); |
+ } |
+ |
+ /** |
+ * @return a flag with no bit set. |
+ */ |
+ public static ReadFlags none() { |
+ return new ReadFlags(FLAG_NONE); |
+ } |
+ |
+ } |
+ |
+ /** |
+ * TODO(qsr): |
+ * |
+ * @param bytes |
+ * @param handles |
+ * @param flags |
+ */ |
+ void writeMessage(ByteBuffer bytes, List<Handle> handles, WriteFlags flags); |
+ |
+ /** |
+ * TODO(qsr): Insert description here. |
+ */ |
+ static class ReadMessageResult { |
+ public boolean wasMessageRead; |
+ public int messageSize; |
+ public int handlesCount; |
+ public List<UntypedHandle> handles; |
+ } |
+ |
+ /** |
+ * TODO(qsr): |
+ * |
+ * @param bytes |
+ * @param maxNumberOfHandles |
+ * @param flags |
+ * @return TODO(qsr) |
+ */ |
+ ReadMessageResult readMessage(ByteBuffer bytes, int maxNumberOfHandles, |
+ ReadFlags flags); |
+} |