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

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

Issue 649633003: Add Equals() to mojom structs and related types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reorder 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
« no previous file with comments | « mojo/edk/mojo_edk.gyp ('k') | mojo/public/cpp/bindings/lib/bindings_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/array.h
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h
index 966cf313d1cbd2afd2f8013d7fd91b7cca9c284b..2544abb04dadf76c001a0d186c8d6d7e79de5af9 100644
--- a/mojo/public/cpp/bindings/array.h
+++ b/mojo/public/cpp/bindings/array.h
@@ -12,6 +12,7 @@
#include <vector>
#include "mojo/public/cpp/bindings/lib/array_internal.h"
+#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
#include "mojo/public/cpp/bindings/type_converter.h"
@@ -107,6 +108,18 @@ class Array {
return result.Pass();
}
+ bool Equals(const Array& other) const {
+ if (is_null() != other.is_null())
+ return false;
+ if (size() != other.size())
+ return false;
+ for (size_t i = 0; i < size(); ++i) {
+ if (!internal::ValueTraits<T>::Equals(at(i), other.at(i)))
+ return false;
+ }
+ return true;
+ }
+
private:
typedef std::vector<StorageType> Array::*Testable;
« no previous file with comments | « mojo/edk/mojo_edk.gyp ('k') | mojo/public/cpp/bindings/lib/bindings_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698