Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_STRONG_ASSOCIATED_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 namespace mojo { | 22 namespace mojo { |
| 23 | 23 |
| 24 template <typename Interface> | 24 template <typename Interface> |
| 25 class StrongAssociatedBinding; | 25 class StrongAssociatedBinding; |
| 26 | 26 |
| 27 template <typename Interface> | 27 template <typename Interface> |
| 28 using StrongAssociatedBindingPtr = | 28 using StrongAssociatedBindingPtr = |
| 29 base::WeakPtr<StrongAssociatedBinding<Interface>>; | 29 base::WeakPtr<StrongAssociatedBinding<Interface>>; |
| 30 | 30 |
| 31 // This connects an interface implementation strongly to an associated pipe. | 31 // This connects an interface implementation strongly to an associated pipe. |
| 32 // When a connection error is detected the implementation is deleted. | 32 // When a connection error is detected the implementation is deleted. If the |
| 33 // task runner that a StrongBinding is bound on is stopped, the connection error | |
|
yzshen1
2017/01/26 23:58:20
nit: StrongBinding -> StrongAssociatedBinding
Sam McNally
2017/01/27 04:54:20
Done.
| |
| 34 // handler will not be invoked and the implementation will not be deleted. | |
| 33 // | 35 // |
| 34 // To use, call StrongAssociatedBinding<T>::Create() (see below) or the helper | 36 // To use, call StrongAssociatedBinding<T>::Create() (see below) or the helper |
| 35 // MakeStrongAssociatedBinding function: | 37 // MakeStrongAssociatedBinding function: |
| 36 // | 38 // |
| 37 // mojo::MakeStrongAssociatedBinding(base::MakeUnique<FooImpl>(), | 39 // mojo::MakeStrongAssociatedBinding(base::MakeUnique<FooImpl>(), |
| 38 // std::move(foo_request)); | 40 // std::move(foo_request)); |
| 39 // | 41 // |
| 40 template <typename Interface> | 42 template <typename Interface> |
| 41 class StrongAssociatedBinding { | 43 class StrongAssociatedBinding { |
| 42 public: | 44 public: |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 StrongAssociatedBindingPtr<Interface> MakeStrongAssociatedBinding( | 115 StrongAssociatedBindingPtr<Interface> MakeStrongAssociatedBinding( |
| 114 std::unique_ptr<Impl> impl, | 116 std::unique_ptr<Impl> impl, |
| 115 AssociatedInterfaceRequest<Interface> request) { | 117 AssociatedInterfaceRequest<Interface> request) { |
| 116 return StrongAssociatedBinding<Interface>::Create(std::move(impl), | 118 return StrongAssociatedBinding<Interface>::Create(std::move(impl), |
| 117 std::move(request)); | 119 std::move(request)); |
| 118 } | 120 } |
| 119 | 121 |
| 120 } // namespace mojo | 122 } // namespace mojo |
| 121 | 123 |
| 122 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ | 124 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ |
| OLD | NEW |