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

Side by Side 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: delay InterfacePtr::Create() until you actually need an InterfacePtr. GetProxy() and ConnectToAppl… 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 9
10 #include "mojo/public/cpp/system/message_pipe.h" 10 #include "mojo/public/cpp/system/message_pipe.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // collector->RegisterSource(source.Pass()); 115 // collector->RegisterSource(source.Pass());
116 // CreateSource(source_request.Pass()); // Create implementation locally. 116 // CreateSource(source_request.Pass()); // Create implementation locally.
117 // 117 //
118 template <typename Interface> 118 template <typename Interface>
119 InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) { 119 InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) {
120 MessagePipe pipe; 120 MessagePipe pipe;
121 ptr->Bind(InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u)); 121 ptr->Bind(InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u));
122 return MakeRequest<Interface>(pipe.handle1.Pass()); 122 return MakeRequest<Interface>(pipe.handle1.Pass());
123 } 123 }
124 124
125 template <typename Interface>
viettrungluu 2016/02/11 18:26:29 Could probably use a comment.
vardhan 2016/02/11 22:47:53 Done.
126 InterfaceRequest<Interface> GetProxy(InterfaceHandle<Interface>* ptr) {
127 MessagePipe pipe;
128 *ptr = InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u);
129 return MakeRequest<Interface>(pipe.handle1.Pass());
130 }
131
125 } // namespace mojo 132 } // namespace mojo
126 133
127 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ 134 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698