OLD | NEW |
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_PTR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/callback.h" | 10 #include "mojo/public/cpp/bindings/callback.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // If |info| is valid (containing a valid message pipe handle), returns an | 171 // If |info| is valid (containing a valid message pipe handle), returns an |
172 // InterfacePtr bound to it. Otherwise, returns an unbound InterfacePtr. The | 172 // InterfacePtr bound to it. Otherwise, returns an unbound InterfacePtr. The |
173 // specified |waiter| will be used as in the InterfacePtr::Bind() method. | 173 // specified |waiter| will be used as in the InterfacePtr::Bind() method. |
174 template <typename Interface> | 174 template <typename Interface> |
175 InterfacePtr<Interface> MakeProxy( | 175 InterfacePtr<Interface> MakeProxy( |
176 InterfacePtrInfo<Interface> info, | 176 InterfacePtrInfo<Interface> info, |
177 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { | 177 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
178 InterfacePtr<Interface> ptr; | 178 InterfacePtr<Interface> ptr; |
179 if (info.is_valid()) | 179 if (info.is_valid()) |
180 ptr.Bind(info.Pass(), waiter); | 180 ptr.Bind(info.Pass(), waiter); |
181 return ptr.Pass(); | 181 return ptr; |
182 } | 182 } |
183 | 183 |
184 } // namespace mojo | 184 } // namespace mojo |
185 | 185 |
186 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 186 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
OLD | NEW |