| 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_LIB_BINDING_STATE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 bool is_bound() const { return !!router_; } | 100 bool is_bound() const { return !!router_; } |
| 101 | 101 |
| 102 MessagePipeHandle handle() const { | 102 MessagePipeHandle handle() const { |
| 103 DCHECK(is_bound()); | 103 DCHECK(is_bound()); |
| 104 return router_->handle(); | 104 return router_->handle(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 AssociatedGroup* associated_group() { return nullptr; } | 107 AssociatedGroup* associated_group() { return nullptr; } |
| 108 | 108 |
| 109 void SetAllowSyncDispatch(bool allowed) { |
| 110 DCHECK(is_bound()); |
| 111 router_->SetAllowSyncDispatch(allowed); |
| 112 } |
| 113 |
| 109 void EnableTestingMode() { | 114 void EnableTestingMode() { |
| 110 DCHECK(is_bound()); | 115 DCHECK(is_bound()); |
| 111 router_->EnableTestingMode(); | 116 router_->EnableTestingMode(); |
| 112 } | 117 } |
| 113 | 118 |
| 114 private: | 119 private: |
| 115 void DestroyRouter() { | 120 void DestroyRouter() { |
| 116 router_->set_connection_error_handler(Closure()); | 121 router_->set_connection_error_handler(Closure()); |
| 117 delete router_; | 122 delete router_; |
| 118 router_ = nullptr; | 123 router_ = nullptr; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 207 |
| 203 MessagePipeHandle handle() const { | 208 MessagePipeHandle handle() const { |
| 204 DCHECK(is_bound()); | 209 DCHECK(is_bound()); |
| 205 return router_->handle(); | 210 return router_->handle(); |
| 206 } | 211 } |
| 207 | 212 |
| 208 AssociatedGroup* associated_group() { | 213 AssociatedGroup* associated_group() { |
| 209 return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; | 214 return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; |
| 210 } | 215 } |
| 211 | 216 |
| 217 void SetAllowSyncDispatch(bool allowed) { |
| 218 DCHECK(is_bound()); |
| 219 router_->SetAllowSyncDispatch(allowed); |
| 220 } |
| 221 |
| 212 void EnableTestingMode() { | 222 void EnableTestingMode() { |
| 213 DCHECK(is_bound()); | 223 DCHECK(is_bound()); |
| 214 router_->EnableTestingMode(); | 224 router_->EnableTestingMode(); |
| 215 } | 225 } |
| 216 | 226 |
| 217 private: | 227 private: |
| 218 scoped_refptr<internal::MultiplexRouter> router_; | 228 scoped_refptr<internal::MultiplexRouter> router_; |
| 219 scoped_ptr<internal::InterfaceEndpointClient> endpoint_client_; | 229 scoped_ptr<internal::InterfaceEndpointClient> endpoint_client_; |
| 220 | 230 |
| 221 typename Interface::Stub_ stub_; | 231 typename Interface::Stub_ stub_; |
| 222 Interface* impl_; | 232 Interface* impl_; |
| 223 Closure connection_error_handler_; | 233 Closure connection_error_handler_; |
| 224 | 234 |
| 225 DISALLOW_COPY_AND_ASSIGN(BindingState); | 235 DISALLOW_COPY_AND_ASSIGN(BindingState); |
| 226 }; | 236 }; |
| 227 | 237 |
| 228 } // namesapce internal | 238 } // namesapce internal |
| 229 } // namespace mojo | 239 } // namespace mojo |
| 230 | 240 |
| 231 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 241 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
| OLD | NEW |