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

Unified Diff: mojo/public/cpp/bindings/interface_request.h

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase ontop of master, address trung's comments Created 4 years, 10 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/cpp/bindings/interface_handle.h ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « mojo/public/cpp/bindings/interface_handle.h ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698