OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ASSOCIATED_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 // synchrounous method calls may not be run from this task runner, when they | 89 // synchrounous method calls may not be run from this task runner, when they |
90 // reenter outgoing synchrounous calls on the same thread. | 90 // reenter outgoing synchrounous calls on the same thread. |
91 template <typename Interface, | 91 template <typename Interface, |
92 typename ImplRefTraits = RawPtrImplRefTraits<Interface>> | 92 typename ImplRefTraits = RawPtrImplRefTraits<Interface>> |
93 class AssociatedBinding : public AssociatedBindingBase { | 93 class AssociatedBinding : public AssociatedBindingBase { |
94 public: | 94 public: |
95 using ImplPointerType = typename ImplRefTraits::PointerType; | 95 using ImplPointerType = typename ImplRefTraits::PointerType; |
96 | 96 |
97 // Constructs an incomplete associated binding that will use the | 97 // Constructs an incomplete associated binding that will use the |
98 // implementation |impl|. It may be completed with a subsequent call to the | 98 // implementation |impl|. It may be completed with a subsequent call to the |
99 // |Bind| method. Does not take ownership of |impl|, which must outlive this | 99 // |Bind| method. Does not take ownership of |impl|, which must outlive this |
cmumford
2017/03/07 20:24:23
Doesn't moving |impl| mean that we're taking owner
dmurph
2017/03/09 20:44:15
Done.
| |
100 // object. | 100 // object. |
101 explicit AssociatedBinding(ImplPointerType impl) { stub_.set_sink(impl); } | 101 explicit AssociatedBinding(ImplPointerType impl) { |
102 stub_.set_sink(std::move(impl)); | |
103 } | |
102 | 104 |
103 // Constructs a completed associated binding of |impl|. The output |ptr_info| | 105 // Constructs a completed associated binding of |impl|. The output |ptr_info| |
104 // should be sent by another interface. |impl| must outlive this object. | 106 // should be sent by another interface. |impl| must outlive this object. |
105 AssociatedBinding(ImplPointerType impl, | 107 AssociatedBinding(ImplPointerType impl, |
106 AssociatedInterfacePtrInfo<Interface>* ptr_info, | 108 AssociatedInterfacePtrInfo<Interface>* ptr_info, |
107 scoped_refptr<base::SingleThreadTaskRunner> runner = | 109 scoped_refptr<base::SingleThreadTaskRunner> runner = |
108 base::ThreadTaskRunnerHandle::Get()) | 110 base::ThreadTaskRunnerHandle::Get()) |
109 : AssociatedBinding(std::move(impl)) { | 111 : AssociatedBinding(std::move(impl)) { |
110 Bind(ptr_info, std::move(runner)); | 112 Bind(ptr_info, std::move(runner)); |
111 } | 113 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 | 164 |
163 private: | 165 private: |
164 typename Interface::template Stub_<ImplRefTraits> stub_; | 166 typename Interface::template Stub_<ImplRefTraits> stub_; |
165 | 167 |
166 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); | 168 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); |
167 }; | 169 }; |
168 | 170 |
169 } // namespace mojo | 171 } // namespace mojo |
170 | 172 |
171 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ | 173 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ |
OLD | NEW |