| // camera/mojo/camera_common.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wunused-private-field" |
| #endif |
| |
| #include "camera/mojo/camera_common.mojom.h" |
| |
| #include <math.h> |
| #include <stdint.h> |
| #include <utility> |
| |
| #include "base/debug/alias.h" |
| #include "base/hash/md5_constexpr.h" |
| #include "base/run_loop.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/task/thread_pool/thread_pool_instance.h" |
| #include "base/trace_event/trace_event.h" |
| #include "base/trace_event/typed_macros.h" |
| #include "mojo/public/cpp/bindings/features.h" |
| #include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h" |
| #include "mojo/public/cpp/bindings/lib/generated_code_util.h" |
| #include "mojo/public/cpp/bindings/lib/message_internal.h" |
| #include "mojo/public/cpp/bindings/lib/proxy_to_responder.h" |
| #include "mojo/public/cpp/bindings/lib/send_message_helper.h" |
| #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| #include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/cpp/bindings/mojo_buildflags.h" |
| #include "mojo/public/cpp/bindings/urgent_message_scope.h" |
| #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
| |
| #include "camera/mojo/camera_common.mojom-params-data.h" |
| #include "camera/mojo/camera_common.mojom-shared-message-ids.h" |
| |
| #include "camera/mojo/camera_common.mojom-import-headers.h" |
| #include "camera/mojo/camera_common.mojom-test-utils.h" |
| |
| |
| namespace cros::mojom { |
| CameraResourceCost::CameraResourceCost() |
| : resource_cost() {} |
| |
| CameraResourceCost::CameraResourceCost( |
| uint32_t resource_cost_in) |
| : resource_cost(std::move(resource_cost_in)) {} |
| |
| CameraResourceCost::~CameraResourceCost() = default; |
| size_t CameraResourceCost::Hash(size_t seed) const { |
| seed = mojo::internal::Hash(seed, this->resource_cost); |
| return seed; |
| } |
| |
| void CameraResourceCost::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "resource_cost"), this->resource_cost, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool CameraResourceCost::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| CameraInfo::CameraInfo() |
| : facing(), |
| orientation(), |
| device_version(), |
| static_camera_characteristics(), |
| resource_cost(), |
| conflicting_devices() {} |
| |
| CameraInfo::CameraInfo( |
| CameraFacing facing_in, |
| int32_t orientation_in, |
| uint32_t device_version_in, |
| ::cros::mojom::CameraMetadataPtr static_camera_characteristics_in) |
| : facing(std::move(facing_in)), |
| orientation(std::move(orientation_in)), |
| device_version(std::move(device_version_in)), |
| static_camera_characteristics(std::move(static_camera_characteristics_in)), |
| resource_cost(), |
| conflicting_devices() {} |
| |
| CameraInfo::CameraInfo( |
| CameraFacing facing_in, |
| int32_t orientation_in, |
| uint32_t device_version_in, |
| ::cros::mojom::CameraMetadataPtr static_camera_characteristics_in, |
| CameraResourceCostPtr resource_cost_in, |
| std::optional<std::vector<std::string>> conflicting_devices_in) |
| : facing(std::move(facing_in)), |
| orientation(std::move(orientation_in)), |
| device_version(std::move(device_version_in)), |
| static_camera_characteristics(std::move(static_camera_characteristics_in)), |
| resource_cost(std::move(resource_cost_in)), |
| conflicting_devices(std::move(conflicting_devices_in)) {} |
| |
| CameraInfo::~CameraInfo() = default; |
| |
| void CameraInfo::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "facing"), this->facing, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type CameraFacing>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "orientation"), this->orientation, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type int32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "device_version"), this->device_version, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "static_camera_characteristics"), this->static_camera_characteristics, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::cros::mojom::CameraMetadataPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "resource_cost"), this->resource_cost, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type CameraResourceCostPtr>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "conflicting_devices"), this->conflicting_devices, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const std::optional<std::vector<std::string>>&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool CameraInfo::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| const char CameraModuleCallbacks::Name_[] = "cros.mojom.CameraModuleCallbacks"; |
| |
| CameraModuleCallbacks::IPCStableHashFunction CameraModuleCallbacks::MessageToMethodInfo_(mojo::Message& message) { |
| #if !BUILDFLAG(IS_FUCHSIA) |
| switch (static_cast<messages::CameraModuleCallbacks>(message.name())) { |
| case messages::CameraModuleCallbacks::kCameraDeviceStatusChange: { |
| return &CameraModuleCallbacks::CameraDeviceStatusChange_Sym::IPCStableHash; |
| } |
| case messages::CameraModuleCallbacks::kTorchModeStatusChange: { |
| return &CameraModuleCallbacks::TorchModeStatusChange_Sym::IPCStableHash; |
| } |
| } |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| return nullptr; |
| } |
| |
| |
| const char* CameraModuleCallbacks::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::CameraModuleCallbacks>(message.name())) { |
| case messages::CameraModuleCallbacks::kCameraDeviceStatusChange: |
| return "Receive cros::mojom::CameraModuleCallbacks::CameraDeviceStatusChange"; |
| case messages::CameraModuleCallbacks::kTorchModeStatusChange: |
| return "Receive cros::mojom::CameraModuleCallbacks::TorchModeStatusChange"; |
| } |
| } else { |
| switch (static_cast<messages::CameraModuleCallbacks>(message.name())) { |
| case messages::CameraModuleCallbacks::kCameraDeviceStatusChange: |
| return "Receive reply cros::mojom::CameraModuleCallbacks::CameraDeviceStatusChange"; |
| case messages::CameraModuleCallbacks::kTorchModeStatusChange: |
| return "Receive reply cros::mojom::CameraModuleCallbacks::TorchModeStatusChange"; |
| } |
| } |
| 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 CameraModuleCallbacks::CameraDeviceStatusChange_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::CameraModuleCallbacks::CameraDeviceStatusChange"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModuleCallbacks::TorchModeStatusChange_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::CameraModuleCallbacks::TorchModeStatusChange"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| CameraModuleCallbacksProxy::CameraModuleCallbacksProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void CameraModuleCallbacksProxy::CameraDeviceStatusChange( |
| int32_t in_camera_id, CameraDeviceStatus in_new_status) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModuleCallbacks::CameraDeviceStatusChange", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("camera_id"), in_camera_id, |
| "<value of type int32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("new_status"), in_new_status, |
| "<value of type CameraDeviceStatus>"); |
| }); |
| #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::CameraModuleCallbacks::kCameraDeviceStatusChange), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModuleCallbacks_CameraDeviceStatusChange_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->camera_id = in_camera_id; |
| mojo::internal::Serialize<::cros::mojom::CameraDeviceStatus>( |
| in_new_status, ¶ms->new_status); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModuleCallbacks::Name_); |
| message.set_method_name("CameraDeviceStatusChange"); |
| #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 CameraModuleCallbacksProxy::TorchModeStatusChange( |
| int32_t in_camera_id, TorchModeStatus in_new_status) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModuleCallbacks::TorchModeStatusChange", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("camera_id"), in_camera_id, |
| "<value of type int32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("new_status"), in_new_status, |
| "<value of type TorchModeStatus>"); |
| }); |
| #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::CameraModuleCallbacks::kTorchModeStatusChange), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModuleCallbacks_TorchModeStatusChange_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->camera_id = in_camera_id; |
| mojo::internal::Serialize<::cros::mojom::TorchModeStatus>( |
| in_new_status, ¶ms->new_status); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModuleCallbacks::Name_); |
| message.set_method_name("TorchModeStatusChange"); |
| #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); |
| } |
| |
| // static |
| bool CameraModuleCallbacksStubDispatch::Accept( |
| CameraModuleCallbacks* impl, |
| mojo::Message* message) { |
| switch (static_cast<messages::CameraModuleCallbacks>(message->header()->name)) { |
| case messages::CameraModuleCallbacks::kCameraDeviceStatusChange: { |
| DCHECK(message->is_serialized()); |
| internal::CameraModuleCallbacks_CameraDeviceStatusChange_Params_Data* params = |
| reinterpret_cast<internal::CameraModuleCallbacks_CameraDeviceStatusChange_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModuleCallbacks.0 |
| bool success = true; |
| int32_t p_camera_id{}; |
| CameraDeviceStatus p_new_status{}; |
| CameraModuleCallbacks_CameraDeviceStatusChange_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_camera_id = input_data_view.camera_id(); |
| if (success && !input_data_view.ReadNewStatus(&p_new_status)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModuleCallbacks::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->CameraDeviceStatusChange( |
| std::move(p_camera_id), |
| std::move(p_new_status)); |
| return true; |
| } |
| case messages::CameraModuleCallbacks::kTorchModeStatusChange: { |
| DCHECK(message->is_serialized()); |
| internal::CameraModuleCallbacks_TorchModeStatusChange_Params_Data* params = |
| reinterpret_cast<internal::CameraModuleCallbacks_TorchModeStatusChange_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModuleCallbacks.1 |
| bool success = true; |
| int32_t p_camera_id{}; |
| TorchModeStatus p_new_status{}; |
| CameraModuleCallbacks_TorchModeStatusChange_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_camera_id = input_data_view.camera_id(); |
| if (success && !input_data_view.ReadNewStatus(&p_new_status)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModuleCallbacks::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->TorchModeStatusChange( |
| std::move(p_camera_id), |
| std::move(p_new_status)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool CameraModuleCallbacksStubDispatch::AcceptWithResponder( |
| CameraModuleCallbacks* 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::CameraModuleCallbacks>(message->header()->name)) { |
| case messages::CameraModuleCallbacks::kCameraDeviceStatusChange: { |
| break; |
| } |
| case messages::CameraModuleCallbacks::kTorchModeStatusChange: { |
| break; |
| } |
| } |
| return false; |
| } |
| namespace { |
| } // namespace |
| static const mojo::internal::GenericValidationInfo kCameraModuleCallbacksValidationInfo[] = { |
| { &internal::CameraModuleCallbacks_CameraDeviceStatusChange_Params_Data::Validate, |
| nullptr /* no response */}, |
| { &internal::CameraModuleCallbacks_TorchModeStatusChange_Params_Data::Validate, |
| nullptr /* no response */}, |
| }; |
| |
| bool CameraModuleCallbacksRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::CameraModuleCallbacks::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kCameraModuleCallbacksValidationInfo); |
| } |
| |
| const char VendorTagOps::Name_[] = "cros.mojom.VendorTagOps"; |
| |
| VendorTagOps::IPCStableHashFunction VendorTagOps::MessageToMethodInfo_(mojo::Message& message) { |
| #if !BUILDFLAG(IS_FUCHSIA) |
| switch (static_cast<messages::VendorTagOps>(message.name())) { |
| case messages::VendorTagOps::kGetTagCount: { |
| return &VendorTagOps::GetTagCount_Sym::IPCStableHash; |
| } |
| case messages::VendorTagOps::kGetAllTags: { |
| return &VendorTagOps::GetAllTags_Sym::IPCStableHash; |
| } |
| case messages::VendorTagOps::kGetSectionName: { |
| return &VendorTagOps::GetSectionName_Sym::IPCStableHash; |
| } |
| case messages::VendorTagOps::kGetTagName: { |
| return &VendorTagOps::GetTagName_Sym::IPCStableHash; |
| } |
| case messages::VendorTagOps::kGetTagType: { |
| return &VendorTagOps::GetTagType_Sym::IPCStableHash; |
| } |
| } |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| return nullptr; |
| } |
| |
| |
| const char* VendorTagOps::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::VendorTagOps>(message.name())) { |
| case messages::VendorTagOps::kGetTagCount: |
| return "Receive cros::mojom::VendorTagOps::GetTagCount"; |
| case messages::VendorTagOps::kGetAllTags: |
| return "Receive cros::mojom::VendorTagOps::GetAllTags"; |
| case messages::VendorTagOps::kGetSectionName: |
| return "Receive cros::mojom::VendorTagOps::GetSectionName"; |
| case messages::VendorTagOps::kGetTagName: |
| return "Receive cros::mojom::VendorTagOps::GetTagName"; |
| case messages::VendorTagOps::kGetTagType: |
| return "Receive cros::mojom::VendorTagOps::GetTagType"; |
| } |
| } else { |
| switch (static_cast<messages::VendorTagOps>(message.name())) { |
| case messages::VendorTagOps::kGetTagCount: |
| return "Receive reply cros::mojom::VendorTagOps::GetTagCount"; |
| case messages::VendorTagOps::kGetAllTags: |
| return "Receive reply cros::mojom::VendorTagOps::GetAllTags"; |
| case messages::VendorTagOps::kGetSectionName: |
| return "Receive reply cros::mojom::VendorTagOps::GetSectionName"; |
| case messages::VendorTagOps::kGetTagName: |
| return "Receive reply cros::mojom::VendorTagOps::GetTagName"; |
| case messages::VendorTagOps::kGetTagType: |
| return "Receive reply cros::mojom::VendorTagOps::GetTagType"; |
| } |
| } |
| 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 VendorTagOps::GetTagCount_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::VendorTagOps::GetTagCount"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t VendorTagOps::GetAllTags_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::VendorTagOps::GetAllTags"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t VendorTagOps::GetSectionName_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::VendorTagOps::GetSectionName"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t VendorTagOps::GetTagName_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::VendorTagOps::GetTagName"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t VendorTagOps::GetTagType_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::VendorTagOps::GetTagType"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| class VendorTagOps_GetTagCount_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| VendorTagOps_GetTagCount_ForwardToCallback( |
| VendorTagOps::GetTagCountCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| VendorTagOps_GetTagCount_ForwardToCallback(const VendorTagOps_GetTagCount_ForwardToCallback&) = delete; |
| VendorTagOps_GetTagCount_ForwardToCallback& operator=(const VendorTagOps_GetTagCount_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| VendorTagOps::GetTagCountCallback callback_; |
| }; |
| |
| class VendorTagOps_GetAllTags_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| VendorTagOps_GetAllTags_ForwardToCallback( |
| VendorTagOps::GetAllTagsCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| VendorTagOps_GetAllTags_ForwardToCallback(const VendorTagOps_GetAllTags_ForwardToCallback&) = delete; |
| VendorTagOps_GetAllTags_ForwardToCallback& operator=(const VendorTagOps_GetAllTags_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| VendorTagOps::GetAllTagsCallback callback_; |
| }; |
| |
| class VendorTagOps_GetSectionName_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| VendorTagOps_GetSectionName_ForwardToCallback( |
| VendorTagOps::GetSectionNameCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| VendorTagOps_GetSectionName_ForwardToCallback(const VendorTagOps_GetSectionName_ForwardToCallback&) = delete; |
| VendorTagOps_GetSectionName_ForwardToCallback& operator=(const VendorTagOps_GetSectionName_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| VendorTagOps::GetSectionNameCallback callback_; |
| }; |
| |
| class VendorTagOps_GetTagName_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| VendorTagOps_GetTagName_ForwardToCallback( |
| VendorTagOps::GetTagNameCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| VendorTagOps_GetTagName_ForwardToCallback(const VendorTagOps_GetTagName_ForwardToCallback&) = delete; |
| VendorTagOps_GetTagName_ForwardToCallback& operator=(const VendorTagOps_GetTagName_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| VendorTagOps::GetTagNameCallback callback_; |
| }; |
| |
| class VendorTagOps_GetTagType_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| VendorTagOps_GetTagType_ForwardToCallback( |
| VendorTagOps::GetTagTypeCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| VendorTagOps_GetTagType_ForwardToCallback(const VendorTagOps_GetTagType_ForwardToCallback&) = delete; |
| VendorTagOps_GetTagType_ForwardToCallback& operator=(const VendorTagOps_GetTagType_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| VendorTagOps::GetTagTypeCallback callback_; |
| }; |
| |
| VendorTagOpsProxy::VendorTagOpsProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void VendorTagOpsProxy::GetTagCount( |
| GetTagCountCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send cros::mojom::VendorTagOps::GetTagCount"); |
| #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::VendorTagOps::kGetTagCount), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetTagCount_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetTagCount"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new VendorTagOps_GetTagCount_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void VendorTagOpsProxy::GetAllTags( |
| GetAllTagsCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send cros::mojom::VendorTagOps::GetAllTags"); |
| #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::VendorTagOps::kGetAllTags), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetAllTags_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetAllTags"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new VendorTagOps_GetAllTags_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void VendorTagOpsProxy::GetSectionName( |
| uint32_t in_tag, GetSectionNameCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::VendorTagOps::GetSectionName", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("tag"), in_tag, |
| "<value of type 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::VendorTagOps::kGetSectionName), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetSectionName_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->tag = in_tag; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetSectionName"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new VendorTagOps_GetSectionName_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void VendorTagOpsProxy::GetTagName( |
| uint32_t in_tag, GetTagNameCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::VendorTagOps::GetTagName", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("tag"), in_tag, |
| "<value of type 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::VendorTagOps::kGetTagName), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetTagName_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->tag = in_tag; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetTagName"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new VendorTagOps_GetTagName_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void VendorTagOpsProxy::GetTagType( |
| uint32_t in_tag, GetTagTypeCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::VendorTagOps::GetTagType", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("tag"), in_tag, |
| "<value of type 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::VendorTagOps::kGetTagType), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetTagType_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->tag = in_tag; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetTagType"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new VendorTagOps_GetTagType_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| class VendorTagOps_GetTagCount_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static VendorTagOps::GetTagCountCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<VendorTagOps_GetTagCount_ProxyToResponder> proxy( |
| new VendorTagOps_GetTagCount_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&VendorTagOps_GetTagCount_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~VendorTagOps_GetTagCount_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: |
| VendorTagOps_GetTagCount_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) |
| << "VendorTagOps::GetTagCountCallback 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 VendorTagOps_GetTagCount_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::VendorTagOps_GetTagCount_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetTagCount_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.0 |
| bool success = true; |
| int32_t p_result{}; |
| VendorTagOps_GetTagCount_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 0, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void VendorTagOps_GetTagCount_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::VendorTagOps::GetTagCount", "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::VendorTagOps::kGetTagCount), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetTagCount_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetTagCount"); |
| #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 VendorTagOps_GetAllTags_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static VendorTagOps::GetAllTagsCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<VendorTagOps_GetAllTags_ProxyToResponder> proxy( |
| new VendorTagOps_GetAllTags_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&VendorTagOps_GetAllTags_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~VendorTagOps_GetAllTags_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: |
| VendorTagOps_GetAllTags_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) |
| << "VendorTagOps::GetAllTagsCallback 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( |
| const std::vector<uint32_t>& in_tag_array); |
| }; |
| |
| bool VendorTagOps_GetAllTags_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::VendorTagOps_GetAllTags_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetAllTags_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.1 |
| bool success = true; |
| std::vector<uint32_t> p_tag_array{}; |
| VendorTagOps_GetAllTags_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadTagArray(&p_tag_array)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 1, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_tag_array)); |
| return true; |
| } |
| |
| void VendorTagOps_GetAllTags_ProxyToResponder::Run( |
| const std::vector<uint32_t>& in_tag_array) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::VendorTagOps::GetAllTags", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("tag_array"), in_tag_array, |
| "<value of type const std::vector<uint32_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::VendorTagOps::kGetAllTags), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetAllTags_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->tag_array)::BaseType> |
| tag_array_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& tag_array_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint32_t>>( |
| in_tag_array, tag_array_fragment, &tag_array_validate_params); |
| params->tag_array.Set( |
| tag_array_fragment.is_null() ? nullptr : tag_array_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->tag_array.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null tag_array in "); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetAllTags"); |
| #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 VendorTagOps_GetSectionName_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static VendorTagOps::GetSectionNameCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<VendorTagOps_GetSectionName_ProxyToResponder> proxy( |
| new VendorTagOps_GetSectionName_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&VendorTagOps_GetSectionName_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~VendorTagOps_GetSectionName_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: |
| VendorTagOps_GetSectionName_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) |
| << "VendorTagOps::GetSectionNameCallback 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( |
| const std::optional<std::string>& in_name); |
| }; |
| |
| bool VendorTagOps_GetSectionName_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::VendorTagOps_GetSectionName_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetSectionName_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.2 |
| bool success = true; |
| std::optional<std::string> p_name{}; |
| VendorTagOps_GetSectionName_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadName(&p_name)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 2, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_name)); |
| return true; |
| } |
| |
| void VendorTagOps_GetSectionName_ProxyToResponder::Run( |
| const std::optional<std::string>& in_name) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::VendorTagOps::GetSectionName", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("name"), in_name, |
| "<value of type const std::optional<std::string>&>"); |
| }); |
| #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::VendorTagOps::kGetSectionName), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetSectionName_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->name)::BaseType> name_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_name, name_fragment); |
| params->name.Set( |
| name_fragment.is_null() ? nullptr : name_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetSectionName"); |
| #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 VendorTagOps_GetTagName_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static VendorTagOps::GetTagNameCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<VendorTagOps_GetTagName_ProxyToResponder> proxy( |
| new VendorTagOps_GetTagName_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&VendorTagOps_GetTagName_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~VendorTagOps_GetTagName_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: |
| VendorTagOps_GetTagName_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) |
| << "VendorTagOps::GetTagNameCallback 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( |
| const std::optional<std::string>& in_name); |
| }; |
| |
| bool VendorTagOps_GetTagName_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::VendorTagOps_GetTagName_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetTagName_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.3 |
| bool success = true; |
| std::optional<std::string> p_name{}; |
| VendorTagOps_GetTagName_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadName(&p_name)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 3, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_name)); |
| return true; |
| } |
| |
| void VendorTagOps_GetTagName_ProxyToResponder::Run( |
| const std::optional<std::string>& in_name) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::VendorTagOps::GetTagName", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("name"), in_name, |
| "<value of type const std::optional<std::string>&>"); |
| }); |
| #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::VendorTagOps::kGetTagName), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetTagName_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->name)::BaseType> name_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_name, name_fragment); |
| params->name.Set( |
| name_fragment.is_null() ? nullptr : name_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetTagName"); |
| #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 VendorTagOps_GetTagType_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static VendorTagOps::GetTagTypeCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<VendorTagOps_GetTagType_ProxyToResponder> proxy( |
| new VendorTagOps_GetTagType_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&VendorTagOps_GetTagType_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~VendorTagOps_GetTagType_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: |
| VendorTagOps_GetTagType_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) |
| << "VendorTagOps::GetTagTypeCallback 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_type); |
| }; |
| |
| bool VendorTagOps_GetTagType_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::VendorTagOps_GetTagType_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetTagType_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.4 |
| bool success = true; |
| int32_t p_type{}; |
| VendorTagOps_GetTagType_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_type = input_data_view.type(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 4, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_type)); |
| return true; |
| } |
| |
| void VendorTagOps_GetTagType_ProxyToResponder::Run( |
| int32_t in_type) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::VendorTagOps::GetTagType", "async_response_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("type"), in_type, |
| "<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::VendorTagOps::kGetTagType), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::VendorTagOps_GetTagType_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->type = in_type; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VendorTagOps::Name_); |
| message.set_method_name("GetTagType"); |
| #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 VendorTagOpsStubDispatch::Accept( |
| VendorTagOps* impl, |
| mojo::Message* message) { |
| switch (static_cast<messages::VendorTagOps>(message->header()->name)) { |
| case messages::VendorTagOps::kGetTagCount: { |
| break; |
| } |
| case messages::VendorTagOps::kGetAllTags: { |
| break; |
| } |
| case messages::VendorTagOps::kGetSectionName: { |
| break; |
| } |
| case messages::VendorTagOps::kGetTagName: { |
| break; |
| } |
| case messages::VendorTagOps::kGetTagType: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool VendorTagOpsStubDispatch::AcceptWithResponder( |
| VendorTagOps* 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::VendorTagOps>(message->header()->name)) { |
| case messages::VendorTagOps::kGetTagCount: { |
| internal::VendorTagOps_GetTagCount_Params_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetTagCount_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.0 |
| bool success = true; |
| VendorTagOps_GetTagCount_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 0, false); |
| return false; |
| } |
| VendorTagOps::GetTagCountCallback callback = |
| VendorTagOps_GetTagCount_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetTagCount(std::move(callback)); |
| return true; |
| } |
| case messages::VendorTagOps::kGetAllTags: { |
| internal::VendorTagOps_GetAllTags_Params_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetAllTags_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.1 |
| bool success = true; |
| VendorTagOps_GetAllTags_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 1, false); |
| return false; |
| } |
| VendorTagOps::GetAllTagsCallback callback = |
| VendorTagOps_GetAllTags_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetAllTags(std::move(callback)); |
| return true; |
| } |
| case messages::VendorTagOps::kGetSectionName: { |
| internal::VendorTagOps_GetSectionName_Params_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetSectionName_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.2 |
| bool success = true; |
| uint32_t p_tag{}; |
| VendorTagOps_GetSectionName_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_tag = input_data_view.tag(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 2, false); |
| return false; |
| } |
| VendorTagOps::GetSectionNameCallback callback = |
| VendorTagOps_GetSectionName_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetSectionName( |
| std::move(p_tag), std::move(callback)); |
| return true; |
| } |
| case messages::VendorTagOps::kGetTagName: { |
| internal::VendorTagOps_GetTagName_Params_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetTagName_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.3 |
| bool success = true; |
| uint32_t p_tag{}; |
| VendorTagOps_GetTagName_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_tag = input_data_view.tag(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 3, false); |
| return false; |
| } |
| VendorTagOps::GetTagNameCallback callback = |
| VendorTagOps_GetTagName_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetTagName( |
| std::move(p_tag), std::move(callback)); |
| return true; |
| } |
| case messages::VendorTagOps::kGetTagType: { |
| internal::VendorTagOps_GetTagType_Params_Data* params = |
| reinterpret_cast< |
| internal::VendorTagOps_GetTagType_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for VendorTagOps.4 |
| bool success = true; |
| uint32_t p_tag{}; |
| VendorTagOps_GetTagType_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_tag = input_data_view.tag(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VendorTagOps::Name_, 4, false); |
| return false; |
| } |
| VendorTagOps::GetTagTypeCallback callback = |
| VendorTagOps_GetTagType_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetTagType( |
| std::move(p_tag), std::move(callback)); |
| return true; |
| } |
| } |
| return false; |
| } |
| namespace { |
| } // namespace |
| static const mojo::internal::GenericValidationInfo kVendorTagOpsValidationInfo[] = { |
| { &internal::VendorTagOps_GetTagCount_Params_Data::Validate, |
| &internal::VendorTagOps_GetTagCount_ResponseParams_Data::Validate}, |
| { &internal::VendorTagOps_GetAllTags_Params_Data::Validate, |
| &internal::VendorTagOps_GetAllTags_ResponseParams_Data::Validate}, |
| { &internal::VendorTagOps_GetSectionName_Params_Data::Validate, |
| &internal::VendorTagOps_GetSectionName_ResponseParams_Data::Validate}, |
| { &internal::VendorTagOps_GetTagName_Params_Data::Validate, |
| &internal::VendorTagOps_GetTagName_ResponseParams_Data::Validate}, |
| { &internal::VendorTagOps_GetTagType_Params_Data::Validate, |
| &internal::VendorTagOps_GetTagType_ResponseParams_Data::Validate}, |
| }; |
| |
| bool VendorTagOpsRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::VendorTagOps::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kVendorTagOpsValidationInfo); |
| } |
| |
| bool VendorTagOpsResponseValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::VendorTagOps::Name_; |
| return mojo::internal::ValidateResponseGenericPacked(message, name, kVendorTagOpsValidationInfo); |
| } |
| const char CameraModule::Name_[] = "cros.mojom.CameraModule"; |
| |
| CameraModule::IPCStableHashFunction CameraModule::MessageToMethodInfo_(mojo::Message& message) { |
| #if !BUILDFLAG(IS_FUCHSIA) |
| switch (static_cast<messages::CameraModule>(message.name())) { |
| case messages::CameraModule::kOpenDevice: { |
| return &CameraModule::OpenDevice_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kGetNumberOfCameras: { |
| return &CameraModule::GetNumberOfCameras_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kGetCameraInfo: { |
| return &CameraModule::GetCameraInfo_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kSetCallbacks: { |
| return &CameraModule::SetCallbacks_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kSetTorchMode: { |
| return &CameraModule::SetTorchMode_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kInit: { |
| return &CameraModule::Init_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kGetVendorTagOps: { |
| return &CameraModule::GetVendorTagOps_Sym::IPCStableHash; |
| } |
| case messages::CameraModule::kSetCallbacksAssociated: { |
| return &CameraModule::SetCallbacksAssociated_Sym::IPCStableHash; |
| } |
| } |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| return nullptr; |
| } |
| |
| |
| const char* CameraModule::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::CameraModule>(message.name())) { |
| case messages::CameraModule::kOpenDevice: |
| return "Receive cros::mojom::CameraModule::OpenDevice"; |
| case messages::CameraModule::kGetNumberOfCameras: |
| return "Receive cros::mojom::CameraModule::GetNumberOfCameras"; |
| case messages::CameraModule::kGetCameraInfo: |
| return "Receive cros::mojom::CameraModule::GetCameraInfo"; |
| case messages::CameraModule::kSetCallbacks: |
| return "Receive cros::mojom::CameraModule::SetCallbacks"; |
| case messages::CameraModule::kSetTorchMode: |
| return "Receive cros::mojom::CameraModule::SetTorchMode"; |
| case messages::CameraModule::kInit: |
| return "Receive cros::mojom::CameraModule::Init"; |
| case messages::CameraModule::kGetVendorTagOps: |
| return "Receive cros::mojom::CameraModule::GetVendorTagOps"; |
| case messages::CameraModule::kSetCallbacksAssociated: |
| return "Receive cros::mojom::CameraModule::SetCallbacksAssociated"; |
| } |
| } else { |
| switch (static_cast<messages::CameraModule>(message.name())) { |
| case messages::CameraModule::kOpenDevice: |
| return "Receive reply cros::mojom::CameraModule::OpenDevice"; |
| case messages::CameraModule::kGetNumberOfCameras: |
| return "Receive reply cros::mojom::CameraModule::GetNumberOfCameras"; |
| case messages::CameraModule::kGetCameraInfo: |
| return "Receive reply cros::mojom::CameraModule::GetCameraInfo"; |
| case messages::CameraModule::kSetCallbacks: |
| return "Receive reply cros::mojom::CameraModule::SetCallbacks"; |
| case messages::CameraModule::kSetTorchMode: |
| return "Receive reply cros::mojom::CameraModule::SetTorchMode"; |
| case messages::CameraModule::kInit: |
| return "Receive reply cros::mojom::CameraModule::Init"; |
| case messages::CameraModule::kGetVendorTagOps: |
| return "Receive reply cros::mojom::CameraModule::GetVendorTagOps"; |
| case messages::CameraModule::kSetCallbacksAssociated: |
| return "Receive reply cros::mojom::CameraModule::SetCallbacksAssociated"; |
| } |
| } |
| 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 CameraModule::OpenDevice_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::CameraModule::OpenDevice"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::GetNumberOfCameras_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::CameraModule::GetNumberOfCameras"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::GetCameraInfo_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::CameraModule::GetCameraInfo"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::SetCallbacks_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::CameraModule::SetCallbacks"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::SetTorchMode_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::CameraModule::SetTorchMode"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::Init_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::CameraModule::Init"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::GetVendorTagOps_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::CameraModule::GetVendorTagOps"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t CameraModule::SetCallbacksAssociated_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::CameraModule::SetCallbacksAssociated"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| class CameraModule_OpenDevice_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_OpenDevice_ForwardToCallback( |
| CameraModule::OpenDeviceCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_OpenDevice_ForwardToCallback(const CameraModule_OpenDevice_ForwardToCallback&) = delete; |
| CameraModule_OpenDevice_ForwardToCallback& operator=(const CameraModule_OpenDevice_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::OpenDeviceCallback callback_; |
| }; |
| |
| class CameraModule_GetNumberOfCameras_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_GetNumberOfCameras_ForwardToCallback( |
| CameraModule::GetNumberOfCamerasCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_GetNumberOfCameras_ForwardToCallback(const CameraModule_GetNumberOfCameras_ForwardToCallback&) = delete; |
| CameraModule_GetNumberOfCameras_ForwardToCallback& operator=(const CameraModule_GetNumberOfCameras_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::GetNumberOfCamerasCallback callback_; |
| }; |
| |
| class CameraModule_GetCameraInfo_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_GetCameraInfo_ForwardToCallback( |
| CameraModule::GetCameraInfoCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_GetCameraInfo_ForwardToCallback(const CameraModule_GetCameraInfo_ForwardToCallback&) = delete; |
| CameraModule_GetCameraInfo_ForwardToCallback& operator=(const CameraModule_GetCameraInfo_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::GetCameraInfoCallback callback_; |
| }; |
| |
| class CameraModule_SetCallbacks_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_SetCallbacks_ForwardToCallback( |
| CameraModule::SetCallbacksCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_SetCallbacks_ForwardToCallback(const CameraModule_SetCallbacks_ForwardToCallback&) = delete; |
| CameraModule_SetCallbacks_ForwardToCallback& operator=(const CameraModule_SetCallbacks_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::SetCallbacksCallback callback_; |
| }; |
| |
| class CameraModule_SetTorchMode_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_SetTorchMode_ForwardToCallback( |
| CameraModule::SetTorchModeCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_SetTorchMode_ForwardToCallback(const CameraModule_SetTorchMode_ForwardToCallback&) = delete; |
| CameraModule_SetTorchMode_ForwardToCallback& operator=(const CameraModule_SetTorchMode_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::SetTorchModeCallback callback_; |
| }; |
| |
| class CameraModule_Init_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_Init_ForwardToCallback( |
| CameraModule::InitCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_Init_ForwardToCallback(const CameraModule_Init_ForwardToCallback&) = delete; |
| CameraModule_Init_ForwardToCallback& operator=(const CameraModule_Init_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::InitCallback callback_; |
| }; |
| |
| class CameraModule_GetVendorTagOps_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_GetVendorTagOps_ForwardToCallback( |
| CameraModule::GetVendorTagOpsCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_GetVendorTagOps_ForwardToCallback(const CameraModule_GetVendorTagOps_ForwardToCallback&) = delete; |
| CameraModule_GetVendorTagOps_ForwardToCallback& operator=(const CameraModule_GetVendorTagOps_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::GetVendorTagOpsCallback callback_; |
| }; |
| |
| class CameraModule_SetCallbacksAssociated_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| CameraModule_SetCallbacksAssociated_ForwardToCallback( |
| CameraModule::SetCallbacksAssociatedCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| CameraModule_SetCallbacksAssociated_ForwardToCallback(const CameraModule_SetCallbacksAssociated_ForwardToCallback&) = delete; |
| CameraModule_SetCallbacksAssociated_ForwardToCallback& operator=(const CameraModule_SetCallbacksAssociated_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| CameraModule::SetCallbacksAssociatedCallback callback_; |
| }; |
| |
| CameraModuleProxy::CameraModuleProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void CameraModuleProxy::OpenDevice( |
| int32_t in_camera_id, ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> in_device_ops_receiver, OpenDeviceCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModule::OpenDevice", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("camera_id"), in_camera_id, |
| "<value of type int32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("device_ops_receiver"), in_device_ops_receiver, |
| "<value of type ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps>>"); |
| }); |
| #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::CameraModule::kOpenDevice), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_OpenDevice_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->camera_id = in_camera_id; |
| mojo::internal::Serialize<mojo::InterfaceRequestDataView<::cros::mojom::Camera3DeviceOpsInterfaceBase>>( |
| in_device_ops_receiver, ¶ms->device_ops_receiver, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->device_ops_receiver), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid device_ops_receiver in CameraModule.OpenDevice request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("OpenDevice"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_OpenDevice_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::GetNumberOfCameras( |
| GetNumberOfCamerasCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send cros::mojom::CameraModule::GetNumberOfCameras"); |
| #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::CameraModule::kGetNumberOfCameras), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_GetNumberOfCameras_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("GetNumberOfCameras"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_GetNumberOfCameras_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::GetCameraInfo( |
| int32_t in_camera_id, GetCameraInfoCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModule::GetCameraInfo", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("camera_id"), in_camera_id, |
| "<value of type int32_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::CameraModule::kGetCameraInfo), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_GetCameraInfo_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->camera_id = in_camera_id; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("GetCameraInfo"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_GetCameraInfo_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::SetCallbacks( |
| ::mojo::PendingRemote<CameraModuleCallbacks> in_callbacks, SetCallbacksCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModule::SetCallbacks", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("callbacks"), in_callbacks, |
| "<value of type ::mojo::PendingRemote<CameraModuleCallbacks>>"); |
| }); |
| #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::CameraModule::kSetCallbacks), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_SetCallbacks_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::cros::mojom::CameraModuleCallbacksInterfaceBase>>( |
| in_callbacks, ¶ms->callbacks, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->callbacks), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid callbacks in CameraModule.SetCallbacks request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("SetCallbacks"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_SetCallbacks_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::SetTorchMode( |
| int32_t in_camera_id, bool in_enabled, SetTorchModeCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModule::SetTorchMode", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("camera_id"), in_camera_id, |
| "<value of type int32_t>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("enabled"), in_enabled, |
| "<value of type bool>"); |
| }); |
| #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::CameraModule::kSetTorchMode), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_SetTorchMode_Params_Data> params( |
| message); |
| params.Allocate(); |
| params->camera_id = in_camera_id; |
| params->enabled = in_enabled; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("SetTorchMode"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_SetTorchMode_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::Init( |
| InitCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send cros::mojom::CameraModule::Init"); |
| #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::CameraModule::kInit), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_Init_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("Init"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_Init_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::GetVendorTagOps( |
| ::mojo::PendingReceiver<VendorTagOps> in_vendor_tag_ops_receiver, GetVendorTagOpsCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModule::GetVendorTagOps", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("vendor_tag_ops_receiver"), in_vendor_tag_ops_receiver, |
| "<value of type ::mojo::PendingReceiver<VendorTagOps>>"); |
| }); |
| #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::CameraModule::kGetVendorTagOps), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_GetVendorTagOps_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfaceRequestDataView<::cros::mojom::VendorTagOpsInterfaceBase>>( |
| in_vendor_tag_ops_receiver, ¶ms->vendor_tag_ops_receiver, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->vendor_tag_ops_receiver), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid vendor_tag_ops_receiver in CameraModule.GetVendorTagOps request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("GetVendorTagOps"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_GetVendorTagOps_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void CameraModuleProxy::SetCallbacksAssociated( |
| ::mojo::PendingAssociatedRemote<CameraModuleCallbacks> in_callbacks, SetCallbacksAssociatedCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send cros::mojom::CameraModule::SetCallbacksAssociated", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("callbacks"), in_callbacks, |
| "<value of type ::mojo::PendingAssociatedRemote<CameraModuleCallbacks>>"); |
| }); |
| #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::CameraModule::kSetCallbacksAssociated), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_SetCallbacksAssociated_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<::cros::mojom::CameraModuleCallbacksAssociatedPtrInfoDataView>( |
| in_callbacks, ¶ms->callbacks, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->callbacks), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID, |
| "invalid callbacks in CameraModule.SetCallbacksAssociated request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("SetCallbacksAssociated"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new CameraModule_SetCallbacksAssociated_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| class CameraModule_OpenDevice_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::OpenDeviceCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_OpenDevice_ProxyToResponder> proxy( |
| new CameraModule_OpenDevice_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_OpenDevice_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_OpenDevice_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: |
| CameraModule_OpenDevice_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) |
| << "CameraModule::OpenDeviceCallback 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 CameraModule_OpenDevice_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_OpenDevice_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_OpenDevice_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.0 |
| bool success = true; |
| int32_t p_result{}; |
| CameraModule_OpenDevice_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 0, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void CameraModule_OpenDevice_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::OpenDevice", "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::CameraModule::kOpenDevice), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_OpenDevice_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("OpenDevice"); |
| #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 CameraModule_GetNumberOfCameras_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::GetNumberOfCamerasCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_GetNumberOfCameras_ProxyToResponder> proxy( |
| new CameraModule_GetNumberOfCameras_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_GetNumberOfCameras_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_GetNumberOfCameras_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: |
| CameraModule_GetNumberOfCameras_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) |
| << "CameraModule::GetNumberOfCamerasCallback 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 CameraModule_GetNumberOfCameras_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_GetNumberOfCameras_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_GetNumberOfCameras_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.1 |
| bool success = true; |
| int32_t p_result{}; |
| CameraModule_GetNumberOfCameras_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 1, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void CameraModule_GetNumberOfCameras_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::GetNumberOfCameras", "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::CameraModule::kGetNumberOfCameras), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_GetNumberOfCameras_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("GetNumberOfCameras"); |
| #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 CameraModule_GetCameraInfo_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::GetCameraInfoCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_GetCameraInfo_ProxyToResponder> proxy( |
| new CameraModule_GetCameraInfo_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_GetCameraInfo_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_GetCameraInfo_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: |
| CameraModule_GetCameraInfo_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) |
| << "CameraModule::GetCameraInfoCallback 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, CameraInfoPtr in_camera_info); |
| }; |
| |
| bool CameraModule_GetCameraInfo_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_GetCameraInfo_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_GetCameraInfo_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.2 |
| bool success = true; |
| int32_t p_result{}; |
| CameraInfoPtr p_camera_info{}; |
| CameraModule_GetCameraInfo_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (success && !input_data_view.ReadCameraInfo(&p_camera_info)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 2, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_camera_info)); |
| return true; |
| } |
| |
| void CameraModule_GetCameraInfo_ProxyToResponder::Run( |
| int32_t in_result, CameraInfoPtr in_camera_info) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::GetCameraInfo", "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("camera_info"), in_camera_info, |
| "<value of type CameraInfoPtr>"); |
| }); |
| #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::CameraModule::kGetCameraInfo), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_GetCameraInfo_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| mojo::internal::MessageFragment< |
| typename decltype(params->camera_info)::BaseType> camera_info_fragment( |
| params.message()); |
| mojo::internal::Serialize<::cros::mojom::CameraInfoDataView>( |
| in_camera_info, camera_info_fragment); |
| params->camera_info.Set( |
| camera_info_fragment.is_null() ? nullptr : camera_info_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("GetCameraInfo"); |
| #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 CameraModule_SetCallbacks_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::SetCallbacksCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_SetCallbacks_ProxyToResponder> proxy( |
| new CameraModule_SetCallbacks_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_SetCallbacks_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_SetCallbacks_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: |
| CameraModule_SetCallbacks_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) |
| << "CameraModule::SetCallbacksCallback 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 CameraModule_SetCallbacks_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_SetCallbacks_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_SetCallbacks_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.3 |
| bool success = true; |
| int32_t p_result{}; |
| CameraModule_SetCallbacks_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 3, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void CameraModule_SetCallbacks_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::SetCallbacks", "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::CameraModule::kSetCallbacks), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_SetCallbacks_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("SetCallbacks"); |
| #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 CameraModule_SetTorchMode_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::SetTorchModeCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_SetTorchMode_ProxyToResponder> proxy( |
| new CameraModule_SetTorchMode_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_SetTorchMode_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_SetTorchMode_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: |
| CameraModule_SetTorchMode_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) |
| << "CameraModule::SetTorchModeCallback 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 CameraModule_SetTorchMode_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_SetTorchMode_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_SetTorchMode_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.4 |
| bool success = true; |
| int32_t p_result{}; |
| CameraModule_SetTorchMode_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 4, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void CameraModule_SetTorchMode_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::SetTorchMode", "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::CameraModule::kSetTorchMode), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_SetTorchMode_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("SetTorchMode"); |
| #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 CameraModule_Init_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::InitCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_Init_ProxyToResponder> proxy( |
| new CameraModule_Init_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_Init_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_Init_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: |
| CameraModule_Init_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) |
| << "CameraModule::InitCallback 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 CameraModule_Init_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_Init_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_Init_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.5 |
| bool success = true; |
| int32_t p_result{}; |
| CameraModule_Init_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 5, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void CameraModule_Init_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::Init", "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::CameraModule::kInit), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_Init_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("Init"); |
| #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 CameraModule_GetVendorTagOps_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::GetVendorTagOpsCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_GetVendorTagOps_ProxyToResponder> proxy( |
| new CameraModule_GetVendorTagOps_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_GetVendorTagOps_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_GetVendorTagOps_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: |
| CameraModule_GetVendorTagOps_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) |
| << "CameraModule::GetVendorTagOpsCallback 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( |
| ); |
| }; |
| |
| bool CameraModule_GetVendorTagOps_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_GetVendorTagOps_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_GetVendorTagOps_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.6 |
| bool success = true; |
| CameraModule_GetVendorTagOps_ResponseParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 6, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run(); |
| return true; |
| } |
| |
| void CameraModule_GetVendorTagOps_ProxyToResponder::Run( |
| ) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send reply cros::mojom::CameraModule::GetVendorTagOps"); |
| #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::CameraModule::kGetVendorTagOps), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_GetVendorTagOps_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("GetVendorTagOps"); |
| #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 CameraModule_SetCallbacksAssociated_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static CameraModule::SetCallbacksAssociatedCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<CameraModule_SetCallbacksAssociated_ProxyToResponder> proxy( |
| new CameraModule_SetCallbacksAssociated_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&CameraModule_SetCallbacksAssociated_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~CameraModule_SetCallbacksAssociated_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: |
| CameraModule_SetCallbacksAssociated_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) |
| << "CameraModule::SetCallbacksAssociatedCallback 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 CameraModule_SetCallbacksAssociated_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| DCHECK(message->is_serialized()); |
| internal::CameraModule_SetCallbacksAssociated_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_SetCallbacksAssociated_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.7 |
| bool success = true; |
| int32_t p_result{}; |
| CameraModule_SetCallbacksAssociated_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_result = input_data_view.result(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 7, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void CameraModule_SetCallbacksAssociated_ProxyToResponder::Run( |
| int32_t in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply cros::mojom::CameraModule::SetCallbacksAssociated", "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::CameraModule::kSetCallbacksAssociated), kFlags, estimated_payload_size); |
| mojo::internal::MessageFragment< |
| ::cros::mojom::internal::CameraModule_SetCallbacksAssociated_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->result = in_result; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(CameraModule::Name_); |
| message.set_method_name("SetCallbacksAssociated"); |
| #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 CameraModuleStubDispatch::Accept( |
| CameraModule* impl, |
| mojo::Message* message) { |
| switch (static_cast<messages::CameraModule>(message->header()->name)) { |
| case messages::CameraModule::kOpenDevice: { |
| break; |
| } |
| case messages::CameraModule::kGetNumberOfCameras: { |
| break; |
| } |
| case messages::CameraModule::kGetCameraInfo: { |
| break; |
| } |
| case messages::CameraModule::kSetCallbacks: { |
| break; |
| } |
| case messages::CameraModule::kSetTorchMode: { |
| break; |
| } |
| case messages::CameraModule::kInit: { |
| break; |
| } |
| case messages::CameraModule::kGetVendorTagOps: { |
| break; |
| } |
| case messages::CameraModule::kSetCallbacksAssociated: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool CameraModuleStubDispatch::AcceptWithResponder( |
| CameraModule* 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::CameraModule>(message->header()->name)) { |
| case messages::CameraModule::kOpenDevice: { |
| internal::CameraModule_OpenDevice_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_OpenDevice_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.0 |
| bool success = true; |
| int32_t p_camera_id{}; |
| ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> p_device_ops_receiver{}; |
| CameraModule_OpenDevice_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_camera_id = input_data_view.camera_id(); |
| if (success) { |
| p_device_ops_receiver = |
| input_data_view.TakeDeviceOpsReceiver<decltype(p_device_ops_receiver)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 0, false); |
| return false; |
| } |
| CameraModule::OpenDeviceCallback callback = |
| CameraModule_OpenDevice_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->OpenDevice( |
| std::move(p_camera_id), |
| std::move(p_device_ops_receiver), std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kGetNumberOfCameras: { |
| internal::CameraModule_GetNumberOfCameras_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_GetNumberOfCameras_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.1 |
| bool success = true; |
| CameraModule_GetNumberOfCameras_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 1, false); |
| return false; |
| } |
| CameraModule::GetNumberOfCamerasCallback callback = |
| CameraModule_GetNumberOfCameras_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetNumberOfCameras(std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kGetCameraInfo: { |
| internal::CameraModule_GetCameraInfo_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_GetCameraInfo_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.2 |
| bool success = true; |
| int32_t p_camera_id{}; |
| CameraModule_GetCameraInfo_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_camera_id = input_data_view.camera_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 2, false); |
| return false; |
| } |
| CameraModule::GetCameraInfoCallback callback = |
| CameraModule_GetCameraInfo_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetCameraInfo( |
| std::move(p_camera_id), std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kSetCallbacks: { |
| internal::CameraModule_SetCallbacks_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_SetCallbacks_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.3 |
| bool success = true; |
| ::mojo::PendingRemote<CameraModuleCallbacks> p_callbacks{}; |
| CameraModule_SetCallbacks_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_callbacks = |
| input_data_view.TakeCallbacks<decltype(p_callbacks)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 3, false); |
| return false; |
| } |
| CameraModule::SetCallbacksCallback callback = |
| CameraModule_SetCallbacks_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->SetCallbacks( |
| std::move(p_callbacks), std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kSetTorchMode: { |
| internal::CameraModule_SetTorchMode_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_SetTorchMode_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.4 |
| bool success = true; |
| int32_t p_camera_id{}; |
| bool p_enabled{}; |
| CameraModule_SetTorchMode_ParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_camera_id = input_data_view.camera_id(); |
| if (success) |
| p_enabled = input_data_view.enabled(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 4, false); |
| return false; |
| } |
| CameraModule::SetTorchModeCallback callback = |
| CameraModule_SetTorchMode_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->SetTorchMode( |
| std::move(p_camera_id), |
| std::move(p_enabled), std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kInit: { |
| internal::CameraModule_Init_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_Init_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.5 |
| bool success = true; |
| CameraModule_Init_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 5, false); |
| return false; |
| } |
| CameraModule::InitCallback callback = |
| CameraModule_Init_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->Init(std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kGetVendorTagOps: { |
| internal::CameraModule_GetVendorTagOps_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_GetVendorTagOps_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.6 |
| bool success = true; |
| ::mojo::PendingReceiver<VendorTagOps> p_vendor_tag_ops_receiver{}; |
| CameraModule_GetVendorTagOps_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_vendor_tag_ops_receiver = |
| input_data_view.TakeVendorTagOpsReceiver<decltype(p_vendor_tag_ops_receiver)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 6, false); |
| return false; |
| } |
| CameraModule::GetVendorTagOpsCallback callback = |
| CameraModule_GetVendorTagOps_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetVendorTagOps( |
| std::move(p_vendor_tag_ops_receiver), std::move(callback)); |
| return true; |
| } |
| case messages::CameraModule::kSetCallbacksAssociated: { |
| internal::CameraModule_SetCallbacksAssociated_Params_Data* params = |
| reinterpret_cast< |
| internal::CameraModule_SetCallbacksAssociated_Params_Data*>( |
| message->mutable_payload()); |
| |
| |
| // Validation for CameraModule.7 |
| bool success = true; |
| ::mojo::PendingAssociatedRemote<CameraModuleCallbacks> p_callbacks{}; |
| CameraModule_SetCallbacksAssociated_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_callbacks = |
| input_data_view.TakeCallbacks<decltype(p_callbacks)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| CameraModule::Name_, 7, false); |
| return false; |
| } |
| CameraModule::SetCallbacksAssociatedCallback callback = |
| CameraModule_SetCallbacksAssociated_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->SetCallbacksAssociated( |
| std::move(p_callbacks), std::move(callback)); |
| return true; |
| } |
| } |
| return false; |
| } |
| namespace { |
| } // namespace |
| static const mojo::internal::GenericValidationInfo kCameraModuleValidationInfo[] = { |
| { &internal::CameraModule_OpenDevice_Params_Data::Validate, |
| &internal::CameraModule_OpenDevice_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_GetNumberOfCameras_Params_Data::Validate, |
| &internal::CameraModule_GetNumberOfCameras_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_GetCameraInfo_Params_Data::Validate, |
| &internal::CameraModule_GetCameraInfo_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_SetCallbacks_Params_Data::Validate, |
| &internal::CameraModule_SetCallbacks_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_SetTorchMode_Params_Data::Validate, |
| &internal::CameraModule_SetTorchMode_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_Init_Params_Data::Validate, |
| &internal::CameraModule_Init_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_GetVendorTagOps_Params_Data::Validate, |
| &internal::CameraModule_GetVendorTagOps_ResponseParams_Data::Validate}, |
| { &internal::CameraModule_SetCallbacksAssociated_Params_Data::Validate, |
| &internal::CameraModule_SetCallbacksAssociated_ResponseParams_Data::Validate}, |
| }; |
| |
| bool CameraModuleRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::CameraModule::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kCameraModuleValidationInfo); |
| } |
| |
| bool CameraModuleResponseValidator::Accept(mojo::Message* message) { |
| const char* name = ::cros::mojom::CameraModule::Name_; |
| return mojo::internal::ValidateResponseGenericPacked(message, name, kCameraModuleValidationInfo); |
| } |
| |
| |
| } // cros::mojom |
| |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::CameraResourceCost::DataView, ::cros::mojom::CameraResourceCostPtr>::Read( |
| ::cros::mojom::CameraResourceCost::DataView input, |
| ::cros::mojom::CameraResourceCostPtr* output) { |
| bool success = true; |
| ::cros::mojom::CameraResourceCostPtr result(::cros::mojom::CameraResourceCost::New()); |
| |
| if (success) |
| result->resource_cost = input.resource_cost(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::CameraInfo::DataView, ::cros::mojom::CameraInfoPtr>::Read( |
| ::cros::mojom::CameraInfo::DataView input, |
| ::cros::mojom::CameraInfoPtr* output) { |
| bool success = true; |
| ::cros::mojom::CameraInfoPtr result(::cros::mojom::CameraInfo::New()); |
| |
| if (success && !input.ReadFacing(&result->facing)) |
| success = false; |
| if (success) |
| result->orientation = input.orientation(); |
| if (success) |
| result->device_version = input.device_version(); |
| if (success && !input.ReadStaticCameraCharacteristics(&result->static_camera_characteristics)) |
| success = false; |
| if (success && !input.ReadResourceCost(&result->resource_cost)) |
| success = false; |
| if (success && !input.ReadConflictingDevices(&result->conflicting_devices)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| |
| // Symbols declared in the -test-utils.h header are defined here instead of a |
| // separate .cc file to save compile time. |
| |
| |
| namespace cros::mojom { |
| |
| |
| void CameraModuleCallbacksInterceptorForTesting::CameraDeviceStatusChange(int32_t camera_id, CameraDeviceStatus new_status) { |
| GetForwardingInterface()->CameraDeviceStatusChange(std::move(camera_id), std::move(new_status)); |
| } |
| void CameraModuleCallbacksInterceptorForTesting::TorchModeStatusChange(int32_t camera_id, TorchModeStatus new_status) { |
| GetForwardingInterface()->TorchModeStatusChange(std::move(camera_id), std::move(new_status)); |
| } |
| CameraModuleCallbacksAsyncWaiter::CameraModuleCallbacksAsyncWaiter( |
| CameraModuleCallbacks* proxy) : proxy_(proxy) {} |
| |
| CameraModuleCallbacksAsyncWaiter::~CameraModuleCallbacksAsyncWaiter() = default; |
| |
| |
| |
| |
| void VendorTagOpsInterceptorForTesting::GetTagCount(GetTagCountCallback callback) { |
| GetForwardingInterface()->GetTagCount(std::move(callback)); |
| } |
| void VendorTagOpsInterceptorForTesting::GetAllTags(GetAllTagsCallback callback) { |
| GetForwardingInterface()->GetAllTags(std::move(callback)); |
| } |
| void VendorTagOpsInterceptorForTesting::GetSectionName(uint32_t tag, GetSectionNameCallback callback) { |
| GetForwardingInterface()->GetSectionName(std::move(tag), std::move(callback)); |
| } |
| void VendorTagOpsInterceptorForTesting::GetTagName(uint32_t tag, GetTagNameCallback callback) { |
| GetForwardingInterface()->GetTagName(std::move(tag), std::move(callback)); |
| } |
| void VendorTagOpsInterceptorForTesting::GetTagType(uint32_t tag, GetTagTypeCallback callback) { |
| GetForwardingInterface()->GetTagType(std::move(tag), std::move(callback)); |
| } |
| VendorTagOpsAsyncWaiter::VendorTagOpsAsyncWaiter( |
| VendorTagOps* proxy) : proxy_(proxy) {} |
| |
| VendorTagOpsAsyncWaiter::~VendorTagOpsAsyncWaiter() = default; |
| |
| void VendorTagOpsAsyncWaiter::GetTagCount( |
| int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->GetTagCount( |
| 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 VendorTagOpsAsyncWaiter::GetTagCount( |
| ) { |
| int32_t async_wait_result; |
| GetTagCount(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void VendorTagOpsAsyncWaiter::GetAllTags( |
| std::vector<uint32_t>* out_tag_array) { |
| base::RunLoop loop; |
| proxy_->GetAllTags( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| std::vector<uint32_t>* out_tag_array |
| , |
| const std::vector<uint32_t>& tag_array) {*out_tag_array = std::move(tag_array); |
| loop->Quit(); |
| }, |
| &loop, |
| out_tag_array)); |
| loop.Run(); |
| } |
| |
| std::vector<uint32_t> VendorTagOpsAsyncWaiter::GetAllTags( |
| ) { |
| std::vector<uint32_t> async_wait_result; |
| GetAllTags(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void VendorTagOpsAsyncWaiter::GetSectionName( |
| uint32_t tag, std::optional<std::string>* out_name) { |
| base::RunLoop loop; |
| proxy_->GetSectionName(std::move(tag), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| std::optional<std::string>* out_name |
| , |
| const std::optional<std::string>& name) {*out_name = std::move(name); |
| loop->Quit(); |
| }, |
| &loop, |
| out_name)); |
| loop.Run(); |
| } |
| |
| std::optional<std::string> VendorTagOpsAsyncWaiter::GetSectionName( |
| uint32_t tag) { |
| std::optional<std::string> async_wait_result; |
| GetSectionName(std::move(tag),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void VendorTagOpsAsyncWaiter::GetTagName( |
| uint32_t tag, std::optional<std::string>* out_name) { |
| base::RunLoop loop; |
| proxy_->GetTagName(std::move(tag), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| std::optional<std::string>* out_name |
| , |
| const std::optional<std::string>& name) {*out_name = std::move(name); |
| loop->Quit(); |
| }, |
| &loop, |
| out_name)); |
| loop.Run(); |
| } |
| |
| std::optional<std::string> VendorTagOpsAsyncWaiter::GetTagName( |
| uint32_t tag) { |
| std::optional<std::string> async_wait_result; |
| GetTagName(std::move(tag),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void VendorTagOpsAsyncWaiter::GetTagType( |
| uint32_t tag, int32_t* out_type) { |
| base::RunLoop loop; |
| proxy_->GetTagType(std::move(tag), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_type |
| , |
| int32_t type) {*out_type = std::move(type); |
| loop->Quit(); |
| }, |
| &loop, |
| out_type)); |
| loop.Run(); |
| } |
| |
| int32_t VendorTagOpsAsyncWaiter::GetTagType( |
| uint32_t tag) { |
| int32_t async_wait_result; |
| GetTagType(std::move(tag),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| |
| |
| |
| void CameraModuleInterceptorForTesting::OpenDevice(int32_t camera_id, ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> device_ops_receiver, OpenDeviceCallback callback) { |
| GetForwardingInterface()->OpenDevice(std::move(camera_id), std::move(device_ops_receiver), std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::GetNumberOfCameras(GetNumberOfCamerasCallback callback) { |
| GetForwardingInterface()->GetNumberOfCameras(std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::GetCameraInfo(int32_t camera_id, GetCameraInfoCallback callback) { |
| GetForwardingInterface()->GetCameraInfo(std::move(camera_id), std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::SetCallbacks(::mojo::PendingRemote<CameraModuleCallbacks> callbacks, SetCallbacksCallback callback) { |
| GetForwardingInterface()->SetCallbacks(std::move(callbacks), std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::SetTorchMode(int32_t camera_id, bool enabled, SetTorchModeCallback callback) { |
| GetForwardingInterface()->SetTorchMode(std::move(camera_id), std::move(enabled), std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::Init(InitCallback callback) { |
| GetForwardingInterface()->Init(std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::GetVendorTagOps(::mojo::PendingReceiver<VendorTagOps> vendor_tag_ops_receiver, GetVendorTagOpsCallback callback) { |
| GetForwardingInterface()->GetVendorTagOps(std::move(vendor_tag_ops_receiver), std::move(callback)); |
| } |
| void CameraModuleInterceptorForTesting::SetCallbacksAssociated(::mojo::PendingAssociatedRemote<CameraModuleCallbacks> callbacks, SetCallbacksAssociatedCallback callback) { |
| GetForwardingInterface()->SetCallbacksAssociated(std::move(callbacks), std::move(callback)); |
| } |
| CameraModuleAsyncWaiter::CameraModuleAsyncWaiter( |
| CameraModule* proxy) : proxy_(proxy) {} |
| |
| CameraModuleAsyncWaiter::~CameraModuleAsyncWaiter() = default; |
| |
| void CameraModuleAsyncWaiter::OpenDevice( |
| int32_t camera_id, ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> device_ops_receiver, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->OpenDevice(std::move(camera_id),std::move(device_ops_receiver), |
| 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 CameraModuleAsyncWaiter::OpenDevice( |
| int32_t camera_id, ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> device_ops_receiver) { |
| int32_t async_wait_result; |
| OpenDevice(std::move(camera_id),std::move(device_ops_receiver),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void CameraModuleAsyncWaiter::GetNumberOfCameras( |
| int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->GetNumberOfCameras( |
| 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 CameraModuleAsyncWaiter::GetNumberOfCameras( |
| ) { |
| int32_t async_wait_result; |
| GetNumberOfCameras(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void CameraModuleAsyncWaiter::GetCameraInfo( |
| int32_t camera_id, int32_t* out_result, CameraInfoPtr* out_camera_info) { |
| base::RunLoop loop; |
| proxy_->GetCameraInfo(std::move(camera_id), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| int32_t* out_result |
| , |
| CameraInfoPtr* out_camera_info |
| , |
| int32_t result, |
| CameraInfoPtr camera_info) {*out_result = std::move(result);*out_camera_info = std::move(camera_info); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_camera_info)); |
| loop.Run(); |
| } |
| |
| |
| |
| void CameraModuleAsyncWaiter::SetCallbacks( |
| ::mojo::PendingRemote<CameraModuleCallbacks> callbacks, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->SetCallbacks(std::move(callbacks), |
| 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 CameraModuleAsyncWaiter::SetCallbacks( |
| ::mojo::PendingRemote<CameraModuleCallbacks> callbacks) { |
| int32_t async_wait_result; |
| SetCallbacks(std::move(callbacks),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void CameraModuleAsyncWaiter::SetTorchMode( |
| int32_t camera_id, bool enabled, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->SetTorchMode(std::move(camera_id),std::move(enabled), |
| 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 CameraModuleAsyncWaiter::SetTorchMode( |
| int32_t camera_id, bool enabled) { |
| int32_t async_wait_result; |
| SetTorchMode(std::move(camera_id),std::move(enabled),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void CameraModuleAsyncWaiter::Init( |
| int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->Init( |
| 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 CameraModuleAsyncWaiter::Init( |
| ) { |
| int32_t async_wait_result; |
| Init(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void CameraModuleAsyncWaiter::GetVendorTagOps( |
| ::mojo::PendingReceiver<VendorTagOps> vendor_tag_ops_receiver) { |
| base::RunLoop loop; |
| proxy_->GetVendorTagOps(std::move(vendor_tag_ops_receiver), |
| base::BindOnce( |
| [](base::RunLoop* loop) { |
| loop->Quit(); |
| }, |
| &loop)); |
| loop.Run(); |
| } |
| |
| |
| |
| void CameraModuleAsyncWaiter::SetCallbacksAssociated( |
| ::mojo::PendingAssociatedRemote<CameraModuleCallbacks> callbacks, int32_t* out_result) { |
| base::RunLoop loop; |
| proxy_->SetCallbacksAssociated(std::move(callbacks), |
| 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 CameraModuleAsyncWaiter::SetCallbacksAssociated( |
| ::mojo::PendingAssociatedRemote<CameraModuleCallbacks> callbacks) { |
| int32_t async_wait_result; |
| SetCallbacksAssociated(std::move(callbacks),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| |
| |
| |
| |
| |
| } // cros::mojom |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |