OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ASSOCIATED_INTERFACE_PTR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // associated interface asynchronously. This does nothing if it's already | 100 // associated interface asynchronously. This does nothing if it's already |
101 // known that the remote side supports the specified version, i.e., if | 101 // known that the remote side supports the specified version, i.e., if |
102 // |version <= this->version()|. | 102 // |version <= this->version()|. |
103 // | 103 // |
104 // After calling RequireVersion() with a version not supported by the remote | 104 // After calling RequireVersion() with a version not supported by the remote |
105 // side, all subsequent calls to interface methods will be ignored. | 105 // side, all subsequent calls to interface methods will be ignored. |
106 void RequireVersion(uint32_t version) { | 106 void RequireVersion(uint32_t version) { |
107 internal_state_.RequireVersion(version); | 107 internal_state_.RequireVersion(version); |
108 } | 108 } |
109 | 109 |
| 110 // Sends a message on the underlying message pipe and runs the current |
| 111 // message loop until its response is received. This can be used in tests to |
| 112 // verify that no message was sent on a message pipe in response to some |
| 113 // stimulus. |
| 114 void FlushForTesting() { internal_state_.FlushForTesting(); } |
| 115 |
110 // Closes the associated interface (if any) and returns the pointer to the | 116 // Closes the associated interface (if any) and returns the pointer to the |
111 // unbound state. | 117 // unbound state. |
112 void reset() { | 118 void reset() { |
113 State doomed; | 119 State doomed; |
114 internal_state_.Swap(&doomed); | 120 internal_state_.Swap(&doomed); |
115 } | 121 } |
116 | 122 |
117 // Indicates whether an error has been encountered. If true, method calls made | 123 // Indicates whether an error has been encountered. If true, method calls made |
118 // on this interface will be dropped (and may already have been dropped). | 124 // on this interface will be dropped (and may already have been dropped). |
119 bool encountered_error() const { return internal_state_.encountered_error(); } | 125 bool encountered_error() const { return internal_state_.encountered_error(); } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, | 205 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, |
200 &ptr_info, &request); | 206 &ptr_info, &request); |
201 | 207 |
202 ptr->Bind(std::move(ptr_info), std::move(runner)); | 208 ptr->Bind(std::move(ptr_info), std::move(runner)); |
203 return request; | 209 return request; |
204 } | 210 } |
205 | 211 |
206 } // namespace mojo | 212 } // namespace mojo |
207 | 213 |
208 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 214 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
OLD | NEW |