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

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

Issue 2136733002: Mojo C++ bindings: add a new mode to generator to use native STL/WTF types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@67_new
Patch Set: . Created 4 years, 5 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/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 b32cf694b9e62ed5b47d8e4c382643b74f108eec..7c3257ed6da23e087ee743b3b030deebd29841f8 100644
--- a/mojo/public/cpp/bindings/lib/bindings_internal.h
+++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -7,6 +7,9 @@
#include <stdint.h>
+#include <functional>
+
+#include "base/template_util.h"
#include "mojo/public/cpp/bindings/interface_id.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
#include "mojo/public/cpp/system/core.h"
@@ -315,6 +318,14 @@ struct BelongsTo {
static_cast<uint32_t>(MojomTypeTraits<T>::category & categories) != 0;
};
+template <typename T>
dcheng 2016/07/12 04:19:42 Nit: maybe static_assert that is_enum<T> is true,
yzshen1 2016/07/12 16:29:20 Done.
+struct EnumHashImpl {
+ size_t operator()(T input) const {
+ using UnderlyingType = typename base::underlying_type<T>::type;
+ return std::hash<UnderlyingType>()(static_cast<UnderlyingType>(input));
+ }
+};
+
} // namespace internal
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698