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

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

Issue 2031823002: Mojo C++ bindings: more consistent Clone() and Equals(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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_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
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return std::move(handle_); 50 return std::move(handle_);
51 } 51 }
52 const ScopedInterfaceEndpointHandle& handle() const { return handle_; } 52 const ScopedInterfaceEndpointHandle& handle() const { return handle_; }
53 void set_handle(ScopedInterfaceEndpointHandle handle) { 53 void set_handle(ScopedInterfaceEndpointHandle handle) {
54 handle_ = std::move(handle); 54 handle_ = std::move(handle);
55 } 55 }
56 56
57 uint32_t version() const { return version_; } 57 uint32_t version() const { return version_; }
58 void set_version(uint32_t version) { version_ = version; } 58 void set_version(uint32_t version) { version_ = version; }
59 59
60 bool Equals(const AssociatedInterfacePtrInfo& other) const {
61 if (this == &other)
62 return true;
63
64 // Now that the two refer to different objects, they are equivalent if
65 // and only if they are both invalid.
66 return !is_valid() && !other.is_valid();
67 }
68
60 private: 69 private:
61 ScopedInterfaceEndpointHandle handle_; 70 ScopedInterfaceEndpointHandle handle_;
62 uint32_t version_; 71 uint32_t version_;
63 }; 72 };
64 73
65 } // namespace mojo 74 } // namespace mojo
66 75
67 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_ 76 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/array.h ('k') | mojo/public/cpp/bindings/associated_interface_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698