Index: mojo/public/cpp/bindings/interface_request.h |
diff --git a/mojo/public/cpp/bindings/interface_request.h b/mojo/public/cpp/bindings/interface_request.h |
index 515fe88b70b9eabaac82f386dd1731be072fcac4..0d634a2cd4cadef32c3a27d8897def82652596f1 100644 |
--- a/mojo/public/cpp/bindings/interface_request.h |
+++ b/mojo/public/cpp/bindings/interface_request.h |
@@ -122,6 +122,17 @@ InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) { |
return MakeRequest<Interface>(pipe.handle1.Pass()); |
} |
+// This is an overload of GetProxy() that assumes that the client end of the |
+// handle is an InterfaceHandle<>. It creates a new message pipe over which the |
+// Interface is to be served. InterfaceHandle<> represents the client's end, |
+// and InterfaceRequest<> should be used to bind to an implementation. |
+template <typename Interface> |
+InterfaceRequest<Interface> GetProxy(InterfaceHandle<Interface>* ptr) { |
+ MessagePipe pipe; |
+ *ptr = InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u); |
+ return MakeRequest<Interface>(pipe.handle1.Pass()); |
+} |
+ |
} // namespace mojo |
#endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |