| // components/mirroring/mojom/session_parameters.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 COMPONENTS_MIRRORING_MOJOM_SESSION_PARAMETERS_MOJOM_SHARED_H_ |
| #define COMPONENTS_MIRRORING_MOJOM_SESSION_PARAMETERS_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 "components/mirroring/mojom/session_parameters.mojom-shared-internal.h" |
| #include "services/network/public/mojom/ip_address.mojom-shared.h" |
| #include "mojo/public/mojom/base/time.mojom-shared.h" |
| |
| |
| |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace mirroring::mojom { |
| class SessionParametersDataView; |
| |
| |
| |
| } // mirroring::mojom |
| |
| namespace mojo { |
| namespace internal { |
| |
| template <> |
| struct MojomTypeTraits<::mirroring::mojom::SessionParametersDataView> { |
| using Data = ::mirroring::mojom::internal::SessionParameters_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| } // namespace internal |
| } // namespace mojo |
| |
| |
| namespace mirroring::mojom { |
| |
| |
| // @generated_from: mirroring.mojom.SessionType |
| enum class SessionType : int32_t { |
| |
| // @generated_from: mirroring.mojom.SessionType.AUDIO_ONLY |
| AUDIO_ONLY = 0, |
| |
| // @generated_from: mirroring.mojom.SessionType.VIDEO_ONLY |
| VIDEO_ONLY = 1, |
| |
| // @generated_from: mirroring.mojom.SessionType.AUDIO_AND_VIDEO |
| AUDIO_AND_VIDEO = 2, |
| kMinValue = 0, |
| kMaxValue = 2, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, SessionType value); |
| inline bool IsKnownEnumValue(SessionType value) { |
| return internal::SessionType_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| class SessionParametersDataView { |
| public: |
| SessionParametersDataView() = default; |
| |
| SessionParametersDataView( |
| internal::SessionParameters_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| template <typename UserType> |
| [[nodiscard]] bool ReadType(UserType* output) const { |
| auto data_value = data_->type; |
| return mojo::internal::Deserialize<::mirroring::mojom::SessionType>( |
| data_value, output); |
| } |
| SessionType type() const { |
| return ::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mirroring::mojom::SessionType>(data_->type)); |
| } |
| inline void GetReceiverAddressDataView( |
| ::network::mojom::IPAddressDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadReceiverAddress(UserType* output) { |
| |
| auto* pointer = data_->receiver_address.Get(); |
| return mojo::internal::Deserialize<::network::mojom::IPAddressDataView>( |
| pointer, output, message_); |
| } |
| inline void GetReceiverModelNameDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadReceiverModelName(UserType* output) { |
| |
| auto* pointer = data_->receiver_model_name.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetReceiverFriendlyNameDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadReceiverFriendlyName(UserType* output) { |
| |
| auto* pointer = data_->receiver_friendly_name.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetSourceIdDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadSourceId(UserType* output) { |
| |
| auto* pointer = data_->source_id.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetDestinationIdDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadDestinationId(UserType* output) { |
| |
| auto* pointer = data_->destination_id.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetTargetPlayoutDelayDataView( |
| ::mojo_base::mojom::TimeDeltaDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadTargetPlayoutDelay(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| ::mojo_base::mojom::TimeDeltaDataView, UserType>(), |
| "Attempting to read the optional `target_playout_delay` 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 `MaybeReadTargetPlayoutDelay` instead " |
| "of `ReadTargetPlayoutDelay if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->target_playout_delay.Get(); |
| return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>( |
| pointer, output, message_); |
| } |
| bool is_remote_playback() const { |
| return data_->is_remote_playback; |
| } |
| bool force_letterboxing() const { |
| return data_->force_letterboxing; |
| } |
| bool enable_rtcp_reporting() const { |
| return data_->enable_rtcp_reporting; |
| } |
| private: |
| internal::SessionParameters_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| } // mirroring::mojom |
| |
| namespace std { |
| |
| template <> |
| struct hash<::mirroring::mojom::SessionType> |
| : public mojo::internal::EnumHashImpl<::mirroring::mojom::SessionType> {}; |
| |
| } // namespace std |
| |
| namespace mojo { |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mirroring::mojom::SessionType, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mirroring::mojom::SessionType, 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<::mirroring::mojom::SessionType>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mirroring::mojom::SessionParametersDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mirroring::mojom::SessionParametersDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mirroring::mojom::internal::SessionParameters_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| mojo::internal::Serialize<::mirroring::mojom::SessionType>( |
| Traits::type(input), &fragment->type); |
| decltype(Traits::receiver_address(input)) in_receiver_address = Traits::receiver_address(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->receiver_address)::BaseType> receiver_address_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::network::mojom::IPAddressDataView>( |
| in_receiver_address, receiver_address_fragment); |
| fragment->receiver_address.Set( |
| receiver_address_fragment.is_null() ? nullptr : receiver_address_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->receiver_address.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null receiver_address in SessionParameters struct"); |
| decltype(Traits::receiver_model_name(input)) in_receiver_model_name = Traits::receiver_model_name(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->receiver_model_name)::BaseType> receiver_model_name_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_receiver_model_name, receiver_model_name_fragment); |
| fragment->receiver_model_name.Set( |
| receiver_model_name_fragment.is_null() ? nullptr : receiver_model_name_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->receiver_model_name.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null receiver_model_name in SessionParameters struct"); |
| decltype(Traits::receiver_friendly_name(input)) in_receiver_friendly_name = Traits::receiver_friendly_name(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->receiver_friendly_name)::BaseType> receiver_friendly_name_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_receiver_friendly_name, receiver_friendly_name_fragment); |
| fragment->receiver_friendly_name.Set( |
| receiver_friendly_name_fragment.is_null() ? nullptr : receiver_friendly_name_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->receiver_friendly_name.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null receiver_friendly_name in SessionParameters struct"); |
| decltype(Traits::source_id(input)) in_source_id = Traits::source_id(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->source_id)::BaseType> source_id_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_source_id, source_id_fragment); |
| fragment->source_id.Set( |
| source_id_fragment.is_null() ? nullptr : source_id_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->source_id.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null source_id in SessionParameters struct"); |
| decltype(Traits::destination_id(input)) in_destination_id = Traits::destination_id(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->destination_id)::BaseType> destination_id_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_destination_id, destination_id_fragment); |
| fragment->destination_id.Set( |
| destination_id_fragment.is_null() ? nullptr : destination_id_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->destination_id.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null destination_id in SessionParameters struct"); |
| decltype(Traits::target_playout_delay(input)) in_target_playout_delay = Traits::target_playout_delay(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->target_playout_delay)::BaseType> target_playout_delay_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo_base::mojom::TimeDeltaDataView>( |
| in_target_playout_delay, target_playout_delay_fragment); |
| fragment->target_playout_delay.Set( |
| target_playout_delay_fragment.is_null() ? nullptr : target_playout_delay_fragment.data()); |
| fragment->is_remote_playback = Traits::is_remote_playback(input); |
| fragment->force_letterboxing = Traits::force_letterboxing(input); |
| fragment->enable_rtcp_reporting = Traits::enable_rtcp_reporting(input); |
| } |
| |
| static bool Deserialize(::mirroring::mojom::internal::SessionParameters_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mirroring::mojom::SessionParametersDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| } // namespace mojo |
| |
| |
| namespace mirroring::mojom { |
| |
| inline void SessionParametersDataView::GetReceiverAddressDataView( |
| ::network::mojom::IPAddressDataView* output) { |
| auto pointer = data_->receiver_address.Get(); |
| *output = ::network::mojom::IPAddressDataView(pointer, message_); |
| } |
| inline void SessionParametersDataView::GetReceiverModelNameDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->receiver_model_name.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void SessionParametersDataView::GetReceiverFriendlyNameDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->receiver_friendly_name.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void SessionParametersDataView::GetSourceIdDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->source_id.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void SessionParametersDataView::GetDestinationIdDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->destination_id.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void SessionParametersDataView::GetTargetPlayoutDelayDataView( |
| ::mojo_base::mojom::TimeDeltaDataView* output) { |
| auto pointer = data_->target_playout_delay.Get(); |
| *output = ::mojo_base::mojom::TimeDeltaDataView(pointer, message_); |
| } |
| |
| |
| |
| } // mirroring::mojom |
| |
| // Declare TraceFormatTraits for enums, which should be defined in ::perfetto |
| // namespace. |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mirroring::mojom::SessionType> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mirroring::mojom::SessionType value); |
| }; |
| |
| } // namespace perfetto |
| |
| #endif // COMPONENTS_MIRRORING_MOJOM_SESSION_PARAMETERS_MOJOM_SHARED_H_
|
| /* Metadata comment
|
| eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi
|
| ZWdpbiI6IDE4MTMsICJlbmQiOiAxODI0LCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1vam9tIiwg
|
| ImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hyb21pdW0v
|
| c3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJtaXJyb3JpbmcubW9qb20uU2Vzc2lvblR5cGUifSwg
|
| ImVkZ2UiOiAiJS9reXRoZS9lZGdlL2dlbmVyYXRlcyJ9LCB7InR5cGUiOiAiYW5jaG9yX2RlZmlu
|
| ZXMiLCAiYmVnaW4iOiAxOTAxLCAiZW5kIjogMTkxMSwgInZuYW1lIjogeyJsYW5ndWFnZSI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