| // camera/mojo/camera_metadata.mojom.cc 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. |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wunused-private-field" |
| #endif |
| |
| #include "camera/mojo/camera_metadata.mojom.h" |
| |
| #include <math.h> |
| #include <stdint.h> |
| #include <utility> |
| |
| #include "base/debug/alias.h" |
| #include "base/hash/md5_constexpr.h" |
| #include "base/run_loop.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/task/thread_pool/thread_pool_instance.h" |
| #include "base/trace_event/trace_event.h" |
| #include "base/trace_event/typed_macros.h" |
| #include "mojo/public/cpp/bindings/features.h" |
| #include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h" |
| #include "mojo/public/cpp/bindings/lib/generated_code_util.h" |
| #include "mojo/public/cpp/bindings/lib/message_internal.h" |
| #include "mojo/public/cpp/bindings/lib/proxy_to_responder.h" |
| #include "mojo/public/cpp/bindings/lib/send_message_helper.h" |
| #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| #include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/cpp/bindings/mojo_buildflags.h" |
| #include "mojo/public/cpp/bindings/urgent_message_scope.h" |
| #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
| |
| #include "camera/mojo/camera_metadata.mojom-params-data.h" |
| #include "camera/mojo/camera_metadata.mojom-shared-message-ids.h" |
| |
| #include "camera/mojo/camera_metadata.mojom-import-headers.h" |
| #include "camera/mojo/camera_metadata.mojom-test-utils.h" |
| |
| |
| namespace cros::mojom { |
| CameraMetadataEntry::CameraMetadataEntry() |
| : index(), |
| tag(), |
| type(), |
| count(), |
| data() {} |
| |
| CameraMetadataEntry::CameraMetadataEntry( |
| uint32_t index_in, |
| ::cros::mojom::CameraMetadataTag tag_in, |
| EntryType type_in, |
| uint32_t count_in, |
| std::vector<uint8_t> data_in) |
| : index(std::move(index_in)), |
| tag(std::move(tag_in)), |
| type(std::move(type_in)), |
| count(std::move(count_in)), |
| data(std::move(data_in)) {} |
| |
| CameraMetadataEntry::~CameraMetadataEntry() = default; |
| |
| void CameraMetadataEntry::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "index"), this->index, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "tag"), this->tag, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::cros::mojom::CameraMetadataTag>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "type"), this->type, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type EntryType>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "count"), this->count, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "data"), this->data, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const std::vector<uint8_t>&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool CameraMetadataEntry::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| CameraMetadata::CameraMetadata() |
| : size(), |
| entry_count(), |
| entry_capacity(), |
| data_count(), |
| data_capacity(), |
| entries() {} |
| |
| CameraMetadata::CameraMetadata( |
| uint32_t size_in, |
| uint32_t entry_count_in, |
| uint32_t entry_capacity_in, |
| uint32_t data_count_in, |
| uint32_t data_capacity_in, |
| std::optional<std::vector<CameraMetadataEntryPtr>> entries_in) |
| : size(std::move(size_in)), |
| entry_count(std::move(entry_count_in)), |
| entry_capacity(std::move(entry_capacity_in)), |
| data_count(std::move(data_count_in)), |
| data_capacity(std::move(data_capacity_in)), |
| entries(std::move(entries_in)) {} |
| |
| CameraMetadata::~CameraMetadata() = default; |
| |
| void CameraMetadata::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "size"), this->size, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "entry_count"), this->entry_count, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "entry_capacity"), this->entry_capacity, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "data_count"), this->data_count, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "data_capacity"), this->data_capacity, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "entries"), this->entries, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::optional<std::vector<CameraMetadataEntryPtr>>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool CameraMetadata::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| |
| |
| } // cros::mojom |
| |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::CameraMetadataEntry::DataView, ::cros::mojom::CameraMetadataEntryPtr>::Read( |
| ::cros::mojom::CameraMetadataEntry::DataView input, |
| ::cros::mojom::CameraMetadataEntryPtr* output) { |
| bool success = true; |
| ::cros::mojom::CameraMetadataEntryPtr result(::cros::mojom::CameraMetadataEntry::New()); |
| |
| if (success) |
| result->index = input.index(); |
| if (success && !input.ReadTag(&result->tag)) |
| success = false; |
| if (success && !input.ReadType(&result->type)) |
| success = false; |
| if (success) |
| result->count = input.count(); |
| if (success && !input.ReadData(&result->data)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::CameraMetadata::DataView, ::cros::mojom::CameraMetadataPtr>::Read( |
| ::cros::mojom::CameraMetadata::DataView input, |
| ::cros::mojom::CameraMetadataPtr* output) { |
| bool success = true; |
| ::cros::mojom::CameraMetadataPtr result(::cros::mojom::CameraMetadata::New()); |
| |
| if (success) |
| result->size = input.size(); |
| if (success) |
| result->entry_count = input.entry_count(); |
| if (success) |
| result->entry_capacity = input.entry_capacity(); |
| if (success) |
| result->data_count = input.data_count(); |
| if (success) |
| result->data_capacity = input.data_capacity(); |
| if (success && !input.ReadEntries(&result->entries)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| |
| // Symbols declared in the -test-utils.h header are defined here instead of a |
| // separate .cc file to save compile time. |
| |
| |
| namespace cros::mojom { |
| |
| |
| |
| |
| } // cros::mojom |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |