| 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_INTERFACE_PTR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 
| 7 | 7 | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <string> | 10 #include <string> | 
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 146   // Indicates whether the message pipe has encountered an error. If true, | 146   // Indicates whether the message pipe has encountered an error. If true, | 
| 147   // method calls made on this interface will be dropped (and may already have | 147   // method calls made on this interface will be dropped (and may already have | 
| 148   // been dropped). | 148   // been dropped). | 
| 149   bool encountered_error() const { return internal_state_.encountered_error(); } | 149   bool encountered_error() const { return internal_state_.encountered_error(); } | 
| 150 | 150 | 
| 151   // Registers a handler to receive error notifications. The handler will be | 151   // Registers a handler to receive error notifications. The handler will be | 
| 152   // called from the thread that owns this InterfacePtr. | 152   // called from the thread that owns this InterfacePtr. | 
| 153   // | 153   // | 
| 154   // This method may only be called after the InterfacePtr has been bound to a | 154   // This method may only be called after the InterfacePtr has been bound to a | 
| 155   // message pipe. | 155   // message pipe. | 
| 156   void set_connection_error_handler(const base::Closure& error_handler) { | 156   void set_connection_error_handler(base::OnceClosure error_handler) { | 
| 157     internal_state_.set_connection_error_handler(error_handler); | 157     internal_state_.set_connection_error_handler(std::move(error_handler)); | 
| 158   } | 158   } | 
| 159 | 159 | 
| 160   void set_connection_error_with_reason_handler( | 160   void set_connection_error_with_reason_handler( | 
| 161       const ConnectionErrorWithReasonCallback& error_handler) { | 161       ConnectionErrorWithReasonCallback error_handler) { | 
| 162     internal_state_.set_connection_error_with_reason_handler(error_handler); | 162     internal_state_.set_connection_error_with_reason_handler( | 
|  | 163         std::move(error_handler)); | 
| 163   } | 164   } | 
| 164 | 165 | 
| 165   // Unbinds the InterfacePtr and returns the information which could be used | 166   // Unbinds the InterfacePtr and returns the information which could be used | 
| 166   // to setup an InterfacePtr again. This method may be used to move the proxy | 167   // to setup an InterfacePtr again. This method may be used to move the proxy | 
| 167   // to a different thread (see class comments for details). | 168   // to a different thread (see class comments for details). | 
| 168   // | 169   // | 
| 169   // It is an error to call PassInterface() while: | 170   // It is an error to call PassInterface() while: | 
| 170   //   - there are pending responses; or | 171   //   - there are pending responses; or | 
| 171   //     TODO: fix this restriction, it's not always obvious when there is a | 172   //     TODO: fix this restriction, it's not always obvious when there is a | 
| 172   //     pending response. | 173   //     pending response. | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 233         base::ThreadTaskRunnerHandle::Get()) { | 234         base::ThreadTaskRunnerHandle::Get()) { | 
| 234   InterfacePtr<Interface> ptr; | 235   InterfacePtr<Interface> ptr; | 
| 235   if (info.is_valid()) | 236   if (info.is_valid()) | 
| 236     ptr.Bind(std::move(info), std::move(runner)); | 237     ptr.Bind(std::move(info), std::move(runner)); | 
| 237   return std::move(ptr); | 238   return std::move(ptr); | 
| 238 } | 239 } | 
| 239 | 240 | 
| 240 }  // namespace mojo | 241 }  // namespace mojo | 
| 241 | 242 | 
| 242 #endif  // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 243 #endif  // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 
| OLD | NEW | 
|---|