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 StrongAssociatedBinding is bound on is stopped, the |
| 34 // connection error handler will not be invoked and the implementation will not |
| 35 // be deleted. |
33 // | 36 // |
34 // To use, call StrongAssociatedBinding<T>::Create() (see below) or the helper | 37 // To use, call StrongAssociatedBinding<T>::Create() (see below) or the helper |
35 // MakeStrongAssociatedBinding function: | 38 // MakeStrongAssociatedBinding function: |
36 // | 39 // |
37 // mojo::MakeStrongAssociatedBinding(base::MakeUnique<FooImpl>(), | 40 // mojo::MakeStrongAssociatedBinding(base::MakeUnique<FooImpl>(), |
38 // std::move(foo_request)); | 41 // std::move(foo_request)); |
39 // | 42 // |
40 template <typename Interface> | 43 template <typename Interface> |
41 class StrongAssociatedBinding { | 44 class StrongAssociatedBinding { |
42 public: | 45 public: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 StrongAssociatedBindingPtr<Interface> MakeStrongAssociatedBinding( | 116 StrongAssociatedBindingPtr<Interface> MakeStrongAssociatedBinding( |
114 std::unique_ptr<Impl> impl, | 117 std::unique_ptr<Impl> impl, |
115 AssociatedInterfaceRequest<Interface> request) { | 118 AssociatedInterfaceRequest<Interface> request) { |
116 return StrongAssociatedBinding<Interface>::Create(std::move(impl), | 119 return StrongAssociatedBinding<Interface>::Create(std::move(impl), |
117 std::move(request)); | 120 std::move(request)); |
118 } | 121 } |
119 | 122 |
120 } // namespace mojo | 123 } // namespace mojo |
121 | 124 |
122 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ | 125 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_H_ |
OLD | NEW |