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

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

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: serialization Created 6 years, 7 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/type_converter.h
diff --git a/mojo/public/cpp/bindings/type_converter.h b/mojo/public/cpp/bindings/type_converter.h
index 83597747c55d2887b8ca1531a328ab448fd02730..12ddc4f0698ca4615fac01befa02c184e925716e 100644
--- a/mojo/public/cpp/bindings/type_converter.h
+++ b/mojo/public/cpp/bindings/type_converter.h
@@ -112,14 +112,16 @@ namespace mojo {
// please use them wisely.
template <typename T, typename U> class TypeConverter;
-} // namespace mojo
-
-#define MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION() \
- static void AssertAllowImplicitTypeConversion() {}
-
-#define MOJO_INHERIT_IMPLICIT_TYPE_CONVERSION(T, U) \
- static void AssertAllowImplicitTypeConversion() { \
- TypeConverter<T, U>::AssertAllowImplicitTypeConversion(); \
+template <typename T> class TypeConverter<T, T> {
+ public:
+ static T ConvertFrom(const T& obj) {
+ return obj;
}
+ static T ConvertTo(const T& obj) {
+ return obj;
+ }
+};
+
+} // namespace mojo
#endif // MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_

Powered by Google App Engine
This is Rietveld 408576698