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/move.h" | 11 #include "base/macros.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 | |
22 public: | 20 public: |
23 InterfacePtrInfo() : version_(0u) {} | 21 InterfacePtrInfo() : version_(0u) {} |
24 | 22 |
25 InterfacePtrInfo(ScopedMessagePipeHandle handle, uint32_t version) | 23 InterfacePtrInfo(ScopedMessagePipeHandle handle, uint32_t version) |
26 : handle_(std::move(handle)), version_(version) {} | 24 : handle_(std::move(handle)), version_(version) {} |
27 | 25 |
28 InterfacePtrInfo(InterfacePtrInfo&& other) | 26 InterfacePtrInfo(InterfacePtrInfo&& other) |
29 : handle_(std::move(other.handle_)), version_(other.version_) { | 27 : handle_(std::move(other.handle_)), version_(other.version_) { |
30 other.version_ = 0u; | 28 other.version_ = 0u; |
31 } | 29 } |
(...skipping 17 matching lines...) Expand all Loading... |
49 void set_handle(ScopedMessagePipeHandle handle) { | 47 void set_handle(ScopedMessagePipeHandle handle) { |
50 handle_ = std::move(handle); | 48 handle_ = std::move(handle); |
51 } | 49 } |
52 | 50 |
53 uint32_t version() const { return version_; } | 51 uint32_t version() const { return version_; } |
54 void set_version(uint32_t version) { version_ = version; } | 52 void set_version(uint32_t version) { version_ = version; } |
55 | 53 |
56 private: | 54 private: |
57 ScopedMessagePipeHandle handle_; | 55 ScopedMessagePipeHandle handle_; |
58 uint32_t version_; | 56 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 |