| // camera/mojo/algorithm/camera_algorithm.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2016 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "camera/mojo/algorithm/camera_algorithm.mojom-shared.h" |
| |
| // Used to support stream output operator for enums. |
| // TODO(dcheng): Consider omitting this somehow if not needed. |
| #include <ostream> |
| #include <utility> |
| |
| #include "base/strings/stringprintf.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/cpp/bindings/lib/validation_util.h" |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
| |
| #include "camera/mojo/algorithm/camera_algorithm.mojom-params-data.h" |
| namespace cros { |
| namespace mojom { |
| |
| namespace internal { |
| |
| |
| // static |
| bool CameraAlgorithmOps_Initialize_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 16, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_Initialize_Params_Data* object = |
| static_cast<const CameraAlgorithmOps_Initialize_Params_Data*>(data); |
| |
| if (!mojo::internal::ValidateHandleOrInterfaceNonNullable( |
| object->callbacks, 1, validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateHandleOrInterface(object->callbacks, |
| validation_context)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_Initialize_Params_Data::CameraAlgorithmOps_Initialize_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_Initialize_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 16, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_Initialize_ResponseParams_Data* object = |
| static_cast<const CameraAlgorithmOps_Initialize_ResponseParams_Data*>(data); |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_Initialize_ResponseParams_Data::CameraAlgorithmOps_Initialize_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_RegisterBuffer_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 16, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_RegisterBuffer_Params_Data* object = |
| static_cast<const CameraAlgorithmOps_RegisterBuffer_Params_Data*>(data); |
| |
| if (!mojo::internal::ValidateHandleOrInterfaceNonNullable( |
| object->buffer_fd, 1, validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateHandleOrInterface(object->buffer_fd, |
| validation_context)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_RegisterBuffer_Params_Data::CameraAlgorithmOps_RegisterBuffer_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_RegisterBuffer_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 16, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_RegisterBuffer_ResponseParams_Data* object = |
| static_cast<const CameraAlgorithmOps_RegisterBuffer_ResponseParams_Data*>(data); |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_RegisterBuffer_ResponseParams_Data::CameraAlgorithmOps_RegisterBuffer_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_Request_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 24, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_Request_Params_Data* object = |
| static_cast<const CameraAlgorithmOps_Request_Params_Data*>(data); |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->req_header, 2, validation_context)) { |
| return false; |
| } |
| constexpr const mojo::internal::ContainerValidateParams& req_header_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| if (!mojo::internal::ValidateContainer(object->req_header, validation_context, |
| &req_header_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_Request_Params_Data::CameraAlgorithmOps_Request_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_DeregisterBuffers_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 16, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_DeregisterBuffers_Params_Data* object = |
| static_cast<const CameraAlgorithmOps_DeregisterBuffers_Params_Data*>(data); |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->buffer_handles, 1, validation_context)) { |
| return false; |
| } |
| constexpr const mojo::internal::ContainerValidateParams& buffer_handles_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| if (!mojo::internal::ValidateContainer(object->buffer_handles, validation_context, |
| &buffer_handles_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_DeregisterBuffers_Params_Data::CameraAlgorithmOps_DeregisterBuffers_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_UpdateReturn_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 24, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_UpdateReturn_Params_Data* object = |
| static_cast<const CameraAlgorithmOps_UpdateReturn_Params_Data*>(data); |
| |
| if (!mojo::internal::ValidateHandleOrInterfaceNonNullable( |
| object->buffer_fd, 3, validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateHandleOrInterface(object->buffer_fd, |
| validation_context)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_UpdateReturn_Params_Data::CameraAlgorithmOps_UpdateReturn_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmOps_Deinitialize_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 8, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmOps_Deinitialize_Params_Data* object = |
| static_cast<const CameraAlgorithmOps_Deinitialize_Params_Data*>(data); |
| |
| return true; |
| } |
| |
| CameraAlgorithmOps_Deinitialize_Params_Data::CameraAlgorithmOps_Deinitialize_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmCallbackOps_Return_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 24, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmCallbackOps_Return_Params_Data* object = |
| static_cast<const CameraAlgorithmCallbackOps_Return_Params_Data*>(data); |
| |
| return true; |
| } |
| |
| CameraAlgorithmCallbackOps_Return_Params_Data::CameraAlgorithmCallbackOps_Return_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool CameraAlgorithmCallbackOps_Update_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory( |
| data, 24, validation_context)) { |
| return false; |
| } |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| [[maybe_unused]] const CameraAlgorithmCallbackOps_Update_Params_Data* object = |
| static_cast<const CameraAlgorithmCallbackOps_Update_Params_Data*>(data); |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->upd_header, 2, validation_context)) { |
| return false; |
| } |
| constexpr const mojo::internal::ContainerValidateParams& upd_header_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| if (!mojo::internal::ValidateContainer(object->upd_header, validation_context, |
| &upd_header_validate_params)) { |
| return false; |
| } |
| |
| if (!mojo::internal::ValidateHandleOrInterfaceNonNullable( |
| object->buffer_fd, 3, validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateHandleOrInterface(object->buffer_fd, |
| validation_context)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| CameraAlgorithmCallbackOps_Update_Params_Data::CameraAlgorithmCallbackOps_Update_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| } // namespace internal |
| } // namespace mojom |
| } // namespace cros |