| // gpu/ipc/common/mailbox.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2025 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_MAILBOX_MOJOM_DATA_VIEW_H_ |
| #define GPU_IPC_COMMON_MAILBOX_MOJOM_DATA_VIEW_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/map_data_view.h" |
| #include "mojo/public/cpp/bindings/string_data_view.h" |
| |
| #include "gpu/ipc/common/mailbox.mojom-shared-internal.h" |
| |
| |
| namespace gpu::mojom { |
| class MailboxDataView; |
| |
| |
| |
| } // gpu::mojom |
| |
| |
| namespace mojo { |
| namespace internal { |
| |
| template <> |
| struct MojomTypeTraits<::gpu::mojom::MailboxDataView> { |
| using Data = ::gpu::mojom::internal::Mailbox_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| } // namespace internal |
| } // namespace mojo |
| |
| |
| namespace gpu::mojom { |
| |
| |
| class MailboxDataView { |
| public: |
| MailboxDataView() = default; |
| |
| MailboxDataView( |
| internal::Mailbox_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetNameDataView( |
| mojo::ArrayDataView<int8_t>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadName(UserType* output) { |
| |
| auto* pointer = data_->name.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<int8_t>>( |
| pointer, output, message_); |
| } |
| private: |
| internal::Mailbox_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| } // gpu::mojom |
| |
| #endif // GPU_IPC_COMMON_MAILBOX_MOJOM_DATA_VIEW_H_ |