| 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 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Indicates whether an error has been encountered. If true, method calls made | 131 // Indicates whether an error has been encountered. If true, method calls made |
| 132 // on this interface will be dropped (and may already have been dropped). | 132 // on this interface will be dropped (and may already have been dropped). |
| 133 bool encountered_error() const { return internal_state_.encountered_error(); } | 133 bool encountered_error() const { return internal_state_.encountered_error(); } |
| 134 | 134 |
| 135 // Registers a handler to receive error notifications. | 135 // Registers a handler to receive error notifications. |
| 136 // | 136 // |
| 137 // This method may only be called after the AssociatedInterfacePtr has been | 137 // This method may only be called after the AssociatedInterfacePtr has been |
| 138 // bound. | 138 // bound. |
| 139 void set_connection_error_handler(const base::Closure& error_handler) { | 139 void set_connection_error_handler(base::OnceClosure error_handler) { |
| 140 internal_state_.set_connection_error_handler(error_handler); | 140 internal_state_.set_connection_error_handler(std::move(error_handler)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void set_connection_error_with_reason_handler( | 143 void set_connection_error_with_reason_handler( |
| 144 const ConnectionErrorWithReasonCallback& error_handler) { | 144 ConnectionErrorWithReasonCallback error_handler) { |
| 145 internal_state_.set_connection_error_with_reason_handler(error_handler); | 145 internal_state_.set_connection_error_with_reason_handler( |
| 146 std::move(error_handler)); |
| 146 } | 147 } |
| 147 | 148 |
| 148 // Unbinds and returns the associated interface pointer information which | 149 // Unbinds and returns the associated interface pointer information which |
| 149 // could be used to setup an AssociatedInterfacePtr again. This method may be | 150 // could be used to setup an AssociatedInterfacePtr again. This method may be |
| 150 // used to move the proxy to a different thread. | 151 // used to move the proxy to a different thread. |
| 151 // | 152 // |
| 152 // It is an error to call PassInterface() while there are pending responses. | 153 // It is an error to call PassInterface() while there are pending responses. |
| 153 // TODO: fix this restriction, it's not always obvious when there is a | 154 // TODO: fix this restriction, it's not always obvious when there is a |
| 154 // pending response. | 155 // pending response. |
| 155 AssociatedInterfacePtrInfo<Interface> PassInterface() { | 156 AssociatedInterfacePtrInfo<Interface> PassInterface() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // |handle| is supposed to be the request of an associated interface. This | 270 // |handle| is supposed to be the request of an associated interface. This |
| 270 // method associates the interface with a dedicated, disconnected message pipe. | 271 // method associates the interface with a dedicated, disconnected message pipe. |
| 271 // That way, the corresponding associated interface pointer of |handle| can | 272 // That way, the corresponding associated interface pointer of |handle| can |
| 272 // safely make calls (although those calls are silently dropped). | 273 // safely make calls (although those calls are silently dropped). |
| 273 MOJO_CPP_BINDINGS_EXPORT void GetIsolatedInterface( | 274 MOJO_CPP_BINDINGS_EXPORT void GetIsolatedInterface( |
| 274 ScopedInterfaceEndpointHandle handle); | 275 ScopedInterfaceEndpointHandle handle); |
| 275 | 276 |
| 276 } // namespace mojo | 277 } // namespace mojo |
| 277 | 278 |
| 278 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 279 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
| OLD | NEW |