| Index: mojo/public/cpp/bindings/binding.h
|
| diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h
|
| index d556f0b86459b95a39dbba42db00422a28382483..61630c799f9b26eb19bc4d990b515ae7dc254c68 100644
|
| --- a/mojo/public/cpp/bindings/binding.h
|
| +++ b/mojo/public/cpp/bindings/binding.h
|
| @@ -82,6 +82,8 @@ class Binding {
|
| // of the parameters. |impl| must outlive the binding. |ptr| only needs to
|
| // last until the constructor returns. See class comment for definition of
|
| // |waiter|.
|
| + // TODO(vardhan): Deprecate this in favor of the |InterfaceHandle<>| overload
|
| + // below.
|
| Binding(Interface* impl,
|
| InterfacePtr<Interface>* ptr,
|
| const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
|
| @@ -89,6 +91,19 @@ class Binding {
|
| Bind(ptr, waiter);
|
| }
|
|
|
| + // Constructs a completed binding of |impl| to a new message pipe, passing the
|
| + // client end to |ptr|, which takes ownership of it. The caller is expected to
|
| + // pass |ptr| on to the client of the service. Does not take ownership of any
|
| + // of the parameters. |impl| must outlive the binding. |ptr| only needs to
|
| + // last until the constructor returns. See class comment for definition of
|
| + // |waiter|.
|
| + Binding(Interface* impl,
|
| + InterfaceHandle<Interface>* interface_handle,
|
| + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
|
| + : Binding(impl) {
|
| + Bind(interface_handle, waiter);
|
| + }
|
| +
|
| // Constructs a completed binding of |impl| to the message pipe endpoint in
|
| // |request|, taking ownership of the endpoint. Does not take ownership of
|
| // |impl|, which must outlive the binding. See class comment for definition of
|
| @@ -131,6 +146,8 @@ class Binding {
|
| // takes ownership of it. The caller is expected to pass |ptr| on to the
|
| // eventual client of the service. Does not take ownership of |ptr|. See
|
| // class comment for definition of |waiter|.
|
| + // TODO(vardhan): Deprecate this in favor of the |InterfaceHandle<>| overload
|
| + // below.
|
| void Bind(
|
| InterfacePtr<Interface>* ptr,
|
| const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
|
| @@ -142,6 +159,21 @@ class Binding {
|
| }
|
|
|
| // Completes a binding that was constructed with only an interface
|
| + // implementation by creating a new message pipe, binding one end of it to the
|
| + // previously specified implementation, and passing the other to |ptr|, which
|
| + // takes ownership of it. The caller is expected to pass |ptr| on to the
|
| + // eventual client of the service. Does not take ownership of |ptr|. See
|
| + // class comment for definition of |waiter|.
|
| + void Bind(
|
| + InterfaceHandle<Interface>* interface_handle,
|
| + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
|
| + MessagePipe pipe;
|
| + *interface_handle =
|
| + InterfaceHandle<Interface>(pipe.handle0.Pass(), Interface::Version_);
|
| + Bind(pipe.handle1.Pass(), waiter);
|
| + }
|
| +
|
| + // Completes a binding that was constructed with only an interface
|
| // implementation by removing the message pipe endpoint from |request| and
|
| // binding it to the previously specified implementation. See class comment
|
| // for definition of |waiter|.
|
|
|