| // diagnostics/cros_healthd/mojom/delegate.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 "diagnostics/cros_healthd/mojom/delegate.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/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/send_message_helper.h" |
| #include "mojo/public/cpp/bindings/lib/proxy_to_responder.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/interfaces/bindings/interface_control_messages.mojom.h" |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
| |
| #include "diagnostics/cros_healthd/mojom/delegate.mojom-params-data.h" |
| #include "diagnostics/cros_healthd/mojom/delegate.mojom-shared-message-ids.h" |
| |
| #include "diagnostics/cros_healthd/mojom/delegate.mojom-import-headers.h" |
| #include "diagnostics/cros_healthd/mojom/delegate.mojom-test-utils.h" |
| |
| |
| |
| namespace ash { |
| namespace cros_healthd { |
| namespace mojom { |
| const char Delegate::Name_[] = "ash.cros_healthd.mojom.Delegate"; |
| |
| Delegate::IPCStableHashFunction Delegate::MessageToMethodInfo_(mojo::Message& message) { |
| #if !BUILDFLAG(IS_FUCHSIA) |
| switch (message.name()) { |
| case internal::kDelegate_GetFingerprintFrame_Name: { |
| return &Delegate::GetFingerprintFrame_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_GetFingerprintInfo_Name: { |
| return &Delegate::GetFingerprintInfo_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_SetLedColor_Name: { |
| return &Delegate::SetLedColor_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_ResetLedColor_Name: { |
| return &Delegate::ResetLedColor_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_MonitorAudioJack_Name: { |
| return &Delegate::MonitorAudioJack_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_MonitorTouchpad_Name: { |
| return &Delegate::MonitorTouchpad_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_FetchBootPerformance_Name: { |
| return &Delegate::FetchBootPerformance_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_MonitorTouchscreen_Name: { |
| return &Delegate::MonitorTouchscreen_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_MonitorStylusGarage_Name: { |
| return &Delegate::MonitorStylusGarage_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_MonitorStylus_Name: { |
| return &Delegate::MonitorStylus_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_GetLidAngle_Name: { |
| return &Delegate::GetLidAngle_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_GetPsr_Name: { |
| return &Delegate::GetPsr_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_GetAmountOfFreeDiskSpace_Name: { |
| return &Delegate::GetAmountOfFreeDiskSpace_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_GetConnectedHdmiConnectors_Name: { |
| return &Delegate::GetConnectedHdmiConnectors_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_GetPrivacyScreenInfo_Name: { |
| return &Delegate::GetPrivacyScreenInfo_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_FetchDisplayInfo_Name: { |
| return &Delegate::FetchDisplayInfo_Sym::IPCStableHash; |
| } |
| case internal::kDelegate_MonitorPowerButton_Name: { |
| return &Delegate::MonitorPowerButton_Sym::IPCStableHash; |
| } |
| } |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| return nullptr; |
| } |
| |
| |
| const char* Delegate::MessageToMethodName_(mojo::Message& message) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (!is_response) { |
| switch (message.name()) { |
| case internal::kDelegate_GetFingerprintFrame_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetFingerprintFrame"; |
| case internal::kDelegate_GetFingerprintInfo_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetFingerprintInfo"; |
| case internal::kDelegate_SetLedColor_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::SetLedColor"; |
| case internal::kDelegate_ResetLedColor_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::ResetLedColor"; |
| case internal::kDelegate_MonitorAudioJack_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::MonitorAudioJack"; |
| case internal::kDelegate_MonitorTouchpad_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::MonitorTouchpad"; |
| case internal::kDelegate_FetchBootPerformance_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::FetchBootPerformance"; |
| case internal::kDelegate_MonitorTouchscreen_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::MonitorTouchscreen"; |
| case internal::kDelegate_MonitorStylusGarage_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::MonitorStylusGarage"; |
| case internal::kDelegate_MonitorStylus_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::MonitorStylus"; |
| case internal::kDelegate_GetLidAngle_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetLidAngle"; |
| case internal::kDelegate_GetPsr_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetPsr"; |
| case internal::kDelegate_GetAmountOfFreeDiskSpace_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetAmountOfFreeDiskSpace"; |
| case internal::kDelegate_GetConnectedHdmiConnectors_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetConnectedHdmiConnectors"; |
| case internal::kDelegate_GetPrivacyScreenInfo_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::GetPrivacyScreenInfo"; |
| case internal::kDelegate_FetchDisplayInfo_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::FetchDisplayInfo"; |
| case internal::kDelegate_MonitorPowerButton_Name: |
| return "Receive ash::cros_healthd::mojom::Delegate::MonitorPowerButton"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kDelegate_GetFingerprintFrame_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetFingerprintFrame"; |
| case internal::kDelegate_GetFingerprintInfo_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetFingerprintInfo"; |
| case internal::kDelegate_SetLedColor_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::SetLedColor"; |
| case internal::kDelegate_ResetLedColor_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::ResetLedColor"; |
| case internal::kDelegate_MonitorAudioJack_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::MonitorAudioJack"; |
| case internal::kDelegate_MonitorTouchpad_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::MonitorTouchpad"; |
| case internal::kDelegate_FetchBootPerformance_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::FetchBootPerformance"; |
| case internal::kDelegate_MonitorTouchscreen_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::MonitorTouchscreen"; |
| case internal::kDelegate_MonitorStylusGarage_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::MonitorStylusGarage"; |
| case internal::kDelegate_MonitorStylus_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::MonitorStylus"; |
| case internal::kDelegate_GetLidAngle_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetLidAngle"; |
| case internal::kDelegate_GetPsr_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetPsr"; |
| case internal::kDelegate_GetAmountOfFreeDiskSpace_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetAmountOfFreeDiskSpace"; |
| case internal::kDelegate_GetConnectedHdmiConnectors_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetConnectedHdmiConnectors"; |
| case internal::kDelegate_GetPrivacyScreenInfo_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::GetPrivacyScreenInfo"; |
| case internal::kDelegate_FetchDisplayInfo_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::FetchDisplayInfo"; |
| case internal::kDelegate_MonitorPowerButton_Name: |
| return "Receive reply ash::cros_healthd::mojom::Delegate::MonitorPowerButton"; |
| } |
| } |
| 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 Delegate::GetFingerprintFrame_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)ash::cros_healthd::mojom::Delegate::GetFingerprintFrame"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::GetFingerprintInfo_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)ash::cros_healthd::mojom::Delegate::GetFingerprintInfo"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::SetLedColor_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)ash::cros_healthd::mojom::Delegate::SetLedColor"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::ResetLedColor_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)ash::cros_healthd::mojom::Delegate::ResetLedColor"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::MonitorAudioJack_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)ash::cros_healthd::mojom::Delegate::MonitorAudioJack"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::MonitorTouchpad_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)ash::cros_healthd::mojom::Delegate::MonitorTouchpad"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::FetchBootPerformance_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)ash::cros_healthd::mojom::Delegate::FetchBootPerformance"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::MonitorTouchscreen_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)ash::cros_healthd::mojom::Delegate::MonitorTouchscreen"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::MonitorStylusGarage_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)ash::cros_healthd::mojom::Delegate::MonitorStylusGarage"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::MonitorStylus_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)ash::cros_healthd::mojom::Delegate::MonitorStylus"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::GetLidAngle_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)ash::cros_healthd::mojom::Delegate::GetLidAngle"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::GetPsr_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)ash::cros_healthd::mojom::Delegate::GetPsr"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::GetAmountOfFreeDiskSpace_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)ash::cros_healthd::mojom::Delegate::GetAmountOfFreeDiskSpace"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::GetConnectedHdmiConnectors_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)ash::cros_healthd::mojom::Delegate::GetConnectedHdmiConnectors"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::GetPrivacyScreenInfo_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)ash::cros_healthd::mojom::Delegate::GetPrivacyScreenInfo"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::FetchDisplayInfo_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)ash::cros_healthd::mojom::Delegate::FetchDisplayInfo"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| uint32_t Delegate::MonitorPowerButton_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)ash::cros_healthd::mojom::Delegate::MonitorPowerButton"); |
| const uint32_t hash = kHash; |
| base::debug::Alias(&hash); |
| return hash; |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| class Delegate_GetFingerprintFrame_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetFingerprintFrame_ForwardToCallback( |
| Delegate::GetFingerprintFrameCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetFingerprintFrame_ForwardToCallback(const Delegate_GetFingerprintFrame_ForwardToCallback&) = delete; |
| Delegate_GetFingerprintFrame_ForwardToCallback& operator=(const Delegate_GetFingerprintFrame_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetFingerprintFrameCallback callback_; |
| }; |
| |
| class Delegate_GetFingerprintInfo_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetFingerprintInfo_ForwardToCallback( |
| Delegate::GetFingerprintInfoCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetFingerprintInfo_ForwardToCallback(const Delegate_GetFingerprintInfo_ForwardToCallback&) = delete; |
| Delegate_GetFingerprintInfo_ForwardToCallback& operator=(const Delegate_GetFingerprintInfo_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetFingerprintInfoCallback callback_; |
| }; |
| |
| class Delegate_SetLedColor_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_SetLedColor_ForwardToCallback( |
| Delegate::SetLedColorCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_SetLedColor_ForwardToCallback(const Delegate_SetLedColor_ForwardToCallback&) = delete; |
| Delegate_SetLedColor_ForwardToCallback& operator=(const Delegate_SetLedColor_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::SetLedColorCallback callback_; |
| }; |
| |
| class Delegate_ResetLedColor_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_ResetLedColor_ForwardToCallback( |
| Delegate::ResetLedColorCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_ResetLedColor_ForwardToCallback(const Delegate_ResetLedColor_ForwardToCallback&) = delete; |
| Delegate_ResetLedColor_ForwardToCallback& operator=(const Delegate_ResetLedColor_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::ResetLedColorCallback callback_; |
| }; |
| |
| class Delegate_FetchBootPerformance_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_FetchBootPerformance_ForwardToCallback( |
| Delegate::FetchBootPerformanceCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_FetchBootPerformance_ForwardToCallback(const Delegate_FetchBootPerformance_ForwardToCallback&) = delete; |
| Delegate_FetchBootPerformance_ForwardToCallback& operator=(const Delegate_FetchBootPerformance_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::FetchBootPerformanceCallback callback_; |
| }; |
| |
| class Delegate_GetLidAngle_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetLidAngle_ForwardToCallback( |
| Delegate::GetLidAngleCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetLidAngle_ForwardToCallback(const Delegate_GetLidAngle_ForwardToCallback&) = delete; |
| Delegate_GetLidAngle_ForwardToCallback& operator=(const Delegate_GetLidAngle_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetLidAngleCallback callback_; |
| }; |
| |
| class Delegate_GetPsr_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetPsr_ForwardToCallback( |
| Delegate::GetPsrCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetPsr_ForwardToCallback(const Delegate_GetPsr_ForwardToCallback&) = delete; |
| Delegate_GetPsr_ForwardToCallback& operator=(const Delegate_GetPsr_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetPsrCallback callback_; |
| }; |
| |
| class Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback( |
| Delegate::GetAmountOfFreeDiskSpaceCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback(const Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback&) = delete; |
| Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback& operator=(const Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetAmountOfFreeDiskSpaceCallback callback_; |
| }; |
| |
| class Delegate_GetConnectedHdmiConnectors_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetConnectedHdmiConnectors_ForwardToCallback( |
| Delegate::GetConnectedHdmiConnectorsCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetConnectedHdmiConnectors_ForwardToCallback(const Delegate_GetConnectedHdmiConnectors_ForwardToCallback&) = delete; |
| Delegate_GetConnectedHdmiConnectors_ForwardToCallback& operator=(const Delegate_GetConnectedHdmiConnectors_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetConnectedHdmiConnectorsCallback callback_; |
| }; |
| |
| class Delegate_GetPrivacyScreenInfo_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_GetPrivacyScreenInfo_ForwardToCallback( |
| Delegate::GetPrivacyScreenInfoCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_GetPrivacyScreenInfo_ForwardToCallback(const Delegate_GetPrivacyScreenInfo_ForwardToCallback&) = delete; |
| Delegate_GetPrivacyScreenInfo_ForwardToCallback& operator=(const Delegate_GetPrivacyScreenInfo_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::GetPrivacyScreenInfoCallback callback_; |
| }; |
| |
| class Delegate_FetchDisplayInfo_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| Delegate_FetchDisplayInfo_ForwardToCallback( |
| Delegate::FetchDisplayInfoCallback callback |
| ) : callback_(std::move(callback)) { |
| } |
| |
| Delegate_FetchDisplayInfo_ForwardToCallback(const Delegate_FetchDisplayInfo_ForwardToCallback&) = delete; |
| Delegate_FetchDisplayInfo_ForwardToCallback& operator=(const Delegate_FetchDisplayInfo_ForwardToCallback&) = delete; |
| |
| bool Accept(mojo::Message* message) override; |
| private: |
| Delegate::FetchDisplayInfoCallback callback_; |
| }; |
| |
| DelegateProxy::DelegateProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void DelegateProxy::GetFingerprintFrame( |
| ::ash::cros_healthd::mojom::FingerprintCaptureType in_type, GetFingerprintFrameCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::GetFingerprintFrame", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("type"), in_type, |
| "<value of type ::ash::cros_healthd::mojom::FingerprintCaptureType>"); |
| }); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetFingerprintFrame_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetFingerprintFrame_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::FingerprintCaptureType>( |
| in_type, ¶ms->type); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetFingerprintFrame"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetFingerprintFrame_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::GetFingerprintInfo( |
| GetFingerprintInfoCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::GetFingerprintInfo"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetFingerprintInfo_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetFingerprintInfo_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetFingerprintInfo"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetFingerprintInfo_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::SetLedColor( |
| ::ash::cros_healthd::mojom::LedName in_name, ::ash::cros_healthd::mojom::LedColor in_color, SetLedColorCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::SetLedColor", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("name"), in_name, |
| "<value of type ::ash::cros_healthd::mojom::LedName>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("color"), in_color, |
| "<value of type ::ash::cros_healthd::mojom::LedColor>"); |
| }); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_SetLedColor_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_SetLedColor_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::LedName>( |
| in_name, ¶ms->name); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::LedColor>( |
| in_color, ¶ms->color); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("SetLedColor"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_SetLedColor_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::ResetLedColor( |
| ::ash::cros_healthd::mojom::LedName in_name, ResetLedColorCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::ResetLedColor", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("name"), in_name, |
| "<value of type ::ash::cros_healthd::mojom::LedName>"); |
| }); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_ResetLedColor_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_ResetLedColor_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::LedName>( |
| in_name, ¶ms->name); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("ResetLedColor"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_ResetLedColor_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::MonitorAudioJack( |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::AudioJackObserver> in_observer) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::MonitorAudioJack", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("observer"), in_observer, |
| "<value of type ::mojo::PendingRemote<::ash::cros_healthd::mojom::AudioJackObserver>>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_MonitorAudioJack_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_MonitorAudioJack_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::ash::cros_healthd::mojom::AudioJackObserverInterfaceBase>>( |
| in_observer, ¶ms->observer, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->observer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid observer in Delegate.MonitorAudioJack request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("MonitorAudioJack"); |
| #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 DelegateProxy::MonitorTouchpad( |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchpadObserver> in_observer) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::MonitorTouchpad", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("observer"), in_observer, |
| "<value of type ::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchpadObserver>>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_MonitorTouchpad_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_MonitorTouchpad_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::ash::cros_healthd::mojom::TouchpadObserverInterfaceBase>>( |
| in_observer, ¶ms->observer, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->observer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid observer in Delegate.MonitorTouchpad request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("MonitorTouchpad"); |
| #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 DelegateProxy::FetchBootPerformance( |
| FetchBootPerformanceCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::FetchBootPerformance"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_FetchBootPerformance_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_FetchBootPerformance_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("FetchBootPerformance"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_FetchBootPerformance_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::MonitorTouchscreen( |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchscreenObserver> in_observer) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::MonitorTouchscreen", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("observer"), in_observer, |
| "<value of type ::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchscreenObserver>>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_MonitorTouchscreen_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_MonitorTouchscreen_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::ash::cros_healthd::mojom::TouchscreenObserverInterfaceBase>>( |
| in_observer, ¶ms->observer, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->observer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid observer in Delegate.MonitorTouchscreen request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("MonitorTouchscreen"); |
| #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 DelegateProxy::MonitorStylusGarage( |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusGarageObserver> in_observer) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::MonitorStylusGarage", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("observer"), in_observer, |
| "<value of type ::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusGarageObserver>>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_MonitorStylusGarage_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_MonitorStylusGarage_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::ash::cros_healthd::mojom::StylusGarageObserverInterfaceBase>>( |
| in_observer, ¶ms->observer, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->observer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid observer in Delegate.MonitorStylusGarage request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("MonitorStylusGarage"); |
| #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 DelegateProxy::MonitorStylus( |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusObserver> in_observer) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::MonitorStylus", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("observer"), in_observer, |
| "<value of type ::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusObserver>>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_MonitorStylus_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_MonitorStylus_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::ash::cros_healthd::mojom::StylusObserverInterfaceBase>>( |
| in_observer, ¶ms->observer, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->observer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid observer in Delegate.MonitorStylus request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("MonitorStylus"); |
| #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 DelegateProxy::GetLidAngle( |
| GetLidAngleCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::GetLidAngle"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetLidAngle_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetLidAngle_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetLidAngle"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetLidAngle_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::GetPsr( |
| GetPsrCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::GetPsr"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetPsr_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetPsr_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetPsr"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetPsr_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::GetAmountOfFreeDiskSpace( |
| const std::string& in_path, GetAmountOfFreeDiskSpaceCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::GetAmountOfFreeDiskSpace", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("path"), in_path, |
| "<value of type const std::string&>"); |
| }); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetAmountOfFreeDiskSpace_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetAmountOfFreeDiskSpace_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->path)::BaseType> path_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_path, path_fragment); |
| params->path.Set( |
| path_fragment.is_null() ? nullptr : path_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->path.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null path in Delegate.GetAmountOfFreeDiskSpace request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetAmountOfFreeDiskSpace"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::GetConnectedHdmiConnectors( |
| GetConnectedHdmiConnectorsCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::GetConnectedHdmiConnectors"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetConnectedHdmiConnectors_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetConnectedHdmiConnectors_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetConnectedHdmiConnectors"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetConnectedHdmiConnectors_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::GetPrivacyScreenInfo( |
| GetPrivacyScreenInfoCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::GetPrivacyScreenInfo"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetPrivacyScreenInfo_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetPrivacyScreenInfo_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetPrivacyScreenInfo"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_GetPrivacyScreenInfo_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::FetchDisplayInfo( |
| FetchDisplayInfoCallback callback) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send ash::cros_healthd::mojom::Delegate::FetchDisplayInfo"); |
| #endif |
| const bool kExpectsResponse = true; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_FetchDisplayInfo_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_FetchDisplayInfo_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("FetchDisplayInfo"); |
| #endif |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new Delegate_FetchDisplayInfo_ForwardToCallback( |
| std::move(callback))); |
| ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder)); |
| } |
| |
| void DelegateProxy::MonitorPowerButton( |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::PowerButtonObserver> in_observer) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send ash::cros_healthd::mojom::Delegate::MonitorPowerButton", "input_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("observer"), in_observer, |
| "<value of type ::mojo::PendingRemote<::ash::cros_healthd::mojom::PowerButtonObserver>>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_MonitorPowerButton_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_MonitorPowerButton_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::ash::cros_healthd::mojom::PowerButtonObserverInterfaceBase>>( |
| in_observer, ¶ms->observer, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->observer), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid observer in Delegate.MonitorPowerButton request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("MonitorPowerButton"); |
| #endif |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ::mojo::internal::SendMojoMessage(*receiver_, message); |
| } |
| class Delegate_GetFingerprintFrame_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetFingerprintFrameCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetFingerprintFrame_ProxyToResponder> proxy( |
| new Delegate_GetFingerprintFrame_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetFingerprintFrame_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetFingerprintFrame_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: |
| Delegate_GetFingerprintFrame_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) |
| << "Delegate::GetFingerprintFrameCallback 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( |
| ::ash::cros_healthd::mojom::FingerprintFrameResultPtr in_result, const absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_GetFingerprintFrame_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetFingerprintFrame_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetFingerprintFrame_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::FingerprintFrameResultPtr p_result{}; |
| absl::optional<std::string> p_err{}; |
| Delegate_GetFingerprintFrame_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 0, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_GetFingerprintFrame_ProxyToResponder::Run( |
| ::ash::cros_healthd::mojom::FingerprintFrameResultPtr in_result, const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetFingerprintFrame", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type ::ash::cros_healthd::mojom::FingerprintFrameResultPtr>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetFingerprintFrame_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetFingerprintFrame_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->result)::BaseType> result_fragment( |
| params.message()); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::FingerprintFrameResultDataView>( |
| in_result, result_fragment); |
| params->result.Set( |
| result_fragment.is_null() ? nullptr : result_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->result.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null result in "); |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetFingerprintFrame"); |
| #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 Delegate_GetFingerprintInfo_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetFingerprintInfoCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetFingerprintInfo_ProxyToResponder> proxy( |
| new Delegate_GetFingerprintInfo_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetFingerprintInfo_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetFingerprintInfo_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: |
| Delegate_GetFingerprintInfo_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) |
| << "Delegate::GetFingerprintInfoCallback 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( |
| ::ash::cros_healthd::mojom::FingerprintInfoResultPtr in_result, const absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_GetFingerprintInfo_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetFingerprintInfo_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetFingerprintInfo_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::FingerprintInfoResultPtr p_result{}; |
| absl::optional<std::string> p_err{}; |
| Delegate_GetFingerprintInfo_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 1, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_GetFingerprintInfo_ProxyToResponder::Run( |
| ::ash::cros_healthd::mojom::FingerprintInfoResultPtr in_result, const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetFingerprintInfo", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type ::ash::cros_healthd::mojom::FingerprintInfoResultPtr>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetFingerprintInfo_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetFingerprintInfo_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->result)::BaseType> result_fragment( |
| params.message()); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::FingerprintInfoResultDataView>( |
| in_result, result_fragment); |
| params->result.Set( |
| result_fragment.is_null() ? nullptr : result_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->result.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null result in "); |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetFingerprintInfo"); |
| #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 Delegate_SetLedColor_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::SetLedColorCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_SetLedColor_ProxyToResponder> proxy( |
| new Delegate_SetLedColor_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_SetLedColor_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_SetLedColor_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: |
| Delegate_SetLedColor_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) |
| << "Delegate::SetLedColorCallback 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 absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_SetLedColor_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_SetLedColor_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_SetLedColor_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| absl::optional<std::string> p_err{}; |
| Delegate_SetLedColor_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 2, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_SetLedColor_ProxyToResponder::Run( |
| const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::SetLedColor", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_SetLedColor_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_SetLedColor_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("SetLedColor"); |
| #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 Delegate_ResetLedColor_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::ResetLedColorCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_ResetLedColor_ProxyToResponder> proxy( |
| new Delegate_ResetLedColor_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_ResetLedColor_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_ResetLedColor_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: |
| Delegate_ResetLedColor_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) |
| << "Delegate::ResetLedColorCallback 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 absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_ResetLedColor_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_ResetLedColor_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_ResetLedColor_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| absl::optional<std::string> p_err{}; |
| Delegate_ResetLedColor_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 3, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_ResetLedColor_ProxyToResponder::Run( |
| const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::ResetLedColor", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_ResetLedColor_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_ResetLedColor_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("ResetLedColor"); |
| #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 Delegate_FetchBootPerformance_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::FetchBootPerformanceCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_FetchBootPerformance_ProxyToResponder> proxy( |
| new Delegate_FetchBootPerformance_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_FetchBootPerformance_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_FetchBootPerformance_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: |
| Delegate_FetchBootPerformance_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) |
| << "Delegate::FetchBootPerformanceCallback 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( |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr in_result); |
| }; |
| |
| bool Delegate_FetchBootPerformance_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_FetchBootPerformance_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_FetchBootPerformance_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr p_result{}; |
| Delegate_FetchBootPerformance_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 6, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Delegate_FetchBootPerformance_ProxyToResponder::Run( |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::FetchBootPerformance", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type ::ash::cros_healthd::mojom::BootPerformanceResultPtr>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_FetchBootPerformance_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_FetchBootPerformance_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment<decltype(params->result)> |
| result_fragment(params.message()); |
| result_fragment.Claim(¶ms->result); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::BootPerformanceResultDataView>( |
| in_result, result_fragment, true); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->result.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null result in "); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("FetchBootPerformance"); |
| #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 Delegate_GetLidAngle_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetLidAngleCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetLidAngle_ProxyToResponder> proxy( |
| new Delegate_GetLidAngle_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetLidAngle_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetLidAngle_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: |
| Delegate_GetLidAngle_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) |
| << "Delegate::GetLidAngleCallback 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( |
| absl::optional<uint16_t> in_lid_angle); |
| }; |
| |
| bool Delegate_GetLidAngle_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetLidAngle_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetLidAngle_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| absl::optional<uint16_t> p_lid_angle{}; |
| Delegate_GetLidAngle_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_lid_angle = input_data_view.lid_angle(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 10, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_lid_angle)); |
| return true; |
| } |
| |
| void Delegate_GetLidAngle_ProxyToResponder::Run( |
| absl::optional<uint16_t> in_lid_angle) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetLidAngle", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("lid_angle"), in_lid_angle, |
| "<value of type absl::optional<uint16_t>>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetLidAngle_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetLidAngle_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->lid_angle_$flag = in_lid_angle.has_value(); |
| if (in_lid_angle.has_value()) { |
| params->lid_angle_$value = in_lid_angle.value(); |
| } |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetLidAngle"); |
| #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 Delegate_GetPsr_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetPsrCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetPsr_ProxyToResponder> proxy( |
| new Delegate_GetPsr_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetPsr_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetPsr_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: |
| Delegate_GetPsr_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) |
| << "Delegate::GetPsrCallback 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( |
| ::ash::cros_healthd::mojom::PsrInfoPtr in_result, const absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_GetPsr_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetPsr_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetPsr_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::PsrInfoPtr p_result{}; |
| absl::optional<std::string> p_err{}; |
| Delegate_GetPsr_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 11, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result), |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_GetPsr_ProxyToResponder::Run( |
| ::ash::cros_healthd::mojom::PsrInfoPtr in_result, const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetPsr", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type ::ash::cros_healthd::mojom::PsrInfoPtr>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetPsr_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetPsr_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->result)::BaseType> result_fragment( |
| params.message()); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::PsrInfoDataView>( |
| in_result, result_fragment); |
| params->result.Set( |
| result_fragment.is_null() ? nullptr : result_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->result.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null result in "); |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetPsr"); |
| #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 Delegate_GetAmountOfFreeDiskSpace_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetAmountOfFreeDiskSpaceCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetAmountOfFreeDiskSpace_ProxyToResponder> proxy( |
| new Delegate_GetAmountOfFreeDiskSpace_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetAmountOfFreeDiskSpace_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetAmountOfFreeDiskSpace_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: |
| Delegate_GetAmountOfFreeDiskSpace_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) |
| << "Delegate::GetAmountOfFreeDiskSpaceCallback 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( |
| absl::optional<uint64_t> in_free_space_byte); |
| }; |
| |
| bool Delegate_GetAmountOfFreeDiskSpace_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetAmountOfFreeDiskSpace_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetAmountOfFreeDiskSpace_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| absl::optional<uint64_t> p_free_space_byte{}; |
| Delegate_GetAmountOfFreeDiskSpace_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_free_space_byte = input_data_view.free_space_byte(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 12, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_free_space_byte)); |
| return true; |
| } |
| |
| void Delegate_GetAmountOfFreeDiskSpace_ProxyToResponder::Run( |
| absl::optional<uint64_t> in_free_space_byte) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetAmountOfFreeDiskSpace", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("free_space_byte"), in_free_space_byte, |
| "<value of type absl::optional<uint64_t>>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetAmountOfFreeDiskSpace_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetAmountOfFreeDiskSpace_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->free_space_byte_$flag = in_free_space_byte.has_value(); |
| if (in_free_space_byte.has_value()) { |
| params->free_space_byte_$value = in_free_space_byte.value(); |
| } |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetAmountOfFreeDiskSpace"); |
| #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 Delegate_GetConnectedHdmiConnectors_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetConnectedHdmiConnectorsCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetConnectedHdmiConnectors_ProxyToResponder> proxy( |
| new Delegate_GetConnectedHdmiConnectors_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetConnectedHdmiConnectors_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetConnectedHdmiConnectors_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: |
| Delegate_GetConnectedHdmiConnectors_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) |
| << "Delegate::GetConnectedHdmiConnectorsCallback 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( |
| base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr> in_connectors, const absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_GetConnectedHdmiConnectors_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetConnectedHdmiConnectors_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetConnectedHdmiConnectors_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr> p_connectors{}; |
| absl::optional<std::string> p_err{}; |
| Delegate_GetConnectedHdmiConnectors_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadConnectors(&p_connectors)) |
| success = false; |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 13, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_connectors), |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_GetConnectedHdmiConnectors_ProxyToResponder::Run( |
| base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr> in_connectors, const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetConnectedHdmiConnectors", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("connectors"), in_connectors, |
| "<value of type base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr>>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetConnectedHdmiConnectors_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetConnectedHdmiConnectors_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->connectors)::BaseType> |
| connectors_fragment(params.message()); |
| constexpr const mojo::internal::ContainerValidateParams& connectors_validate_params = |
| mojo::internal::GetMapValidator<*&mojo::internal::GetArrayValidator<0, false, nullptr>(), *&mojo::internal::GetArrayValidator<0, false, nullptr>()>(); |
| mojo::internal::Serialize<mojo::MapDataView<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoDataView>>( |
| in_connectors, connectors_fragment, &connectors_validate_params); |
| params->connectors.Set( |
| connectors_fragment.is_null() ? nullptr : connectors_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->connectors.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null connectors in "); |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetConnectedHdmiConnectors"); |
| #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 Delegate_GetPrivacyScreenInfo_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::GetPrivacyScreenInfoCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_GetPrivacyScreenInfo_ProxyToResponder> proxy( |
| new Delegate_GetPrivacyScreenInfo_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_GetPrivacyScreenInfo_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_GetPrivacyScreenInfo_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: |
| Delegate_GetPrivacyScreenInfo_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) |
| << "Delegate::GetPrivacyScreenInfoCallback 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 in_privacy_screen_supported, bool in_privacy_screen_enabled, const absl::optional<std::string>& in_err); |
| }; |
| |
| bool Delegate_GetPrivacyScreenInfo_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_GetPrivacyScreenInfo_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetPrivacyScreenInfo_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| bool p_privacy_screen_supported{}; |
| bool p_privacy_screen_enabled{}; |
| absl::optional<std::string> p_err{}; |
| Delegate_GetPrivacyScreenInfo_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success) |
| p_privacy_screen_supported = input_data_view.privacy_screen_supported(); |
| if (success) |
| p_privacy_screen_enabled = input_data_view.privacy_screen_enabled(); |
| if (success && !input_data_view.ReadErr(&p_err)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 14, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_privacy_screen_supported), |
| std::move(p_privacy_screen_enabled), |
| std::move(p_err)); |
| return true; |
| } |
| |
| void Delegate_GetPrivacyScreenInfo_ProxyToResponder::Run( |
| bool in_privacy_screen_supported, bool in_privacy_screen_enabled, const absl::optional<std::string>& in_err) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::GetPrivacyScreenInfo", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("privacy_screen_supported"), in_privacy_screen_supported, |
| "<value of type bool>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("privacy_screen_enabled"), in_privacy_screen_enabled, |
| "<value of type bool>"); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("err"), in_err, |
| "<value of type const absl::optional<std::string>&>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_GetPrivacyScreenInfo_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_GetPrivacyScreenInfo_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| params->privacy_screen_supported = in_privacy_screen_supported; |
| params->privacy_screen_enabled = in_privacy_screen_enabled; |
| mojo::internal::MessageFragment< |
| typename decltype(params->err)::BaseType> err_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_err, err_fragment); |
| params->err.Set( |
| err_fragment.is_null() ? nullptr : err_fragment.data()); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("GetPrivacyScreenInfo"); |
| #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 Delegate_FetchDisplayInfo_ProxyToResponder : public ::mojo::internal::ProxyToResponder { |
| public: |
| static Delegate::FetchDisplayInfoCallback CreateCallback( |
| ::mojo::Message& message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<Delegate_FetchDisplayInfo_ProxyToResponder> proxy( |
| new Delegate_FetchDisplayInfo_ProxyToResponder( |
| message, std::move(responder))); |
| return base::BindOnce(&Delegate_FetchDisplayInfo_ProxyToResponder::Run, |
| std::move(proxy)); |
| } |
| |
| ~Delegate_FetchDisplayInfo_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: |
| Delegate_FetchDisplayInfo_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) |
| << "Delegate::FetchDisplayInfoCallback 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( |
| ::ash::cros_healthd::mojom::DisplayResultPtr in_result); |
| }; |
| |
| bool Delegate_FetchDisplayInfo_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_FetchDisplayInfo_ResponseParams_Data* params = |
| reinterpret_cast< |
| internal::Delegate_FetchDisplayInfo_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::DisplayResultPtr p_result{}; |
| Delegate_FetchDisplayInfo_ResponseParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadResult(&p_result)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 15, true); |
| return false; |
| } |
| if (!callback_.is_null()) |
| std::move(callback_).Run( |
| std::move(p_result)); |
| return true; |
| } |
| |
| void Delegate_FetchDisplayInfo_ProxyToResponder::Run( |
| ::ash::cros_healthd::mojom::DisplayResultPtr in_result) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send reply ash::cros_healthd::mojom::Delegate::FetchDisplayInfo", "async_response_parameters", |
| [&](perfetto_libchrome::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto_libchrome::WriteIntoTracedValueWithFallback( |
| dict.AddItem("result"), in_result, |
| "<value of type ::ash::cros_healthd::mojom::DisplayResultPtr>"); |
| }); |
| #endif |
| |
| const uint32_t kFlags = mojo::Message::kFlagIsResponse | |
| ((is_sync_) ? mojo::Message::kFlagIsSync : 0) | |
| ((true) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kDelegate_FetchDisplayInfo_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::ash::cros_healthd::mojom::internal::Delegate_FetchDisplayInfo_ResponseParams_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment<decltype(params->result)> |
| result_fragment(params.message()); |
| result_fragment.Claim(¶ms->result); |
| mojo::internal::Serialize<::ash::cros_healthd::mojom::DisplayResultDataView>( |
| in_result, result_fragment, true); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->result.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null result in "); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(Delegate::Name_); |
| message.set_method_name("FetchDisplayInfo"); |
| #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 DelegateStubDispatch::Accept( |
| Delegate* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kDelegate_GetFingerprintFrame_Name: { |
| break; |
| } |
| case internal::kDelegate_GetFingerprintInfo_Name: { |
| break; |
| } |
| case internal::kDelegate_SetLedColor_Name: { |
| break; |
| } |
| case internal::kDelegate_ResetLedColor_Name: { |
| break; |
| } |
| case internal::kDelegate_MonitorAudioJack_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_MonitorAudioJack_Params_Data* params = |
| reinterpret_cast<internal::Delegate_MonitorAudioJack_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::AudioJackObserver> p_observer{}; |
| Delegate_MonitorAudioJack_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_observer = |
| input_data_view.TakeObserver<decltype(p_observer)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 4, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->MonitorAudioJack( |
| std::move(p_observer)); |
| return true; |
| } |
| case internal::kDelegate_MonitorTouchpad_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_MonitorTouchpad_Params_Data* params = |
| reinterpret_cast<internal::Delegate_MonitorTouchpad_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchpadObserver> p_observer{}; |
| Delegate_MonitorTouchpad_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_observer = |
| input_data_view.TakeObserver<decltype(p_observer)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 5, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->MonitorTouchpad( |
| std::move(p_observer)); |
| return true; |
| } |
| case internal::kDelegate_FetchBootPerformance_Name: { |
| break; |
| } |
| case internal::kDelegate_MonitorTouchscreen_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_MonitorTouchscreen_Params_Data* params = |
| reinterpret_cast<internal::Delegate_MonitorTouchscreen_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchscreenObserver> p_observer{}; |
| Delegate_MonitorTouchscreen_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_observer = |
| input_data_view.TakeObserver<decltype(p_observer)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 7, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->MonitorTouchscreen( |
| std::move(p_observer)); |
| return true; |
| } |
| case internal::kDelegate_MonitorStylusGarage_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_MonitorStylusGarage_Params_Data* params = |
| reinterpret_cast<internal::Delegate_MonitorStylusGarage_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusGarageObserver> p_observer{}; |
| Delegate_MonitorStylusGarage_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_observer = |
| input_data_view.TakeObserver<decltype(p_observer)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 8, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->MonitorStylusGarage( |
| std::move(p_observer)); |
| return true; |
| } |
| case internal::kDelegate_MonitorStylus_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_MonitorStylus_Params_Data* params = |
| reinterpret_cast<internal::Delegate_MonitorStylus_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusObserver> p_observer{}; |
| Delegate_MonitorStylus_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_observer = |
| input_data_view.TakeObserver<decltype(p_observer)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 9, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->MonitorStylus( |
| std::move(p_observer)); |
| return true; |
| } |
| case internal::kDelegate_GetLidAngle_Name: { |
| break; |
| } |
| case internal::kDelegate_GetPsr_Name: { |
| break; |
| } |
| case internal::kDelegate_GetAmountOfFreeDiskSpace_Name: { |
| break; |
| } |
| case internal::kDelegate_GetConnectedHdmiConnectors_Name: { |
| break; |
| } |
| case internal::kDelegate_GetPrivacyScreenInfo_Name: { |
| break; |
| } |
| case internal::kDelegate_FetchDisplayInfo_Name: { |
| break; |
| } |
| case internal::kDelegate_MonitorPowerButton_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::Delegate_MonitorPowerButton_Params_Data* params = |
| reinterpret_cast<internal::Delegate_MonitorPowerButton_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<::ash::cros_healthd::mojom::PowerButtonObserver> p_observer{}; |
| Delegate_MonitorPowerButton_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_observer = |
| input_data_view.TakeObserver<decltype(p_observer)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 16, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->MonitorPowerButton( |
| std::move(p_observer)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool DelegateStubDispatch::AcceptWithResponder( |
| Delegate* 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 (message->header()->name) { |
| case internal::kDelegate_GetFingerprintFrame_Name: { |
| |
| internal::Delegate_GetFingerprintFrame_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetFingerprintFrame_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::FingerprintCaptureType p_type{}; |
| Delegate_GetFingerprintFrame_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadType(&p_type)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 0, false); |
| return false; |
| } |
| Delegate::GetFingerprintFrameCallback callback = |
| Delegate_GetFingerprintFrame_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetFingerprintFrame( |
| std::move(p_type), std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_GetFingerprintInfo_Name: { |
| |
| internal::Delegate_GetFingerprintInfo_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetFingerprintInfo_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_GetFingerprintInfo_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 1, false); |
| return false; |
| } |
| Delegate::GetFingerprintInfoCallback callback = |
| Delegate_GetFingerprintInfo_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetFingerprintInfo(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_SetLedColor_Name: { |
| |
| internal::Delegate_SetLedColor_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_SetLedColor_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::LedName p_name{}; |
| ::ash::cros_healthd::mojom::LedColor p_color{}; |
| Delegate_SetLedColor_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadName(&p_name)) |
| success = false; |
| if (success && !input_data_view.ReadColor(&p_color)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 2, false); |
| return false; |
| } |
| Delegate::SetLedColorCallback callback = |
| Delegate_SetLedColor_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->SetLedColor( |
| std::move(p_name), |
| std::move(p_color), std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_ResetLedColor_Name: { |
| |
| internal::Delegate_ResetLedColor_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_ResetLedColor_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::ash::cros_healthd::mojom::LedName p_name{}; |
| Delegate_ResetLedColor_ParamsDataView 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, |
| Delegate::Name_, 3, false); |
| return false; |
| } |
| Delegate::ResetLedColorCallback callback = |
| Delegate_ResetLedColor_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ResetLedColor( |
| std::move(p_name), std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_MonitorAudioJack_Name: { |
| break; |
| } |
| case internal::kDelegate_MonitorTouchpad_Name: { |
| break; |
| } |
| case internal::kDelegate_FetchBootPerformance_Name: { |
| |
| internal::Delegate_FetchBootPerformance_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_FetchBootPerformance_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_FetchBootPerformance_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 6, false); |
| return false; |
| } |
| Delegate::FetchBootPerformanceCallback callback = |
| Delegate_FetchBootPerformance_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->FetchBootPerformance(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_MonitorTouchscreen_Name: { |
| break; |
| } |
| case internal::kDelegate_MonitorStylusGarage_Name: { |
| break; |
| } |
| case internal::kDelegate_MonitorStylus_Name: { |
| break; |
| } |
| case internal::kDelegate_GetLidAngle_Name: { |
| |
| internal::Delegate_GetLidAngle_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetLidAngle_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_GetLidAngle_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 10, false); |
| return false; |
| } |
| Delegate::GetLidAngleCallback callback = |
| Delegate_GetLidAngle_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetLidAngle(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_GetPsr_Name: { |
| |
| internal::Delegate_GetPsr_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetPsr_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_GetPsr_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 11, false); |
| return false; |
| } |
| Delegate::GetPsrCallback callback = |
| Delegate_GetPsr_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetPsr(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_GetAmountOfFreeDiskSpace_Name: { |
| |
| internal::Delegate_GetAmountOfFreeDiskSpace_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetAmountOfFreeDiskSpace_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| std::string p_path{}; |
| Delegate_GetAmountOfFreeDiskSpace_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadPath(&p_path)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 12, false); |
| return false; |
| } |
| Delegate::GetAmountOfFreeDiskSpaceCallback callback = |
| Delegate_GetAmountOfFreeDiskSpace_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetAmountOfFreeDiskSpace( |
| std::move(p_path), std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_GetConnectedHdmiConnectors_Name: { |
| |
| internal::Delegate_GetConnectedHdmiConnectors_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetConnectedHdmiConnectors_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_GetConnectedHdmiConnectors_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 13, false); |
| return false; |
| } |
| Delegate::GetConnectedHdmiConnectorsCallback callback = |
| Delegate_GetConnectedHdmiConnectors_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetConnectedHdmiConnectors(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_GetPrivacyScreenInfo_Name: { |
| |
| internal::Delegate_GetPrivacyScreenInfo_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_GetPrivacyScreenInfo_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_GetPrivacyScreenInfo_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 14, false); |
| return false; |
| } |
| Delegate::GetPrivacyScreenInfoCallback callback = |
| Delegate_GetPrivacyScreenInfo_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->GetPrivacyScreenInfo(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_FetchDisplayInfo_Name: { |
| |
| internal::Delegate_FetchDisplayInfo_Params_Data* params = |
| reinterpret_cast< |
| internal::Delegate_FetchDisplayInfo_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| Delegate_FetchDisplayInfo_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| Delegate::Name_, 15, false); |
| return false; |
| } |
| Delegate::FetchDisplayInfoCallback callback = |
| Delegate_FetchDisplayInfo_ProxyToResponder::CreateCallback( |
| *message, std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->FetchDisplayInfo(std::move(callback)); |
| return true; |
| } |
| case internal::kDelegate_MonitorPowerButton_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const mojo::internal::GenericValidationInfo kDelegateValidationInfo[] = { |
| {&internal::Delegate_GetFingerprintFrame_Params_Data::Validate, |
| &internal::Delegate_GetFingerprintFrame_ResponseParams_Data::Validate}, |
| {&internal::Delegate_GetFingerprintInfo_Params_Data::Validate, |
| &internal::Delegate_GetFingerprintInfo_ResponseParams_Data::Validate}, |
| {&internal::Delegate_SetLedColor_Params_Data::Validate, |
| &internal::Delegate_SetLedColor_ResponseParams_Data::Validate}, |
| {&internal::Delegate_ResetLedColor_Params_Data::Validate, |
| &internal::Delegate_ResetLedColor_ResponseParams_Data::Validate}, |
| {&internal::Delegate_MonitorAudioJack_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::Delegate_MonitorTouchpad_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::Delegate_FetchBootPerformance_Params_Data::Validate, |
| &internal::Delegate_FetchBootPerformance_ResponseParams_Data::Validate}, |
| {&internal::Delegate_MonitorTouchscreen_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::Delegate_MonitorStylusGarage_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::Delegate_MonitorStylus_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::Delegate_GetLidAngle_Params_Data::Validate, |
| &internal::Delegate_GetLidAngle_ResponseParams_Data::Validate}, |
| {&internal::Delegate_GetPsr_Params_Data::Validate, |
| &internal::Delegate_GetPsr_ResponseParams_Data::Validate}, |
| {&internal::Delegate_GetAmountOfFreeDiskSpace_Params_Data::Validate, |
| &internal::Delegate_GetAmountOfFreeDiskSpace_ResponseParams_Data::Validate}, |
| {&internal::Delegate_GetConnectedHdmiConnectors_Params_Data::Validate, |
| &internal::Delegate_GetConnectedHdmiConnectors_ResponseParams_Data::Validate}, |
| {&internal::Delegate_GetPrivacyScreenInfo_Params_Data::Validate, |
| &internal::Delegate_GetPrivacyScreenInfo_ResponseParams_Data::Validate}, |
| {&internal::Delegate_FetchDisplayInfo_Params_Data::Validate, |
| &internal::Delegate_FetchDisplayInfo_ResponseParams_Data::Validate}, |
| {&internal::Delegate_MonitorPowerButton_Params_Data::Validate, |
| nullptr /* no response */}, |
| }; |
| |
| bool DelegateRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::ash::cros_healthd::mojom::Delegate::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kDelegateValidationInfo); |
| } |
| |
| bool DelegateResponseValidator::Accept(mojo::Message* message) { |
| const char* name = ::ash::cros_healthd::mojom::Delegate::Name_; |
| return mojo::internal::ValidateResponseGenericPacked(message, name, kDelegateValidationInfo); |
| } |
| |
| |
| } // namespace mojom |
| } // namespace cros_healthd |
| } // namespace ash |
| |
| |
| namespace mojo { |
| |
| } // namespace mojo |
| |
| |
| // Symbols declared in the -test-utils.h header are defined here instead of a |
| // separate .cc file to save compile time. |
| |
| |
| namespace ash { |
| namespace cros_healthd { |
| namespace mojom { |
| |
| |
| void DelegateInterceptorForTesting::GetFingerprintFrame(::ash::cros_healthd::mojom::FingerprintCaptureType type, GetFingerprintFrameCallback callback) { |
| GetForwardingInterface()->GetFingerprintFrame(std::move(type), std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::GetFingerprintInfo(GetFingerprintInfoCallback callback) { |
| GetForwardingInterface()->GetFingerprintInfo(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::SetLedColor(::ash::cros_healthd::mojom::LedName name, ::ash::cros_healthd::mojom::LedColor color, SetLedColorCallback callback) { |
| GetForwardingInterface()->SetLedColor(std::move(name), std::move(color), std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::ResetLedColor(::ash::cros_healthd::mojom::LedName name, ResetLedColorCallback callback) { |
| GetForwardingInterface()->ResetLedColor(std::move(name), std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::MonitorAudioJack(::mojo::PendingRemote<::ash::cros_healthd::mojom::AudioJackObserver> observer) { |
| GetForwardingInterface()->MonitorAudioJack(std::move(observer)); |
| } |
| void DelegateInterceptorForTesting::MonitorTouchpad(::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchpadObserver> observer) { |
| GetForwardingInterface()->MonitorTouchpad(std::move(observer)); |
| } |
| void DelegateInterceptorForTesting::FetchBootPerformance(FetchBootPerformanceCallback callback) { |
| GetForwardingInterface()->FetchBootPerformance(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::MonitorTouchscreen(::mojo::PendingRemote<::ash::cros_healthd::mojom::TouchscreenObserver> observer) { |
| GetForwardingInterface()->MonitorTouchscreen(std::move(observer)); |
| } |
| void DelegateInterceptorForTesting::MonitorStylusGarage(::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusGarageObserver> observer) { |
| GetForwardingInterface()->MonitorStylusGarage(std::move(observer)); |
| } |
| void DelegateInterceptorForTesting::MonitorStylus(::mojo::PendingRemote<::ash::cros_healthd::mojom::StylusObserver> observer) { |
| GetForwardingInterface()->MonitorStylus(std::move(observer)); |
| } |
| void DelegateInterceptorForTesting::GetLidAngle(GetLidAngleCallback callback) { |
| GetForwardingInterface()->GetLidAngle(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::GetPsr(GetPsrCallback callback) { |
| GetForwardingInterface()->GetPsr(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::GetAmountOfFreeDiskSpace(const std::string& path, GetAmountOfFreeDiskSpaceCallback callback) { |
| GetForwardingInterface()->GetAmountOfFreeDiskSpace(std::move(path), std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::GetConnectedHdmiConnectors(GetConnectedHdmiConnectorsCallback callback) { |
| GetForwardingInterface()->GetConnectedHdmiConnectors(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::GetPrivacyScreenInfo(GetPrivacyScreenInfoCallback callback) { |
| GetForwardingInterface()->GetPrivacyScreenInfo(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::FetchDisplayInfo(FetchDisplayInfoCallback callback) { |
| GetForwardingInterface()->FetchDisplayInfo(std::move(callback)); |
| } |
| void DelegateInterceptorForTesting::MonitorPowerButton(::mojo::PendingRemote<::ash::cros_healthd::mojom::PowerButtonObserver> observer) { |
| GetForwardingInterface()->MonitorPowerButton(std::move(observer)); |
| } |
| DelegateAsyncWaiter::DelegateAsyncWaiter( |
| Delegate* proxy) : proxy_(proxy) {} |
| |
| DelegateAsyncWaiter::~DelegateAsyncWaiter() = default; |
| |
| void DelegateAsyncWaiter::GetFingerprintFrame( |
| ::ash::cros_healthd::mojom::FingerprintCaptureType type, ::ash::cros_healthd::mojom::FingerprintFrameResultPtr* out_result, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->GetFingerprintFrame(std::move(type), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| ::ash::cros_healthd::mojom::FingerprintFrameResultPtr* out_result |
| , |
| absl::optional<std::string>* out_err |
| , |
| ::ash::cros_healthd::mojom::FingerprintFrameResultPtr result, |
| const absl::optional<std::string>& err) {*out_result = std::move(result);*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_err)); |
| loop.Run(); |
| } |
| |
| |
| |
| void DelegateAsyncWaiter::GetFingerprintInfo( |
| ::ash::cros_healthd::mojom::FingerprintInfoResultPtr* out_result, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->GetFingerprintInfo( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| ::ash::cros_healthd::mojom::FingerprintInfoResultPtr* out_result |
| , |
| absl::optional<std::string>* out_err |
| , |
| ::ash::cros_healthd::mojom::FingerprintInfoResultPtr result, |
| const absl::optional<std::string>& err) {*out_result = std::move(result);*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_err)); |
| loop.Run(); |
| } |
| |
| |
| |
| void DelegateAsyncWaiter::SetLedColor( |
| ::ash::cros_healthd::mojom::LedName name, ::ash::cros_healthd::mojom::LedColor color, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->SetLedColor(std::move(name),std::move(color), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| absl::optional<std::string>* out_err |
| , |
| const absl::optional<std::string>& err) {*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_err)); |
| loop.Run(); |
| } |
| |
| absl::optional<std::string> DelegateAsyncWaiter::SetLedColor( |
| ::ash::cros_healthd::mojom::LedName name, ::ash::cros_healthd::mojom::LedColor color) { |
| absl::optional<std::string> async_wait_result; |
| SetLedColor(std::move(name),std::move(color),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void DelegateAsyncWaiter::ResetLedColor( |
| ::ash::cros_healthd::mojom::LedName name, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->ResetLedColor(std::move(name), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| absl::optional<std::string>* out_err |
| , |
| const absl::optional<std::string>& err) {*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_err)); |
| loop.Run(); |
| } |
| |
| absl::optional<std::string> DelegateAsyncWaiter::ResetLedColor( |
| ::ash::cros_healthd::mojom::LedName name) { |
| absl::optional<std::string> async_wait_result; |
| ResetLedColor(std::move(name),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void DelegateAsyncWaiter::FetchBootPerformance( |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr* out_result) { |
| base::RunLoop loop; |
| proxy_->FetchBootPerformance( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr* out_result |
| , |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr DelegateAsyncWaiter::FetchBootPerformance( |
| ) { |
| ::ash::cros_healthd::mojom::BootPerformanceResultPtr async_wait_result; |
| FetchBootPerformance(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void DelegateAsyncWaiter::GetLidAngle( |
| absl::optional<uint16_t>* out_lid_angle) { |
| base::RunLoop loop; |
| proxy_->GetLidAngle( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| absl::optional<uint16_t>* out_lid_angle |
| , |
| absl::optional<uint16_t> lid_angle) {*out_lid_angle = std::move(lid_angle); |
| loop->Quit(); |
| }, |
| &loop, |
| out_lid_angle)); |
| loop.Run(); |
| } |
| |
| absl::optional<uint16_t> DelegateAsyncWaiter::GetLidAngle( |
| ) { |
| absl::optional<uint16_t> async_wait_result; |
| GetLidAngle(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void DelegateAsyncWaiter::GetPsr( |
| ::ash::cros_healthd::mojom::PsrInfoPtr* out_result, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->GetPsr( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| ::ash::cros_healthd::mojom::PsrInfoPtr* out_result |
| , |
| absl::optional<std::string>* out_err |
| , |
| ::ash::cros_healthd::mojom::PsrInfoPtr result, |
| const absl::optional<std::string>& err) {*out_result = std::move(result);*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result, |
| out_err)); |
| loop.Run(); |
| } |
| |
| |
| |
| void DelegateAsyncWaiter::GetAmountOfFreeDiskSpace( |
| const std::string& path, absl::optional<uint64_t>* out_free_space_byte) { |
| base::RunLoop loop; |
| proxy_->GetAmountOfFreeDiskSpace(std::move(path), |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| absl::optional<uint64_t>* out_free_space_byte |
| , |
| absl::optional<uint64_t> free_space_byte) {*out_free_space_byte = std::move(free_space_byte); |
| loop->Quit(); |
| }, |
| &loop, |
| out_free_space_byte)); |
| loop.Run(); |
| } |
| |
| absl::optional<uint64_t> DelegateAsyncWaiter::GetAmountOfFreeDiskSpace( |
| const std::string& path) { |
| absl::optional<uint64_t> async_wait_result; |
| GetAmountOfFreeDiskSpace(std::move(path),&async_wait_result); |
| return async_wait_result; |
| } |
| |
| void DelegateAsyncWaiter::GetConnectedHdmiConnectors( |
| base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr>* out_connectors, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->GetConnectedHdmiConnectors( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr>* out_connectors |
| , |
| absl::optional<std::string>* out_err |
| , |
| base::flat_map<uint32_t, ::ash::cros_healthd::mojom::ExternalDisplayInfoPtr> connectors, |
| const absl::optional<std::string>& err) {*out_connectors = std::move(connectors);*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_connectors, |
| out_err)); |
| loop.Run(); |
| } |
| |
| |
| |
| void DelegateAsyncWaiter::GetPrivacyScreenInfo( |
| bool* out_privacy_screen_supported, bool* out_privacy_screen_enabled, absl::optional<std::string>* out_err) { |
| base::RunLoop loop; |
| proxy_->GetPrivacyScreenInfo( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| bool* out_privacy_screen_supported |
| , |
| bool* out_privacy_screen_enabled |
| , |
| absl::optional<std::string>* out_err |
| , |
| bool privacy_screen_supported, |
| bool privacy_screen_enabled, |
| const absl::optional<std::string>& err) {*out_privacy_screen_supported = std::move(privacy_screen_supported);*out_privacy_screen_enabled = std::move(privacy_screen_enabled);*out_err = std::move(err); |
| loop->Quit(); |
| }, |
| &loop, |
| out_privacy_screen_supported, |
| out_privacy_screen_enabled, |
| out_err)); |
| loop.Run(); |
| } |
| |
| |
| |
| void DelegateAsyncWaiter::FetchDisplayInfo( |
| ::ash::cros_healthd::mojom::DisplayResultPtr* out_result) { |
| base::RunLoop loop; |
| proxy_->FetchDisplayInfo( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| ::ash::cros_healthd::mojom::DisplayResultPtr* out_result |
| , |
| ::ash::cros_healthd::mojom::DisplayResultPtr result) {*out_result = std::move(result); |
| loop->Quit(); |
| }, |
| &loop, |
| out_result)); |
| loop.Run(); |
| } |
| |
| ::ash::cros_healthd::mojom::DisplayResultPtr DelegateAsyncWaiter::FetchDisplayInfo( |
| ) { |
| ::ash::cros_healthd::mojom::DisplayResultPtr async_wait_result; |
| FetchDisplayInfo(&async_wait_result); |
| return async_wait_result; |
| } |
| |
| |
| |
| |
| |
| |
| } // namespace mojom |
| } // namespace cros_healthd |
| } // namespace ash |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |