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_LIB_INTERFACE_PTR_STATE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> // For |std::swap()|. | 9 #include <algorithm> // For |std::swap()|. |
10 #include <utility> | 10 #include <utility> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 router_->set_connection_error_handler(error_handler); | 132 router_->set_connection_error_handler(error_handler); |
133 } | 133 } |
134 | 134 |
135 // Returns true if bound and awaiting a response to a message. | 135 // Returns true if bound and awaiting a response to a message. |
136 bool has_pending_callbacks() const { | 136 bool has_pending_callbacks() const { |
137 return router_ && router_->has_pending_responders(); | 137 return router_ && router_->has_pending_responders(); |
138 } | 138 } |
139 | 139 |
140 AssociatedGroup* associated_group() { return nullptr; } | 140 AssociatedGroup* associated_group() { return nullptr; } |
141 | 141 |
| 142 void SetAllowSyncDispatch(bool allowed) { |
| 143 DCHECK(router_); |
| 144 router_->SetAllowSyncDispatch(allowed); |
| 145 } |
| 146 |
142 void EnableTestingMode() { | 147 void EnableTestingMode() { |
143 ConfigureProxyIfNecessary(); | 148 ConfigureProxyIfNecessary(); |
144 router_->EnableTestingMode(); | 149 router_->EnableTestingMode(); |
145 } | 150 } |
146 | 151 |
147 private: | 152 private: |
148 using Proxy = typename Interface::Proxy_; | 153 using Proxy = typename Interface::Proxy_; |
149 | 154 |
150 void ConfigureProxyIfNecessary() { | 155 void ConfigureProxyIfNecessary() { |
151 // The proxy has been configured. | 156 // The proxy has been configured. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Returns true if bound and awaiting a response to a message. | 292 // Returns true if bound and awaiting a response to a message. |
288 bool has_pending_callbacks() const { | 293 bool has_pending_callbacks() const { |
289 return endpoint_client_ && endpoint_client_->has_pending_responders(); | 294 return endpoint_client_ && endpoint_client_->has_pending_responders(); |
290 } | 295 } |
291 | 296 |
292 AssociatedGroup* associated_group() { | 297 AssociatedGroup* associated_group() { |
293 ConfigureProxyIfNecessary(); | 298 ConfigureProxyIfNecessary(); |
294 return endpoint_client_->associated_group(); | 299 return endpoint_client_->associated_group(); |
295 } | 300 } |
296 | 301 |
| 302 void SetAllowSyncDispatch(bool allowed) { |
| 303 DCHECK(router_); |
| 304 router_->SetAllowSyncDispatch(allowed); |
| 305 } |
| 306 |
297 void EnableTestingMode() { | 307 void EnableTestingMode() { |
298 ConfigureProxyIfNecessary(); | 308 ConfigureProxyIfNecessary(); |
299 router_->EnableTestingMode(); | 309 router_->EnableTestingMode(); |
300 } | 310 } |
301 | 311 |
302 private: | 312 private: |
303 using Proxy = typename Interface::Proxy_; | 313 using Proxy = typename Interface::Proxy_; |
304 | 314 |
305 void ConfigureProxyIfNecessary() { | 315 void ConfigureProxyIfNecessary() { |
306 // The proxy has been configured. | 316 // The proxy has been configured. |
(...skipping 26 matching lines...) Expand all Loading... |
333 | 343 |
334 uint32_t version_; | 344 uint32_t version_; |
335 | 345 |
336 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); | 346 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); |
337 }; | 347 }; |
338 | 348 |
339 } // namespace internal | 349 } // namespace internal |
340 } // namespace mojo | 350 } // namespace mojo |
341 | 351 |
342 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ | 352 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
OLD | NEW |