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_INTERFACE_PTR_INFO_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_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/move.h" |
12 #include "mojo/public/cpp/system/message_pipe.h" | 12 #include "mojo/public/cpp/system/message_pipe.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 | 15 |
16 // InterfacePtrInfo stores necessary information to communicate with a remote | 16 // InterfacePtrInfo stores necessary information to communicate with a remote |
17 // interface implementation, which could be used to construct an InterfacePtr. | 17 // interface implementation, which could be used to construct an InterfacePtr. |
18 template <typename Interface> | 18 template <typename Interface> |
19 class InterfacePtrInfo { | 19 class InterfacePtrInfo { |
| 20 MOVE_ONLY_TYPE_FOR_CPP_03(InterfacePtrInfo); |
| 21 |
20 public: | 22 public: |
21 InterfacePtrInfo() : version_(0u) {} | 23 InterfacePtrInfo() : version_(0u) {} |
22 | 24 |
23 InterfacePtrInfo(ScopedMessagePipeHandle handle, uint32_t version) | 25 InterfacePtrInfo(ScopedMessagePipeHandle handle, uint32_t version) |
24 : handle_(std::move(handle)), version_(version) {} | 26 : handle_(std::move(handle)), version_(version) {} |
25 | 27 |
26 InterfacePtrInfo(InterfacePtrInfo&& other) | 28 InterfacePtrInfo(InterfacePtrInfo&& other) |
27 : handle_(std::move(other.handle_)), version_(other.version_) { | 29 : handle_(std::move(other.handle_)), version_(other.version_) { |
28 other.version_ = 0u; | 30 other.version_ = 0u; |
29 } | 31 } |
(...skipping 17 matching lines...) Expand all Loading... |
47 void set_handle(ScopedMessagePipeHandle handle) { | 49 void set_handle(ScopedMessagePipeHandle handle) { |
48 handle_ = std::move(handle); | 50 handle_ = std::move(handle); |
49 } | 51 } |
50 | 52 |
51 uint32_t version() const { return version_; } | 53 uint32_t version() const { return version_; } |
52 void set_version(uint32_t version) { version_ = version; } | 54 void set_version(uint32_t version) { version_ = version; } |
53 | 55 |
54 private: | 56 private: |
55 ScopedMessagePipeHandle handle_; | 57 ScopedMessagePipeHandle handle_; |
56 uint32_t version_; | 58 uint32_t version_; |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(InterfacePtrInfo); | |
59 }; | 59 }; |
60 | 60 |
61 } // namespace mojo | 61 } // namespace mojo |
62 | 62 |
63 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ | 63 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ |
OLD | NEW |