| // Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef GPU_IPC_COMMON_GPU_FEATURE_INFO_MOJOM_BLINK_H_ |
| #define GPU_IPC_COMMON_GPU_FEATURE_INFO_MOJOM_BLINK_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "base/callback.h" |
| #include "base/macros.h" |
| #include "base/optional.h" |
| |
| #include "mojo/public/cpp/bindings/mojo_buildflags.h" |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| #include "base/trace_event/trace_event.h" |
| #endif |
| #include "mojo/public/cpp/bindings/clone_traits.h" |
| #include "mojo/public/cpp/bindings/equals_traits.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.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 "gpu/ipc/common/gpu_feature_info.mojom-shared.h" |
| #include "gpu/ipc/common/gpu_feature_info.mojom-blink-forward.h" |
| #include "ui/gfx/mojo/buffer_types.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 "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
| #include "mojo/public/cpp/bindings/associated_interface_request.h" |
| #include "mojo/public/cpp/bindings/interface_ptr.h" |
| #include "mojo/public/cpp/bindings/interface_request.h" |
| #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" |
| #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" |
| |
| |
| #include "mojo/public/cpp/bindings/lib/native_enum_serialization.h" |
| #include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace WTF { |
| struct gpu_mojom_internal_GpuFeatureStatus_DataHashFn { |
| static unsigned GetHash(const ::gpu::mojom::GpuFeatureStatus& value) { |
| using utype = std::underlying_type<::gpu::mojom::GpuFeatureStatus>::type; |
| return DefaultHash<utype>::Hash().GetHash(static_cast<utype>(value)); |
| } |
| static bool Equal(const ::gpu::mojom::GpuFeatureStatus& left, const ::gpu::mojom::GpuFeatureStatus& right) { |
| return left == right; |
| } |
| static const bool safe_to_compare_to_empty_or_deleted = true; |
| }; |
| |
| template <> |
| struct HashTraits<::gpu::mojom::GpuFeatureStatus> |
| : public GenericHashTraits<::gpu::mojom::GpuFeatureStatus> { |
| static_assert(true, |
| "-1000000 is a reserved enum value"); |
| static_assert(true, |
| "-1000001 is a reserved enum value"); |
| static const bool hasIsEmptyValueFunction = true; |
| static bool IsEmptyValue(const ::gpu::mojom::GpuFeatureStatus& value) { |
| return value == static_cast<::gpu::mojom::GpuFeatureStatus>(-1000000); |
| } |
| static void ConstructDeletedValue(::gpu::mojom::GpuFeatureStatus& slot, bool) { |
| slot = static_cast<::gpu::mojom::GpuFeatureStatus>(-1000001); |
| } |
| static bool IsDeletedValue(const ::gpu::mojom::GpuFeatureStatus& value) { |
| return value == static_cast<::gpu::mojom::GpuFeatureStatus>(-1000001); |
| } |
| }; |
| } // namespace WTF |
| |
| |
| namespace gpu { |
| namespace mojom { |
| namespace blink { |
| |
| |
| |
| |
| |
| |
| |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo |
| class GpuFeatureInfo { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<GpuFeatureInfo, T>::value>; |
| using DataView = GpuFeatureInfoDataView; |
| using Data_ = internal::GpuFeatureInfo_Data; |
| |
| template <typename... Args> |
| static GpuFeatureInfoPtr New(Args&&... args) { |
| return GpuFeatureInfoPtr( |
| base::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static GpuFeatureInfoPtr From(const U& u) { |
| return mojo::TypeConverter<GpuFeatureInfoPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, GpuFeatureInfo>::Convert(*this); |
| } |
| |
| |
| GpuFeatureInfo(); |
| |
| GpuFeatureInfo( |
| const WTF::Vector<GpuFeatureStatus>& status_values, |
| const WTF::Vector<int32_t>& enabled_gpu_driver_bug_workarounds, |
| const WTF::String& disabled_extensions, |
| const WTF::String& disabled_webgl_extensions, |
| const WTF::Vector<uint32_t>& applied_gpu_blacklist_entries, |
| const WTF::Vector<uint32_t>& applied_gpu_driver_bug_list_entries, |
| const WTF::Vector<::gfx::mojom::blink::BufferFormat>& supported_buffer_formats_for_allocation_and_texturing); |
| |
| ~GpuFeatureInfo(); |
| |
| // 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 = GpuFeatureInfoPtr> |
| GpuFeatureInfoPtr 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, GpuFeatureInfo::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename UserType> |
| static WTF::Vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| GpuFeatureInfo::DataView, WTF::Vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| GpuFeatureInfo::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::GpuFeatureInfo_UnserializedMessageContext< |
| UserType, GpuFeatureInfo::DataView>>(0, 0, std::move(input))); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| return mojo::internal::DeserializeImpl<GpuFeatureInfo::DataView>( |
| data, data_num_bytes, std::vector<mojo::ScopedHandle>(), output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const WTF::Vector<uint8_t>& input, |
| UserType* output) { |
| return GpuFeatureInfo::Deserialize( |
| input.size() == 0 ? nullptr : &input.front(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::GpuFeatureInfo_UnserializedMessageContext< |
| UserType, GpuFeatureInfo::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<GpuFeatureInfo::DataView>( |
| input.payload(), input.payload_num_bytes(), |
| std::move(*input.mutable_handles()), output, Validate); |
| } |
| |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.status_values |
| WTF::Vector<GpuFeatureStatus> status_values; |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.enabled_gpu_driver_bug_workarounds |
| WTF::Vector<int32_t> enabled_gpu_driver_bug_workarounds; |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.disabled_extensions |
| WTF::String disabled_extensions; |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.disabled_webgl_extensions |
| WTF::String disabled_webgl_extensions; |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.applied_gpu_blacklist_entries |
| WTF::Vector<uint32_t> applied_gpu_blacklist_entries; |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.applied_gpu_driver_bug_list_entries |
| WTF::Vector<uint32_t> applied_gpu_driver_bug_list_entries; |
| |
| // @generated_from: gpu.mojom.GpuFeatureInfo.supported_buffer_formats_for_allocation_and_texturing |
| WTF::Vector<::gfx::mojom::blink::BufferFormat> supported_buffer_formats_for_allocation_and_texturing; |
| |
| 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, GpuFeatureInfo::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, GpuFeatureInfo::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, GpuFeatureInfo::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, GpuFeatureInfo::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| template <typename StructPtrType> |
| GpuFeatureInfoPtr GpuFeatureInfo::Clone() const { |
| return New( |
| mojo::Clone(status_values), |
| mojo::Clone(enabled_gpu_driver_bug_workarounds), |
| mojo::Clone(disabled_extensions), |
| mojo::Clone(disabled_webgl_extensions), |
| mojo::Clone(applied_gpu_blacklist_entries), |
| mojo::Clone(applied_gpu_driver_bug_list_entries), |
| mojo::Clone(supported_buffer_formats_for_allocation_and_texturing) |
| ); |
| } |
| |
| template <typename T, GpuFeatureInfo::EnableIfSame<T>*> |
| bool GpuFeatureInfo::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->status_values, other_struct.status_values)) |
| return false; |
| if (!mojo::Equals(this->enabled_gpu_driver_bug_workarounds, other_struct.enabled_gpu_driver_bug_workarounds)) |
| return false; |
| if (!mojo::Equals(this->disabled_extensions, other_struct.disabled_extensions)) |
| return false; |
| if (!mojo::Equals(this->disabled_webgl_extensions, other_struct.disabled_webgl_extensions)) |
| return false; |
| if (!mojo::Equals(this->applied_gpu_blacklist_entries, other_struct.applied_gpu_blacklist_entries)) |
| return false; |
| if (!mojo::Equals(this->applied_gpu_driver_bug_list_entries, other_struct.applied_gpu_driver_bug_list_entries)) |
| return false; |
| if (!mojo::Equals(this->supported_buffer_formats_for_allocation_and_texturing, other_struct.supported_buffer_formats_for_allocation_and_texturing)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, GpuFeatureInfo::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.status_values < rhs.status_values) |
| return true; |
| if (rhs.status_values < lhs.status_values) |
| return false; |
| if (lhs.enabled_gpu_driver_bug_workarounds < rhs.enabled_gpu_driver_bug_workarounds) |
| return true; |
| if (rhs.enabled_gpu_driver_bug_workarounds < lhs.enabled_gpu_driver_bug_workarounds) |
| return false; |
| if (lhs.disabled_extensions < rhs.disabled_extensions) |
| return true; |
| if (rhs.disabled_extensions < lhs.disabled_extensions) |
| return false; |
| if (lhs.disabled_webgl_extensions < rhs.disabled_webgl_extensions) |
| return true; |
| if (rhs.disabled_webgl_extensions < lhs.disabled_webgl_extensions) |
| return false; |
| if (lhs.applied_gpu_blacklist_entries < rhs.applied_gpu_blacklist_entries) |
| return true; |
| if (rhs.applied_gpu_blacklist_entries < lhs.applied_gpu_blacklist_entries) |
| return false; |
| if (lhs.applied_gpu_driver_bug_list_entries < rhs.applied_gpu_driver_bug_list_entries) |
| return true; |
| if (rhs.applied_gpu_driver_bug_list_entries < lhs.applied_gpu_driver_bug_list_entries) |
| return false; |
| if (lhs.supported_buffer_formats_for_allocation_and_texturing < rhs.supported_buffer_formats_for_allocation_and_texturing) |
| return true; |
| if (rhs.supported_buffer_formats_for_allocation_and_texturing < lhs.supported_buffer_formats_for_allocation_and_texturing) |
| return false; |
| return false; |
| } |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace gpu |
| |
| namespace mojo { |
| |
| |
| template <> |
| struct StructTraits<::gpu::mojom::blink::GpuFeatureInfo::DataView, |
| ::gpu::mojom::blink::GpuFeatureInfoPtr> { |
| static bool IsNull(const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { return !input; } |
| static void SetToNull(::gpu::mojom::blink::GpuFeatureInfoPtr* output) { output->reset(); } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::status_values)& status_values( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->status_values; |
| } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::enabled_gpu_driver_bug_workarounds)& enabled_gpu_driver_bug_workarounds( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->enabled_gpu_driver_bug_workarounds; |
| } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::disabled_extensions)& disabled_extensions( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->disabled_extensions; |
| } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::disabled_webgl_extensions)& disabled_webgl_extensions( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->disabled_webgl_extensions; |
| } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::applied_gpu_blacklist_entries)& applied_gpu_blacklist_entries( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->applied_gpu_blacklist_entries; |
| } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::applied_gpu_driver_bug_list_entries)& applied_gpu_driver_bug_list_entries( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->applied_gpu_driver_bug_list_entries; |
| } |
| |
| static const decltype(::gpu::mojom::blink::GpuFeatureInfo::supported_buffer_formats_for_allocation_and_texturing)& supported_buffer_formats_for_allocation_and_texturing( |
| const ::gpu::mojom::blink::GpuFeatureInfoPtr& input) { |
| return input->supported_buffer_formats_for_allocation_and_texturing; |
| } |
| |
| static bool Read(::gpu::mojom::blink::GpuFeatureInfo::DataView input, ::gpu::mojom::blink::GpuFeatureInfoPtr* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // GPU_IPC_COMMON_GPU_FEATURE_INFO_MOJOM_BLINK_H_
|
| /* Metadata comment
|
| eyJtZXRhIjogW3siZW5kIjogMzQ5MiwgImJlZ2luIjogMzQ3OCwgImVkZ2UiOiAiJS9reXRoZS9l
|
| ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw
|
| dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui
|
| OiAibW9qb20iLCAic2lnbmF0dXJlIjogImdwdS5tb2pvbS5HcHVGZWF0dXJlSW5mbyJ9fSwgeyJl
|
| bmQiOiA3NDg1LCAiYmVnaW4iOiA3NDcyLCAiZWRnZSI6ICIlL2t5dGhlL2VkZ2UvZ2VuZXJhdGVz
|
| IiwgInR5cGUiOiAiYW5jaG9yX2RlZmluZXMiLCAidm5hbWUiOiB7ImNvcnB1cyI6ICJjaHJvbWl1
|
| bS5nb29nbGVzb3VyY2UuY29tL2Nocm9taXVtL3NyYyIsICJsYW5ndWFnZSI6ICJtb2pvbSIsICJz
|
| aWduYXR1cmUiOiAiZ3B1Lm1vam9tLkdwdUZlYXR1cmVJbmZvLnN0YXR1c192YWx1ZXMifX0sIHsi
|
| ZW5kIjogNzYyNywgImJlZ2luIjogNzU5MywgImVkZ2UiOiAiJS9reXRoZS9lZGdlL2dlbmVyYXRl
|
| cyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3JwdXMiOiAiY2hyb21p
|
| dW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2UiOiAibW9qb20iLCAi
|
| c2lnbmF0dXJlIjogImdwdS5t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