Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: mojo/public/cpp/bindings/interface_ptr_info.h

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Regenerate correctly Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/interface_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
10 #include "mojo/public/cpp/system/macros.h" 11 #include "mojo/public/cpp/system/macros.h"
11 #include "mojo/public/cpp/system/message_pipe.h" 12 #include "mojo/public/cpp/system/message_pipe.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 15
15 // InterfacePtrInfo stores necessary information to communicate with a remote 16 // InterfacePtrInfo stores necessary information to communicate with a remote
16 // interface implementation, which could be used to construct an InterfacePtr. 17 // interface implementation, which could be used to construct an InterfacePtr.
17 template <typename Interface> 18 template <typename Interface>
18 class InterfacePtrInfo { 19 class InterfacePtrInfo {
19 MOJO_MOVE_ONLY_TYPE(InterfacePtrInfo); 20 MOJO_MOVE_ONLY_TYPE(InterfacePtrInfo);
20 21
21 public: 22 public:
22 InterfacePtrInfo() : version_(0u) {} 23 InterfacePtrInfo() : version_(0u) {}
23 24
24 InterfacePtrInfo(ScopedMessagePipeHandle handle, uint32_t version) 25 InterfacePtrInfo(ScopedMessagePipeHandle handle, uint32_t version)
25 : handle_(handle.Pass()), version_(version) {} 26 : handle_(std::move(handle)), version_(version) {}
26 27
27 InterfacePtrInfo(InterfacePtrInfo&& other) 28 InterfacePtrInfo(InterfacePtrInfo&& other)
28 : handle_(other.handle_.Pass()), version_(other.version_) { 29 : handle_(std::move(other.handle_)), version_(other.version_) {
29 other.version_ = 0u; 30 other.version_ = 0u;
30 } 31 }
31 32
32 ~InterfacePtrInfo() {} 33 ~InterfacePtrInfo() {}
33 34
34 InterfacePtrInfo& operator=(InterfacePtrInfo&& other) { 35 InterfacePtrInfo& operator=(InterfacePtrInfo&& other) {
35 if (this != &other) { 36 if (this != &other) {
36 handle_ = other.handle_.Pass(); 37 handle_ = other.handle_.Pass();
37 version_ = other.version_; 38 version_ = other.version_;
38 other.version_ = 0u; 39 other.version_ = 0u;
39 } 40 }
40 41
41 return *this; 42 return *this;
42 } 43 }
43 44
44 bool is_valid() const { return handle_.is_valid(); } 45 bool is_valid() const { return handle_.is_valid(); }
45 46
46 ScopedMessagePipeHandle PassHandle() { return handle_.Pass(); } 47 ScopedMessagePipeHandle PassHandle() { return std::move(handle_); }
47 const ScopedMessagePipeHandle& handle() const { return handle_; } 48 const ScopedMessagePipeHandle& handle() const { return handle_; }
48 void set_handle(ScopedMessagePipeHandle handle) { handle_ = handle.Pass(); } 49 void set_handle(ScopedMessagePipeHandle handle) {
50 handle_ = std::move(handle);
51 }
49 52
50 uint32_t version() const { return version_; } 53 uint32_t version() const { return version_; }
51 void set_version(uint32_t version) { version_ = version; } 54 void set_version(uint32_t version) { version_ = version; }
52 55
53 private: 56 private:
54 ScopedMessagePipeHandle handle_; 57 ScopedMessagePipeHandle handle_;
55 uint32_t version_; 58 uint32_t version_;
56 }; 59 };
57 60
58 } // namespace mojo 61 } // namespace mojo
59 62
60 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ 63 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/interface_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698