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

Unified Diff: mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h

Issue 2146153002: Mojo typemap config: support "copyable_pass_by_value" attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@69_change_move_only
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/tests/struct_with_traits_impl_traits.h
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
index 4550526d7bb5f263bd36034b55e3ea66905365f8..fe88462014a89b7d4e1ed06a4aa87423d46ede6e 100644
--- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
+++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
@@ -93,15 +93,32 @@ struct StructTraits<test::StructWithTraits, test::StructWithTraitsImpl> {
};
template <>
-struct StructTraits<test::PassByValueStructWithTraits,
- test::PassByValueStructWithTraitsImpl> {
- // Deserialization to test::PassByValueStructTraitsImpl.
- static bool Read(test::PassByValueStructWithTraits::DataView data,
- test::PassByValueStructWithTraitsImpl* out);
+struct StructTraits<test::TrivialStructWithTraits,
+ test::TrivialStructWithTraitsImpl> {
+ // Deserialization to test::TrivialStructTraitsImpl.
+ static bool Read(test::TrivialStructWithTraits::DataView data,
+ test::TrivialStructWithTraitsImpl* out) {
+ out->value = data.value();
+ return true;
+ }
+
+ // Fields in test::TrivialStructWithTraits.
+ // See src/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.
+ static int32_t value(test::TrivialStructWithTraitsImpl& input) {
+ return input.value;
+ }
+};
+
+template <>
+struct StructTraits<test::MoveOnlyStructWithTraits,
+ test::MoveOnlyStructWithTraitsImpl> {
+ // Deserialization to test::MoveOnlyStructTraitsImpl.
+ static bool Read(test::MoveOnlyStructWithTraits::DataView data,
+ test::MoveOnlyStructWithTraitsImpl* out);
- // Fields in test::PassByValueStructWithTraits.
+ // Fields in test::MoveOnlyStructWithTraits.
// See src/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.
- static ScopedHandle f_handle(test::PassByValueStructWithTraitsImpl& value) {
+ static ScopedHandle f_handle(test::MoveOnlyStructWithTraitsImpl& value) {
return std::move(value.get_mutable_handle());
}
};

Powered by Google App Engine
This is Rietveld 408576698