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 "mojo/public/c/environment/async_waiter.h" | 8 #include "mojo/public/c/environment/async_waiter.h" |
9 #include "mojo/public/cpp/bindings/error_handler.h" | 9 #include "mojo/public/cpp/bindings/error_handler.h" |
10 #include "mojo/public/cpp/bindings/interface_ptr.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 // ErrorHandler implementation | 117 // ErrorHandler implementation |
118 void OnConnectionError() override { | 118 void OnConnectionError() override { |
119 if (error_handler_) | 119 if (error_handler_) |
120 error_handler_->OnConnectionError(); | 120 error_handler_->OnConnectionError(); |
121 } | 121 } |
122 | 122 |
123 Interface* impl() { return impl_; } | 123 Interface* impl() { return impl_; } |
124 Client* client() { return proxy_; } | 124 Client* client() { return proxy_; } |
| 125 |
| 126 bool is_bound() const { return !!internal_router_; } |
| 127 |
125 // Exposed for testing, should not generally be used. | 128 // Exposed for testing, should not generally be used. |
126 internal::Router* internal_router() { return internal_router_; } | 129 internal::Router* internal_router() { return internal_router_; } |
127 | 130 |
128 private: | 131 private: |
129 internal::Router* internal_router_ = nullptr; | 132 internal::Router* internal_router_ = nullptr; |
130 typename Client::Proxy_* proxy_ = nullptr; | 133 typename Client::Proxy_* proxy_ = nullptr; |
131 typename Interface::Stub_ stub_; | 134 typename Interface::Stub_ stub_; |
132 Interface* impl_; | 135 Interface* impl_; |
133 ErrorHandler* error_handler_ = nullptr; | 136 ErrorHandler* error_handler_ = nullptr; |
134 | 137 |
135 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); | 138 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); |
136 }; | 139 }; |
137 | 140 |
138 } // namespace mojo | 141 } // namespace mojo |
139 | 142 |
140 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 143 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
OLD | NEW |