Index: mojo/public/cpp/bindings/lib/bindings_internal.h |
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h |
index df3c620f084d2d1558e263b271b16f99a28cc635..80ec18ab01f9951dfdeb7156aacf9d5d2a5d803c 100644 |
--- a/mojo/public/cpp/bindings/lib/bindings_internal.h |
+++ b/mojo/public/cpp/bindings/lib/bindings_internal.h |
@@ -12,6 +12,12 @@ |
namespace mojo { |
class String; |
+template <typename T> |
+class Array; |
+ |
+template <typename K, typename V> |
+class Map; |
+ |
namespace internal { |
template <typename T> |
class Array_Data; |
@@ -94,6 +100,50 @@ struct WrapperTraits<S, true> { |
typedef typename S::Data_* DataType; |
}; |
+template <typename T> |
+struct ValueTraits { |
+ static bool Equals(const T& a, const T& b) { return a == b; } |
+}; |
+ |
+// TODO(aa): It would be cool to have IsSpecializationOf<> template helper, but |
+// got lost in the goop when I tried. |
+template <typename T> |
+struct ValueTraits<Array<T>> { |
+ static bool Equals(const Array<T>& a, const Array<T>& b) { |
+ return a.Equals(b); |
+ } |
+}; |
+ |
+template <typename T, typename U> |
+struct ValueTraits<Map<T, U>> { |
+ static bool Equals(const Map<T, U>& a, const Map<T, U>& b) { |
+ return a.Equals(b); |
+ } |
+}; |
+ |
+template <typename T> |
+struct ValueTraits<StructPtr<T>> { |
+ static bool Equals(const StructPtr<T>& a, const StructPtr<T>& b) { |
+ return a.Equals(b); |
+ } |
+}; |
+ |
+template <typename T> |
+struct ValueTraits<InlinedStructPtr<T>> { |
+ static bool Equals(const InlinedStructPtr<T>& a, |
+ const InlinedStructPtr<T>& b) { |
+ return a.Equals(b); |
+ } |
+}; |
+ |
+template <typename T> |
+struct ValueTraits<ScopedHandleBase<T>> { |
+ static bool Equals(const ScopedHandleBase<T>& a, |
+ const ScopedHandleBase<T>& b) { |
+ return a.get().value() == b.get().value(); |
+ } |
+}; |
+ |
} // namespace internal |
} // namespace mojo |