#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "services/device/public/mojom/serial.mojom.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/features.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "services/device/public/mojom/serial.mojom-params-data.h"
#include "services/device/public/mojom/serial.mojom-shared-message-ids.h"
#include "services/device/public/mojom/serial.mojom-import-headers.h"
#include "services/device/public/mojom/serial.mojom-test-utils.h"
namespace device::mojom {
SerialPortInfo::SerialPortInfo()
: … { … }
SerialPortInfo::SerialPortInfo(
const ::base::UnguessableToken& token_in,
const ::base::FilePath& path_in,
SerialPortType type_in,
uint16_t vendor_id_in,
bool has_vendor_id_in,
uint16_t product_id_in,
bool has_product_id_in,
const std::optional<::device::BluetoothUUID>& bluetooth_service_class_id_in,
const std::optional<std::string>& display_name_in,
const std::optional<std::string>& serial_number_in,
bool connected_in)
: … { … }
SerialPortInfo::~SerialPortInfo() = default;
void SerialPortInfo::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool SerialPortInfo::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
SerialConnectionOptions::SerialConnectionOptions()
: … { … }
SerialConnectionOptions::SerialConnectionOptions(
uint32_t bitrate_in,
SerialDataBits data_bits_in,
SerialParityBit parity_bit_in,
SerialStopBits stop_bits_in,
bool cts_flow_control_in,
bool has_cts_flow_control_in)
: … { … }
SerialConnectionOptions::~SerialConnectionOptions() = default;
size_t SerialConnectionOptions::Hash(size_t seed) const { … }
void SerialConnectionOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool SerialConnectionOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
SerialConnectionInfo::SerialConnectionInfo()
: … { … }
SerialConnectionInfo::SerialConnectionInfo(
uint32_t bitrate_in,
SerialDataBits data_bits_in,
SerialParityBit parity_bit_in,
SerialStopBits stop_bits_in,
bool cts_flow_control_in)
: … { … }
SerialConnectionInfo::~SerialConnectionInfo() = default;
size_t SerialConnectionInfo::Hash(size_t seed) const { … }
void SerialConnectionInfo::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool SerialConnectionInfo::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
SerialHostControlSignals::SerialHostControlSignals()
: … { … }
SerialHostControlSignals::SerialHostControlSignals(
bool dtr_in,
bool has_dtr_in,
bool rts_in,
bool has_rts_in,
bool brk_in,
bool has_brk_in)
: … { … }
SerialHostControlSignals::~SerialHostControlSignals() = default;
size_t SerialHostControlSignals::Hash(size_t seed) const { … }
void SerialHostControlSignals::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool SerialHostControlSignals::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
SerialPortControlSignals::SerialPortControlSignals()
: … { … }
SerialPortControlSignals::SerialPortControlSignals(
bool dcd_in,
bool cts_in,
bool ri_in,
bool dsr_in)
: … { … }
SerialPortControlSignals::~SerialPortControlSignals() = default;
size_t SerialPortControlSignals::Hash(size_t seed) const { … }
void SerialPortControlSignals::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool SerialPortControlSignals::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char SerialPortManager::Name_[] = …;
SerialPortManager::IPCStableHashFunction SerialPortManager::MessageToMethodInfo_(mojo::Message& message) { … }
const char* SerialPortManager::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SerialPortManager::SetClient_Sym::IPCStableHash() { … }
uint32_t SerialPortManager::GetDevices_Sym::IPCStableHash() { … }
uint32_t SerialPortManager::OpenPort_Sym::IPCStableHash() { … }
# endif
class SerialPortManager_GetDevices_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPortManager_OpenPort_ForwardToCallback
: public mojo::MessageReceiver { … };
SerialPortManagerProxy::SerialPortManagerProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void SerialPortManagerProxy::SetClient(
::mojo::PendingRemote<SerialPortManagerClient> in_client) { … }
void SerialPortManagerProxy::GetDevices(
GetDevicesCallback callback) { … }
void SerialPortManagerProxy::OpenPort(
const ::base::UnguessableToken& in_token, bool in_use_alternate_path, SerialConnectionOptionsPtr in_options, ::mojo::PendingRemote<SerialPortClient> in_client, ::mojo::PendingRemote<SerialPortConnectionWatcher> in_watcher, OpenPortCallback callback) { … }
class SerialPortManager_GetDevices_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPortManager_GetDevices_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPortManager_GetDevices_ProxyToResponder::Run(
std::vector<SerialPortInfoPtr> in_devices) { … }
class SerialPortManager_OpenPort_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPortManager_OpenPort_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPortManager_OpenPort_ProxyToResponder::Run(
::mojo::PendingRemote<SerialPort> in_port) { … }
bool SerialPortManagerStubDispatch::Accept(
SerialPortManager* impl,
mojo::Message* message) { … }
bool SerialPortManagerStubDispatch::AcceptWithResponder(
SerialPortManager* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kSerialPortManagerValidationInfo[] = …;
bool SerialPortManagerRequestValidator::Accept(mojo::Message* message) { … }
bool SerialPortManagerResponseValidator::Accept(mojo::Message* message) { … }
const char SerialPortManagerClient::Name_[] = …;
SerialPortManagerClient::IPCStableHashFunction SerialPortManagerClient::MessageToMethodInfo_(mojo::Message& message) { … }
const char* SerialPortManagerClient::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SerialPortManagerClient::OnPortAdded_Sym::IPCStableHash() { … }
uint32_t SerialPortManagerClient::OnPortRemoved_Sym::IPCStableHash() { … }
uint32_t SerialPortManagerClient::OnPortConnectedStateChanged_Sym::IPCStableHash() { … }
# endif
SerialPortManagerClientProxy::SerialPortManagerClientProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void SerialPortManagerClientProxy::OnPortAdded(
SerialPortInfoPtr in_port_info) { … }
void SerialPortManagerClientProxy::OnPortRemoved(
SerialPortInfoPtr in_port_info) { … }
void SerialPortManagerClientProxy::OnPortConnectedStateChanged(
SerialPortInfoPtr in_port_info) { … }
bool SerialPortManagerClientStubDispatch::Accept(
SerialPortManagerClient* impl,
mojo::Message* message) { … }
bool SerialPortManagerClientStubDispatch::AcceptWithResponder(
SerialPortManagerClient* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kSerialPortManagerClientValidationInfo[] = …;
bool SerialPortManagerClientRequestValidator::Accept(mojo::Message* message) { … }
const char SerialPort::Name_[] = …;
SerialPort::IPCStableHashFunction SerialPort::MessageToMethodInfo_(mojo::Message& message) { … }
const char* SerialPort::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SerialPort::StartWriting_Sym::IPCStableHash() { … }
uint32_t SerialPort::StartReading_Sym::IPCStableHash() { … }
uint32_t SerialPort::Flush_Sym::IPCStableHash() { … }
uint32_t SerialPort::Drain_Sym::IPCStableHash() { … }
uint32_t SerialPort::GetControlSignals_Sym::IPCStableHash() { … }
uint32_t SerialPort::SetControlSignals_Sym::IPCStableHash() { … }
uint32_t SerialPort::ConfigurePort_Sym::IPCStableHash() { … }
uint32_t SerialPort::GetPortInfo_Sym::IPCStableHash() { … }
uint32_t SerialPort::Close_Sym::IPCStableHash() { … }
# endif
class SerialPort_Flush_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPort_Drain_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPort_GetControlSignals_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPort_SetControlSignals_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPort_ConfigurePort_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPort_GetPortInfo_ForwardToCallback
: public mojo::MessageReceiver { … };
class SerialPort_Close_ForwardToCallback
: public mojo::MessageReceiver { … };
SerialPortProxy::SerialPortProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void SerialPortProxy::StartWriting(
::mojo::ScopedDataPipeConsumerHandle in_consumer) { … }
void SerialPortProxy::StartReading(
::mojo::ScopedDataPipeProducerHandle in_producer) { … }
void SerialPortProxy::Flush(
SerialPortFlushMode in_mode, FlushCallback callback) { … }
void SerialPortProxy::Drain(
DrainCallback callback) { … }
void SerialPortProxy::GetControlSignals(
GetControlSignalsCallback callback) { … }
void SerialPortProxy::SetControlSignals(
SerialHostControlSignalsPtr in_signals, SetControlSignalsCallback callback) { … }
void SerialPortProxy::ConfigurePort(
SerialConnectionOptionsPtr in_options, ConfigurePortCallback callback) { … }
void SerialPortProxy::GetPortInfo(
GetPortInfoCallback callback) { … }
void SerialPortProxy::Close(
bool in_flush, CloseCallback callback) { … }
class SerialPort_Flush_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_Flush_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_Flush_ProxyToResponder::Run(
) { … }
class SerialPort_Drain_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_Drain_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_Drain_ProxyToResponder::Run(
) { … }
class SerialPort_GetControlSignals_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_GetControlSignals_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_GetControlSignals_ProxyToResponder::Run(
SerialPortControlSignalsPtr in_signals) { … }
class SerialPort_SetControlSignals_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_SetControlSignals_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_SetControlSignals_ProxyToResponder::Run(
bool in_success) { … }
class SerialPort_ConfigurePort_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_ConfigurePort_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_ConfigurePort_ProxyToResponder::Run(
bool in_success) { … }
class SerialPort_GetPortInfo_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_GetPortInfo_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_GetPortInfo_ProxyToResponder::Run(
SerialConnectionInfoPtr in_info) { … }
class SerialPort_Close_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool SerialPort_Close_ForwardToCallback::Accept(
mojo::Message* message) { … }
void SerialPort_Close_ProxyToResponder::Run(
) { … }
bool SerialPortStubDispatch::Accept(
SerialPort* impl,
mojo::Message* message) { … }
bool SerialPortStubDispatch::AcceptWithResponder(
SerialPort* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kSerialPortValidationInfo[] = …;
bool SerialPortRequestValidator::Accept(mojo::Message* message) { … }
bool SerialPortResponseValidator::Accept(mojo::Message* message) { … }
const char SerialPortClient::Name_[] = …;
SerialPortClient::IPCStableHashFunction SerialPortClient::MessageToMethodInfo_(mojo::Message& message) { … }
const char* SerialPortClient::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SerialPortClient::OnReadError_Sym::IPCStableHash() { … }
uint32_t SerialPortClient::OnSendError_Sym::IPCStableHash() { … }
# endif
SerialPortClientProxy::SerialPortClientProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void SerialPortClientProxy::OnReadError(
SerialReceiveError in_error) { … }
void SerialPortClientProxy::OnSendError(
SerialSendError in_error) { … }
bool SerialPortClientStubDispatch::Accept(
SerialPortClient* impl,
mojo::Message* message) { … }
bool SerialPortClientStubDispatch::AcceptWithResponder(
SerialPortClient* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kSerialPortClientValidationInfo[] = …;
bool SerialPortClientRequestValidator::Accept(mojo::Message* message) { … }
const char SerialPortConnectionWatcher::Name_[] = …;
SerialPortConnectionWatcher::IPCStableHashFunction SerialPortConnectionWatcher::MessageToMethodInfo_(mojo::Message& message) { … }
const char* SerialPortConnectionWatcher::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
# endif
SerialPortConnectionWatcherProxy::SerialPortConnectionWatcherProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
bool SerialPortConnectionWatcherStubDispatch::Accept(
SerialPortConnectionWatcher* impl,
mojo::Message* message) { … }
bool SerialPortConnectionWatcherStubDispatch::AcceptWithResponder(
SerialPortConnectionWatcher* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
bool SerialPortConnectionWatcherRequestValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::device::mojom::SerialPortInfo::DataView, ::device::mojom::SerialPortInfoPtr>::Read(
::device::mojom::SerialPortInfo::DataView input,
::device::mojom::SerialPortInfoPtr* output) { … }
bool StructTraits<::device::mojom::SerialConnectionOptions::DataView, ::device::mojom::SerialConnectionOptionsPtr>::Read(
::device::mojom::SerialConnectionOptions::DataView input,
::device::mojom::SerialConnectionOptionsPtr* output) { … }
bool StructTraits<::device::mojom::SerialConnectionInfo::DataView, ::device::mojom::SerialConnectionInfoPtr>::Read(
::device::mojom::SerialConnectionInfo::DataView input,
::device::mojom::SerialConnectionInfoPtr* output) { … }
bool StructTraits<::device::mojom::SerialHostControlSignals::DataView, ::device::mojom::SerialHostControlSignalsPtr>::Read(
::device::mojom::SerialHostControlSignals::DataView input,
::device::mojom::SerialHostControlSignalsPtr* output) { … }
bool StructTraits<::device::mojom::SerialPortControlSignals::DataView, ::device::mojom::SerialPortControlSignalsPtr>::Read(
::device::mojom::SerialPortControlSignals::DataView input,
::device::mojom::SerialPortControlSignalsPtr* output) { … }
}
namespace device::mojom {
void SerialPortManagerInterceptorForTesting::SetClient(::mojo::PendingRemote<SerialPortManagerClient> client) { … }
void SerialPortManagerInterceptorForTesting::GetDevices(GetDevicesCallback callback) { … }
void SerialPortManagerInterceptorForTesting::OpenPort(const ::base::UnguessableToken& token, bool use_alternate_path, SerialConnectionOptionsPtr options, ::mojo::PendingRemote<SerialPortClient> client, ::mojo::PendingRemote<SerialPortConnectionWatcher> watcher, OpenPortCallback callback) { … }
SerialPortManagerAsyncWaiter::SerialPortManagerAsyncWaiter(
SerialPortManager* proxy) : … { … }
SerialPortManagerAsyncWaiter::~SerialPortManagerAsyncWaiter() = default;
void SerialPortManagerAsyncWaiter::GetDevices(
std::vector<SerialPortInfoPtr>* out_devices) { … }
std::vector<SerialPortInfoPtr> SerialPortManagerAsyncWaiter::GetDevices(
) { … }
void SerialPortManagerAsyncWaiter::OpenPort(
const ::base::UnguessableToken& token, bool use_alternate_path, SerialConnectionOptionsPtr options, ::mojo::PendingRemote<SerialPortClient> client, ::mojo::PendingRemote<SerialPortConnectionWatcher> watcher, ::mojo::PendingRemote<SerialPort>* out_port) { … }
::mojo::PendingRemote<SerialPort> SerialPortManagerAsyncWaiter::OpenPort(
const ::base::UnguessableToken& token, bool use_alternate_path, SerialConnectionOptionsPtr options, ::mojo::PendingRemote<SerialPortClient> client, ::mojo::PendingRemote<SerialPortConnectionWatcher> watcher) { … }
void SerialPortManagerClientInterceptorForTesting::OnPortAdded(SerialPortInfoPtr port_info) { … }
void SerialPortManagerClientInterceptorForTesting::OnPortRemoved(SerialPortInfoPtr port_info) { … }
void SerialPortManagerClientInterceptorForTesting::OnPortConnectedStateChanged(SerialPortInfoPtr port_info) { … }
SerialPortManagerClientAsyncWaiter::SerialPortManagerClientAsyncWaiter(
SerialPortManagerClient* proxy) : … { … }
SerialPortManagerClientAsyncWaiter::~SerialPortManagerClientAsyncWaiter() = default;
void SerialPortInterceptorForTesting::StartWriting(::mojo::ScopedDataPipeConsumerHandle consumer) { … }
void SerialPortInterceptorForTesting::StartReading(::mojo::ScopedDataPipeProducerHandle producer) { … }
void SerialPortInterceptorForTesting::Flush(SerialPortFlushMode mode, FlushCallback callback) { … }
void SerialPortInterceptorForTesting::Drain(DrainCallback callback) { … }
void SerialPortInterceptorForTesting::GetControlSignals(GetControlSignalsCallback callback) { … }
void SerialPortInterceptorForTesting::SetControlSignals(SerialHostControlSignalsPtr signals, SetControlSignalsCallback callback) { … }
void SerialPortInterceptorForTesting::ConfigurePort(SerialConnectionOptionsPtr options, ConfigurePortCallback callback) { … }
void SerialPortInterceptorForTesting::GetPortInfo(GetPortInfoCallback callback) { … }
void SerialPortInterceptorForTesting::Close(bool flush, CloseCallback callback) { … }
SerialPortAsyncWaiter::SerialPortAsyncWaiter(
SerialPort* proxy) : … { … }
SerialPortAsyncWaiter::~SerialPortAsyncWaiter() = default;
void SerialPortAsyncWaiter::Flush(
SerialPortFlushMode mode) { … }
void SerialPortAsyncWaiter::Drain(
) { … }
void SerialPortAsyncWaiter::GetControlSignals(
SerialPortControlSignalsPtr* out_signals) { … }
SerialPortControlSignalsPtr SerialPortAsyncWaiter::GetControlSignals(
) { … }
void SerialPortAsyncWaiter::SetControlSignals(
SerialHostControlSignalsPtr signals, bool* out_success) { … }
bool SerialPortAsyncWaiter::SetControlSignals(
SerialHostControlSignalsPtr signals) { … }
void SerialPortAsyncWaiter::ConfigurePort(
SerialConnectionOptionsPtr options, bool* out_success) { … }
bool SerialPortAsyncWaiter::ConfigurePort(
SerialConnectionOptionsPtr options) { … }
void SerialPortAsyncWaiter::GetPortInfo(
SerialConnectionInfoPtr* out_info) { … }
SerialConnectionInfoPtr SerialPortAsyncWaiter::GetPortInfo(
) { … }
void SerialPortAsyncWaiter::Close(
bool flush) { … }
void SerialPortClientInterceptorForTesting::OnReadError(SerialReceiveError error) { … }
void SerialPortClientInterceptorForTesting::OnSendError(SerialSendError error) { … }
SerialPortClientAsyncWaiter::SerialPortClientAsyncWaiter(
SerialPortClient* proxy) : … { … }
SerialPortClientAsyncWaiter::~SerialPortClientAsyncWaiter() = default;
SerialPortConnectionWatcherAsyncWaiter::SerialPortConnectionWatcherAsyncWaiter(
SerialPortConnectionWatcher* proxy) : … { … }
SerialPortConnectionWatcherAsyncWaiter::~SerialPortConnectionWatcherAsyncWaiter() = default;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif