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

Unified Diff: mojo/public/cpp/bindings/struct_ptr.h

Issue 649633003: Add Equals() to mojom structs and related types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 6 years, 2 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/struct_ptr.h
diff --git a/mojo/public/cpp/bindings/struct_ptr.h b/mojo/public/cpp/bindings/struct_ptr.h
index 5d0836489aadfda523cae11266bbb0793057d270..c13c8863d121c639f63e26b12222795de85424cb 100644
--- a/mojo/public/cpp/bindings/struct_ptr.h
+++ b/mojo/public/cpp/bindings/struct_ptr.h
@@ -71,6 +71,12 @@ class StructPtr {
// that it contains Mojo handles).
StructPtr Clone() const { return is_null() ? StructPtr() : ptr_->Clone(); }
+ bool Equals(const StructPtr& other) const {
+ if (is_null() != other.is_null())
+ return false;
+ return ptr_->Equals(*other.ptr_);
yzshen1 2014/10/14 21:47:21 ptr_ and other.ptr_ may both be null here. (Please
Aaron Boodman 2014/10/14 22:30:12 Good point! Thanks.
+ }
+
private:
typedef Struct* StructPtr::*Testable;
@@ -139,6 +145,11 @@ class InlinedStructPtr {
InlinedStructPtr Clone() const {
return is_null() ? InlinedStructPtr() : value_.Clone();
}
+ bool Equals(const InlinedStructPtr& other) const {
+ if (is_null() != other.is_null())
+ return false;
+ return value_.Equals(other.value_);
yzshen1 2014/10/14 21:47:21 It seems we don't need to compare the value if the
Aaron Boodman 2014/10/14 22:30:12 Done.
+ }
private:
typedef Struct InlinedStructPtr::*Testable;

Powered by Google App Engine
This is Rietveld 408576698