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_STRONG_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Interface* impl() { return binding_.impl(); } | 107 Interface* impl() { return binding_.impl(); } |
108 // Exposed for testing, should not generally be used. | 108 // Exposed for testing, should not generally be used. |
109 internal::Router* internal_router() { return binding_.internal_router(); } | 109 internal::Router* internal_router() { return binding_.internal_router(); } |
110 | 110 |
111 void OnConnectionError() { | 111 void OnConnectionError() { |
112 if (!connection_error_handler_.is_null()) | 112 if (!connection_error_handler_.is_null()) |
113 connection_error_handler_.Run(); | 113 connection_error_handler_.Run(); |
114 delete binding_.impl(); | 114 delete binding_.impl(); |
115 } | 115 } |
116 | 116 |
| 117 // Sends a message on the underlying message pipe and runs the current |
| 118 // message loop until its response is received. This can be used in tests to |
| 119 // verify that no message was sent on a message pipe in response to some |
| 120 // stimulus. |
| 121 void FlushForTesting() { binding_.FlushForTesting(); } |
| 122 |
117 private: | 123 private: |
118 base::Closure connection_error_handler_; | 124 base::Closure connection_error_handler_; |
119 Binding<Interface> binding_; | 125 Binding<Interface> binding_; |
120 | 126 |
121 DISALLOW_COPY_AND_ASSIGN(StrongBinding); | 127 DISALLOW_COPY_AND_ASSIGN(StrongBinding); |
122 }; | 128 }; |
123 | 129 |
124 } // namespace mojo | 130 } // namespace mojo |
125 | 131 |
126 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ | 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ |
OLD | NEW |