| Index: third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
|
| diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h b/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
|
| index cdca105287dc80e5af762174ec57bced7ad82f4d..04f4902bd89223ab2a1a83c8574bdcc2bf3f7bc9 100644
|
| --- a/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
|
| +++ b/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <algorithm>
|
|
|
| +#include "mojo/public/cpp/bindings/callback.h"
|
| #include "mojo/public/cpp/bindings/error_handler.h"
|
| #include "mojo/public/cpp/bindings/interface_ptr_info.h"
|
| #include "mojo/public/cpp/bindings/lib/interface_ptr_internal.h"
|
| @@ -14,7 +15,6 @@
|
| #include "mojo/public/cpp/system/macros.h"
|
|
|
| namespace mojo {
|
| -class ErrorHandler;
|
|
|
| // A pointer to a local proxy of a remote Interface implementation. Uses a
|
| // message pipe to communicate with the remote implementation, and automatically
|
| @@ -23,9 +23,10 @@ class ErrorHandler;
|
| //
|
| // This class is thread hostile, as is the local proxy it manages. All calls to
|
| // this class or the proxy should be from the same thread that created it. If
|
| -// you need to move the proxy to a different thread, extract the message pipe
|
| -// using PassMessagePipe(), pass it to a different thread, and create a new
|
| -// InterfacePtr from that thread.
|
| +// you need to move the proxy to a different thread, extract the
|
| +// InterfacePtrInfo (containing just the message pipe and any version
|
| +// information) using PassInterface(), pass it to a different thread, and
|
| +// create and bind a new InterfacePtr from that thread.
|
| template <typename Interface>
|
| class InterfacePtr {
|
| MOJO_MOVE_ONLY_TYPE(InterfacePtr)
|
| @@ -129,8 +130,21 @@ class InterfacePtr {
|
| //
|
| // This method may only be called after the InterfacePtr has been bound to a
|
| // message pipe.
|
| + void set_connection_error_handler(const Closure& error_handler) {
|
| + internal_state_.set_connection_error_handler(error_handler);
|
| + }
|
| +
|
| + // Similar to the method above but uses the ErrorHandler interface instead of
|
| + // a callback.
|
| + // NOTE: Deprecated. Please use the method above.
|
| + // TODO(yzshen): Remove this method once all callsites are converted.
|
| void set_error_handler(ErrorHandler* error_handler) {
|
| - internal_state_.set_error_handler(error_handler);
|
| + if (error_handler) {
|
| + set_connection_error_handler(
|
| + [error_handler]() { error_handler->OnConnectionError(); });
|
| + } else {
|
| + set_connection_error_handler(Closure());
|
| + }
|
| }
|
|
|
| // Unbinds the InterfacePtr and returns the information which could be used
|
|
|