Chromium Code Reviews| 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_ |