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

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

Issue 2253293002: Mojo C++ bindings: change the first template parameter of StructTraits and UnionTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@91_extra
Patch Set: rebase Created 4 years, 4 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 6e7efb70b70bb4581d52f59eb0ed0f8932aa6de2..adcad8aa9e42442c19ee98775c1484b3b34e53b8 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
@@ -18,7 +18,7 @@
namespace mojo {
template <>
-struct StructTraits<test::NestedStructWithTraits,
+struct StructTraits<test::NestedStructWithTraitsDataView,
test::NestedStructWithTraitsImpl> {
static void* SetUpContext(const test::NestedStructWithTraitsImpl& input);
static void TearDownContext(const test::NestedStructWithTraitsImpl& input,
@@ -27,7 +27,7 @@ struct StructTraits<test::NestedStructWithTraits,
static int32_t value(const test::NestedStructWithTraitsImpl& input,
void* context);
- static bool Read(test::NestedStructWithTraits::DataView data,
+ static bool Read(test::NestedStructWithTraitsDataView data,
test::NestedStructWithTraitsImpl* output);
};
@@ -39,9 +39,10 @@ struct EnumTraits<test::EnumWithTraits, test::EnumWithTraitsImpl> {
};
template <>
-struct StructTraits<test::StructWithTraits, test::StructWithTraitsImpl> {
+struct StructTraits<test::StructWithTraitsDataView,
+ test::StructWithTraitsImpl> {
// Deserialization to test::StructTraitsImpl.
- static bool Read(test::StructWithTraits::DataView data,
+ static bool Read(test::StructWithTraitsDataView data,
test::StructWithTraitsImpl* out);
// Fields in test::StructWithTraits.
@@ -98,10 +99,10 @@ struct StructTraits<test::StructWithTraits, test::StructWithTraitsImpl> {
};
template <>
-struct StructTraits<test::TrivialStructWithTraits,
+struct StructTraits<test::TrivialStructWithTraitsDataView,
test::TrivialStructWithTraitsImpl> {
// Deserialization to test::TrivialStructTraitsImpl.
- static bool Read(test::TrivialStructWithTraits::DataView data,
+ static bool Read(test::TrivialStructWithTraitsDataView data,
test::TrivialStructWithTraitsImpl* out) {
out->value = data.value();
return true;
@@ -115,10 +116,10 @@ struct StructTraits<test::TrivialStructWithTraits,
};
template <>
-struct StructTraits<test::MoveOnlyStructWithTraits,
+struct StructTraits<test::MoveOnlyStructWithTraitsDataView,
test::MoveOnlyStructWithTraitsImpl> {
// Deserialization to test::MoveOnlyStructTraitsImpl.
- static bool Read(test::MoveOnlyStructWithTraits::DataView data,
+ static bool Read(test::MoveOnlyStructWithTraitsDataView data,
test::MoveOnlyStructWithTraitsImpl* out);
// Fields in test::MoveOnlyStructWithTraits.
@@ -129,13 +130,14 @@ struct StructTraits<test::MoveOnlyStructWithTraits,
};
template <>
-struct StructTraits<test::StructWithTraitsForUniquePtr, std::unique_ptr<int>> {
+struct StructTraits<test::StructWithTraitsForUniquePtrDataView,
+ std::unique_ptr<int>> {
static bool IsNull(const std::unique_ptr<int>& data) { return !data; }
static void SetToNull(std::unique_ptr<int>* data) { data->reset(); }
static int f_int32(const std::unique_ptr<int>& data) { return *data; }
- static bool Read(test::StructWithTraitsForUniquePtr::DataView data,
+ static bool Read(test::StructWithTraitsForUniquePtrDataView data,
std::unique_ptr<int>* out) {
out->reset(new int(data.f_int32()));
return true;
@@ -143,7 +145,7 @@ struct StructTraits<test::StructWithTraitsForUniquePtr, std::unique_ptr<int>> {
};
template <>
-struct UnionTraits<test::UnionWithTraits,
+struct UnionTraits<test::UnionWithTraitsDataView,
std::unique_ptr<test::UnionWithTraitsBase>> {
static bool IsNull(const std::unique_ptr<test::UnionWithTraitsBase>& data) {
return !data;
@@ -152,12 +154,12 @@ struct UnionTraits<test::UnionWithTraits,
data->reset();
}
- static test::UnionWithTraits::DataView::Tag GetTag(
+ static test::UnionWithTraitsDataView::Tag GetTag(
const std::unique_ptr<test::UnionWithTraitsBase>& data) {
if (data->type() == test::UnionWithTraitsBase::Type::INT32)
- return test::UnionWithTraits::DataView::Tag::F_INT32;
+ return test::UnionWithTraitsDataView::Tag::F_INT32;
- return test::UnionWithTraits::DataView::Tag::F_STRUCT;
+ return test::UnionWithTraitsDataView::Tag::F_STRUCT;
}
static int32_t f_int32(
@@ -170,14 +172,14 @@ struct UnionTraits<test::UnionWithTraits,
return static_cast<test::UnionWithTraitsStruct*>(data.get())->get_struct();
}
- static bool Read(test::UnionWithTraits::DataView data,
+ static bool Read(test::UnionWithTraitsDataView data,
std::unique_ptr<test::UnionWithTraitsBase>* out) {
switch (data.tag()) {
- case test::UnionWithTraits::DataView::Tag::F_INT32: {
+ case test::UnionWithTraitsDataView::Tag::F_INT32: {
out->reset(new test::UnionWithTraitsInt32(data.f_int32()));
return true;
}
- case test::UnionWithTraits::DataView::Tag::F_STRUCT: {
+ case test::UnionWithTraitsDataView::Tag::F_STRUCT: {
auto* struct_object = new test::UnionWithTraitsStruct();
out->reset(struct_object);
return data.ReadFStruct(&struct_object->get_mutable_struct());

Powered by Google App Engine
This is Rietveld 408576698