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

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

Issue 1358353002: * Change C++ serialization/deserialization to not be move-only operations (with the except of |Ha… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Cleanup forward declarations of array/map serialization functions Created 5 years, 3 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 bb7347e61571a3694493825735a935bb5906f5f7..ed9fa14b5428bf3f046fdb88cadb51d90d30fbdd 100644
--- a/mojo/public/cpp/bindings/lib/bindings_internal.h
+++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -186,6 +186,36 @@ struct ValueTraits<ScopedHandleBase<T>> {
}
};
+template <typename T>
+struct UnwrapStructPtr {
+ static T* value(T& x) { return &x; }
+};
+
+template <typename T>
+struct UnwrapStructPtr<StructPtr<T>> {
+ static T* value(StructPtr<T>& x) { return x.get(); }
+};
+
+template <typename T>
+struct UnwrapStructPtr<InlinedStructPtr<T>> {
+ static T* value(InlinedStructPtr<T>& x) { return x.get(); }
+};
+
+template <typename T>
+struct UnwrapConstStructPtr {
+ static const T* value(const T& x) { return &x; }
+};
+
+template <typename T>
+struct UnwrapConstStructPtr<StructPtr<T>> {
+ static const T* value(const StructPtr<T>& x) { return x.get(); }
+};
+
+template <typename T>
+struct UnwrapConstStructPtr<InlinedStructPtr<T>> {
+ static const T* value(const InlinedStructPtr<T>& x) { return x.get(); }
+};
+
} // namespace internal
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698