| // gpu/ipc/common/shared_image_metadata.mojom-blink.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef GPU_IPC_COMMON_SHARED_IMAGE_METADATA_MOJOM_BLINK_H_ |
| #define GPU_IPC_COMMON_SHARED_IMAGE_METADATA_MOJOM_BLINK_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <optional> |
| #include <type_traits> |
| #include <utility> |
| #include "mojo/public/cpp/bindings/clone_traits.h" |
| #include "mojo/public/cpp/bindings/equals_traits.h" |
| #include "mojo/public/cpp/bindings/struct_ptr.h" |
| #include "mojo/public/cpp/bindings/struct_traits.h" |
| #include "mojo/public/cpp/bindings/union_traits.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "gpu/ipc/common/shared_image_metadata.mojom-features.h" // IWYU pragma: export |
| #include "gpu/ipc/common/shared_image_metadata.mojom-shared.h" // IWYU pragma: export |
| #include "gpu/ipc/common/shared_image_metadata.mojom-blink-forward.h" // IWYU pragma: export |
| #include "services/viz/public/mojom/compositing/shared_image_format.mojom-blink.h" |
| #include "ui/gfx/geometry/mojom/geometry.mojom-blink.h" |
| #include "ui/gfx/mojom/color_space.mojom-blink.h" |
| #include "skia/public/mojom/surface_origin.mojom-blink.h" |
| #include "skia/public/mojom/image_info.mojom-blink.h" |
| |
| #include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h" |
| #include "mojo/public/cpp/bindings/lib/wtf_hash_util.h" |
| #include "third_party/blink/renderer/platform/wtf/hash_functions.h" |
| #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" |
| |
| |
| |
| |
| #include "gpu/ipc/common/shared_image_metadata_mojom_traits.h" |
| #include "third_party/blink/public/platform/web_common.h" |
| #if !BLINK_MOJO_IMPL && !INSIDE_BLINK |
| #error "File must only be imported inside blink" |
| #endif |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace gpu::mojom::blink { |
| |
| |
| |
| |
| |
| |
| |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata |
| class BLINK_PLATFORM_EXPORT SharedImageMetadata { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<SharedImageMetadata, T>::value>; |
| using DataView = SharedImageMetadataDataView; |
| using Data_ = internal::SharedImageMetadata_Data; |
| |
| template <typename... Args> |
| static SharedImageMetadataPtr New(Args&&... args) { |
| return SharedImageMetadataPtr( |
| std::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static SharedImageMetadataPtr From(const U& u) { |
| return mojo::TypeConverter<SharedImageMetadataPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, SharedImageMetadata>::Convert(*this); |
| } |
| |
| |
| SharedImageMetadata(); |
| |
| SharedImageMetadata( |
| ::viz::mojom::blink::SharedImageFormatPtr format, |
| const ::gfx::Size& size, |
| const ::gfx::ColorSpace& color_space, |
| ::GrSurfaceOrigin surface_origin, |
| ::SkAlphaType alpha_type, |
| uint32_t usage); |
| |
| SharedImageMetadata(const SharedImageMetadata&) = delete; |
| SharedImageMetadata& operator=(const SharedImageMetadata&) = delete; |
| |
| ~SharedImageMetadata(); |
| |
| // Clone() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Clone() or copy |
| // constructor/assignment are available for members. |
| template <typename StructPtrType = SharedImageMetadataPtr> |
| SharedImageMetadataPtr Clone() const; |
| |
| // Equals() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Equals() or == operator |
| // are available for members. |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool operator!=(const T& rhs) const { return !operator==(rhs); } |
| |
| template <mojo::internal::SendValidation send_validation, typename UserType> |
| static ::blink::Vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| SharedImageMetadata::DataView, ::blink::Vector<uint8_t>, send_validation>(input); |
| } |
| |
| template <typename UserType> |
| static ::blink::Vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| SharedImageMetadata::DataView, ::blink::Vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| SharedImageMetadata::DataView>(input); |
| } |
| |
| // The returned Message is serialized only if the message is moved |
| // cross-process or cross-language. Otherwise if the message is Deserialized |
| // as the same UserType |input| will just be moved to |output| in |
| // DeserializeFromMessage. |
| template <typename UserType> |
| static mojo::Message WrapAsMessage(UserType input) { |
| return mojo::Message(std::make_unique< |
| internal::SharedImageMetadata_UnserializedMessageContext< |
| UserType, SharedImageMetadata::DataView>>(0, 0, std::move(input)), |
| MOJO_CREATE_MESSAGE_FLAG_NONE); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| mojo::Message message; |
| return mojo::internal::DeserializeImpl<SharedImageMetadata::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(base::span<const uint8_t> input, |
| UserType* output) { |
| return SharedImageMetadata::Deserialize( |
| input.empty() ? nullptr : input.data(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::SharedImageMetadata_UnserializedMessageContext< |
| UserType, SharedImageMetadata::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<SharedImageMetadata::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata.format |
| ::viz::mojom::blink::SharedImageFormatPtr format; |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata.size |
| ::gfx::Size size; |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata.color_space |
| ::gfx::ColorSpace color_space; |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata.surface_origin |
| ::GrSurfaceOrigin surface_origin; |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata.alpha_type |
| ::SkAlphaType alpha_type; |
| |
| // @generated_from: gpu.mojom.SharedImageMetadata.usage |
| uint32_t usage; |
| |
| // Serialise this struct into a trace. |
| void WriteIntoTrace(perfetto::TracedValue traced_context) const; |
| |
| private: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| }; |
| |
| // The comparison operators are templates, so they are only instantiated if they |
| // are used. Thus, the bindings generator does not need to know whether |
| // comparison operators are available for members. |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| template <typename StructPtrType> |
| SharedImageMetadataPtr SharedImageMetadata::Clone() const { |
| return New( |
| mojo::Clone(format), |
| mojo::Clone(size), |
| mojo::Clone(color_space), |
| mojo::Clone(surface_origin), |
| mojo::Clone(alpha_type), |
| mojo::Clone(usage) |
| ); |
| } |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>*> |
| bool SharedImageMetadata::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->format, other_struct.format)) |
| return false; |
| if (!mojo::Equals(this->size, other_struct.size)) |
| return false; |
| if (!mojo::Equals(this->color_space, other_struct.color_space)) |
| return false; |
| if (!mojo::Equals(this->surface_origin, other_struct.surface_origin)) |
| return false; |
| if (!mojo::Equals(this->alpha_type, other_struct.alpha_type)) |
| return false; |
| if (!mojo::Equals(this->usage, other_struct.usage)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, SharedImageMetadata::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.format < rhs.format) |
| return true; |
| if (rhs.format < lhs.format) |
| return false; |
| if (lhs.size < rhs.size) |
| return true; |
| if (rhs.size < lhs.size) |
| return false; |
| if (lhs.color_space < rhs.color_space) |
| return true; |
| if (rhs.color_space < lhs.color_space) |
| return false; |
| if (lhs.surface_origin < rhs.surface_origin) |
| return true; |
| if (rhs.surface_origin < lhs.surface_origin) |
| return false; |
| if (lhs.alpha_type < rhs.alpha_type) |
| return true; |
| if (rhs.alpha_type < lhs.alpha_type) |
| return false; |
| if (lhs.usage < rhs.usage) |
| return true; |
| if (rhs.usage < lhs.usage) |
| return false; |
| return false; |
| } |
| |
| |
| } // gpu::mojom::blink |
| |
| namespace mojo { |
| |
| |
| template <> |
| struct BLINK_PLATFORM_EXPORT StructTraits<::gpu::mojom::blink::SharedImageMetadata::DataView, |
| ::gpu::mojom::blink::SharedImageMetadataPtr> { |
| static bool IsNull(const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { return !input; } |
| static void SetToNull(::gpu::mojom::blink::SharedImageMetadataPtr* output) { output->reset(); } |
| |
| static const decltype(::gpu::mojom::blink::SharedImageMetadata::format)& format( |
| const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { |
| return input->format; |
| } |
| |
| static const decltype(::gpu::mojom::blink::SharedImageMetadata::size)& size( |
| const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { |
| return input->size; |
| } |
| |
| static const decltype(::gpu::mojom::blink::SharedImageMetadata::color_space)& color_space( |
| const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { |
| return input->color_space; |
| } |
| |
| static decltype(::gpu::mojom::blink::SharedImageMetadata::surface_origin) surface_origin( |
| const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { |
| return input->surface_origin; |
| } |
| |
| static decltype(::gpu::mojom::blink::SharedImageMetadata::alpha_type) alpha_type( |
| const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { |
| return input->alpha_type; |
| } |
| |
| static decltype(::gpu::mojom::blink::SharedImageMetadata::usage) usage( |
| const ::gpu::mojom::blink::SharedImageMetadataPtr& input) { |
| return input->usage; |
| } |
| |
| static bool Read(::gpu::mojom::blink::SharedImageMetadata::DataView input, ::gpu::mojom::blink::SharedImageMetadataPtr* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // GPU_IPC_COMMON_SHARED_IMAGE_METADATA_MOJOM_BLINK_H_ |
| |
| /* Metadata comment |
| eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi |
| ZWdpbiI6IDIwNjcsICJlbmQiOiAyMDg2LCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1vam9tIiwg |
| ImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hyb21pdW0v |
| c3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJncHUubW9qb20uU2hhcmVkSW1hZ2VNZXRhZGF0YSJ9 |
| LCAiZWRnZSI6ICIlL2t5dGhlL2VkZ2UvZ2VuZXJhdGVzIn0sIHsidHlwZSI6ICJhbmNob3JfZGVm |
| aW5lcyIsICJiZWdpbiI6IDY2MjIsICJlbmQiOiA2NjI4LCAidm5hbWUiOiB7Imxhbmd1YWdlIjog |
| Im1vam9tIiwgImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbG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