OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace mojo { | 25 namespace mojo { |
26 | 26 |
27 template <typename Interface> | 27 template <typename Interface> |
28 class StrongBinding; | 28 class StrongBinding; |
29 | 29 |
30 template <typename Interface> | 30 template <typename Interface> |
31 using StrongBindingPtr = base::WeakPtr<StrongBinding<Interface>>; | 31 using StrongBindingPtr = base::WeakPtr<StrongBinding<Interface>>; |
32 | 32 |
33 // This connects an interface implementation strongly to a pipe. When a | 33 // This connects an interface implementation strongly to a pipe. When a |
34 // connection error is detected the implementation is deleted. | 34 // connection error is detected the implementation is deleted. If the task |
| 35 // runner that a StrongBinding is bound on is stopped, the connection error |
| 36 // handler will not be invoked and the implementation will not be deleted. |
35 // | 37 // |
36 // To use, call StrongBinding<T>::Create() (see below) or the helper | 38 // To use, call StrongBinding<T>::Create() (see below) or the helper |
37 // MakeStrongBinding function: | 39 // MakeStrongBinding function: |
38 // | 40 // |
39 // mojo::MakeStrongBinding(base::MakeUnique<FooImpl>(), | 41 // mojo::MakeStrongBinding(base::MakeUnique<FooImpl>(), |
40 // std::move(foo_request)); | 42 // std::move(foo_request)); |
41 // | 43 // |
42 template <typename Interface> | 44 template <typename Interface> |
43 class StrongBinding { | 45 class StrongBinding { |
44 public: | 46 public: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 template <typename Interface, typename Impl> | 116 template <typename Interface, typename Impl> |
115 StrongBindingPtr<Interface> MakeStrongBinding( | 117 StrongBindingPtr<Interface> MakeStrongBinding( |
116 std::unique_ptr<Impl> impl, | 118 std::unique_ptr<Impl> impl, |
117 InterfaceRequest<Interface> request) { | 119 InterfaceRequest<Interface> request) { |
118 return StrongBinding<Interface>::Create(std::move(impl), std::move(request)); | 120 return StrongBinding<Interface>::Create(std::move(impl), std::move(request)); |
119 } | 121 } |
120 | 122 |
121 } // namespace mojo | 123 } // namespace mojo |
122 | 124 |
123 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ | 125 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ |
OLD | NEW |