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

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

Issue 1785843002: [mojo] Implement pipe fusion API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 f67566d2d0ef76e2537eafe22b0e31f55f42a649..92b08c814e50e857e013c9d4ca0bf18e2de724ae 100644
--- a/mojo/public/cpp/bindings/interface_request.h
+++ b/mojo/public/cpp/bindings/interface_request.h
@@ -117,6 +117,18 @@ InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) {
return MakeRequest<Interface>(std::move(pipe.handle1));
}
+// Fuses an InterfaceRequest<T> endpoint with an InterfacePtr<T> endpoint.
+// Returns |true| on success or |false| on failure. Note that both arguments
+// are invalidated regardless of the result.
+template <typename Interface>
+bool FuseProxy(InterfaceRequest<Interface> *request,
yzshen1 2016/03/10 23:49:03 How about the following signature: bool FuseInter
Ken Rockot(use gerrit already) 2016/03/11 00:32:46 Done
+ InterfacePtr<Interface>* proxy) {
+ ScopedMessagePipeHandle handle0 = request->PassMessagePipe();
+ ScopedMessagePipeHandle handle1 = proxy->PassInterface().PassHandle();
+ MojoResult result = FuseMessagePipes(&handle0, &handle1);
+ return result == MOJO_RESULT_OK;
+}
+
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_

Powered by Google App Engine
This is Rietveld 408576698