| // services/viz/privileged/mojom/viz_main.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors. All rights reserved. |
| // 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 "services/viz/privileged/mojom/viz_main.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/trace_event/trace_event.h" |
| #include "base/trace_event/typed_macros.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 "services/viz/privileged/mojom/viz_main.mojom-params-data.h" |
| #include "services/viz/privileged/mojom/viz_main.mojom-shared-message-ids.h" |
| |
| #include "services/viz/privileged/mojom/viz_main.mojom-import-headers.h" |
| #include "services/viz/privileged/mojom/viz_main.mojom-test-utils.h" |
| |
| |
| #ifndef SERVICES_VIZ_PRIVILEGED_MOJOM_VIZ_MAIN_MOJOM_JUMBO_H_ |
| #define SERVICES_VIZ_PRIVILEGED_MOJOM_VIZ_MAIN_MOJOM_JUMBO_H_ |
| #endif |
| |
| |
| |
| namespace viz { |
| namespace mojom { |
| FrameSinkManagerParams::FrameSinkManagerParams() |
| : restart_id(), |
| use_activation_deadline(true), |
| activation_deadline_in_frames(4U), |
| frame_sink_manager(), |
| frame_sink_manager_client(), |
| debug_renderer_settings() {} |
| |
| FrameSinkManagerParams::FrameSinkManagerParams( |
| uint32_t restart_id_in, |
| bool use_activation_deadline_in, |
| uint32_t activation_deadline_in_frames_in, |
| ::mojo::PendingReceiver<::viz::mojom::FrameSinkManager> frame_sink_manager_in, |
| ::mojo::PendingRemote<::viz::mojom::FrameSinkManagerClient> frame_sink_manager_client_in, |
| const ::viz::DebugRendererSettings& debug_renderer_settings_in) |
| : restart_id(std::move(restart_id_in)), |
| use_activation_deadline(std::move(use_activation_deadline_in)), |
| activation_deadline_in_frames(std::move(activation_deadline_in_frames_in)), |
| frame_sink_manager(std::move(frame_sink_manager_in)), |
| frame_sink_manager_client(std::move(frame_sink_manager_client_in)), |
| debug_renderer_settings(std::move(debug_renderer_settings_in)) {} |
| |
| FrameSinkManagerParams::~FrameSinkManagerParams() = default; |
| |
| void FrameSinkManagerParams::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "restart_id"), this->restart_id, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "use_activation_deadline"), this->use_activation_deadline, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type bool>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "activation_deadline_in_frames"), this->activation_deadline_in_frames, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "frame_sink_manager"), this->frame_sink_manager, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::mojo::PendingReceiver<::viz::mojom::FrameSinkManager>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "frame_sink_manager_client"), this->frame_sink_manager_client, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::mojo::PendingRemote<::viz::mojom::FrameSinkManagerClient>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "debug_renderer_settings"), this->debug_renderer_settings, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const ::viz::DebugRendererSettings&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool FrameSinkManagerParams::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| const char VizDebugOutput::Name_[] = "viz.mojom.VizDebugOutput"; |
| |
| std::pair<uint32_t, const void*> VizDebugOutput::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kVizDebugOutput_LogFrame_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)viz::mojom::VizDebugOutput::LogFrame"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&VizDebugOutput::LogFrame_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* VizDebugOutput::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::kVizDebugOutput_LogFrame_Name: |
| return "Receive viz::mojom::VizDebugOutput::LogFrame"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kVizDebugOutput_LogFrame_Name: |
| return "Receive reply viz::mojom::VizDebugOutput::LogFrame"; |
| } |
| } |
| 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) |
| void VizDebugOutput::LogFrame_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| VizDebugOutputProxy::VizDebugOutputProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void VizDebugOutputProxy::LogFrame( |
| ::base::Value in_frameData) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send viz::mojom::VizDebugOutput::LogFrame", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("frameData"), in_frameData, |
| "<value of type ::base::Value>"); |
| }); |
| #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::kVizDebugOutput_LogFrame_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::viz::mojom::internal::VizDebugOutput_LogFrame_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment<decltype(params->frameData)> |
| frameData_fragment(params.message()); |
| frameData_fragment.Claim(¶ms->frameData); |
| mojo::internal::Serialize<::mojo_base::mojom::ValueDataView>( |
| in_frameData, frameData_fragment, true); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->frameData.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null frameData in VizDebugOutput.LogFrame request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VizDebugOutput::Name_); |
| message.set_method_name("LogFrame"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| // static |
| bool VizDebugOutputStubDispatch::Accept( |
| VizDebugOutput* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kVizDebugOutput_LogFrame_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::VizDebugOutput_LogFrame_Params_Data* params = |
| reinterpret_cast<internal::VizDebugOutput_LogFrame_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::base::Value p_frameData{}; |
| VizDebugOutput_LogFrame_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadFrameData(&p_frameData)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VizDebugOutput::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->LogFrame( |
| std::move(p_frameData)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool VizDebugOutputStubDispatch::AcceptWithResponder( |
| VizDebugOutput* 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::kVizDebugOutput_LogFrame_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const std::pair<uint32_t, mojo::internal::GenericValidationInfo> kVizDebugOutputValidationInfo[] = { |
| {internal::kVizDebugOutput_LogFrame_Name, |
| {&internal::VizDebugOutput_LogFrame_Params_Data::Validate, |
| nullptr /* no response */}}, |
| }; |
| |
| bool VizDebugOutputRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::viz::mojom::VizDebugOutput::Name_; |
| return mojo::internal::ValidateRequestGeneric(message, name, kVizDebugOutputValidationInfo); |
| } |
| |
| const char VizMain::Name_[] = "viz.mojom.VizMain"; |
| |
| std::pair<uint32_t, const void*> VizMain::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kVizMain_CreateFrameSinkManager_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)viz::mojom::VizMain::CreateFrameSinkManager"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&VizMain::CreateFrameSinkManager_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kVizMain_CreateGpuService_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)viz::mojom::VizMain::CreateGpuService"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&VizMain::CreateGpuService_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kVizMain_StartDebugStream_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)viz::mojom::VizMain::StartDebugStream"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&VizMain::StartDebugStream_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kVizMain_FilterDebugStream_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)viz::mojom::VizMain::FilterDebugStream"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&VizMain::FilterDebugStream_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kVizMain_StopDebugStream_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)viz::mojom::VizMain::StopDebugStream"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&VizMain::StopDebugStream_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* VizMain::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::kVizMain_CreateFrameSinkManager_Name: |
| return "Receive viz::mojom::VizMain::CreateFrameSinkManager"; |
| case internal::kVizMain_CreateGpuService_Name: |
| return "Receive viz::mojom::VizMain::CreateGpuService"; |
| case internal::kVizMain_StartDebugStream_Name: |
| return "Receive viz::mojom::VizMain::StartDebugStream"; |
| case internal::kVizMain_FilterDebugStream_Name: |
| return "Receive viz::mojom::VizMain::FilterDebugStream"; |
| case internal::kVizMain_StopDebugStream_Name: |
| return "Receive viz::mojom::VizMain::StopDebugStream"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kVizMain_CreateFrameSinkManager_Name: |
| return "Receive reply viz::mojom::VizMain::CreateFrameSinkManager"; |
| case internal::kVizMain_CreateGpuService_Name: |
| return "Receive reply viz::mojom::VizMain::CreateGpuService"; |
| case internal::kVizMain_StartDebugStream_Name: |
| return "Receive reply viz::mojom::VizMain::StartDebugStream"; |
| case internal::kVizMain_FilterDebugStream_Name: |
| return "Receive reply viz::mojom::VizMain::FilterDebugStream"; |
| case internal::kVizMain_StopDebugStream_Name: |
| return "Receive reply viz::mojom::VizMain::StopDebugStream"; |
| } |
| } |
| 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) |
| void VizMain::CreateFrameSinkManager_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void VizMain::CreateGpuService_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void VizMain::StartDebugStream_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void VizMain::FilterDebugStream_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void VizMain::StopDebugStream_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| VizMainProxy::VizMainProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void VizMainProxy::CreateFrameSinkManager( |
| FrameSinkManagerParamsPtr in_params) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send viz::mojom::VizMain::CreateFrameSinkManager", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("params"), in_params, |
| "<value of type FrameSinkManagerParamsPtr>"); |
| }); |
| #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::kVizMain_CreateFrameSinkManager_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::viz::mojom::internal::VizMain_CreateFrameSinkManager_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->params)::BaseType> params_fragment( |
| params.message()); |
| mojo::internal::Serialize<::viz::mojom::FrameSinkManagerParamsDataView>( |
| in_params, params_fragment); |
| params->params.Set( |
| params_fragment.is_null() ? nullptr : params_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->params.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null params in VizMain.CreateFrameSinkManager request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VizMain::Name_); |
| message.set_method_name("CreateFrameSinkManager"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void VizMainProxy::CreateGpuService( |
| ::mojo::PendingReceiver<::viz::mojom::GpuService> in_gpu_service, ::mojo::PendingRemote<::viz::mojom::GpuHost> in_gpu_host, ::mojo::PendingRemote<::discardable_memory::mojom::DiscardableSharedMemoryManager> in_discardable_memory_manager, ::base::UnsafeSharedMemoryRegion in_activity_flags, ::gfx::FontRenderParams::SubpixelRendering in_subpixel_rendering) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send viz::mojom::VizMain::CreateGpuService", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("gpu_service"), in_gpu_service, |
| "<value of type ::mojo::PendingReceiver<::viz::mojom::GpuService>>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("gpu_host"), in_gpu_host, |
| "<value of type ::mojo::PendingRemote<::viz::mojom::GpuHost>>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("discardable_memory_manager"), in_discardable_memory_manager, |
| "<value of type ::mojo::PendingRemote<::discardable_memory::mojom::DiscardableSharedMemoryManager>>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("activity_flags"), in_activity_flags, |
| "<value of type ::base::UnsafeSharedMemoryRegion>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("subpixel_rendering"), in_subpixel_rendering, |
| "<value of type ::gfx::FontRenderParams::SubpixelRendering>"); |
| }); |
| #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::kVizMain_CreateGpuService_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::viz::mojom::internal::VizMain_CreateGpuService_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfaceRequestDataView<::viz::mojom::GpuServiceInterfaceBase>>( |
| in_gpu_service, ¶ms->gpu_service, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->gpu_service), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid gpu_service in VizMain.CreateGpuService request"); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::viz::mojom::GpuHostInterfaceBase>>( |
| in_gpu_host, ¶ms->gpu_host, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->gpu_host), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid gpu_host in VizMain.CreateGpuService request"); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::discardable_memory::mojom::DiscardableSharedMemoryManagerInterfaceBase>>( |
| in_discardable_memory_manager, ¶ms->discardable_memory_manager, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->discardable_memory_manager), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid discardable_memory_manager in VizMain.CreateGpuService request"); |
| mojo::internal::MessageFragment< |
| typename decltype(params->activity_flags)::BaseType> activity_flags_fragment( |
| params.message()); |
| mojo::internal::Serialize<::mojo_base::mojom::UnsafeSharedMemoryRegionDataView>( |
| in_activity_flags, activity_flags_fragment); |
| params->activity_flags.Set( |
| activity_flags_fragment.is_null() ? nullptr : activity_flags_fragment.data()); |
| mojo::internal::Serialize<::gfx::mojom::SubpixelRendering>( |
| in_subpixel_rendering, ¶ms->subpixel_rendering); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VizMain::Name_); |
| message.set_method_name("CreateGpuService"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void VizMainProxy::StartDebugStream( |
| ::mojo::PendingRemote<VizDebugOutput> in_viz_debug) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send viz::mojom::VizMain::StartDebugStream", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("viz_debug"), in_viz_debug, |
| "<value of type ::mojo::PendingRemote<VizDebugOutput>>"); |
| }); |
| #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::kVizMain_StartDebugStream_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::viz::mojom::internal::VizMain_StartDebugStream_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::viz::mojom::VizDebugOutputInterfaceBase>>( |
| in_viz_debug, ¶ms->viz_debug, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->viz_debug), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid viz_debug in VizMain.StartDebugStream request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VizMain::Name_); |
| message.set_method_name("StartDebugStream"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void VizMainProxy::FilterDebugStream( |
| ::base::Value in_filterData) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send viz::mojom::VizMain::FilterDebugStream", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("filterData"), in_filterData, |
| "<value of type ::base::Value>"); |
| }); |
| #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::kVizMain_FilterDebugStream_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::viz::mojom::internal::VizMain_FilterDebugStream_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment<decltype(params->filterData)> |
| filterData_fragment(params.message()); |
| filterData_fragment.Claim(¶ms->filterData); |
| mojo::internal::Serialize<::mojo_base::mojom::ValueDataView>( |
| in_filterData, filterData_fragment, true); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->filterData.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null filterData in VizMain.FilterDebugStream request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VizMain::Name_); |
| message.set_method_name("FilterDebugStream"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void VizMainProxy::StopDebugStream( |
| ) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send viz::mojom::VizMain::StopDebugStream"); |
| #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::kVizMain_StopDebugStream_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::viz::mojom::internal::VizMain_StopDebugStream_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(VizMain::Name_); |
| message.set_method_name("StopDebugStream"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| // static |
| bool VizMainStubDispatch::Accept( |
| VizMain* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kVizMain_CreateFrameSinkManager_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::VizMain_CreateFrameSinkManager_Params_Data* params = |
| reinterpret_cast<internal::VizMain_CreateFrameSinkManager_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| FrameSinkManagerParamsPtr p_params{}; |
| VizMain_CreateFrameSinkManager_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadParams(&p_params)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VizMain::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->CreateFrameSinkManager( |
| std::move(p_params)); |
| return true; |
| } |
| case internal::kVizMain_CreateGpuService_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::VizMain_CreateGpuService_Params_Data* params = |
| reinterpret_cast<internal::VizMain_CreateGpuService_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingReceiver<::viz::mojom::GpuService> p_gpu_service{}; |
| ::mojo::PendingRemote<::viz::mojom::GpuHost> p_gpu_host{}; |
| ::mojo::PendingRemote<::discardable_memory::mojom::DiscardableSharedMemoryManager> p_discardable_memory_manager{}; |
| ::base::UnsafeSharedMemoryRegion p_activity_flags{}; |
| ::gfx::FontRenderParams::SubpixelRendering p_subpixel_rendering{}; |
| VizMain_CreateGpuService_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_gpu_service = |
| input_data_view.TakeGpuService<decltype(p_gpu_service)>(); |
| } |
| if (success) { |
| p_gpu_host = |
| input_data_view.TakeGpuHost<decltype(p_gpu_host)>(); |
| } |
| if (success) { |
| p_discardable_memory_manager = |
| input_data_view.TakeDiscardableMemoryManager<decltype(p_discardable_memory_manager)>(); |
| } |
| if (success && !input_data_view.ReadActivityFlags(&p_activity_flags)) |
| success = false; |
| if (success && !input_data_view.ReadSubpixelRendering(&p_subpixel_rendering)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VizMain::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->CreateGpuService( |
| std::move(p_gpu_service), |
| std::move(p_gpu_host), |
| std::move(p_discardable_memory_manager), |
| std::move(p_activity_flags), |
| std::move(p_subpixel_rendering)); |
| return true; |
| } |
| case internal::kVizMain_StartDebugStream_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::VizMain_StartDebugStream_Params_Data* params = |
| reinterpret_cast<internal::VizMain_StartDebugStream_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<VizDebugOutput> p_viz_debug{}; |
| VizMain_StartDebugStream_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_viz_debug = |
| input_data_view.TakeVizDebug<decltype(p_viz_debug)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VizMain::Name_, 2, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->StartDebugStream( |
| std::move(p_viz_debug)); |
| return true; |
| } |
| case internal::kVizMain_FilterDebugStream_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::VizMain_FilterDebugStream_Params_Data* params = |
| reinterpret_cast<internal::VizMain_FilterDebugStream_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::base::Value p_filterData{}; |
| VizMain_FilterDebugStream_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadFilterData(&p_filterData)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VizMain::Name_, 3, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->FilterDebugStream( |
| std::move(p_filterData)); |
| return true; |
| } |
| case internal::kVizMain_StopDebugStream_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::VizMain_StopDebugStream_Params_Data* params = |
| reinterpret_cast<internal::VizMain_StopDebugStream_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| VizMain_StopDebugStream_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| VizMain::Name_, 4, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->StopDebugStream(); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool VizMainStubDispatch::AcceptWithResponder( |
| VizMain* 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::kVizMain_CreateFrameSinkManager_Name: { |
| break; |
| } |
| case internal::kVizMain_CreateGpuService_Name: { |
| break; |
| } |
| case internal::kVizMain_StartDebugStream_Name: { |
| break; |
| } |
| case internal::kVizMain_FilterDebugStream_Name: { |
| break; |
| } |
| case internal::kVizMain_StopDebugStream_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const std::pair<uint32_t, mojo::internal::GenericValidationInfo> kVizMainValidationInfo[] = { |
| {internal::kVizMain_CreateFrameSinkManager_Name, |
| {&internal::VizMain_CreateFrameSinkManager_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kVizMain_CreateGpuService_Name, |
| {&internal::VizMain_CreateGpuService_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kVizMain_StartDebugStream_Name, |
| {&internal::VizMain_StartDebugStream_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kVizMain_FilterDebugStream_Name, |
| {&internal::VizMain_FilterDebugStream_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kVizMain_StopDebugStream_Name, |
| {&internal::VizMain_StopDebugStream_Params_Data::Validate, |
| nullptr /* no response */}}, |
| }; |
| |
| bool VizMainRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::viz::mojom::VizMain::Name_; |
| return mojo::internal::ValidateRequestGeneric(message, name, kVizMainValidationInfo); |
| } |
| |
| |
| |
| } // namespace mojom |
| } // namespace viz |
| |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::viz::mojom::FrameSinkManagerParams::DataView, ::viz::mojom::FrameSinkManagerParamsPtr>::Read( |
| ::viz::mojom::FrameSinkManagerParams::DataView input, |
| ::viz::mojom::FrameSinkManagerParamsPtr* output) { |
| bool success = true; |
| ::viz::mojom::FrameSinkManagerParamsPtr result(::viz::mojom::FrameSinkManagerParams::New()); |
| |
| if (success) |
| result->restart_id = input.restart_id(); |
| if (success) |
| result->use_activation_deadline = input.use_activation_deadline(); |
| if (success) |
| result->activation_deadline_in_frames = input.activation_deadline_in_frames(); |
| if (success) { |
| result->frame_sink_manager = |
| input.TakeFrameSinkManager<decltype(result->frame_sink_manager)>(); |
| } |
| if (success) { |
| result->frame_sink_manager_client = |
| input.TakeFrameSinkManagerClient<decltype(result->frame_sink_manager_client)>(); |
| } |
| if (success && !input.ReadDebugRendererSettings(&result->debug_renderer_settings)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| |
| // Symbols declared in the -test-utils.h header are defined here instead of a |
| // separate .cc file to save compile time. |
| |
| |
| namespace viz { |
| namespace mojom { |
| |
| |
| void VizDebugOutputInterceptorForTesting::LogFrame(::base::Value frameData) { |
| GetForwardingInterface()->LogFrame(std::move(frameData)); |
| } |
| VizDebugOutputAsyncWaiter::VizDebugOutputAsyncWaiter( |
| VizDebugOutput* proxy) : proxy_(proxy) {} |
| |
| VizDebugOutputAsyncWaiter::~VizDebugOutputAsyncWaiter() = default; |
| |
| |
| |
| |
| void VizMainInterceptorForTesting::CreateFrameSinkManager(FrameSinkManagerParamsPtr params) { |
| GetForwardingInterface()->CreateFrameSinkManager(std::move(params)); |
| } |
| void VizMainInterceptorForTesting::CreateGpuService(::mojo::PendingReceiver<::viz::mojom::GpuService> gpu_service, ::mojo::PendingRemote<::viz::mojom::GpuHost> gpu_host, ::mojo::PendingRemote<::discardable_memory::mojom::DiscardableSharedMemoryManager> discardable_memory_manager, ::base::UnsafeSharedMemoryRegion activity_flags, ::gfx::FontRenderParams::SubpixelRendering subpixel_rendering) { |
| GetForwardingInterface()->CreateGpuService(std::move(gpu_service), std::move(gpu_host), std::move(discardable_memory_manager), std::move(activity_flags), std::move(subpixel_rendering)); |
| } |
| void VizMainInterceptorForTesting::StartDebugStream(::mojo::PendingRemote<VizDebugOutput> viz_debug) { |
| GetForwardingInterface()->StartDebugStream(std::move(viz_debug)); |
| } |
| void VizMainInterceptorForTesting::FilterDebugStream(::base::Value filterData) { |
| GetForwardingInterface()->FilterDebugStream(std::move(filterData)); |
| } |
| void VizMainInterceptorForTesting::StopDebugStream() { |
| GetForwardingInterface()->StopDebugStream(); |
| } |
| VizMainAsyncWaiter::VizMainAsyncWaiter( |
| VizMain* proxy) : proxy_(proxy) {} |
| |
| VizMainAsyncWaiter::~VizMainAsyncWaiter() = default; |
| |
| |
| |
| |
| |
| |
| } // namespace mojom |
| } // namespace viz |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |