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

Unified Diff: mojo/public/cpp/bindings/interface_ptr.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, 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/interface_ptr.h
diff --git a/mojo/public/cpp/bindings/interface_ptr.h b/mojo/public/cpp/bindings/interface_ptr.h
index e427dc4668d2a273b85f3cb4706f7db781f8daa1..041c24264147084046654e4a41905f9b95d7a537 100644
--- a/mojo/public/cpp/bindings/interface_ptr.h
+++ b/mojo/public/cpp/bindings/interface_ptr.h
@@ -183,6 +183,15 @@ class InterfacePtr {
return internal_state_.associated_group();
}
+ bool Equals(const InterfacePtr& other) const {
+ if (this == &other)
+ return true;
+
+ // Now that the two refer to different objects, they are equivalent if
+ // and only if they are both null.
+ return !(*this) && !other;
+ }
+
// DO NOT USE. Exposed only for internal use and for testing.
internal::InterfacePtrState<Interface, Interface::PassesAssociatedKinds_>*
internal_state() {
« no previous file with comments | « mojo/public/cpp/bindings/associated_interface_request.h ('k') | mojo/public/cpp/bindings/interface_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698