| // mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2016 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_VALIDATION_TEST_INTERFACES_MOJOM_SHARED_H_ |
| #define MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_VALIDATION_TEST_INTERFACES_MOJOM_SHARED_H_ |
| |
| #include <stdint.h> |
| |
| #include <functional> |
| #include <iosfwd> |
| #include <type_traits> |
| #include <utility> |
| #include "mojo/public/cpp/bindings/array_data_view.h" |
| #include "mojo/public/cpp/bindings/enum_traits.h" |
| #include "mojo/public/cpp/bindings/interface_data_view.h" |
| #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/map_data_view.h" |
| #include "mojo/public/cpp/bindings/string_data_view.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom-shared-internal.h" |
| #include "mojo/public/cpp/bindings/lib/interface_serialization.h" |
| #include "mojo/public/cpp/system/data_pipe.h" |
| |
| |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace mojo::test { |
| class StructADataView; |
| |
| class StructBDataView; |
| |
| class StructCDataView; |
| |
| class StructDDataView; |
| |
| class StructEDataView; |
| |
| class StructFDataView; |
| |
| class StructGDataView; |
| |
| class BasicStructDataView; |
| |
| class StructWithEnumDataView; |
| |
| class RecursiveDataView; |
| |
| class UnionADataView; |
| |
| |
| } // mojo::test |
| |
| namespace mojo { |
| namespace internal { |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructADataView> { |
| using Data = ::mojo::test::internal::StructA_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructBDataView> { |
| using Data = ::mojo::test::internal::StructB_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructCDataView> { |
| using Data = ::mojo::test::internal::StructC_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructDDataView> { |
| using Data = ::mojo::test::internal::StructD_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructEDataView> { |
| using Data = ::mojo::test::internal::StructE_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructFDataView> { |
| using Data = ::mojo::test::internal::StructF_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructGDataView> { |
| using Data = ::mojo::test::internal::StructG_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::BasicStructDataView> { |
| using Data = ::mojo::test::internal::BasicStruct_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructWithEnumDataView> { |
| using Data = ::mojo::test::internal::StructWithEnum_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::RecursiveDataView> { |
| using Data = ::mojo::test::internal::Recursive_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::UnionADataView> { |
| using Data = ::mojo::test::internal::UnionA_Data; |
| using DataAsArrayElement = Data; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion; |
| }; |
| |
| } // namespace internal |
| } // namespace mojo |
| |
| |
| namespace mojo::test { |
| |
| |
| // @generated_from: mojo.test.EnumA |
| enum class EnumA : int32_t { |
| |
| // @generated_from: mojo.test.EnumA.ENUM_A_0 |
| ENUM_A_0 = 0, |
| |
| // @generated_from: mojo.test.EnumA.ENUM_A_1 |
| ENUM_A_1 = 1, |
| kMinValue = 0, |
| kMaxValue = 1, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, EnumA value); |
| inline bool IsKnownEnumValue(EnumA value) { |
| return internal::EnumA_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| // @generated_from: mojo.test.EnumB |
| enum class EnumB : int32_t { |
| |
| // @generated_from: mojo.test.EnumB.ENUM_B_0 |
| ENUM_B_0 = 0, |
| |
| // @generated_from: mojo.test.EnumB.ENUM_B_1 |
| ENUM_B_1 = 1, |
| |
| // @generated_from: mojo.test.EnumB.ENUM_B_2 |
| ENUM_B_2 = 2, |
| kMinValue = 0, |
| kMaxValue = 2, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, EnumB value); |
| inline bool IsKnownEnumValue(EnumB value) { |
| return internal::EnumB_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| // @generated_from: mojo.test.EmptyEnum |
| enum class EmptyEnum : int32_t { |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, EmptyEnum value); |
| inline bool IsKnownEnumValue(EmptyEnum value) { |
| return internal::EmptyEnum_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| // @generated_from: mojo.test.ExtensibleEmptyEnum |
| enum class ExtensibleEmptyEnum : int32_t { |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, ExtensibleEmptyEnum value); |
| inline bool IsKnownEnumValue(ExtensibleEmptyEnum value) { |
| return internal::ExtensibleEmptyEnum_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| // @generated_from: mojo.test.BasicEnum |
| enum class BasicEnum : int32_t { |
| |
| // @generated_from: mojo.test.BasicEnum.A |
| A = 0, |
| |
| // @generated_from: mojo.test.BasicEnum.B |
| B = 1, |
| |
| // @generated_from: mojo.test.BasicEnum.C |
| C = 0, |
| |
| // @generated_from: mojo.test.BasicEnum.D |
| D = -3, |
| |
| // @generated_from: mojo.test.BasicEnum.E |
| E = 10, |
| kMinValue = -3, |
| kMaxValue = 10, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, BasicEnum value); |
| inline bool IsKnownEnumValue(BasicEnum value) { |
| return internal::BasicEnum_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| // @generated_from: mojo.test.StructWithEnum.EnumWithin |
| enum class StructWithEnum_EnumWithin : int32_t { |
| |
| // @generated_from: mojo.test.StructWithEnum.EnumWithin.A |
| A = 0, |
| |
| // @generated_from: mojo.test.StructWithEnum.EnumWithin.B |
| B = 1, |
| |
| // @generated_from: mojo.test.StructWithEnum.EnumWithin.C |
| C = 2, |
| |
| // @generated_from: mojo.test.StructWithEnum.EnumWithin.D |
| D = 3, |
| kMinValue = 0, |
| kMaxValue = 3, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, StructWithEnum_EnumWithin value); |
| inline bool IsKnownEnumValue(StructWithEnum_EnumWithin value) { |
| return internal::StructWithEnum_EnumWithin_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| // Interface base classes. They are used for type safety check. |
| class InterfaceAInterfaceBase {}; |
| |
| using InterfaceAPtrDataView = |
| mojo::InterfacePtrDataView<InterfaceAInterfaceBase>; |
| using InterfaceARequestDataView = |
| mojo::InterfaceRequestDataView<InterfaceAInterfaceBase>; |
| using InterfaceAAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<InterfaceAInterfaceBase>; |
| using InterfaceAAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<InterfaceAInterfaceBase>; |
| class BoundsCheckTestInterfaceInterfaceBase {}; |
| |
| using BoundsCheckTestInterfacePtrDataView = |
| mojo::InterfacePtrDataView<BoundsCheckTestInterfaceInterfaceBase>; |
| using BoundsCheckTestInterfaceRequestDataView = |
| mojo::InterfaceRequestDataView<BoundsCheckTestInterfaceInterfaceBase>; |
| using BoundsCheckTestInterfaceAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<BoundsCheckTestInterfaceInterfaceBase>; |
| using BoundsCheckTestInterfaceAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<BoundsCheckTestInterfaceInterfaceBase>; |
| class ConformanceTestInterfaceInterfaceBase {}; |
| |
| using ConformanceTestInterfacePtrDataView = |
| mojo::InterfacePtrDataView<ConformanceTestInterfaceInterfaceBase>; |
| using ConformanceTestInterfaceRequestDataView = |
| mojo::InterfaceRequestDataView<ConformanceTestInterfaceInterfaceBase>; |
| using ConformanceTestInterfaceAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<ConformanceTestInterfaceInterfaceBase>; |
| using ConformanceTestInterfaceAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<ConformanceTestInterfaceInterfaceBase>; |
| class IntegrationTestInterfaceInterfaceBase {}; |
| |
| using IntegrationTestInterfacePtrDataView = |
| mojo::InterfacePtrDataView<IntegrationTestInterfaceInterfaceBase>; |
| using IntegrationTestInterfaceRequestDataView = |
| mojo::InterfaceRequestDataView<IntegrationTestInterfaceInterfaceBase>; |
| using IntegrationTestInterfaceAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<IntegrationTestInterfaceInterfaceBase>; |
| using IntegrationTestInterfaceAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<IntegrationTestInterfaceInterfaceBase>; |
| |
| |
| class StructADataView { |
| public: |
| StructADataView() = default; |
| |
| StructADataView( |
| internal::StructA_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| uint64_t i() const { |
| return data_->i; |
| } |
| private: |
| internal::StructA_Data* data_ = nullptr; |
| }; |
| |
| |
| class StructBDataView { |
| public: |
| StructBDataView() = default; |
| |
| StructBDataView( |
| internal::StructB_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetStructADataView( |
| StructADataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadStructA(UserType* output) { |
| |
| auto* pointer = data_->struct_a.Get(); |
| return mojo::internal::Deserialize<::mojo::test::StructADataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructB_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructCDataView { |
| public: |
| StructCDataView() = default; |
| |
| StructCDataView( |
| internal::StructC_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetDataDataView( |
| mojo::ArrayDataView<uint8_t>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadData(UserType* output) { |
| |
| auto* pointer = data_->data.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructC_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructDDataView { |
| public: |
| StructDDataView() = default; |
| |
| StructDDataView( |
| internal::StructD_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetMessagePipesDataView( |
| mojo::ArrayDataView<mojo::ScopedMessagePipeHandle>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadMessagePipes(UserType* output) { |
| |
| auto* pointer = data_->message_pipes.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<mojo::ScopedMessagePipeHandle>>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructD_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructEDataView { |
| public: |
| StructEDataView() = default; |
| |
| StructEDataView( |
| internal::StructE_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetStructDDataView( |
| StructDDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadStructD(UserType* output) { |
| |
| auto* pointer = data_->struct_d.Get(); |
| return mojo::internal::Deserialize<::mojo::test::StructDDataView>( |
| pointer, output, message_); |
| } |
| mojo::ScopedDataPipeConsumerHandle TakeDataPipeConsumer() { |
| mojo::ScopedDataPipeConsumerHandle result; |
| bool ret = |
| mojo::internal::Deserialize<mojo::ScopedDataPipeConsumerHandle>( |
| &data_->data_pipe_consumer, &result, message_); |
| DCHECK(ret); |
| return result; |
| } |
| private: |
| internal::StructE_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructFDataView { |
| public: |
| StructFDataView() = default; |
| |
| StructFDataView( |
| internal::StructF_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetFixedSizeArrayDataView( |
| mojo::ArrayDataView<uint8_t>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFixedSizeArray(UserType* output) { |
| |
| auto* pointer = data_->fixed_size_array.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructF_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructGDataView { |
| public: |
| StructGDataView() = default; |
| |
| StructGDataView( |
| internal::StructG_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| int32_t i() const { |
| return data_->i; |
| } |
| inline void GetStructADataView( |
| StructADataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadStructA(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| ::mojo::test::StructADataView, UserType>(), |
| "Attempting to read the optional `struct_a` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadStructA` instead " |
| "of `ReadStructA if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->header_.version >= 1 |
| ? data_->struct_a.Get() : nullptr; |
| return mojo::internal::Deserialize<::mojo::test::StructADataView>( |
| pointer, output, message_); |
| } |
| inline void GetStrDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadStr(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| mojo::StringDataView, UserType>(), |
| "Attempting to read the optional `str` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadStr` instead " |
| "of `ReadStr if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->header_.version >= 3 |
| ? data_->str.Get() : nullptr; |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| bool b() const { |
| if (data_->header_.version < 3) |
| return bool{}; |
| return data_->b; |
| } |
| private: |
| internal::StructG_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class BasicStructDataView { |
| public: |
| BasicStructDataView() = default; |
| |
| BasicStructDataView( |
| internal::BasicStruct_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| int32_t a() const { |
| return data_->a; |
| } |
| private: |
| internal::BasicStruct_Data* data_ = nullptr; |
| }; |
| |
| |
| class StructWithEnumDataView { |
| public: |
| StructWithEnumDataView() = default; |
| |
| StructWithEnumDataView( |
| internal::StructWithEnum_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| private: |
| internal::StructWithEnum_Data* data_ = nullptr; |
| }; |
| |
| |
| class RecursiveDataView { |
| public: |
| RecursiveDataView() = default; |
| |
| RecursiveDataView( |
| internal::Recursive_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetRecursiveDataView( |
| RecursiveDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadRecursive(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| ::mojo::test::RecursiveDataView, UserType>(), |
| "Attempting to read the optional `recursive` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadRecursive` instead " |
| "of `ReadRecursive if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->recursive.Get(); |
| return mojo::internal::Deserialize<::mojo::test::RecursiveDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::Recursive_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class UnionADataView { |
| public: |
| using Tag = internal::UnionA_Data::UnionA_Tag; |
| |
| UnionADataView() = default; |
| |
| UnionADataView( |
| internal::UnionA_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { |
| // For inlined unions, |data_| is always non-null. In that case we need to |
| // check |data_->is_null()|. |
| return !data_ || data_->is_null(); |
| } |
| |
| Tag tag() const { return data_->tag; } |
| bool is_struct_a() const { return data_->tag == Tag::kStructA; } |
| inline void GetStructADataView( |
| StructADataView* output) const; |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadStructA(UserType* output) const { |
| |
| CHECK(is_struct_a()); |
| return mojo::internal::Deserialize<::mojo::test::StructADataView>( |
| data_->data.f_struct_a.Get(), output, message_); |
| } |
| bool is_b() const { return data_->tag == Tag::kB; } |
| bool b() const { |
| CHECK(is_b()); |
| return data_->data.f_b; |
| } |
| |
| private: |
| internal::UnionA_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| |
| } // mojo::test |
| |
| namespace std { |
| |
| template <> |
| struct hash<::mojo::test::EnumA> |
| : public mojo::internal::EnumHashImpl<::mojo::test::EnumA> {}; |
| |
| template <> |
| struct hash<::mojo::test::EnumB> |
| : public mojo::internal::EnumHashImpl<::mojo::test::EnumB> {}; |
| |
| template <> |
| struct hash<::mojo::test::EmptyEnum> |
| : public mojo::internal::EnumHashImpl<::mojo::test::EmptyEnum> {}; |
| |
| template <> |
| struct hash<::mojo::test::ExtensibleEmptyEnum> |
| : public mojo::internal::EnumHashImpl<::mojo::test::ExtensibleEmptyEnum> {}; |
| |
| template <> |
| struct hash<::mojo::test::BasicEnum> |
| : public mojo::internal::EnumHashImpl<::mojo::test::BasicEnum> {}; |
| |
| template <> |
| struct hash<::mojo::test::StructWithEnum_EnumWithin> |
| : public mojo::internal::EnumHashImpl<::mojo::test::StructWithEnum_EnumWithin> {}; |
| |
| } // namespace std |
| |
| namespace mojo { |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::EnumA, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::EnumA, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::EnumA>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::EnumB, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::EnumB, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::EnumB>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::EmptyEnum, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::EmptyEnum, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::EmptyEnum>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::ExtensibleEmptyEnum, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::ExtensibleEmptyEnum, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::ExtensibleEmptyEnum>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::BasicEnum, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::BasicEnum, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::BasicEnum>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructWithEnum_EnumWithin, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::StructWithEnum_EnumWithin, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::StructWithEnum_EnumWithin>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructADataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructADataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructA_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->i = Traits::i(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructA_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructADataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructBDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructBDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructB_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::struct_a(input)) in_struct_a = Traits::struct_a(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->struct_a)::BaseType> struct_a_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::StructADataView>( |
| in_struct_a, struct_a_fragment); |
| fragment->struct_a.Set( |
| struct_a_fragment.is_null() ? nullptr : struct_a_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->struct_a.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null struct_a in StructB struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructB_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructBDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructCDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructCDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructC_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::data(input)) in_data = Traits::data(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->data)::BaseType> |
| data_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& data_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>>( |
| in_data, data_fragment, &data_validate_params); |
| fragment->data.Set( |
| data_fragment.is_null() ? nullptr : data_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->data.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null data in StructC struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructC_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructCDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructDDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructDDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructD_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::message_pipes(input)) in_message_pipes = Traits::message_pipes(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->message_pipes)::BaseType> |
| message_pipes_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& message_pipes_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<mojo::ScopedMessagePipeHandle>>( |
| in_message_pipes, message_pipes_fragment, &message_pipes_validate_params); |
| fragment->message_pipes.Set( |
| message_pipes_fragment.is_null() ? nullptr : message_pipes_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->message_pipes.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null message_pipes in StructD struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructD_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructDDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructEDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructEDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructE_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::struct_d(input)) in_struct_d = Traits::struct_d(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->struct_d)::BaseType> struct_d_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::StructDDataView>( |
| in_struct_d, struct_d_fragment); |
| fragment->struct_d.Set( |
| struct_d_fragment.is_null() ? nullptr : struct_d_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->struct_d.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null struct_d in StructE struct"); |
| decltype(Traits::data_pipe_consumer(input)) in_data_pipe_consumer = Traits::data_pipe_consumer(input); |
| mojo::internal::Serialize<mojo::ScopedDataPipeConsumerHandle>( |
| in_data_pipe_consumer, &fragment->data_pipe_consumer, &fragment.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(fragment->data_pipe_consumer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid data_pipe_consumer in StructE struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructE_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructEDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructFDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructFDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructF_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::fixed_size_array(input)) in_fixed_size_array = Traits::fixed_size_array(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->fixed_size_array)::BaseType> |
| fixed_size_array_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& fixed_size_array_validate_params = |
| mojo::internal::GetArrayValidator<3, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>>( |
| in_fixed_size_array, fixed_size_array_fragment, &fixed_size_array_validate_params); |
| fragment->fixed_size_array.Set( |
| fixed_size_array_fragment.is_null() ? nullptr : fixed_size_array_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->fixed_size_array.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null fixed_size_array in StructF struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructF_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructFDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructGDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructGDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructG_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->i = Traits::i(input); |
| decltype(Traits::struct_a(input)) in_struct_a = Traits::struct_a(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->struct_a)::BaseType> struct_a_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::StructADataView>( |
| in_struct_a, struct_a_fragment); |
| fragment->struct_a.Set( |
| struct_a_fragment.is_null() ? nullptr : struct_a_fragment.data()); |
| decltype(Traits::str(input)) in_str = Traits::str(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->str)::BaseType> str_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_str, str_fragment); |
| fragment->str.Set( |
| str_fragment.is_null() ? nullptr : str_fragment.data()); |
| fragment->b = Traits::b(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructG_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructGDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::BasicStructDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::BasicStructDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::BasicStruct_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->a = Traits::a(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::BasicStruct_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::BasicStructDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructWithEnumDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructWithEnumDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructWithEnum_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructWithEnum_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructWithEnumDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::RecursiveDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::RecursiveDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::Recursive_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::recursive(input)) in_recursive = Traits::recursive(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->recursive)::BaseType> recursive_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::RecursiveDataView>( |
| in_recursive, recursive_fragment); |
| fragment->recursive.Set( |
| recursive_fragment.is_null() ? nullptr : recursive_fragment.data()); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::Recursive_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::RecursiveDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::UnionADataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = UnionTraits<::mojo::test::UnionADataView, UserType>; |
| |
| static void Serialize(MaybeConstUserType& input, |
| MessageFragment<::mojo::test::internal::UnionA_Data>& fragment, |
| bool inlined) { |
| if (CallIsNullIfExists<Traits>(input)) { |
| if (inlined) |
| fragment->set_null(); |
| return; |
| } |
| |
| if (!inlined) |
| fragment.Allocate(); |
| |
| // TODO(azani): Handle unknown and objects. |
| // Set the not-null flag. |
| fragment->size = kUnionDataSize; |
| fragment->tag = Traits::GetTag(input); |
| switch (fragment->tag) { |
| case ::mojo::test::UnionADataView::Tag::kStructA: { |
| decltype(Traits::struct_a(input)) |
| in_struct_a = Traits::struct_a(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->data.f_struct_a)::BaseType> |
| value_fragment(fragment.message()); |
| mojo::internal::Serialize<::mojo::test::StructADataView>( |
| in_struct_a, value_fragment); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| value_fragment.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null struct_a in UnionA union"); |
| fragment->data.f_struct_a.Set( |
| value_fragment.is_null() ? nullptr : value_fragment.data()); |
| break; |
| } |
| case ::mojo::test::UnionADataView::Tag::kB: { |
| decltype(Traits::b(input)) |
| in_b = Traits::b(input); |
| fragment->data.f_b = in_b; |
| break; |
| } |
| } |
| } |
| |
| static bool Deserialize(::mojo::test::internal::UnionA_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input || input->is_null()) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::UnionADataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| } // namespace mojo |
| |
| |
| namespace mojo::test { |
| |
| |
| |
| inline void StructBDataView::GetStructADataView( |
| StructADataView* output) { |
| auto pointer = data_->struct_a.Get(); |
| *output = StructADataView(pointer, message_); |
| } |
| |
| |
| inline void StructCDataView::GetDataDataView( |
| mojo::ArrayDataView<uint8_t>* output) { |
| auto pointer = data_->data.Get(); |
| *output = mojo::ArrayDataView<uint8_t>(pointer, message_); |
| } |
| |
| |
| inline void StructDDataView::GetMessagePipesDataView( |
| mojo::ArrayDataView<mojo::ScopedMessagePipeHandle>* output) { |
| auto pointer = data_->message_pipes.Get(); |
| *output = mojo::ArrayDataView<mojo::ScopedMessagePipeHandle>(pointer, message_); |
| } |
| |
| |
| inline void StructEDataView::GetStructDDataView( |
| StructDDataView* output) { |
| auto pointer = data_->struct_d.Get(); |
| *output = StructDDataView(pointer, message_); |
| } |
| |
| |
| inline void StructFDataView::GetFixedSizeArrayDataView( |
| mojo::ArrayDataView<uint8_t>* output) { |
| auto pointer = data_->fixed_size_array.Get(); |
| *output = mojo::ArrayDataView<uint8_t>(pointer, message_); |
| } |
| |
| |
| inline void StructGDataView::GetStructADataView( |
| StructADataView* output) { |
| auto pointer = data_->header_.version >= 1 |
| ? data_->struct_a.Get() : nullptr; |
| *output = StructADataView(pointer, message_); |
| } |
| inline void StructGDataView::GetStrDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->header_.version >= 3 |
| ? data_->str.Get() : nullptr; |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| |
| |
| |
| |
| |
| |
| inline void RecursiveDataView::GetRecursiveDataView( |
| RecursiveDataView* output) { |
| auto pointer = data_->recursive.Get(); |
| *output = RecursiveDataView(pointer, message_); |
| } |
| |
| |
| inline void UnionADataView::GetStructADataView( |
| StructADataView* output) const { |
| CHECK(is_struct_a()); |
| *output = StructADataView(data_->data.f_struct_a.Get(), message_); |
| } |
| |
| |
| } // mojo::test |
| |
| // Declare TraceFormatTraits for enums, which should be defined in ::perfetto |
| // namespace. |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::EnumA> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::EnumA value); |
| }; |
| |
| } // namespace perfetto |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::EnumB> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::EnumB value); |
| }; |
| |
| } // namespace perfetto |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::EmptyEnum> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::EmptyEnum value); |
| }; |
| |
| } // namespace perfetto |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::ExtensibleEmptyEnum> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::ExtensibleEmptyEnum value); |
| }; |
| |
| } // namespace perfetto |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::BasicEnum> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::BasicEnum value); |
| }; |
| |
| } // namespace perfetto |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::StructWithEnum_EnumWithin> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::StructWithEnum_EnumWithin value); |
| }; |
| |
| } // namespace perfetto |
| |
| #endif // MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_VALIDATION_TEST_INTERFACES_MOJOM_SHARED_H_
|
| /* Metadata comment
|
| eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi
|
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