| // media/capture/video/chromeos/mojom/camera3.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 "media/capture/video/chromeos/mojom/camera3.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 "media/capture/video/chromeos/mojom/camera3.mojom-params-data.h" |
| #include "media/capture/video/chromeos/mojom/camera3.mojom-shared-message-ids.h" |
| |
| #include "media/capture/video/chromeos/mojom/camera3.mojom-import-headers.h" |
| #include "media/capture/video/chromeos/mojom/camera3.mojom-test-utils.h" |
| |
| |
| namespace cros::mojom { |
| CropRotateScaleInfo::CropRotateScaleInfo() |
| : crop_rotate_scale_degrees() {} |
| |
| CropRotateScaleInfo::CropRotateScaleInfo( |
| Camera3StreamRotation crop_rotate_scale_degrees_in) |
| : crop_rotate_scale_degrees(std::move(crop_rotate_scale_degrees_in)) {} |
| |
| CropRotateScaleInfo::~CropRotateScaleInfo() = default; |
| size_t CropRotateScaleInfo::Hash(size_t seed) const { |
| seed = mojo::internal::Hash(seed, this->crop_rotate_scale_degrees); |
| return seed; |
| } |
| |
| void CropRotateScaleInfo::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "crop_rotate_scale_degrees"), this->crop_rotate_scale_degrees, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamRotation>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool CropRotateScaleInfo::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3Stream::Camera3Stream() |
| : id(), |
| stream_type(), |
| width(), |
| height(), |
| format(), |
| usage(), |
| max_buffers(), |
| data_space(), |
| rotation(), |
| crop_rotate_scale_info(), |
| physical_camera_id(), |
| effects() {} |
| |
| Camera3Stream::Camera3Stream( |
| uint64_t id_in, |
| Camera3StreamType stream_type_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| HalPixelFormat format_in, |
| uint32_t usage_in, |
| uint32_t max_buffers_in, |
| uint32_t data_space_in, |
| Camera3StreamRotation rotation_in) |
| : id(std::move(id_in)), |
| stream_type(std::move(stream_type_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| format(std::move(format_in)), |
| usage(std::move(usage_in)), |
| max_buffers(std::move(max_buffers_in)), |
| data_space(std::move(data_space_in)), |
| rotation(std::move(rotation_in)), |
| crop_rotate_scale_info(), |
| physical_camera_id(), |
| effects() {} |
| |
| Camera3Stream::Camera3Stream( |
| uint64_t id_in, |
| Camera3StreamType stream_type_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| HalPixelFormat format_in, |
| uint32_t usage_in, |
| uint32_t max_buffers_in, |
| uint32_t data_space_in, |
| Camera3StreamRotation rotation_in, |
| CropRotateScaleInfoPtr crop_rotate_scale_info_in) |
| : id(std::move(id_in)), |
| stream_type(std::move(stream_type_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| format(std::move(format_in)), |
| usage(std::move(usage_in)), |
| max_buffers(std::move(max_buffers_in)), |
| data_space(std::move(data_space_in)), |
| rotation(std::move(rotation_in)), |
| crop_rotate_scale_info(std::move(crop_rotate_scale_info_in)), |
| physical_camera_id(), |
| effects() {} |
| |
| Camera3Stream::Camera3Stream( |
| uint64_t id_in, |
| Camera3StreamType stream_type_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| HalPixelFormat format_in, |
| uint32_t usage_in, |
| uint32_t max_buffers_in, |
| uint32_t data_space_in, |
| Camera3StreamRotation rotation_in, |
| CropRotateScaleInfoPtr crop_rotate_scale_info_in, |
| const std::optional<std::string>& physical_camera_id_in) |
| : id(std::move(id_in)), |
| stream_type(std::move(stream_type_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| format(std::move(format_in)), |
| usage(std::move(usage_in)), |
| max_buffers(std::move(max_buffers_in)), |
| data_space(std::move(data_space_in)), |
| rotation(std::move(rotation_in)), |
| crop_rotate_scale_info(std::move(crop_rotate_scale_info_in)), |
| physical_camera_id(std::move(physical_camera_id_in)), |
| effects() {} |
| |
| Camera3Stream::Camera3Stream( |
| uint64_t id_in, |
| Camera3StreamType stream_type_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| HalPixelFormat format_in, |
| uint32_t usage_in, |
| uint32_t max_buffers_in, |
| uint32_t data_space_in, |
| Camera3StreamRotation rotation_in, |
| CropRotateScaleInfoPtr crop_rotate_scale_info_in, |
| const std::optional<std::string>& physical_camera_id_in, |
| std::optional<std::vector<::cros::mojom::Camera3StreamEffectPtr>> effects_in) |
| : id(std::move(id_in)), |
| stream_type(std::move(stream_type_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| format(std::move(format_in)), |
| usage(std::move(usage_in)), |
| max_buffers(std::move(max_buffers_in)), |
| data_space(std::move(data_space_in)), |
| rotation(std::move(rotation_in)), |
| crop_rotate_scale_info(std::move(crop_rotate_scale_info_in)), |
| physical_camera_id(std::move(physical_camera_id_in)), |
| effects(std::move(effects_in)) {} |
| |
| Camera3Stream::~Camera3Stream() = default; |
| |
| void Camera3Stream::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "id"), this->id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "stream_type"), this->stream_type, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamType>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "width"), this->width, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "height"), this->height, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "format"), this->format, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type HalPixelFormat>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "usage"), this->usage, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "max_buffers"), this->max_buffers, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "data_space"), this->data_space, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "rotation"), this->rotation, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamRotation>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "crop_rotate_scale_info"), this->crop_rotate_scale_info, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type CropRotateScaleInfoPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "physical_camera_id"), this->physical_camera_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const std::optional<std::string>&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "effects"), this->effects, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::optional<std::vector<::cros::mojom::Camera3StreamEffectPtr>>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3Stream::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3StreamConfiguration::Camera3StreamConfiguration() |
| : streams(), |
| operation_mode(), |
| session_parameters() {} |
| |
| Camera3StreamConfiguration::Camera3StreamConfiguration( |
| std::vector<Camera3StreamPtr> streams_in, |
| Camera3StreamConfigurationMode operation_mode_in) |
| : streams(std::move(streams_in)), |
| operation_mode(std::move(operation_mode_in)), |
| session_parameters() {} |
| |
| Camera3StreamConfiguration::Camera3StreamConfiguration( |
| std::vector<Camera3StreamPtr> streams_in, |
| Camera3StreamConfigurationMode operation_mode_in, |
| ::cros::mojom::CameraMetadataPtr session_parameters_in) |
| : streams(std::move(streams_in)), |
| operation_mode(std::move(operation_mode_in)), |
| session_parameters(std::move(session_parameters_in)) {} |
| |
| Camera3StreamConfiguration::~Camera3StreamConfiguration() = default; |
| |
| void Camera3StreamConfiguration::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "streams"), this->streams, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::vector<Camera3StreamPtr>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "operation_mode"), this->operation_mode, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamConfigurationMode>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "session_parameters"), this->session_parameters, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::cros::mojom::CameraMetadataPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3StreamConfiguration::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| CameraBufferHandle::CameraBufferHandle() |
| : buffer_id(), |
| fds(), |
| drm_format(), |
| hal_pixel_format(), |
| width(), |
| height(), |
| strides(), |
| offsets(), |
| sizes(), |
| has_modifier(), |
| modifier() {} |
| |
| CameraBufferHandle::CameraBufferHandle( |
| uint64_t buffer_id_in, |
| std::vector<::mojo::ScopedHandle> fds_in, |
| uint32_t drm_format_in, |
| HalPixelFormat hal_pixel_format_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| std::vector<uint32_t> strides_in, |
| std::vector<uint32_t> offsets_in) |
| : buffer_id(std::move(buffer_id_in)), |
| fds(std::move(fds_in)), |
| drm_format(std::move(drm_format_in)), |
| hal_pixel_format(std::move(hal_pixel_format_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| strides(std::move(strides_in)), |
| offsets(std::move(offsets_in)), |
| sizes(), |
| has_modifier(), |
| modifier() {} |
| |
| CameraBufferHandle::CameraBufferHandle( |
| uint64_t buffer_id_in, |
| std::vector<::mojo::ScopedHandle> fds_in, |
| uint32_t drm_format_in, |
| HalPixelFormat hal_pixel_format_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| std::vector<uint32_t> strides_in, |
| std::vector<uint32_t> offsets_in, |
| std::optional<std::vector<uint32_t>> sizes_in) |
| : buffer_id(std::move(buffer_id_in)), |
| fds(std::move(fds_in)), |
| drm_format(std::move(drm_format_in)), |
| hal_pixel_format(std::move(hal_pixel_format_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| strides(std::move(strides_in)), |
| offsets(std::move(offsets_in)), |
| sizes(std::move(sizes_in)), |
| has_modifier(), |
| modifier() {} |
| |
| CameraBufferHandle::CameraBufferHandle( |
| uint64_t buffer_id_in, |
| std::vector<::mojo::ScopedHandle> fds_in, |
| uint32_t drm_format_in, |
| HalPixelFormat hal_pixel_format_in, |
| uint32_t width_in, |
| uint32_t height_in, |
| std::vector<uint32_t> strides_in, |
| std::vector<uint32_t> offsets_in, |
| std::optional<std::vector<uint32_t>> sizes_in, |
| bool has_modifier_in, |
| uint64_t modifier_in) |
| : buffer_id(std::move(buffer_id_in)), |
| fds(std::move(fds_in)), |
| drm_format(std::move(drm_format_in)), |
| hal_pixel_format(std::move(hal_pixel_format_in)), |
| width(std::move(width_in)), |
| height(std::move(height_in)), |
| strides(std::move(strides_in)), |
| offsets(std::move(offsets_in)), |
| sizes(std::move(sizes_in)), |
| has_modifier(std::move(has_modifier_in)), |
| modifier(std::move(modifier_in)) {} |
| |
| CameraBufferHandle::~CameraBufferHandle() = default; |
| |
| void CameraBufferHandle::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "buffer_id"), this->buffer_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "fds"), this->fds, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::vector<::mojo::ScopedHandle>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "drm_format"), this->drm_format, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "hal_pixel_format"), this->hal_pixel_format, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type HalPixelFormat>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "width"), this->width, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "height"), this->height, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "strides"), this->strides, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const std::vector<uint32_t>&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "offsets"), this->offsets, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const std::vector<uint32_t>&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "sizes"), this->sizes, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const std::optional<std::vector<uint32_t>>&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "has_modifier"), this->has_modifier, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type bool>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "modifier"), this->modifier, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool CameraBufferHandle::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3StreamBuffer::Camera3StreamBuffer() |
| : stream_id(), |
| buffer_id(), |
| status(), |
| acquire_fence(), |
| release_fence(), |
| buffer_handle() {} |
| |
| Camera3StreamBuffer::Camera3StreamBuffer( |
| uint64_t stream_id_in, |
| uint64_t buffer_id_in, |
| Camera3BufferStatus status_in, |
| ::mojo::ScopedHandle acquire_fence_in, |
| ::mojo::ScopedHandle release_fence_in) |
| : stream_id(std::move(stream_id_in)), |
| buffer_id(std::move(buffer_id_in)), |
| status(std::move(status_in)), |
| acquire_fence(std::move(acquire_fence_in)), |
| release_fence(std::move(release_fence_in)), |
| buffer_handle() {} |
| |
| Camera3StreamBuffer::Camera3StreamBuffer( |
| uint64_t stream_id_in, |
| uint64_t buffer_id_in, |
| Camera3BufferStatus status_in, |
| ::mojo::ScopedHandle acquire_fence_in, |
| ::mojo::ScopedHandle release_fence_in, |
| CameraBufferHandlePtr buffer_handle_in) |
| : stream_id(std::move(stream_id_in)), |
| buffer_id(std::move(buffer_id_in)), |
| status(std::move(status_in)), |
| acquire_fence(std::move(acquire_fence_in)), |
| release_fence(std::move(release_fence_in)), |
| buffer_handle(std::move(buffer_handle_in)) {} |
| |
| Camera3StreamBuffer::~Camera3StreamBuffer() = default; |
| |
| void Camera3StreamBuffer::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "stream_id"), this->stream_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "buffer_id"), this->buffer_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "status"), this->status, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3BufferStatus>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "acquire_fence"), this->acquire_fence, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::mojo::ScopedHandle>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "release_fence"), this->release_fence, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::mojo::ScopedHandle>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "buffer_handle"), this->buffer_handle, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type CameraBufferHandlePtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3StreamBuffer::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3ErrorMsg::Camera3ErrorMsg() |
| : frame_number(), |
| error_stream_id(), |
| error_code() {} |
| |
| Camera3ErrorMsg::Camera3ErrorMsg( |
| uint32_t frame_number_in, |
| uint64_t error_stream_id_in, |
| Camera3ErrorMsgCode error_code_in) |
| : frame_number(std::move(frame_number_in)), |
| error_stream_id(std::move(error_stream_id_in)), |
| error_code(std::move(error_code_in)) {} |
| |
| Camera3ErrorMsg::~Camera3ErrorMsg() = default; |
| size_t Camera3ErrorMsg::Hash(size_t seed) const { |
| seed = mojo::internal::Hash(seed, this->frame_number); |
| seed = mojo::internal::Hash(seed, this->error_stream_id); |
| seed = mojo::internal::Hash(seed, this->error_code); |
| return seed; |
| } |
| |
| void Camera3ErrorMsg::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "frame_number"), this->frame_number, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "error_stream_id"), this->error_stream_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "error_code"), this->error_code, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3ErrorMsgCode>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3ErrorMsg::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3ShutterMsg::Camera3ShutterMsg() |
| : frame_number(), |
| timestamp() {} |
| |
| Camera3ShutterMsg::Camera3ShutterMsg( |
| uint32_t frame_number_in, |
| uint64_t timestamp_in) |
| : frame_number(std::move(frame_number_in)), |
| timestamp(std::move(timestamp_in)) {} |
| |
| Camera3ShutterMsg::~Camera3ShutterMsg() = default; |
| size_t Camera3ShutterMsg::Hash(size_t seed) const { |
| seed = mojo::internal::Hash(seed, this->frame_number); |
| seed = mojo::internal::Hash(seed, this->timestamp); |
| return seed; |
| } |
| |
| void Camera3ShutterMsg::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "frame_number"), this->frame_number, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "timestamp"), this->timestamp, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3ShutterMsg::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3NotifyMsg::Camera3NotifyMsg() |
| : type(), |
| message() {} |
| |
| Camera3NotifyMsg::Camera3NotifyMsg( |
| Camera3MsgType type_in, |
| Camera3NotifyMsgMessagePtr message_in) |
| : type(std::move(type_in)), |
| message(std::move(message_in)) {} |
| |
| Camera3NotifyMsg::~Camera3NotifyMsg() = default; |
| |
| void Camera3NotifyMsg::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "type"), this->type, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3MsgType>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "message"), this->message, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3NotifyMsgMessagePtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3NotifyMsg::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3BufferRequest::Camera3BufferRequest() |
| : stream_id(), |
| num_buffers_requested() {} |
| |
| Camera3BufferRequest::Camera3BufferRequest( |
| uint64_t stream_id_in, |
| uint32_t num_buffers_requested_in) |
| : stream_id(std::move(stream_id_in)), |
| num_buffers_requested(std::move(num_buffers_requested_in)) {} |
| |
| Camera3BufferRequest::~Camera3BufferRequest() = default; |
| size_t Camera3BufferRequest::Hash(size_t seed) const { |
| seed = mojo::internal::Hash(seed, this->stream_id); |
| seed = mojo::internal::Hash(seed, this->num_buffers_requested); |
| return seed; |
| } |
| |
| void Camera3BufferRequest::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "stream_id"), this->stream_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "num_buffers_requested"), this->num_buffers_requested, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3BufferRequest::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3StreamBufferRet::Camera3StreamBufferRet() |
| : stream_id(), |
| status(), |
| output_buffers() {} |
| |
| Camera3StreamBufferRet::Camera3StreamBufferRet( |
| uint64_t stream_id_in, |
| Camera3StreamBufferReqStatus status_in, |
| std::optional<std::vector<Camera3StreamBufferPtr>> output_buffers_in) |
| : stream_id(std::move(stream_id_in)), |
| status(std::move(status_in)), |
| output_buffers(std::move(output_buffers_in)) {} |
| |
| Camera3StreamBufferRet::~Camera3StreamBufferRet() = default; |
| |
| void Camera3StreamBufferRet::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "stream_id"), this->stream_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "status"), this->status, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamBufferReqStatus>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "output_buffers"), this->output_buffers, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::optional<std::vector<Camera3StreamBufferPtr>>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3StreamBufferRet::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3PhyscamMetadata::Camera3PhyscamMetadata() |
| : id(), |
| metadata() {} |
| |
| Camera3PhyscamMetadata::Camera3PhyscamMetadata( |
| int32_t id_in, |
| ::cros::mojom::CameraMetadataPtr metadata_in) |
| : id(std::move(id_in)), |
| metadata(std::move(metadata_in)) {} |
| |
| Camera3PhyscamMetadata::~Camera3PhyscamMetadata() = default; |
| |
| void Camera3PhyscamMetadata::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "id"), this->id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type int32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "metadata"), this->metadata, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::cros::mojom::CameraMetadataPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3PhyscamMetadata::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3CaptureRequest::Camera3CaptureRequest() |
| : frame_number(), |
| settings(), |
| input_buffer(), |
| output_buffers(), |
| physcam_settings() {} |
| |
| Camera3CaptureRequest::Camera3CaptureRequest( |
| uint32_t frame_number_in, |
| ::cros::mojom::CameraMetadataPtr settings_in, |
| Camera3StreamBufferPtr input_buffer_in, |
| std::vector<Camera3StreamBufferPtr> output_buffers_in) |
| : frame_number(std::move(frame_number_in)), |
| settings(std::move(settings_in)), |
| input_buffer(std::move(input_buffer_in)), |
| output_buffers(std::move(output_buffers_in)), |
| physcam_settings() {} |
| |
| Camera3CaptureRequest::Camera3CaptureRequest( |
| uint32_t frame_number_in, |
| ::cros::mojom::CameraMetadataPtr settings_in, |
| Camera3StreamBufferPtr input_buffer_in, |
| std::vector<Camera3StreamBufferPtr> output_buffers_in, |
| std::optional<std::vector<Camera3PhyscamMetadataPtr>> physcam_settings_in) |
| : frame_number(std::move(frame_number_in)), |
| settings(std::move(settings_in)), |
| input_buffer(std::move(input_buffer_in)), |
| output_buffers(std::move(output_buffers_in)), |
| physcam_settings(std::move(physcam_settings_in)) {} |
| |
| Camera3CaptureRequest::~Camera3CaptureRequest() = default; |
| |
| void Camera3CaptureRequest::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "frame_number"), this->frame_number, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "settings"), this->settings, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::cros::mojom::CameraMetadataPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "input_buffer"), this->input_buffer, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamBufferPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "output_buffers"), this->output_buffers, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::vector<Camera3StreamBufferPtr>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "physcam_settings"), this->physcam_settings, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::optional<std::vector<Camera3PhyscamMetadataPtr>>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3CaptureRequest::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3CaptureResult::Camera3CaptureResult() |
| : frame_number(), |
| result(), |
| output_buffers(), |
| input_buffer(), |
| partial_result(), |
| physcam_metadata() {} |
| |
| Camera3CaptureResult::Camera3CaptureResult( |
| uint32_t frame_number_in, |
| ::cros::mojom::CameraMetadataPtr result_in, |
| std::optional<std::vector<Camera3StreamBufferPtr>> output_buffers_in, |
| Camera3StreamBufferPtr input_buffer_in, |
| uint32_t partial_result_in) |
| : frame_number(std::move(frame_number_in)), |
| result(std::move(result_in)), |
| output_buffers(std::move(output_buffers_in)), |
| input_buffer(std::move(input_buffer_in)), |
| partial_result(std::move(partial_result_in)), |
| physcam_metadata() {} |
| |
| Camera3CaptureResult::Camera3CaptureResult( |
| uint32_t frame_number_in, |
| ::cros::mojom::CameraMetadataPtr result_in, |
| std::optional<std::vector<Camera3StreamBufferPtr>> output_buffers_in, |
| Camera3StreamBufferPtr input_buffer_in, |
| uint32_t partial_result_in, |
| std::optional<std::vector<Camera3PhyscamMetadataPtr>> physcam_metadata_in) |
| : frame_number(std::move(frame_number_in)), |
| result(std::move(result_in)), |
| output_buffers(std::move(output_buffers_in)), |
| input_buffer(std::move(input_buffer_in)), |
| partial_result(std::move(partial_result_in)), |
| physcam_metadata(std::move(physcam_metadata_in)) {} |
| |
| Camera3CaptureResult::~Camera3CaptureResult() = default; |
| |
| void Camera3CaptureResult::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "frame_number"), this->frame_number, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "result"), this->result, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::cros::mojom::CameraMetadataPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "output_buffers"), this->output_buffers, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::optional<std::vector<Camera3StreamBufferPtr>>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "input_buffer"), this->input_buffer, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type Camera3StreamBufferPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "partial_result"), this->partial_result, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "physcam_metadata"), this->physcam_metadata, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::optional<std::vector<Camera3PhyscamMetadataPtr>>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool Camera3CaptureResult::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| Camera3NotifyMsgMessage::Camera3NotifyMsgMessage() : tag_(Tag::kError) { |
| data_.error = new Camera3ErrorMsgPtr; |
| } |
| |
| Camera3NotifyMsgMessage::~Camera3NotifyMsgMessage() { |
| DestroyActive(); |
| } |
| |
| |
| void Camera3NotifyMsgMessage::set_error( |
| Camera3ErrorMsgPtr error) { |
| if (tag_ == Tag::kError) { |
| *(data_.error) = std::move(error); |
| } else { |
| DestroyActive(); |
| tag_ = Tag::kError; |
| data_.error = new Camera3ErrorMsgPtr( |
| std::move(error)); |
| } |
| } |
| void Camera3NotifyMsgMessage::set_shutter( |
| Camera3ShutterMsgPtr shutter) { |
| if (tag_ == Tag::kShutter) { |
| *(data_.shutter) = std::move(shutter); |
| } else { |
| DestroyActive(); |
| tag_ = Tag::kShutter; |
| data_.shutter = new Camera3ShutterMsgPtr( |
| std::move(shutter)); |
| } |
| } |
| void Camera3NotifyMsgMessage::set_generic( |
| std::vector<uint8_t> generic) { |
| if (tag_ == Tag::kGeneric) { |
| *(data_.generic) = std::move(generic); |
| } else { |
| DestroyActive(); |
| tag_ = Tag::kGeneric; |
| data_.generic = new std::vector<uint8_t>( |
| std::move(generic)); |
| } |
| } |
| |
| void Camera3NotifyMsgMessage::DestroyActive() { |
| switch (tag_) { |
| |
| case Tag::kError: |
| |
| delete data_.error; |
| break; |
| case Tag::kShutter: |
| |
| delete data_.shutter; |
| break; |
| case Tag::kGeneric: |
| |
| delete data_.generic; |
| break; |
| } |
| } |
| |
| bool Camera3NotifyMsgMessage::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context, false); |
| } |
| const char Camera3CallbackOps::Name_[] = "cros.mojom.Camera3CallbackOps"; |
| |
| Camera3CallbackOps::IPCStableHashFunction Camera3CallbackOps::MessageToMethodInfo_(mojo::Message& message) { |
| #if !BUILDFLAG(IS_FUCHSIA) |
| switch (static_cast<messages::Camera3CallbackOps>(message.name())) { |
| case messages::Camera3CallbackOps::kProcessCaptureResult: { |
| return &Camera3CallbackOps::ProcessCaptureResult_Sym::IPCStableHash; |
| } |
| case messages::Camera3CallbackOps::kNotify: { |
| return &Camera3CallbackOps::Notify_Sym::IPCStableHash; |
| } |
| case messages::Camera3CallbackOps::kRequestStreamBuffers: { |
| return &Camera3CallbackOps::RequestStreamBuffers_Sym::IPCStableHash; |
| } |
| case messages::Camera3CallbackOps::kReturnStreamBuffers: { |
| return &Camera3CallbackOps::ReturnStreamBuffers_Sym::IPCStableHash; |
| } |
| } |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| return nullptr; |
| } |
| |
| |
| const char* Camera3CallbackOps::MessageToMethodName_(mojo::Message& message) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (!is_response) { |
| switch (static_cast<messages::Camera3CallbackOps>(message.name())) { |
| case messages::Camera3CallbackOps::kProcessCaptureResult: |
| return "Receive cros::mojom::Camera3CallbackOps::ProcessCaptureResult"; |
| case messages::Camera3CallbackOps::kNotify: |
| return "Receive cros::mojom::Camera3CallbackOps::Notify"; |
| case messages::Camera3CallbackOps::kRequestStreamBuffers: |
| return "Receive cros::mojom::Camera3CallbackOps::RequestStreamBuffers"; |
| case messages::Camera3CallbackOps::kReturnStreamBuffers: |
| return "Receive cros::mojom::Camera3CallbackOps::ReturnStreamBuffers"; |
| } |
| } else { |
| switch (static_cast<messages::Camera3CallbackOps>(message.name())) { |
| case messages::Camera3CallbackOps::kProcessCaptureResult: |
| return "Receive reply cros::mojom::Camera3CallbackOps::ProcessCaptureResult"; |
| case messages::Camera3CallbackOps::kNotify: |
| return "Receive reply cros::mojom::Camera3CallbackOps::Notify"; |
| case messages::Camera3CallbackOps::kRequestStreamBuffers: |
| return "Receive reply cros::mojom::Camera3CallbackOps::RequestStreamBuffers"; |
| case messages::Camera3CallbackOps::kReturnStreamBuffers: |
| return "Receive reply cros::mojom::Camera3CallbackOps::ReturnStreamBuffers"; |
| } |
| } |
| return "Receive unknown mojo message"; |
| #else |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (is_response) { |
| return "Receive mojo reply"; |
| } else { |
| return "Receive mojo message"; |
| } |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| } |
| |
| #if !BUILDFLAG(IS_FUCHSIA) |
| uint32_t Camera3CallbackOps::ProcessCaptureResult_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3CallbackOps::ProcessCaptureResult"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3CallbackOps::Notify_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3CallbackOps::Notify"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3CallbackOps::RequestStreamBuffers_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3CallbackOps::RequestStreamBuffers"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3CallbackOps::ReturnStreamBuffers_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3CallbackOps::ReturnStreamBuffers"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| class Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback( |
| Camera3CallbackOps::RequestStreamBuffersCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback(const Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback&) = delete; |
| Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback& operator=(const Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3CallbackOps::RequestStreamBuffersCallback callback_; |
| }; |
| |
| Camera3CallbackOpsProxy::Camera3CallbackOpsProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void Camera3CallbackOpsProxy::ProcessCaptureResult( |
| Camera3CaptureResultPtr in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3CallbackOps::ProcessCaptureResult", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type Camera3CaptureResultPtr>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3CallbackOps::kProcessCaptureResult), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3CallbackOps_ProcessCaptureResult_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->result)::BaseType> result_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3CaptureResultDataView>( |
| in_result, result_fragment); |
| params->result.Set( |
| result_fragment.is_null() ? nullptr : result_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->result.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null result in Camera3CallbackOps.ProcessCaptureResult request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3CallbackOps::Name_); |
| message.set_method_name("ProcessCaptureResult"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| |
| void Camera3CallbackOpsProxy::Notify( |
| Camera3NotifyMsgPtr in_msg) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3CallbackOps::Notify", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("msg"), in_msg, |
| "<value of type Camera3NotifyMsgPtr>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3CallbackOps::kNotify), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3CallbackOps_Notify_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->msg)::BaseType> msg_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3NotifyMsgDataView>( |
| in_msg, msg_fragment); |
| params->msg.Set( |
| msg_fragment.is_null() ? nullptr : msg_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->msg.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null msg in Camera3CallbackOps.Notify request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3CallbackOps::Name_); |
| message.set_method_name("Notify"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| |
| void Camera3CallbackOpsProxy::RequestStreamBuffers( |
| std::vector<Camera3BufferRequestPtr> in_buffer_reqs, RequestStreamBuffersCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3CallbackOps::RequestStreamBuffers", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("buffer_reqs"), in_buffer_reqs, |
| "<value of type std::vector<Camera3BufferRequestPtr>>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3CallbackOps::kRequestStreamBuffers), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3CallbackOps_RequestStreamBuffers_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->buffer_reqs)::BaseType> |
| buffer_reqs_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& buffer_reqs_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3BufferRequestDataView>>( |
| in_buffer_reqs, buffer_reqs_fragment, &buffer_reqs_validate_params); |
| params->buffer_reqs.Set( |
| buffer_reqs_fragment.is_null() ? nullptr : buffer_reqs_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->buffer_reqs.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null buffer_reqs in Camera3CallbackOps.RequestStreamBuffers request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3CallbackOps::Name_); |
| message.set_method_name("RequestStreamBuffers"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3CallbackOpsProxy::ReturnStreamBuffers( |
| std::vector<Camera3StreamBufferPtr> in_buffers) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3CallbackOps::ReturnStreamBuffers", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("buffers"), in_buffers, |
| "<value of type std::vector<Camera3StreamBufferPtr>>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3CallbackOps::kReturnStreamBuffers), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3CallbackOps_ReturnStreamBuffers_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->buffers)::BaseType> |
| buffers_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& buffers_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>( |
| in_buffers, buffers_fragment, &buffers_validate_params); |
| params->buffers.Set( |
| buffers_fragment.is_null() ? nullptr : buffers_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->buffers.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null buffers in Camera3CallbackOps.ReturnStreamBuffers request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3CallbackOps::Name_); |
| message.set_method_name("ReturnStreamBuffers"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| class Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3CallbackOps::RequestStreamBuffersCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder> proxy( |
| new Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3CallbackOps::RequestStreamBuffersCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| Camera3BufferRequestStatus in_result, std::vector<Camera3StreamBufferRetPtr> in_returned_buf_reqs); |
| }; |
| |
| bool Camera3CallbackOps_RequestStreamBuffers_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3CallbackOps_RequestStreamBuffers_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3CallbackOps_RequestStreamBuffers_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3CallbackOps.2 |
| bool success = true; |
| Camera3BufferRequestStatus p_result{}; |
| std::vector<Camera3StreamBufferRetPtr> p_returned_buf_reqs{}; |
| Camera3CallbackOps_RequestStreamBuffers_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (success && !input_data_view.ReadReturnedBufReqs(&p_returned_buf_reqs)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3CallbackOps::Name_, 2, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_returned_buf_reqs)); |
| return true; |
| } |
| |
| void Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder::Run( |
| Camera3BufferRequestStatus in_result, std::vector<Camera3StreamBufferRetPtr> in_returned_buf_reqs) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3CallbackOps::RequestStreamBuffers", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type Camera3BufferRequestStatus>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("returned_buf_reqs"), in_returned_buf_reqs, |
| "<value of type std::vector<Camera3StreamBufferRetPtr>>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3CallbackOps::kRequestStreamBuffers), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3CallbackOps_RequestStreamBuffers_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<::cros::mojom::Camera3BufferRequestStatus>( |
| in_result, ¶ms->result); |
| mojo::internal::MessageFragment< |
| typename decltype(params->returned_buf_reqs)::BaseType> |
| returned_buf_reqs_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& returned_buf_reqs_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferRetDataView>>( |
| in_returned_buf_reqs, returned_buf_reqs_fragment, &returned_buf_reqs_validate_params); |
| params->returned_buf_reqs.Set( |
| returned_buf_reqs_fragment.is_null() ? nullptr : returned_buf_reqs_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->returned_buf_reqs.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null returned_buf_reqs in "); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3CallbackOps::Name_); |
| message.set_method_name("RequestStreamBuffers"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| |
| // static |
| bool Camera3CallbackOpsStubDispatch::Accept( |
| Camera3CallbackOps* impl, |
| mojo::Message* message) { |
| switch (static_cast<messages::Camera3CallbackOps>(message->header()->name)) { |
| case messages::Camera3CallbackOps::kProcessCaptureResult: { |
| DCHECK(message->is_serialized()); |
| internal::Camera3CallbackOps_ProcessCaptureResult_Params_Data* params = |
| reinterpret_cast<internal::Camera3CallbackOps_ProcessCaptureResult_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3CallbackOps.0 |
| bool success = true; |
| Camera3CaptureResultPtr p_result{}; |
| Camera3CallbackOps_ProcessCaptureResult_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3CallbackOps::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ProcessCaptureResult( |
| std::move(p_result)); |
| return true; |
| } |
| case messages::Camera3CallbackOps::kNotify: { |
| DCHECK(message->is_serialized()); |
| internal::Camera3CallbackOps_Notify_Params_Data* params = |
| reinterpret_cast<internal::Camera3CallbackOps_Notify_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3CallbackOps.1 |
| bool success = true; |
| Camera3NotifyMsgPtr p_msg{}; |
| Camera3CallbackOps_Notify_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadMsg(&p_msg)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3CallbackOps::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->Notify( |
| std::move(p_msg)); |
| return true; |
| } |
| case messages::Camera3CallbackOps::kRequestStreamBuffers: { |
| break; |
| } |
| case messages::Camera3CallbackOps::kReturnStreamBuffers: { |
| DCHECK(message->is_serialized()); |
| internal::Camera3CallbackOps_ReturnStreamBuffers_Params_Data* params = |
| reinterpret_cast<internal::Camera3CallbackOps_ReturnStreamBuffers_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3CallbackOps.3 |
| bool success = true; |
| std::vector<Camera3StreamBufferPtr> p_buffers{}; |
| Camera3CallbackOps_ReturnStreamBuffers_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadBuffers(&p_buffers)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3CallbackOps::Name_, 3, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ReturnStreamBuffers( |
| std::move(p_buffers)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool Camera3CallbackOpsStubDispatch::AcceptWithResponder( |
| Camera3CallbackOps* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| [[maybe_unused]] const bool message_is_sync = |
| message->has_flag(mojo::Message::kFlagIsSync); |
| [[maybe_unused]] const uint64_t request_id = message->request_id(); |
| switch (static_cast<messages::Camera3CallbackOps>(message->header()->name)) { |
| case messages::Camera3CallbackOps::kProcessCaptureResult: { |
| break; |
| } |
| case messages::Camera3CallbackOps::kNotify: { |
| break; |
| } |
| case messages::Camera3CallbackOps::kRequestStreamBuffers: { |
| internal::Camera3CallbackOps_RequestStreamBuffers_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3CallbackOps_RequestStreamBuffers_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3CallbackOps.2 |
| bool success = true; |
| std::vector<Camera3BufferRequestPtr> p_buffer_reqs{}; |
| Camera3CallbackOps_RequestStreamBuffers_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadBufferReqs(&p_buffer_reqs)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3CallbackOps::Name_, 2, false); |
| return false; |
| } |
| Camera3CallbackOps::RequestStreamBuffersCallback callback = |
| Camera3CallbackOps_RequestStreamBuffers_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->RequestStreamBuffers( |
| std::move(p_buffer_reqs), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3CallbackOps::kReturnStreamBuffers: { |
| break; |
| } |
| } |
| return false; |
| } |
| namespace { |
| } // namespace |
| static const mojo::internal::GenericValidationInfo kCamera3CallbackOpsValidationInfo[] = { |
| { &internal::Camera3CallbackOps_ProcessCaptureResult_Params_Data::Validate, |
| nullptr /* no response */}, |
| { &internal::Camera3CallbackOps_Notify_Params_Data::Validate, |
| nullptr /* no response */}, |
| { &internal::Camera3CallbackOps_RequestStreamBuffers_Params_Data::Validate, |
| &internal::Camera3CallbackOps_RequestStreamBuffers_ResponseParams_Data::Validate}, |
| { &internal::Camera3CallbackOps_ReturnStreamBuffers_Params_Data::Validate, |
| nullptr /* no response */}, |
| }; |
| |
| bool Camera3CallbackOpsRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::Camera3CallbackOps::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kCamera3CallbackOpsValidationInfo); |
| } |
| |
| bool Camera3CallbackOpsResponseValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::Camera3CallbackOps::Name_; |
| return mojo::internal::ValidateResponseGenericPacked(message, name, kCamera3CallbackOpsValidationInfo); |
| } |
| const char Camera3DeviceOps::Name_[] = "cros.mojom.Camera3DeviceOps"; |
| |
| Camera3DeviceOps::IPCStableHashFunction Camera3DeviceOps::MessageToMethodInfo_(mojo::Message& message) { |
| #if !BUILDFLAG(IS_FUCHSIA) |
| switch (static_cast<messages::Camera3DeviceOps>(message.name())) { |
| case messages::Camera3DeviceOps::kInitialize: { |
| return &Camera3DeviceOps::Initialize_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kConfigureStreams: { |
| return &Camera3DeviceOps::ConfigureStreams_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kConstructDefaultRequestSettings: { |
| return &Camera3DeviceOps::ConstructDefaultRequestSettings_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kProcessCaptureRequest: { |
| return &Camera3DeviceOps::ProcessCaptureRequest_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kDump: { |
| return &Camera3DeviceOps::Dump_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kFlush: { |
| return &Camera3DeviceOps::Flush_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kRegisterBuffer: { |
| return &Camera3DeviceOps::RegisterBuffer_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kClose: { |
| return &Camera3DeviceOps::Close_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers: { |
| return &Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kSignalStreamFlush: { |
| return &Camera3DeviceOps::SignalStreamFlush_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kOnNewBuffer: { |
| return &Camera3DeviceOps::OnNewBuffer_Sym::IPCStableHash; |
| } |
| case messages::Camera3DeviceOps::kOnBufferRetired: { |
| return &Camera3DeviceOps::OnBufferRetired_Sym::IPCStableHash; |
| } |
| } |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| return nullptr; |
| } |
| |
| |
| const char* Camera3DeviceOps::MessageToMethodName_(mojo::Message& message) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (!is_response) { |
| switch (static_cast<messages::Camera3DeviceOps>(message.name())) { |
| case messages::Camera3DeviceOps::kInitialize: |
| return "Receive cros::mojom::Camera3DeviceOps::Initialize"; |
| case messages::Camera3DeviceOps::kConfigureStreams: |
| return "Receive cros::mojom::Camera3DeviceOps::ConfigureStreams"; |
| case messages::Camera3DeviceOps::kConstructDefaultRequestSettings: |
| return "Receive cros::mojom::Camera3DeviceOps::ConstructDefaultRequestSettings"; |
| case messages::Camera3DeviceOps::kProcessCaptureRequest: |
| return "Receive cros::mojom::Camera3DeviceOps::ProcessCaptureRequest"; |
| case messages::Camera3DeviceOps::kDump: |
| return "Receive cros::mojom::Camera3DeviceOps::Dump"; |
| case messages::Camera3DeviceOps::kFlush: |
| return "Receive cros::mojom::Camera3DeviceOps::Flush"; |
| case messages::Camera3DeviceOps::kRegisterBuffer: |
| return "Receive cros::mojom::Camera3DeviceOps::RegisterBuffer"; |
| case messages::Camera3DeviceOps::kClose: |
| return "Receive cros::mojom::Camera3DeviceOps::Close"; |
| case messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers: |
| return "Receive cros::mojom::Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers"; |
| case messages::Camera3DeviceOps::kSignalStreamFlush: |
| return "Receive cros::mojom::Camera3DeviceOps::SignalStreamFlush"; |
| case messages::Camera3DeviceOps::kOnNewBuffer: |
| return "Receive cros::mojom::Camera3DeviceOps::OnNewBuffer"; |
| case messages::Camera3DeviceOps::kOnBufferRetired: |
| return "Receive cros::mojom::Camera3DeviceOps::OnBufferRetired"; |
| } |
| } else { |
| switch (static_cast<messages::Camera3DeviceOps>(message.name())) { |
| case messages::Camera3DeviceOps::kInitialize: |
| return "Receive reply cros::mojom::Camera3DeviceOps::Initialize"; |
| case messages::Camera3DeviceOps::kConfigureStreams: |
| return "Receive reply cros::mojom::Camera3DeviceOps::ConfigureStreams"; |
| case messages::Camera3DeviceOps::kConstructDefaultRequestSettings: |
| return "Receive reply cros::mojom::Camera3DeviceOps::ConstructDefaultRequestSettings"; |
| case messages::Camera3DeviceOps::kProcessCaptureRequest: |
| return "Receive reply cros::mojom::Camera3DeviceOps::ProcessCaptureRequest"; |
| case messages::Camera3DeviceOps::kDump: |
| return "Receive reply cros::mojom::Camera3DeviceOps::Dump"; |
| case messages::Camera3DeviceOps::kFlush: |
| return "Receive reply cros::mojom::Camera3DeviceOps::Flush"; |
| case messages::Camera3DeviceOps::kRegisterBuffer: |
| return "Receive reply cros::mojom::Camera3DeviceOps::RegisterBuffer"; |
| case messages::Camera3DeviceOps::kClose: |
| return "Receive reply cros::mojom::Camera3DeviceOps::Close"; |
| case messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers: |
| return "Receive reply cros::mojom::Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers"; |
| case messages::Camera3DeviceOps::kSignalStreamFlush: |
| return "Receive reply cros::mojom::Camera3DeviceOps::SignalStreamFlush"; |
| case messages::Camera3DeviceOps::kOnNewBuffer: |
| return "Receive reply cros::mojom::Camera3DeviceOps::OnNewBuffer"; |
| case messages::Camera3DeviceOps::kOnBufferRetired: |
| return "Receive reply cros::mojom::Camera3DeviceOps::OnBufferRetired"; |
| } |
| } |
| return "Receive unknown mojo message"; |
| #else |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (is_response) { |
| return "Receive mojo reply"; |
| } else { |
| return "Receive mojo message"; |
| } |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| } |
| |
| #if !BUILDFLAG(IS_FUCHSIA) |
| uint32_t Camera3DeviceOps::Initialize_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::Initialize"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::ConfigureStreams_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::ConfigureStreams"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::ConstructDefaultRequestSettings_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::ConstructDefaultRequestSettings"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::ProcessCaptureRequest_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::ProcessCaptureRequest"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::Dump_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::Dump"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::Flush_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::Flush"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::RegisterBuffer_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::RegisterBuffer"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::Close_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::Close"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::SignalStreamFlush_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::SignalStreamFlush"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::OnNewBuffer_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::OnNewBuffer"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Camera3DeviceOps::OnBufferRetired_Sym::IPCStableHash() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symbolization. So each IPCStableHash should have a unique address. |
| // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of |
| // __LINE__ value, which is not unique accross different mojo modules. |
| // The code below is very similar to NO_CODE_FOLDING, but it uses a unique |
| // hash instead of __LINE__. |
| constexpr uint32_t kHash = base::MD5Hash32Constexpr( |
| "(Impl)cros::mojom::Camera3DeviceOps::OnBufferRetired"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| class Camera3DeviceOps_Initialize_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_Initialize_ForwardToCallback( |
| Camera3DeviceOps::InitializeCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_Initialize_ForwardToCallback(const Camera3DeviceOps_Initialize_ForwardToCallback&) = delete; |
| Camera3DeviceOps_Initialize_ForwardToCallback& operator=(const Camera3DeviceOps_Initialize_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::InitializeCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_ConfigureStreams_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_ConfigureStreams_ForwardToCallback( |
| Camera3DeviceOps::ConfigureStreamsCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_ConfigureStreams_ForwardToCallback(const Camera3DeviceOps_ConfigureStreams_ForwardToCallback&) = delete; |
| Camera3DeviceOps_ConfigureStreams_ForwardToCallback& operator=(const Camera3DeviceOps_ConfigureStreams_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::ConfigureStreamsCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback( |
| Camera3DeviceOps::ConstructDefaultRequestSettingsCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback(const Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback&) = delete; |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback& operator=(const Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::ConstructDefaultRequestSettingsCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback( |
| Camera3DeviceOps::ProcessCaptureRequestCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback(const Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback&) = delete; |
| Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback& operator=(const Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::ProcessCaptureRequestCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_Flush_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_Flush_ForwardToCallback( |
| Camera3DeviceOps::FlushCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_Flush_ForwardToCallback(const Camera3DeviceOps_Flush_ForwardToCallback&) = delete; |
| Camera3DeviceOps_Flush_ForwardToCallback& operator=(const Camera3DeviceOps_Flush_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::FlushCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_RegisterBuffer_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_RegisterBuffer_ForwardToCallback( |
| Camera3DeviceOps::RegisterBufferCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_RegisterBuffer_ForwardToCallback(const Camera3DeviceOps_RegisterBuffer_ForwardToCallback&) = delete; |
| Camera3DeviceOps_RegisterBuffer_ForwardToCallback& operator=(const Camera3DeviceOps_RegisterBuffer_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::RegisterBufferCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_Close_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_Close_ForwardToCallback( |
| Camera3DeviceOps::CloseCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_Close_ForwardToCallback(const Camera3DeviceOps_Close_ForwardToCallback&) = delete; |
| Camera3DeviceOps_Close_ForwardToCallback& operator=(const Camera3DeviceOps_Close_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::CloseCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback( |
| Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffersCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback(const Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback&) = delete; |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback& operator=(const Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffersCallback callback_; |
| }; |
| |
| class Camera3DeviceOps_OnNewBuffer_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Camera3DeviceOps_OnNewBuffer_ForwardToCallback( |
| Camera3DeviceOps::OnNewBufferCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Camera3DeviceOps_OnNewBuffer_ForwardToCallback(const Camera3DeviceOps_OnNewBuffer_ForwardToCallback&) = delete; |
| Camera3DeviceOps_OnNewBuffer_ForwardToCallback& operator=(const Camera3DeviceOps_OnNewBuffer_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Camera3DeviceOps::OnNewBufferCallback callback_; |
| }; |
| |
| Camera3DeviceOpsProxy::Camera3DeviceOpsProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void Camera3DeviceOpsProxy::Initialize( |
| ::mojo::PendingRemote<Camera3CallbackOps> in_callback_ops, InitializeCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::Initialize", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("callback_ops"), in_callback_ops, |
| "<value of type ::mojo::PendingRemote<Camera3CallbackOps>>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kInitialize), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Initialize_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::cros::mojom::Camera3CallbackOpsInterfaceBase>>( |
| in_callback_ops, ¶ms->callback_ops, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->callback_ops), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid callback_ops in Camera3DeviceOps.Initialize request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Initialize"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_Initialize_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::ConfigureStreams( |
| Camera3StreamConfigurationPtr in_config, ConfigureStreamsCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::ConfigureStreams", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("config"), in_config, |
| "<value of type Camera3StreamConfigurationPtr>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kConfigureStreams), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ConfigureStreams_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->config)::BaseType> config_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3StreamConfigurationDataView>( |
| in_config, config_fragment); |
| params->config.Set( |
| config_fragment.is_null() ? nullptr : config_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->config.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null config in Camera3DeviceOps.ConfigureStreams request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ConfigureStreams"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_ConfigureStreams_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::ConstructDefaultRequestSettings( |
| Camera3RequestTemplate in_type, ConstructDefaultRequestSettingsCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::ConstructDefaultRequestSettings", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("type"), in_type, |
| "<value of type Camera3RequestTemplate>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kConstructDefaultRequestSettings), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ConstructDefaultRequestSettings_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<::cros::mojom::Camera3RequestTemplate>( |
| in_type, ¶ms->type); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ConstructDefaultRequestSettings"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::ProcessCaptureRequest( |
| Camera3CaptureRequestPtr in_request, ProcessCaptureRequestCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::ProcessCaptureRequest", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("request"), in_request, |
| "<value of type Camera3CaptureRequestPtr>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kProcessCaptureRequest), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ProcessCaptureRequest_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->request)::BaseType> request_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3CaptureRequestDataView>( |
| in_request, request_fragment); |
| params->request.Set( |
| request_fragment.is_null() ? nullptr : request_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->request.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null request in Camera3DeviceOps.ProcessCaptureRequest request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ProcessCaptureRequest"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::Dump( |
| ::mojo::ScopedHandle in_fd) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::Dump", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("fd"), in_fd, |
| "<value of type ::mojo::ScopedHandle>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kDump), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Dump_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::ScopedHandle>( |
| in_fd, ¶ms->fd, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->fd), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid fd in Camera3DeviceOps.Dump request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Dump"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| |
| void Camera3DeviceOpsProxy::Flush( |
| FlushCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send cros::mojom::Camera3DeviceOps::Flush"); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kFlush), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Flush_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Flush"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_Flush_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::RegisterBuffer( |
| uint64_t in_buffer_id, Camera3DeviceOps::BufferType in_type, std::vector<::mojo::ScopedHandle> in_fds, uint32_t in_drm_format, HalPixelFormat in_hal_pixel_format, uint32_t in_width, uint32_t in_height, const std::vector<uint32_t>& in_strides, const std::vector<uint32_t>& in_offsets, RegisterBufferCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::RegisterBuffer", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("buffer_id"), in_buffer_id, |
| "<value of type uint64_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("type"), in_type, |
| "<value of type Camera3DeviceOps::BufferType>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("fds"), in_fds, |
| "<value of type std::vector<::mojo::ScopedHandle>>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("drm_format"), in_drm_format, |
| "<value of type uint32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("hal_pixel_format"), in_hal_pixel_format, |
| "<value of type HalPixelFormat>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("width"), in_width, |
| "<value of type uint32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("height"), in_height, |
| "<value of type uint32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("strides"), in_strides, |
| "<value of type const std::vector<uint32_t>&>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("offsets"), in_offsets, |
| "<value of type const std::vector<uint32_t>&>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kRegisterBuffer), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_RegisterBuffer_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->buffer_id = in_buffer_id; |
| mojo::internal::Serialize<::cros::mojom::Camera3DeviceOps_BufferType>( |
| in_type, ¶ms->type); |
| mojo::internal::MessageFragment< |
| typename decltype(params->fds)::BaseType> |
| fds_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& fds_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<mojo::ScopedHandle>>( |
| in_fds, fds_fragment, &fds_validate_params); |
| params->fds.Set( |
| fds_fragment.is_null() ? nullptr : fds_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->fds.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null fds in Camera3DeviceOps.RegisterBuffer request"); |
| params->drm_format = in_drm_format; |
| mojo::internal::Serialize<::cros::mojom::HalPixelFormat>( |
| in_hal_pixel_format, ¶ms->hal_pixel_format); |
| params->width = in_width; |
| params->height = in_height; |
| mojo::internal::MessageFragment< |
| typename decltype(params->strides)::BaseType> |
| strides_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& strides_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint32_t>>( |
| in_strides, strides_fragment, &strides_validate_params); |
| params->strides.Set( |
| strides_fragment.is_null() ? nullptr : strides_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->strides.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null strides in Camera3DeviceOps.RegisterBuffer request"); |
| mojo::internal::MessageFragment< |
| typename decltype(params->offsets)::BaseType> |
| offsets_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& offsets_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint32_t>>( |
| in_offsets, offsets_fragment, &offsets_validate_params); |
| params->offsets.Set( |
| offsets_fragment.is_null() ? nullptr : offsets_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->offsets.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null offsets in Camera3DeviceOps.RegisterBuffer request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("RegisterBuffer"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_RegisterBuffer_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::Close( |
| CloseCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send cros::mojom::Camera3DeviceOps::Close"); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kClose), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Close_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Close"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_Close_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::ConfigureStreamsAndGetAllocatedBuffers( |
| Camera3StreamConfigurationPtr in_config, ConfigureStreamsAndGetAllocatedBuffersCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("config"), in_config, |
| "<value of type Camera3StreamConfigurationPtr>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->config)::BaseType> config_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3StreamConfigurationDataView>( |
| in_config, config_fragment); |
| params->config.Set( |
| config_fragment.is_null() ? nullptr : config_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->config.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null config in Camera3DeviceOps.ConfigureStreamsAndGetAllocatedBuffers request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ConfigureStreamsAndGetAllocatedBuffers"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::SignalStreamFlush( |
| const std::vector<uint64_t>& in_stream_ids) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::SignalStreamFlush", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("stream_ids"), in_stream_ids, |
| "<value of type const std::vector<uint64_t>&>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kSignalStreamFlush), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_SignalStreamFlush_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->stream_ids)::BaseType> |
| stream_ids_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& stream_ids_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint64_t>>( |
| in_stream_ids, stream_ids_fragment, &stream_ids_validate_params); |
| params->stream_ids.Set( |
| stream_ids_fragment.is_null() ? nullptr : stream_ids_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->stream_ids.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null stream_ids in Camera3DeviceOps.SignalStreamFlush request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("SignalStreamFlush"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| |
| void Camera3DeviceOpsProxy::OnNewBuffer( |
| CameraBufferHandlePtr in_buffer, OnNewBufferCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::OnNewBuffer", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("buffer"), in_buffer, |
| "<value of type CameraBufferHandlePtr>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kOnNewBuffer), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_OnNewBuffer_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->buffer)::BaseType> buffer_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::CameraBufferHandleDataView>( |
| in_buffer, buffer_fragment); |
| params->buffer.Set( |
| buffer_fragment.is_null() ? nullptr : buffer_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->buffer.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null buffer in Camera3DeviceOps.OnNewBuffer request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("OnNewBuffer"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Camera3DeviceOps_OnNewBuffer_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void Camera3DeviceOpsProxy::OnBufferRetired( |
| uint64_t in_buffer_id) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::Camera3DeviceOps::OnBufferRetired", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("buffer_id"), in_buffer_id, |
| "<value of type uint64_t>"); |
| }); |
| #endif |
| |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| const bool is_urgent = false; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kOnBufferRetired), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_OnBufferRetired_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->buffer_id = in_buffer_id; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("OnBufferRetired"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| class Camera3DeviceOps_Initialize_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::InitializeCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_Initialize_ProxyToResponder> proxy( |
| new Camera3DeviceOps_Initialize_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_Initialize_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_Initialize_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_Initialize_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::InitializeCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result); |
| }; |
| |
| bool Camera3DeviceOps_Initialize_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_Initialize_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_Initialize_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.0 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3DeviceOps_Initialize_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 0, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_Initialize_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::Initialize", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kInitialize), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Initialize_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Initialize"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_ConfigureStreams_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::ConfigureStreamsCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_ConfigureStreams_ProxyToResponder> proxy( |
| new Camera3DeviceOps_ConfigureStreams_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_ConfigureStreams_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_ConfigureStreams_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_ConfigureStreams_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::ConfigureStreamsCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result, Camera3StreamConfigurationPtr in_updated_config); |
| }; |
| |
| bool Camera3DeviceOps_ConfigureStreams_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_ConfigureStreams_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ConfigureStreams_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.1 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3StreamConfigurationPtr p_updated_config{}; |
| Camera3DeviceOps_ConfigureStreams_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (success && !input_data_view.ReadUpdatedConfig(&p_updated_config)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 1, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_updated_config)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_ConfigureStreams_ProxyToResponder::Run( |
| int32_t in_result, Camera3StreamConfigurationPtr in_updated_config) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::ConfigureStreams", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("updated_config"), in_updated_config, |
| "<value of type Camera3StreamConfigurationPtr>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kConfigureStreams), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ConfigureStreams_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| mojo::internal::MessageFragment< |
| typename decltype(params->updated_config)::BaseType> updated_config_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3StreamConfigurationDataView>( |
| in_updated_config, updated_config_fragment); |
| params->updated_config.Set( |
| updated_config_fragment.is_null() ? nullptr : updated_config_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ConfigureStreams"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::ConstructDefaultRequestSettingsCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder> proxy( |
| new Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::ConstructDefaultRequestSettingsCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| ::cros::mojom::CameraMetadataPtr in_settings); |
| }; |
| |
| bool Camera3DeviceOps_ConstructDefaultRequestSettings_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_ConstructDefaultRequestSettings_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ConstructDefaultRequestSettings_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.2 |
| bool success = true; |
| ::cros::mojom::CameraMetadataPtr p_settings{}; |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadSettings(&p_settings)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 2, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_settings)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder::Run( |
| ::cros::mojom::CameraMetadataPtr in_settings) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::ConstructDefaultRequestSettings", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("settings"), in_settings, |
| "<value of type ::cros::mojom::CameraMetadataPtr>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kConstructDefaultRequestSettings), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ConstructDefaultRequestSettings_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->settings)::BaseType> settings_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::CameraMetadataDataView>( |
| in_settings, settings_fragment); |
| params->settings.Set( |
| settings_fragment.is_null() ? nullptr : settings_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ConstructDefaultRequestSettings"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::ProcessCaptureRequestCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder> proxy( |
| new Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::ProcessCaptureRequestCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result); |
| }; |
| |
| bool Camera3DeviceOps_ProcessCaptureRequest_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_ProcessCaptureRequest_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ProcessCaptureRequest_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.3 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3DeviceOps_ProcessCaptureRequest_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 3, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::ProcessCaptureRequest", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kProcessCaptureRequest), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ProcessCaptureRequest_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ProcessCaptureRequest"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_Flush_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::FlushCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_Flush_ProxyToResponder> proxy( |
| new Camera3DeviceOps_Flush_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_Flush_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_Flush_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_Flush_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::FlushCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result); |
| }; |
| |
| bool Camera3DeviceOps_Flush_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_Flush_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_Flush_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.5 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3DeviceOps_Flush_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 5, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_Flush_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::Flush", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kFlush), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Flush_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Flush"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_RegisterBuffer_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::RegisterBufferCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_RegisterBuffer_ProxyToResponder> proxy( |
| new Camera3DeviceOps_RegisterBuffer_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_RegisterBuffer_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_RegisterBuffer_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_RegisterBuffer_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::RegisterBufferCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result); |
| }; |
| |
| bool Camera3DeviceOps_RegisterBuffer_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_RegisterBuffer_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_RegisterBuffer_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.6 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3DeviceOps_RegisterBuffer_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 6, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_RegisterBuffer_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::RegisterBuffer", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kRegisterBuffer), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_RegisterBuffer_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("RegisterBuffer"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_Close_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::CloseCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_Close_ProxyToResponder> proxy( |
| new Camera3DeviceOps_Close_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_Close_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_Close_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_Close_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::CloseCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result); |
| }; |
| |
| bool Camera3DeviceOps_Close_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_Close_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_Close_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.7 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3DeviceOps_Close_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 7, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_Close_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::Close", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kClose), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_Close_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("Close"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffersCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder> proxy( |
| new Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffersCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result, Camera3StreamConfigurationPtr in_updated_config, base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>> in_allocated_buffers); |
| }; |
| |
| bool Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.8 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3StreamConfigurationPtr p_updated_config{}; |
| base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>> p_allocated_buffers{}; |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (success && !input_data_view.ReadUpdatedConfig(&p_updated_config)) |
| success = false; |
| if (success && !input_data_view.ReadAllocatedBuffers(&p_allocated_buffers)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 8, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_updated_config), |
| std::move(p_allocated_buffers)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder::Run( |
| int32_t in_result, Camera3StreamConfigurationPtr in_updated_config, base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>> in_allocated_buffers) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffers", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("updated_config"), in_updated_config, |
| "<value of type Camera3StreamConfigurationPtr>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("allocated_buffers"), in_allocated_buffers, |
| "<value of type base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>>>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| mojo::internal::MessageFragment< |
| typename decltype(params->updated_config)::BaseType> updated_config_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::Camera3StreamConfigurationDataView>( |
| in_updated_config, updated_config_fragment); |
| params->updated_config.Set( |
| updated_config_fragment.is_null() ? nullptr : updated_config_fragment.data()); |
| mojo::internal::MessageFragment< |
| typename decltype(params->allocated_buffers)::BaseType> |
| allocated_buffers_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& allocated_buffers_validate_params = |
| mojo::internal::GetMapValidator<*&mojo::internal::GetArrayValidator<0, false, nullptr>(), *&mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>()>(); |
| mojo::internal::Serialize<mojo::MapDataView<uint64_t, mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>>( |
| in_allocated_buffers, allocated_buffers_fragment, &allocated_buffers_validate_params); |
| params->allocated_buffers.Set( |
| allocated_buffers_fragment.is_null() ? nullptr : allocated_buffers_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->allocated_buffers.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null allocated_buffers in "); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("ConfigureStreamsAndGetAllocatedBuffers"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| class Camera3DeviceOps_OnNewBuffer_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Camera3DeviceOps::OnNewBufferCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Camera3DeviceOps_OnNewBuffer_ProxyToResponder> proxy( |
| new Camera3DeviceOps_OnNewBuffer_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Camera3DeviceOps_OnNewBuffer_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Camera3DeviceOps_OnNewBuffer_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // If we're being destroyed without being run, we want to ensure the |
| // binding endpoint has been closed. This checks for that asynchronously. |
| // We pass a bound generated callback to handle the response so that any |
| // resulting DCHECK stack will have useful interface type information. |
| // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to |
| // fizzle if this happens after shutdown and the endpoint is bound to a |
| // BLOCK_SHUTDOWN sequence. |
| base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler; |
| responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete)); |
| } |
| #endif |
| } |
| |
| private: |
| Camera3DeviceOps_OnNewBuffer_ProxyToResponder( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : ::mojo::internal::ProxyToResponder(message, std::move(responder)) { |
| } |
| |
| #if DCHECK_IS_ON() |
| static void OnIsConnectedComplete(bool connected) { |
| DCHECK(!connected) |
| << "Camera3DeviceOps::OnNewBufferCallback was destroyed without " |
| << "first either being run or its corresponding binding being closed. " |
| << "It is an error to drop response callbacks which still correspond " |
| << "to an open interface pipe."; |
| } |
| #endif |
| |
| void Run( |
| int32_t in_result); |
| }; |
| |
| bool Camera3DeviceOps_OnNewBuffer_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_OnNewBuffer_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_OnNewBuffer_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.10 |
| bool success = true; |
| int32_t p_result{}; |
| Camera3DeviceOps_OnNewBuffer_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 10, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Camera3DeviceOps_OnNewBuffer_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::Camera3DeviceOps::OnNewBuffer", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type int32_t>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt) | |
| ((false) ? mojo::Message::kFlagIsUrgent : 0); |
| |
| const size_t estimated_payload_size = |
| 0; |
| mojo::Message message( |
| base::to_underlying(messages::Camera3DeviceOps::kOnNewBuffer), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::Camera3DeviceOps_OnNewBuffer_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Camera3DeviceOps::Name_); |
| message.set_method_name("OnNewBuffer"); |
| #endif |
| |
| message.set_request_id(request_id_); |
| message.set_trace_nonce(trace_nonce_); |
| ::mojo::internal::SendMojoMessage(*responder_, message); |
| // SendMojoMessage() fails silently if the responder connection is closed, |
| // or if the message is malformed. |
| // |
| // TODO(darin): If Accept() returns false due to a malformed message, that |
| // may be good reason to close the connection. However, we don't have a |
| // way to do that from here. We should add a way. |
| responder_ = nullptr; |
| } |
| |
| // static |
| bool Camera3DeviceOpsStubDispatch::Accept( |
| Camera3DeviceOps* impl, |
| mojo::Message* message) { |
| switch (static_cast<messages::Camera3DeviceOps>(message->header()->name)) { |
| case messages::Camera3DeviceOps::kInitialize: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kConfigureStreams: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kConstructDefaultRequestSettings: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kProcessCaptureRequest: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kDump: { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_Dump_Params_Data* params = |
| reinterpret_cast<internal::Camera3DeviceOps_Dump_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.4 |
| bool success = true; |
| ::mojo::ScopedHandle p_fd{}; |
| Camera3DeviceOps_Dump_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_fd = input_data_view.TakeFd(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 4, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->Dump( |
| std::move(p_fd)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kFlush: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kRegisterBuffer: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kClose: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kSignalStreamFlush: { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_SignalStreamFlush_Params_Data* params = |
| reinterpret_cast<internal::Camera3DeviceOps_SignalStreamFlush_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.9 |
| bool success = true; |
| std::vector<uint64_t> p_stream_ids{}; |
| Camera3DeviceOps_SignalStreamFlush_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadStreamIds(&p_stream_ids)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 9, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->SignalStreamFlush( |
| std::move(p_stream_ids)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kOnNewBuffer: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kOnBufferRetired: { |
| DCHECK(message->is_serialized()); |
| internal::Camera3DeviceOps_OnBufferRetired_Params_Data* params = |
| reinterpret_cast<internal::Camera3DeviceOps_OnBufferRetired_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.11 |
| bool success = true; |
| uint64_t p_buffer_id{}; |
| Camera3DeviceOps_OnBufferRetired_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_buffer_id = input_data_view.buffer_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 11, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->OnBufferRetired( |
| std::move(p_buffer_id)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool Camera3DeviceOpsStubDispatch::AcceptWithResponder( |
| Camera3DeviceOps* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| [[maybe_unused]] const bool message_is_sync = |
| message->has_flag(mojo::Message::kFlagIsSync); |
| [[maybe_unused]] const uint64_t request_id = message->request_id(); |
| switch (static_cast<messages::Camera3DeviceOps>(message->header()->name)) { |
| case messages::Camera3DeviceOps::kInitialize: { |
| internal::Camera3DeviceOps_Initialize_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_Initialize_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.0 |
| bool success = true; |
| ::mojo::PendingRemote<Camera3CallbackOps> p_callback_ops{}; |
| Camera3DeviceOps_Initialize_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_callback_ops = |
| input_data_view.TakeCallbackOps<decltype(p_callback_ops)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 0, false); |
| return false; |
| } |
| Camera3DeviceOps::InitializeCallback callback = |
| Camera3DeviceOps_Initialize_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->Initialize( |
| std::move(p_callback_ops), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kConfigureStreams: { |
| internal::Camera3DeviceOps_ConfigureStreams_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ConfigureStreams_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.1 |
| bool success = true; |
| Camera3StreamConfigurationPtr p_config{}; |
| Camera3DeviceOps_ConfigureStreams_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadConfig(&p_config)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 1, false); |
| return false; |
| } |
| Camera3DeviceOps::ConfigureStreamsCallback callback = |
| Camera3DeviceOps_ConfigureStreams_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ConfigureStreams( |
| std::move(p_config), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kConstructDefaultRequestSettings: { |
| internal::Camera3DeviceOps_ConstructDefaultRequestSettings_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ConstructDefaultRequestSettings_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.2 |
| bool success = true; |
| Camera3RequestTemplate p_type{}; |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadType(&p_type)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 2, false); |
| return false; |
| } |
| Camera3DeviceOps::ConstructDefaultRequestSettingsCallback callback = |
| Camera3DeviceOps_ConstructDefaultRequestSettings_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ConstructDefaultRequestSettings( |
| std::move(p_type), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kProcessCaptureRequest: { |
| internal::Camera3DeviceOps_ProcessCaptureRequest_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ProcessCaptureRequest_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.3 |
| bool success = true; |
| Camera3CaptureRequestPtr p_request{}; |
| Camera3DeviceOps_ProcessCaptureRequest_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadRequest(&p_request)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 3, false); |
| return false; |
| } |
| Camera3DeviceOps::ProcessCaptureRequestCallback callback = |
| Camera3DeviceOps_ProcessCaptureRequest_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ProcessCaptureRequest( |
| std::move(p_request), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kDump: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kFlush: { |
| internal::Camera3DeviceOps_Flush_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_Flush_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.5 |
| bool success = true; |
| Camera3DeviceOps_Flush_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 5, false); |
| return false; |
| } |
| Camera3DeviceOps::FlushCallback callback = |
| Camera3DeviceOps_Flush_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->Flush(std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kRegisterBuffer: { |
| internal::Camera3DeviceOps_RegisterBuffer_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_RegisterBuffer_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.6 |
| bool success = true; |
| uint64_t p_buffer_id{}; |
| Camera3DeviceOps::BufferType p_type{}; |
| std::vector<::mojo::ScopedHandle> p_fds{}; |
| uint32_t p_drm_format{}; |
| HalPixelFormat p_hal_pixel_format{}; |
| uint32_t p_width{}; |
| uint32_t p_height{}; |
| std::vector<uint32_t> p_strides{}; |
| std::vector<uint32_t> p_offsets{}; |
| Camera3DeviceOps_RegisterBuffer_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_buffer_id = input_data_view.buffer_id(); |
| if (success && !input_data_view.ReadType(&p_type)) |
| success = false; |
| if (success && !input_data_view.ReadFds(&p_fds)) |
| success = false; |
| if (success) |
| p_drm_format = input_data_view.drm_format(); |
| if (success && !input_data_view.ReadHalPixelFormat(&p_hal_pixel_format)) |
| success = false; |
| if (success) |
| p_width = input_data_view.width(); |
| if (success) |
| p_height = input_data_view.height(); |
| if (success && !input_data_view.ReadStrides(&p_strides)) |
| success = false; |
| if (success && !input_data_view.ReadOffsets(&p_offsets)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 6, false); |
| return false; |
| } |
| Camera3DeviceOps::RegisterBufferCallback callback = |
| Camera3DeviceOps_RegisterBuffer_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->RegisterBuffer( |
| std::move(p_buffer_id), |
| std::move(p_type), |
| std::move(p_fds), |
| std::move(p_drm_format), |
| std::move(p_hal_pixel_format), |
| std::move(p_width), |
| std::move(p_height), |
| std::move(p_strides), |
| std::move(p_offsets), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kClose: { |
| internal::Camera3DeviceOps_Close_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_Close_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.7 |
| bool success = true; |
| Camera3DeviceOps_Close_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 7, false); |
| return false; |
| } |
| Camera3DeviceOps::CloseCallback callback = |
| Camera3DeviceOps_Close_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->Close(std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kConfigureStreamsAndGetAllocatedBuffers: { |
| internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.8 |
| bool success = true; |
| Camera3StreamConfigurationPtr p_config{}; |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadConfig(&p_config)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 8, false); |
| return false; |
| } |
| Camera3DeviceOps::ConfigureStreamsAndGetAllocatedBuffersCallback callback = |
| Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ConfigureStreamsAndGetAllocatedBuffers( |
| std::move(p_config), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kSignalStreamFlush: { |
| break; |
| } |
| case messages::Camera3DeviceOps::kOnNewBuffer: { |
| internal::Camera3DeviceOps_OnNewBuffer_Params_Data* params = |
| reinterpret_cast< |
| internal::Camera3DeviceOps_OnNewBuffer_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for Camera3DeviceOps.10 |
| bool success = true; |
| CameraBufferHandlePtr p_buffer{}; |
| Camera3DeviceOps_OnNewBuffer_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadBuffer(&p_buffer)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Camera3DeviceOps::Name_, 10, false); |
| return false; |
| } |
| Camera3DeviceOps::OnNewBufferCallback callback = |
| Camera3DeviceOps_OnNewBuffer_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->OnNewBuffer( |
| std::move(p_buffer), std::move(callback)); |
| return true; |
| } |
| case messages::Camera3DeviceOps::kOnBufferRetired: { |
| break; |
| } |
| } |
| return false; |
| } |
| namespace { |
| } // namespace |
| static const mojo::internal::GenericValidationInfo kCamera3DeviceOpsValidationInfo[] = { |
| { &internal::Camera3DeviceOps_Initialize_Params_Data::Validate, |
| &internal::Camera3DeviceOps_Initialize_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_ConfigureStreams_Params_Data::Validate, |
| &internal::Camera3DeviceOps_ConfigureStreams_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_ConstructDefaultRequestSettings_Params_Data::Validate, |
| &internal::Camera3DeviceOps_ConstructDefaultRequestSettings_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_ProcessCaptureRequest_Params_Data::Validate, |
| &internal::Camera3DeviceOps_ProcessCaptureRequest_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_Dump_Params_Data::Validate, |
| nullptr /* no response */}, |
| { &internal::Camera3DeviceOps_Flush_Params_Data::Validate, |
| &internal::Camera3DeviceOps_Flush_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_RegisterBuffer_Params_Data::Validate, |
| &internal::Camera3DeviceOps_RegisterBuffer_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_Close_Params_Data::Validate, |
| &internal::Camera3DeviceOps_Close_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_Params_Data::Validate, |
| &internal::Camera3DeviceOps_ConfigureStreamsAndGetAllocatedBuffers_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_SignalStreamFlush_Params_Data::Validate, |
| nullptr /* no response */}, |
| { &internal::Camera3DeviceOps_OnNewBuffer_Params_Data::Validate, |
| &internal::Camera3DeviceOps_OnNewBuffer_ResponseParams_Data::Validate}, |
| { &internal::Camera3DeviceOps_OnBufferRetired_Params_Data::Validate, |
| nullptr /* no response */}, |
| }; |
| |
| bool Camera3DeviceOpsRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::Camera3DeviceOps::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kCamera3DeviceOpsValidationInfo); |
| } |
| |
| bool Camera3DeviceOpsResponseValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::Camera3DeviceOps::Name_; |
| return mojo::internal::ValidateResponseGenericPacked(message, name, kCamera3DeviceOpsValidationInfo); |
| } |
| |
| |
| } // cros::mojom |
| |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::CropRotateScaleInfo::DataView, ::cros::mojom::CropRotateScaleInfoPtr>::Read( |
| ::cros::mojom::CropRotateScaleInfo::DataView input, |
| ::cros::mojom::CropRotateScaleInfoPtr* output) { |
| bool success = true; |
| ::cros::mojom::CropRotateScaleInfoPtr result(::cros::mojom::CropRotateScaleInfo::New()); |
| |
| if (success && !input.ReadCropRotateScaleDegrees(&result->crop_rotate_scale_degrees)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3Stream::DataView, ::cros::mojom::Camera3StreamPtr>::Read( |
| ::cros::mojom::Camera3Stream::DataView input, |
| ::cros::mojom::Camera3StreamPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3StreamPtr result(::cros::mojom::Camera3Stream::New()); |
| |
| if (success) |
| result->id = input.id(); |
| if (success && !input.ReadStreamType(&result->stream_type)) |
| success = false; |
| if (success) |
| result->width = input.width(); |
| if (success) |
| result->height = input.height(); |
| if (success && !input.ReadFormat(&result->format)) |
| success = false; |
| if (success) |
| result->usage = input.usage(); |
| if (success) |
| result->max_buffers = input.max_buffers(); |
| if (success) |
| result->data_space = input.data_space(); |
| if (success && !input.ReadRotation(&result->rotation)) |
| success = false; |
| if (success && !input.ReadCropRotateScaleInfo(&result->crop_rotate_scale_info)) |
| success = false; |
| if (success && !input.ReadPhysicalCameraId(&result->physical_camera_id)) |
| success = false; |
| if (success && !input.ReadEffects(&result->effects)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3StreamConfiguration::DataView, ::cros::mojom::Camera3StreamConfigurationPtr>::Read( |
| ::cros::mojom::Camera3StreamConfiguration::DataView input, |
| ::cros::mojom::Camera3StreamConfigurationPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3StreamConfigurationPtr result(::cros::mojom::Camera3StreamConfiguration::New()); |
| |
| if (success && !input.ReadStreams(&result->streams)) |
| success = false; |
| if (success && !input.ReadOperationMode(&result->operation_mode)) |
| success = false; |
| if (success && !input.ReadSessionParameters(&result->session_parameters)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::CameraBufferHandle::DataView, ::cros::mojom::CameraBufferHandlePtr>::Read( |
| ::cros::mojom::CameraBufferHandle::DataView input, |
| ::cros::mojom::CameraBufferHandlePtr* output) { |
| bool success = true; |
| ::cros::mojom::CameraBufferHandlePtr result(::cros::mojom::CameraBufferHandle::New()); |
| |
| if (success) |
| result->buffer_id = input.buffer_id(); |
| if (success && !input.ReadFds(&result->fds)) |
| success = false; |
| if (success) |
| result->drm_format = input.drm_format(); |
| if (success && !input.ReadHalPixelFormat(&result->hal_pixel_format)) |
| success = false; |
| if (success) |
| result->width = input.width(); |
| if (success) |
| result->height = input.height(); |
| if (success && !input.ReadStrides(&result->strides)) |
| success = false; |
| if (success && !input.ReadOffsets(&result->offsets)) |
| success = false; |
| if (success && !input.ReadSizes(&result->sizes)) |
| success = false; |
| if (success) |
| result->has_modifier = input.has_modifier(); |
| if (success) |
| result->modifier = input.modifier(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3StreamBuffer::DataView, ::cros::mojom::Camera3StreamBufferPtr>::Read( |
| ::cros::mojom::Camera3StreamBuffer::DataView input, |
| ::cros::mojom::Camera3StreamBufferPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3StreamBufferPtr result(::cros::mojom::Camera3StreamBuffer::New()); |
| |
| if (success) |
| result->stream_id = input.stream_id(); |
| if (success) |
| result->buffer_id = input.buffer_id(); |
| if (success && !input.ReadStatus(&result->status)) |
| success = false; |
| if (success) |
| result->acquire_fence = input.TakeAcquireFence(); |
| if (success) |
| result->release_fence = input.TakeReleaseFence(); |
| if (success && !input.ReadBufferHandle(&result->buffer_handle)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3ErrorMsg::DataView, ::cros::mojom::Camera3ErrorMsgPtr>::Read( |
| ::cros::mojom::Camera3ErrorMsg::DataView input, |
| ::cros::mojom::Camera3ErrorMsgPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3ErrorMsgPtr result(::cros::mojom::Camera3ErrorMsg::New()); |
| |
| if (success) |
| result->frame_number = input.frame_number(); |
| if (success) |
| result->error_stream_id = input.error_stream_id(); |
| if (success && !input.ReadErrorCode(&result->error_code)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3ShutterMsg::DataView, ::cros::mojom::Camera3ShutterMsgPtr>::Read( |
| ::cros::mojom::Camera3ShutterMsg::DataView input, |
| ::cros::mojom::Camera3ShutterMsgPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3ShutterMsgPtr result(::cros::mojom::Camera3ShutterMsg::New()); |
| |
| if (success) |
| result->frame_number = input.frame_number(); |
| if (success) |
| result->timestamp = input.timestamp(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3NotifyMsg::DataView, ::cros::mojom::Camera3NotifyMsgPtr>::Read( |
| ::cros::mojom::Camera3NotifyMsg::DataView input, |
| ::cros::mojom::Camera3NotifyMsgPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3NotifyMsgPtr result(::cros::mojom::Camera3NotifyMsg::New()); |
| |
| if (success && !input.ReadType(&result->type)) |
| success = false; |
| if (success && !input.ReadMessage(&result->message)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3BufferRequest::DataView, ::cros::mojom::Camera3BufferRequestPtr>::Read( |
| ::cros::mojom::Camera3BufferRequest::DataView input, |
| ::cros::mojom::Camera3BufferRequestPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3BufferRequestPtr result(::cros::mojom::Camera3BufferRequest::New()); |
| |
| if (success) |
| result->stream_id = input.stream_id(); |
| if (success) |
| result->num_buffers_requested = input.num_buffers_requested(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3StreamBufferRet::DataView, ::cros::mojom::Camera3StreamBufferRetPtr>::Read( |
| ::cros::mojom::Camera3StreamBufferRet::DataView input, |
| ::cros::mojom::Camera3StreamBufferRetPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3StreamBufferRetPtr result(::cros::mojom::Camera3StreamBufferRet::New()); |
| |
| if (success) |
| result->stream_id = input.stream_id(); |
| if (success && !input.ReadStatus(&result->status)) |
| success = false; |
| if (success && !input.ReadOutputBuffers(&result->output_buffers)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3PhyscamMetadata::DataView, ::cros::mojom::Camera3PhyscamMetadataPtr>::Read( |
| ::cros::mojom::Camera3PhyscamMetadata::DataView input, |
| ::cros::mojom::Camera3PhyscamMetadataPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3PhyscamMetadataPtr result(::cros::mojom::Camera3PhyscamMetadata::New()); |
| |
| if (success) |
| result->id = input.id(); |
| if (success && !input.ReadMetadata(&result->metadata)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3CaptureRequest::DataView, ::cros::mojom::Camera3CaptureRequestPtr>::Read( |
| ::cros::mojom::Camera3CaptureRequest::DataView input, |
| ::cros::mojom::Camera3CaptureRequestPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3CaptureRequestPtr result(::cros::mojom::Camera3CaptureRequest::New()); |
| |
| if (success) |
| result->frame_number = input.frame_number(); |
| if (success && !input.ReadSettings(&result->settings)) |
| success = false; |
| if (success && !input.ReadInputBuffer(&result->input_buffer)) |
| success = false; |
| if (success && !input.ReadOutputBuffers(&result->output_buffers)) |
| success = false; |
| if (success && !input.ReadPhyscamSettings(&result->physcam_settings)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::Camera3CaptureResult::DataView, ::cros::mojom::Camera3CaptureResultPtr>::Read( |
| ::cros::mojom::Camera3CaptureResult::DataView input, |
| ::cros::mojom::Camera3CaptureResultPtr* output) { |
| bool success = true; |
| ::cros::mojom::Camera3CaptureResultPtr result(::cros::mojom::Camera3CaptureResult::New()); |
| |
| if (success) |
| result->frame_number = input.frame_number(); |
| if (success && !input.ReadResult(&result->result)) |
| success = false; |
| if (success && !input.ReadOutputBuffers(&result->output_buffers)) |
| success = false; |
| if (success && !input.ReadInputBuffer(&result->input_buffer)) |
| success = false; |
| if (success) |
| result->partial_result = input.partial_result(); |
| if (success && !input.ReadPhyscamMetadata(&result->physcam_metadata)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| // static |
| bool UnionTraits<::cros::mojom::Camera3NotifyMsgMessage::DataView, ::cros::mojom::Camera3NotifyMsgMessagePtr>::Read( |
| ::cros::mojom::Camera3NotifyMsgMessage::DataView input, |
| ::cros::mojom::Camera3NotifyMsgMessagePtr* output) { |
| using UnionType = ::cros::mojom::Camera3NotifyMsgMessage; |
| using Tag = UnionType::Tag; |
| |
| switch (input.tag()) { |
| case Tag::kError: { |
| ::cros::mojom::Camera3ErrorMsgPtr result_error; |
| if (!input.ReadError(&result_error)) |
| return false; |
| |
| *output = UnionType::NewError( |
| std::move(result_error)); |
| break; |
| } |
| case Tag::kShutter: { |
| ::cros::mojom::Camera3ShutterMsgPtr result_shutter; |
| if (!input.ReadShutter(&result_shutter)) |
| return false; |
| |
| *output = UnionType::NewShutter( |
| std::move(result_shutter)); |
| break; |
| } |
| case Tag::kGeneric: { |
| std::vector<uint8_t> result_generic; |
| if (!input.ReadGeneric(&result_generic)) |
| return false; |
| |
| *output = UnionType::NewGeneric( |
| std::move(result_generic)); |
| break; |
| } |
| default: |
| |
| return false; |
| } |
| return true; |
| } |
| |
| } // 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 { |
| |
| |
| void Camera3CallbackOpsInterceptorForTesting::ProcessCaptureResult(Camera3CaptureResultPtr result) { |
| GetForwardingInterface()->ProcessCaptureResult(std::move(result)); |
| } |
| void Camera3CallbackOpsInterceptorForTesting::Notify(Camera3NotifyMsgPtr msg) { |
| GetForwardingInterface()->Notify(std::move(msg)); |
| } |
| void Camera3CallbackOpsInterceptorForTesting::RequestStreamBuffers(std::vector<Camera3BufferRequestPtr> buffer_reqs, RequestStreamBuffersCallback callback) { |
| GetForwardingInterface()->RequestStreamBuffers(std::move(buffer_reqs), std::move(callback)); |
| } |
| void Camera3CallbackOpsInterceptorForTesting::ReturnStreamBuffers(std::vector<Camera3StreamBufferPtr> buffers) { |
| GetForwardingInterface()->ReturnStreamBuffers(std::move(buffers)); |
| } |
| Camera3CallbackOpsAsyncWaiter::Camera3CallbackOpsAsyncWaiter( |
| Camera3CallbackOps* proxy) : proxy_(proxy) {} |
| |
| Camera3CallbackOpsAsyncWaiter::~Camera3CallbackOpsAsyncWaiter() = default; |
| |
| void Camera3CallbackOpsAsyncWaiter::RequestStreamBuffers( |
| std::vector<Camera3BufferRequestPtr> buffer_reqs, Camera3BufferRequestStatus* out_result, std::vector<Camera3StreamBufferRetPtr>* out_returned_buf_reqs) { |
| base::RunLoop loop; |
| proxy_->RequestStreamBuffers(std::move(buffer_reqs), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| Camera3BufferRequestStatus* out_result |
| , |
| std::vector<Camera3StreamBufferRetPtr>* out_returned_buf_reqs |
| , |
| Camera3BufferRequestStatus result, |
| std::vector<Camera3StreamBufferRetPtr> returned_buf_reqs) {*out_result = std::move(result);*out_returned_buf_reqs = std::move(returned_buf_reqs); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_returned_buf_reqs)); |
| loop.Run(); |
| } |
| |
| |
| |
| |
| |
| |
| void Camera3DeviceOpsInterceptorForTesting::Initialize(::mojo::PendingRemote<Camera3CallbackOps> callback_ops, InitializeCallback callback) { |
| GetForwardingInterface()->Initialize(std::move(callback_ops), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::ConfigureStreams(Camera3StreamConfigurationPtr config, ConfigureStreamsCallback callback) { |
| GetForwardingInterface()->ConfigureStreams(std::move(config), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::ConstructDefaultRequestSettings(Camera3RequestTemplate type, ConstructDefaultRequestSettingsCallback callback) { |
| GetForwardingInterface()->ConstructDefaultRequestSettings(std::move(type), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::ProcessCaptureRequest(Camera3CaptureRequestPtr request, ProcessCaptureRequestCallback callback) { |
| GetForwardingInterface()->ProcessCaptureRequest(std::move(request), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::Dump(::mojo::ScopedHandle fd) { |
| GetForwardingInterface()->Dump(std::move(fd)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::Flush(FlushCallback callback) { |
| GetForwardingInterface()->Flush(std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::RegisterBuffer(uint64_t buffer_id, Camera3DeviceOps::BufferType type, std::vector<::mojo::ScopedHandle> fds, uint32_t drm_format, HalPixelFormat hal_pixel_format, uint32_t width, uint32_t height, const std::vector<uint32_t>& strides, const std::vector<uint32_t>& offsets, RegisterBufferCallback callback) { |
| GetForwardingInterface()->RegisterBuffer(std::move(buffer_id), std::move(type), std::move(fds), std::move(drm_format), std::move(hal_pixel_format), std::move(width), std::move(height), std::move(strides), std::move(offsets), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::Close(CloseCallback callback) { |
| GetForwardingInterface()->Close(std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::ConfigureStreamsAndGetAllocatedBuffers(Camera3StreamConfigurationPtr config, ConfigureStreamsAndGetAllocatedBuffersCallback callback) { |
| GetForwardingInterface()->ConfigureStreamsAndGetAllocatedBuffers(std::move(config), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::SignalStreamFlush(const std::vector<uint64_t>& stream_ids) { |
| GetForwardingInterface()->SignalStreamFlush(std::move(stream_ids)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::OnNewBuffer(CameraBufferHandlePtr buffer, OnNewBufferCallback callback) { |
| GetForwardingInterface()->OnNewBuffer(std::move(buffer), std::move(callback)); |
| } |
| void Camera3DeviceOpsInterceptorForTesting::OnBufferRetired(uint64_t buffer_id) { |
| GetForwardingInterface()->OnBufferRetired(std::move(buffer_id)); |
| } |
| Camera3DeviceOpsAsyncWaiter::Camera3DeviceOpsAsyncWaiter( |
| Camera3DeviceOps* proxy) : proxy_(proxy) {} |
| |
| Camera3DeviceOpsAsyncWaiter::~Camera3DeviceOpsAsyncWaiter() = default; |
| |
| void Camera3DeviceOpsAsyncWaiter::Initialize( |
| ::mojo::PendingRemote<Camera3CallbackOps> callback_ops, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->Initialize(std::move(callback_ops), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| int32_t result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| int32_t Camera3DeviceOpsAsyncWaiter::Initialize( |
| ::mojo::PendingRemote<Camera3CallbackOps> callback_ops) { |
| int32_t async_wait_result; |
| Initialize(std::move(callback_ops),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void Camera3DeviceOpsAsyncWaiter::ConfigureStreams( |
| Camera3StreamConfigurationPtr config, int32_t* out_result, Camera3StreamConfigurationPtr* out_updated_config) { |
| base::RunLoop loop; |
| proxy_->ConfigureStreams(std::move(config), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| Camera3StreamConfigurationPtr* out_updated_config |
| , |
| int32_t result, |
| Camera3StreamConfigurationPtr updated_config) {*out_result = std::move(result);*out_updated_config = std::move(updated_config); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_updated_config)); |
| loop.Run(); |
| } |
| |
| |
| |
| void Camera3DeviceOpsAsyncWaiter::ConstructDefaultRequestSettings( |
| Camera3RequestTemplate type, ::cros::mojom::CameraMetadataPtr* out_settings) { |
| base::RunLoop loop; |
| proxy_->ConstructDefaultRequestSettings(std::move(type), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| ::cros::mojom::CameraMetadataPtr* out_settings |
| , |
| ::cros::mojom::CameraMetadataPtr settings) {*out_settings = std::move(settings); |
| loop->Quit(); |
| }, |
| &loop, |
| out_settings)); |
| loop.Run(); |
| } |
| |
| ::cros::mojom::CameraMetadataPtr Camera3DeviceOpsAsyncWaiter::ConstructDefaultRequestSettings( |
| Camera3RequestTemplate type) { |
| ::cros::mojom::CameraMetadataPtr async_wait_result; |
| ConstructDefaultRequestSettings(std::move(type),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void Camera3DeviceOpsAsyncWaiter::ProcessCaptureRequest( |
| Camera3CaptureRequestPtr request, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->ProcessCaptureRequest(std::move(request), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| int32_t result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| int32_t Camera3DeviceOpsAsyncWaiter::ProcessCaptureRequest( |
| Camera3CaptureRequestPtr request) { |
| int32_t async_wait_result; |
| ProcessCaptureRequest(std::move(request),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void Camera3DeviceOpsAsyncWaiter::Flush( |
| int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->Flush( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| int32_t result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| int32_t Camera3DeviceOpsAsyncWaiter::Flush( |
| ) { |
| int32_t async_wait_result; |
| Flush(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void Camera3DeviceOpsAsyncWaiter::RegisterBuffer( |
| uint64_t buffer_id, Camera3DeviceOps::BufferType type, std::vector<::mojo::ScopedHandle> fds, uint32_t drm_format, HalPixelFormat hal_pixel_format, uint32_t width, uint32_t height, const std::vector<uint32_t>& strides, const std::vector<uint32_t>& offsets, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->RegisterBuffer(std::move(buffer_id),std::move(type),std::move(fds),std::move(drm_format),std::move(hal_pixel_format),std::move(width),std::move(height),std::move(strides),std::move(offsets), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| int32_t result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| int32_t Camera3DeviceOpsAsyncWaiter::RegisterBuffer( |
| uint64_t buffer_id, Camera3DeviceOps::BufferType type, std::vector<::mojo::ScopedHandle> fds, uint32_t drm_format, HalPixelFormat hal_pixel_format, uint32_t width, uint32_t height, const std::vector<uint32_t>& strides, const std::vector<uint32_t>& offsets) { |
| int32_t async_wait_result; |
| RegisterBuffer(std::move(buffer_id),std::move(type),std::move(fds),std::move(drm_format),std::move(hal_pixel_format),std::move(width),std::move(height),std::move(strides),std::move(offsets),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void Camera3DeviceOpsAsyncWaiter::Close( |
| int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->Close( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| int32_t result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| int32_t Camera3DeviceOpsAsyncWaiter::Close( |
| ) { |
| int32_t async_wait_result; |
| Close(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void Camera3DeviceOpsAsyncWaiter::ConfigureStreamsAndGetAllocatedBuffers( |
| Camera3StreamConfigurationPtr config, int32_t* out_result, Camera3StreamConfigurationPtr* out_updated_config, base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>>* out_allocated_buffers) { |
| base::RunLoop loop; |
| proxy_->ConfigureStreamsAndGetAllocatedBuffers(std::move(config), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| Camera3StreamConfigurationPtr* out_updated_config |
| , |
| base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>>* out_allocated_buffers |
| , |
| int32_t result, |
| Camera3StreamConfigurationPtr updated_config, |
| base::flat_map<uint64_t, std::vector<Camera3StreamBufferPtr>> allocated_buffers) {*out_result = std::move(result);*out_updated_config = std::move(updated_config);*out_allocated_buffers = std::move(allocated_buffers); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_updated_config, |
| out_allocated_buffers)); |
| loop.Run(); |
| } |
| |
| |
| |
| void Camera3DeviceOpsAsyncWaiter::OnNewBuffer( |
| CameraBufferHandlePtr buffer, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->OnNewBuffer(std::move(buffer), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| int32_t result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| int32_t Camera3DeviceOpsAsyncWaiter::OnNewBuffer( |
| CameraBufferHandlePtr buffer) { |
| int32_t async_wait_result; |
| OnNewBuffer(std::move(buffer),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| |
| |
| |
| |
| |
| } // cros::mojom |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |