Chromium Code Reviews| Index: mojo/public/cpp/bindings/strong_binding.h |
| diff --git a/mojo/public/cpp/bindings/strong_binding.h b/mojo/public/cpp/bindings/strong_binding.h |
| index e38c7ffe1ff539410772451a94109dd7ebe08c25..d69b088afe58873de820a5075ced30c89c2cc79b 100644 |
| --- a/mojo/public/cpp/bindings/strong_binding.h |
| +++ b/mojo/public/cpp/bindings/strong_binding.h |
| @@ -75,6 +75,8 @@ class StrongBinding { |
| // 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): Consider deprecating this constructor in favor of |
|
viettrungluu
2016/02/11 18:26:29
What I said earlier....
|
| + // |InterfaceHandle<>| instead of |InterfacePtr<>|. |
| StrongBinding( |
| Interface* impl, |
| InterfacePtr<Interface>* ptr, |
| @@ -83,6 +85,20 @@ class StrongBinding { |
| 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|. |
| + StrongBinding( |
| + Interface* impl, |
| + InterfaceHandle<Interface>* ptr, |
| + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) |
| + : StrongBinding(impl) { |
| + binding_.Bind(ptr, 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 |
| @@ -115,6 +131,8 @@ class StrongBinding { |
| // 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): Consider deprecating this constructor in favor of |
|
viettrungluu
2016/02/11 18:26:29
"
|
| + // |InterfaceHandle<>| instead of |InterfacePtr<>|. |
| void Bind( |
| InterfacePtr<Interface>* ptr, |
| const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
| @@ -123,6 +141,19 @@ class StrongBinding { |
| } |
| // 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>* ptr, |
| + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
| + assert(!binding_.is_bound()); |
| + binding_.Bind(ptr, 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|. |