Chromium Code Reviews| 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_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 InterfaceRequest<GenericInterface> request, | 104 InterfaceRequest<GenericInterface> request, |
| 105 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) | 105 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) |
| 106 : Binding(impl) { | 106 : Binding(impl) { |
| 107 Bind(request.PassMessagePipe(), waiter); | 107 Bind(request.PassMessagePipe(), waiter); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Tears down the binding, closing the message pipe and leaving the interface | 110 // Tears down the binding, closing the message pipe and leaving the interface |
| 111 // implementation unbound. | 111 // implementation unbound. |
| 112 ~Binding() {} | 112 ~Binding() {} |
| 113 | 113 |
| 114 // Returns an InterfacePtr bound to one end of a pipe whose other end is | |
| 115 // bound to |this|. | |
| 116 InterfacePtr<Interface> CreateInterfacePtrAndBind() { | |
|
yzshen1
2016/01/21 01:12:09
Please add a |waiter| param (just like line 127),
sky
2016/01/21 14:35:26
Do we really need the waiter param? And doesn't th
| |
| 117 InterfacePtr<Interface> interface_ptr; | |
| 118 Bind(&interface_ptr); | |
| 119 return std::move(interface_ptr); | |
|
yzshen1
2016/01/21 01:12:09
I think std::move() is not needed.
sky
2016/01/21 17:50:24
Done.
| |
| 120 } | |
| 121 | |
| 114 // Completes a binding that was constructed with only an interface | 122 // Completes a binding that was constructed with only an interface |
| 115 // implementation. Takes ownership of |handle| and binds it to the previously | 123 // implementation. Takes ownership of |handle| and binds it to the previously |
| 116 // specified implementation. See class comment for definition of |waiter|. | 124 // specified implementation. See class comment for definition of |waiter|. |
| 117 void Bind( | 125 void Bind( |
| 118 ScopedMessagePipeHandle handle, | 126 ScopedMessagePipeHandle handle, |
| 119 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { | 127 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
| 120 internal_state_.Bind(std::move(handle), waiter); | 128 internal_state_.Bind(std::move(handle), waiter); |
| 121 } | 129 } |
| 122 | 130 |
| 123 // Completes a binding that was constructed with only an interface | 131 // Completes a binding that was constructed with only an interface |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 private: | 247 private: |
| 240 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> | 248 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> |
| 241 internal_state_; | 249 internal_state_; |
| 242 | 250 |
| 243 DISALLOW_COPY_AND_ASSIGN(Binding); | 251 DISALLOW_COPY_AND_ASSIGN(Binding); |
| 244 }; | 252 }; |
| 245 | 253 |
| 246 } // namespace mojo | 254 } // namespace mojo |
| 247 | 255 |
| 248 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 256 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| OLD | NEW |