Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / mojo / public / java / bindings / src / org / chromium / mojo / bindings / InterfaceRequest.java
index b07a0ee..87835e0 100644 (file)
@@ -4,12 +4,47 @@
 
 package org.chromium.mojo.bindings;
 
+import org.chromium.mojo.system.MessagePipeHandle;
+
 /**
- * Used in methods that return instances of remote objects. Allows to start using the remote object
- * immediately, while sending the handle that will be bind to the implementation.
+ * One end of the message pipe representing a request to create an implementation to be bound to it.
+ * The other end of the pipe is bound to a proxy, which can be used immediately, while the
+ * InterfaceRequest is being sent.
+ * <p>
+ * InterfaceRequest are built using |Interface.Manager|.
  *
- * @param <I> the type of the remote interface.
+ * @param <P> the type of the remote interface proxy.
  */
-public final class InterfaceRequest<I extends Interface> {
+public class InterfaceRequest<P extends Interface> implements HandleOwner<MessagePipeHandle> {
+
+    /**
+     * The handle which will be sent and will be connected to the implementation.
+     */
+    private final MessagePipeHandle mHandle;
+
+    /**
+     * Constructor.
+     *
+     * @param handle the handle which will be sent and will be connected to the implementation.
+     */
+    InterfaceRequest(MessagePipeHandle handle) {
+        mHandle = handle;
+    }
+
+    /**
+     * @see HandleOwner#passHandle()
+     */
+    @Override
+    public MessagePipeHandle passHandle() {
+        return mHandle.pass();
+    }
+
+    /**
+     * @see java.io.Closeable#close()
+     */
+    @Override
+    public void close() {
+        mHandle.close();
+    }
 
 }