Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Unified Diff: mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java

Issue 562133002: mojo: java bindigns: add factory for InterfaceRequest that takes a client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow review Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/java/bindings/src/org/chromium/mojo/bindings/Interface.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java
index 225b98a88ce31f7d8a8952e0402830254cfb7761..f7d8afec8a24a8db70d64adade82a9b79a1001d5 100644
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java
@@ -6,6 +6,7 @@ package org.chromium.mojo.bindings;
import org.chromium.mojo.system.Core;
import org.chromium.mojo.system.MessagePipeHandle;
+import org.chromium.mojo.system.Pair;
/**
* Base class for mojo generated interfaces that have a client.
@@ -89,6 +90,19 @@ public interface InterfaceWithClient<CI extends Interface> extends Interface {
}
/**
+ * Constructs a new |InterfaceRequest| for the interface. This method returns a Pair where
+ * the first element is a proxy, and the second element is the request. The proxy can be
+ * used immediately.
+ *
+ * @param client the implementation of the client interface.
+ */
+ public final Pair<P, InterfaceRequest<I>> getInterfaceRequest(Core core, CI client) {
+ Pair<MessagePipeHandle, MessagePipeHandle> handles = core.createMessagePipe(null);
+ P proxy = attachProxy(handles.first, client);
+ return Pair.create(proxy, new InterfaceRequest<I>(handles.second));
+ }
+
+ /**
* Returns a manager for the client inetrafce.
*/
protected abstract Interface.Manager<CI, ?> getClientManager();
« no previous file with comments | « mojo/public/java/bindings/src/org/chromium/mojo/bindings/Interface.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698