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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 // This method may only be called if the object has been bound to a message | 149 // This method may only be called if the object has been bound to a message |
150 // pipe and there are no associated interfaces running. | 150 // pipe and there are no associated interfaces running. |
151 bool WaitForIncomingMethodCall( | 151 bool WaitForIncomingMethodCall( |
152 MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE) { | 152 MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE) { |
153 CHECK(!HasAssociatedInterfaces()); | 153 CHECK(!HasAssociatedInterfaces()); |
154 return internal_state_.WaitForIncomingMethodCall(deadline); | 154 return internal_state_.WaitForIncomingMethodCall(deadline); |
155 } | 155 } |
156 | 156 |
157 // Closes the message pipe that was previously bound. Put this object into a | 157 // Closes the message pipe that was previously bound. Put this object into a |
158 // state where it can be rebound to a new pipe. | 158 // state where it can be rebound to a new pipe. |
159 void Close() { internal_state_.Close(); } | 159 void Close() { if (internal_state_.is_bound()) internal_state_.Close(); } |
please use gerrit instead
2016/04/13 22:56:46
Instead of checking is_bound() here, let's check i
rwlbuis
2016/04/14 00:28:33
Done.
| |
160 | 160 |
161 // Unbinds the underlying pipe from this binding and returns it so it can be | 161 // Unbinds the underlying pipe from this binding and returns it so it can be |
162 // used in another context, such as on another thread or with a different | 162 // used in another context, such as on another thread or with a different |
163 // implementation. Put this object into a state where it can be rebound to a | 163 // implementation. Put this object into a state where it can be rebound to a |
164 // new pipe. | 164 // new pipe. |
165 // | 165 // |
166 // This method may only be called if the object has been bound to a message | 166 // This method may only be called if the object has been bound to a message |
167 // pipe and there are no associated interfaces running. | 167 // pipe and there are no associated interfaces running. |
168 // | 168 // |
169 // TODO(yzshen): For now, users need to make sure there is no one holding | 169 // TODO(yzshen): For now, users need to make sure there is no one holding |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 private: | 214 private: |
215 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> | 215 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> |
216 internal_state_; | 216 internal_state_; |
217 | 217 |
218 DISALLOW_COPY_AND_ASSIGN(Binding); | 218 DISALLOW_COPY_AND_ASSIGN(Binding); |
219 }; | 219 }; |
220 | 220 |
221 } // namespace mojo | 221 } // namespace mojo |
222 | 222 |
223 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 223 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
OLD | NEW |