| 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 | |
| 23 public: | 21 public: |
| 24 AssociatedInterfacePtrInfo() : version_(0u) {} | 22 AssociatedInterfacePtrInfo() : version_(0u) {} |
| 25 | 23 |
| 26 AssociatedInterfacePtrInfo(AssociatedInterfacePtrInfo&& other) | 24 AssociatedInterfacePtrInfo(AssociatedInterfacePtrInfo&& other) |
| 27 : handle_(std::move(other.handle_)), version_(other.version_) { | 25 : handle_(std::move(other.handle_)), version_(other.version_) { |
| 28 other.version_ = 0u; | 26 other.version_ = 0u; |
| 29 } | 27 } |
| 30 | 28 |
| 31 AssociatedInterfacePtrInfo(ScopedInterfaceEndpointHandle handle, | 29 AssociatedInterfacePtrInfo(ScopedInterfaceEndpointHandle handle, |
| 32 uint32_t version) | 30 uint32_t version) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 62 return true; | 60 return true; |
| 63 | 61 |
| 64 // Now that the two refer to different objects, they are equivalent if | 62 // Now that the two refer to different objects, they are equivalent if |
| 65 // and only if they are both invalid. | 63 // and only if they are both invalid. |
| 66 return !is_valid() && !other.is_valid(); | 64 return !is_valid() && !other.is_valid(); |
| 67 } | 65 } |
| 68 | 66 |
| 69 private: | 67 private: |
| 70 ScopedInterfaceEndpointHandle handle_; | 68 ScopedInterfaceEndpointHandle handle_; |
| 71 uint32_t version_; | 69 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 |