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_INFO_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" | 12 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 | 15 |
16 // AssociatedInterfacePtrInfo stores necessary information to construct an | 16 // AssociatedInterfacePtrInfo stores necessary information to construct an |
17 // associated interface pointer. It is similar to InterfacePtrInfo except that | 17 // associated interface pointer. It is similar to InterfacePtrInfo except that |
18 // it doesn't own a message pipe handle. | 18 // it doesn't own a message pipe handle. |
19 template <typename Interface> | 19 template <typename Interface> |
20 class AssociatedInterfacePtrInfo { | 20 class AssociatedInterfacePtrInfo { |
| 21 DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(AssociatedInterfacePtrInfo); |
| 22 |
21 public: | 23 public: |
22 AssociatedInterfacePtrInfo() : version_(0u) {} | 24 AssociatedInterfacePtrInfo() : version_(0u) {} |
23 | 25 |
24 AssociatedInterfacePtrInfo(AssociatedInterfacePtrInfo&& other) | 26 AssociatedInterfacePtrInfo(AssociatedInterfacePtrInfo&& other) |
25 : handle_(std::move(other.handle_)), version_(other.version_) { | 27 : handle_(std::move(other.handle_)), version_(other.version_) { |
26 other.version_ = 0u; | 28 other.version_ = 0u; |
27 } | 29 } |
28 | 30 |
29 AssociatedInterfacePtrInfo(ScopedInterfaceEndpointHandle handle, | 31 AssociatedInterfacePtrInfo(ScopedInterfaceEndpointHandle handle, |
30 uint32_t version) | 32 uint32_t version) |
(...skipping 29 matching lines...) Expand all Loading... |
60 return true; | 62 return true; |
61 | 63 |
62 // Now that the two refer to different objects, they are equivalent if | 64 // Now that the two refer to different objects, they are equivalent if |
63 // and only if they are both invalid. | 65 // and only if they are both invalid. |
64 return !is_valid() && !other.is_valid(); | 66 return !is_valid() && !other.is_valid(); |
65 } | 67 } |
66 | 68 |
67 private: | 69 private: |
68 ScopedInterfaceEndpointHandle handle_; | 70 ScopedInterfaceEndpointHandle handle_; |
69 uint32_t version_; | 71 uint32_t version_; |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrInfo); | |
72 }; | 72 }; |
73 | 73 |
74 } // namespace mojo | 74 } // namespace mojo |
75 | 75 |
76 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_ | 76 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_ |
OLD | NEW |