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_INTERFACE_PTR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "mojo/public/cpp/bindings/associated_group.h" | 10 #include "mojo/public/cpp/bindings/associated_group.h" |
11 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 11 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
12 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 12 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
13 #include "mojo/public/cpp/bindings/callback.h" | 13 #include "mojo/public/cpp/bindings/callback.h" |
14 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" | 14 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 | 17 |
18 // Represents the client side of an associated interface. It is similar to | 18 // Represents the client side of an associated interface. It is similar to |
19 // InterfacePtr, except that it doesn't own a message pipe handle. | 19 // InterfacePtr, except that it doesn't own a message pipe handle. |
20 template <typename Interface> | 20 template <typename Interface> |
21 class AssociatedInterfacePtr { | 21 class AssociatedInterfacePtr { |
22 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(AssociatedInterfacePtr) | 22 DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(AssociatedInterfacePtr) |
23 | 23 |
24 public: | 24 public: |
25 // Constructs an unbound AssociatedInterfacePtr. | 25 // Constructs an unbound AssociatedInterfacePtr. |
26 AssociatedInterfacePtr() {} | 26 AssociatedInterfacePtr() {} |
27 AssociatedInterfacePtr(decltype(nullptr)) {} | 27 AssociatedInterfacePtr(decltype(nullptr)) {} |
28 | 28 |
29 AssociatedInterfacePtr(AssociatedInterfacePtr&& other) { | 29 AssociatedInterfacePtr(AssociatedInterfacePtr&& other) { |
30 internal_state_.Swap(&other.internal_state_); | 30 internal_state_.Swap(&other.internal_state_); |
31 } | 31 } |
32 | 32 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, | 181 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, |
182 &ptr_info, &request); | 182 &ptr_info, &request); |
183 | 183 |
184 ptr->Bind(ptr_info.Pass()); | 184 ptr->Bind(ptr_info.Pass()); |
185 return request.Pass(); | 185 return request.Pass(); |
186 } | 186 } |
187 | 187 |
188 } // namespace mojo | 188 } // namespace mojo |
189 | 189 |
190 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 190 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
OLD | NEW |