Index: mojo/public/java/src/org/chromium/mojo/system/Handle.java |
diff --git a/mojo/public/java/src/org/chromium/mojo/system/Handle.java b/mojo/public/java/src/org/chromium/mojo/system/Handle.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6f60055d74deac867da7baa5017882898ca16228 |
--- /dev/null |
+++ b/mojo/public/java/src/org/chromium/mojo/system/Handle.java |
@@ -0,0 +1,36 @@ |
+// 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.io.Closeable; |
+ |
+/** |
+ * A generic mojo handle. |
+ */ |
+public interface Handle extends Closeable { |
+ |
+ /** |
+ * Closes the given |handle|. |
+ * <p> |
+ * Concurrent operations on |handle| may succeed (or fail as usual) if they happen before the |
+ * close, be cancelled with result |MojoResult.CANCELLED| if they properly overlap (this is |
+ * likely the case with |wait()|, etc.), or fail with |MojoResult.INVALID_ARGUMENT| if they |
+ * happen after. |
+ */ |
+ @Override |
+ public void close(); |
+ |
+ /** |
+ * @see Core#wait(Handle, Core.WaitFlags, long) |
+ */ |
+ public int wait(Core.WaitFlags flags, long deadline); |
+ |
+ /** |
+ * @return whether the handle is valid. A handle is valid until it has been explicitly closed or |
+ * send through a message pipe via |MessagePipeHandle.writeMessage|. |
+ */ |
+ public boolean isValid(); |
+ |
+} |