Chromium Code Reviews| 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; |