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

Unified Diff: mojo/public/cpp/bindings/lib/hash_util.h

Issue 2604953003: Remove internal uses of mojo::Array and mojo::WTFArray. (Closed)
Patch Set: rebase Created 3 years, 11 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 | « cc/ipc/cc_serialization_perftest.cc ('k') | mojo/public/cpp/bindings/lib/native_struct.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/hash_util.h
diff --git a/mojo/public/cpp/bindings/lib/hash_util.h b/mojo/public/cpp/bindings/lib/hash_util.h
index c37599c4ce2a59295c728c24dd3e399248f3a075..93280d69daf2f4842e74302f0cc7af7480530c2c 100644
--- a/mojo/public/cpp/bindings/lib/hash_util.h
+++ b/mojo/public/cpp/bindings/lib/hash_util.h
@@ -10,6 +10,7 @@
#include <type_traits>
#include <vector>
+#include "base/optional.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
namespace mojo {
@@ -63,6 +64,16 @@ struct HashTraits<std::vector<T>, false> {
};
template <typename T>
+struct HashTraits<base::Optional<std::vector<T>>, false> {
+ static size_t Hash(size_t seed, const base::Optional<std::vector<T>>& value) {
+ if (!value)
+ return HashCombine(seed, 0);
+
+ return Hash(seed, *value);
+ }
+};
+
+template <typename T>
size_t Hash(size_t seed, const T& value) {
return HashTraits<T>::Hash(seed, value);
}
« no previous file with comments | « cc/ipc/cc_serialization_perftest.cc ('k') | mojo/public/cpp/bindings/lib/native_struct.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698