| // media/capture/video/chromeos/mojom/camera_common.mojom.h 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. |
| |
| #ifndef MEDIA_CAPTURE_VIDEO_CHROMEOS_MOJOM_CAMERA_COMMON_MOJOM_H_ |
| #define MEDIA_CAPTURE_VIDEO_CHROMEOS_MOJOM_CAMERA_COMMON_MOJOM_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <optional> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "base/types/cxx23_to_underlying.h" |
| #include "mojo/public/cpp/bindings/clone_traits.h" |
| #include "mojo/public/cpp/bindings/equals_traits.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/struct_ptr.h" |
| #include "mojo/public/cpp/bindings/struct_traits.h" |
| #include "mojo/public/cpp/bindings/union_traits.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "media/capture/video/chromeos/mojom/camera_common.mojom-features.h" |
| #include "media/capture/video/chromeos/mojom/camera_common.mojom-shared.h" |
| #include "media/capture/video/chromeos/mojom/camera_common.mojom-forward.h" |
| #include "media/capture/video/chromeos/mojom/camera3.mojom-forward.h" |
| #include "media/capture/video/chromeos/mojom/camera_metadata.mojom.h" |
| #include <string> |
| #include <vector> |
| |
| #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| #include "mojo/public/cpp/bindings/lib/message_size_estimator.h" |
| #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" |
| |
| |
| |
| |
| |
| |
| namespace cros::mojom { |
| |
| class CameraModuleCallbacksProxy; |
| |
| template <typename ImplRefTraits> |
| class CameraModuleCallbacksStub; |
| |
| class CameraModuleCallbacksRequestValidator; |
| |
| |
| class CameraModuleCallbacks |
| : public CameraModuleCallbacksInterfaceBase { |
| public: |
| using IPCStableHashFunction = uint32_t(*)(); |
| |
| static const char Name_[]; |
| static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 1; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = CameraModuleCallbacksInterfaceBase; |
| using Proxy_ = CameraModuleCallbacksProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = CameraModuleCallbacksStub<ImplRefTraits>; |
| |
| using RequestValidator_ = CameraModuleCallbacksRequestValidator; |
| using ResponseValidator_ = mojo::PassThroughFilter; |
| enum MethodMinVersions : uint32_t { |
| kCameraDeviceStatusChangeMinVersion = 0, |
| kTorchModeStatusChangeMinVersion = 1, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct CameraDeviceStatusChange_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct TorchModeStatusChange_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~CameraModuleCallbacks() = default; |
| |
| |
| virtual void CameraDeviceStatusChange(int32_t camera_id, CameraDeviceStatus new_status) = 0; |
| |
| |
| virtual void TorchModeStatusChange(int32_t camera_id, TorchModeStatus new_status) = 0; |
| }; |
| |
| class VendorTagOpsProxy; |
| |
| template <typename ImplRefTraits> |
| class VendorTagOpsStub; |
| |
| class VendorTagOpsRequestValidator; |
| class VendorTagOpsResponseValidator; |
| |
| |
| class VendorTagOps |
| : public VendorTagOpsInterfaceBase { |
| public: |
| using IPCStableHashFunction = uint32_t(*)(); |
| |
| static const char Name_[]; |
| static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 0; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = VendorTagOpsInterfaceBase; |
| using Proxy_ = VendorTagOpsProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = VendorTagOpsStub<ImplRefTraits>; |
| |
| using RequestValidator_ = VendorTagOpsRequestValidator; |
| using ResponseValidator_ = VendorTagOpsResponseValidator; |
| enum MethodMinVersions : uint32_t { |
| kGetTagCountMinVersion = 0, |
| kGetAllTagsMinVersion = 0, |
| kGetSectionNameMinVersion = 0, |
| kGetTagNameMinVersion = 0, |
| kGetTagTypeMinVersion = 0, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct GetTagCount_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetAllTags_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetSectionName_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetTagName_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetTagType_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~VendorTagOps() = default; |
| |
| |
| using GetTagCountCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void GetTagCount(GetTagCountCallback callback) = 0; |
| |
| |
| using GetAllTagsCallback = base::OnceCallback<void(const std::vector<uint32_t>&)>; |
| |
| virtual void GetAllTags(GetAllTagsCallback callback) = 0; |
| |
| |
| using GetSectionNameCallback = base::OnceCallback<void(const std::optional<std::string>&)>; |
| |
| virtual void GetSectionName(uint32_t tag, GetSectionNameCallback callback) = 0; |
| |
| |
| using GetTagNameCallback = base::OnceCallback<void(const std::optional<std::string>&)>; |
| |
| virtual void GetTagName(uint32_t tag, GetTagNameCallback callback) = 0; |
| |
| |
| using GetTagTypeCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void GetTagType(uint32_t tag, GetTagTypeCallback callback) = 0; |
| }; |
| |
| class CameraModuleProxy; |
| |
| template <typename ImplRefTraits> |
| class CameraModuleStub; |
| |
| class CameraModuleRequestValidator; |
| class CameraModuleResponseValidator; |
| |
| |
| class CameraModule |
| : public CameraModuleInterfaceBase { |
| public: |
| using IPCStableHashFunction = uint32_t(*)(); |
| |
| static const char Name_[]; |
| static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 3; |
| static constexpr bool PassesAssociatedKinds_ = true; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = CameraModuleInterfaceBase; |
| using Proxy_ = CameraModuleProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = CameraModuleStub<ImplRefTraits>; |
| |
| using RequestValidator_ = CameraModuleRequestValidator; |
| using ResponseValidator_ = CameraModuleResponseValidator; |
| enum MethodMinVersions : uint32_t { |
| kOpenDeviceMinVersion = 0, |
| kGetNumberOfCamerasMinVersion = 0, |
| kGetCameraInfoMinVersion = 0, |
| kSetCallbacksMinVersion = 0, |
| kSetTorchModeMinVersion = 1, |
| kInitMinVersion = 1, |
| kGetVendorTagOpsMinVersion = 2, |
| kSetCallbacksAssociatedMinVersion = 3, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct OpenDevice_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetNumberOfCameras_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetCameraInfo_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct SetCallbacks_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct SetTorchMode_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct Init_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct GetVendorTagOps_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct SetCallbacksAssociated_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~CameraModule() = default; |
| |
| |
| using OpenDeviceCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void OpenDevice(int32_t camera_id, ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> device_ops_receiver, OpenDeviceCallback callback) = 0; |
| |
| |
| using GetNumberOfCamerasCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void GetNumberOfCameras(GetNumberOfCamerasCallback callback) = 0; |
| |
| |
| using GetCameraInfoCallback = base::OnceCallback<void(int32_t, CameraInfoPtr)>; |
| |
| virtual void GetCameraInfo(int32_t camera_id, GetCameraInfoCallback callback) = 0; |
| |
| |
| using SetCallbacksCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void SetCallbacks(::mojo::PendingRemote<CameraModuleCallbacks> callbacks, SetCallbacksCallback callback) = 0; |
| |
| |
| using SetTorchModeCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void SetTorchMode(int32_t camera_id, bool enabled, SetTorchModeCallback callback) = 0; |
| |
| |
| using InitCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void Init(InitCallback callback) = 0; |
| |
| |
| using GetVendorTagOpsCallback = base::OnceCallback<void()>; |
| |
| virtual void GetVendorTagOps(::mojo::PendingReceiver<VendorTagOps> vendor_tag_ops_receiver, GetVendorTagOpsCallback callback) = 0; |
| |
| |
| using SetCallbacksAssociatedCallback = base::OnceCallback<void(int32_t)>; |
| |
| virtual void SetCallbacksAssociated(::mojo::PendingAssociatedRemote<CameraModuleCallbacks> callbacks, SetCallbacksAssociatedCallback callback) = 0; |
| }; |
| |
| |
| |
| class CameraModuleCallbacksProxy |
| : public CameraModuleCallbacks { |
| public: |
| using InterfaceType = CameraModuleCallbacks; |
| |
| explicit CameraModuleCallbacksProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| void CameraDeviceStatusChange(int32_t camera_id, CameraDeviceStatus new_status) final; |
| |
| void TorchModeStatusChange(int32_t camera_id, TorchModeStatus new_status) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| |
| |
| |
| class VendorTagOpsProxy |
| : public VendorTagOps { |
| public: |
| using InterfaceType = VendorTagOps; |
| |
| explicit VendorTagOpsProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| void GetTagCount(GetTagCountCallback callback) final; |
| |
| void GetAllTags(GetAllTagsCallback callback) final; |
| |
| void GetSectionName(uint32_t tag, GetSectionNameCallback callback) final; |
| |
| void GetTagName(uint32_t tag, GetTagNameCallback callback) final; |
| |
| void GetTagType(uint32_t tag, GetTagTypeCallback callback) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| |
| |
| |
| class CameraModuleProxy |
| : public CameraModule { |
| public: |
| using InterfaceType = CameraModule; |
| |
| explicit CameraModuleProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| void OpenDevice(int32_t camera_id, ::mojo::PendingReceiver<::cros::mojom::Camera3DeviceOps> device_ops_receiver, OpenDeviceCallback callback) final; |
| |
| void GetNumberOfCameras(GetNumberOfCamerasCallback callback) final; |
| |
| void GetCameraInfo(int32_t camera_id, GetCameraInfoCallback callback) final; |
| |
| void SetCallbacks(::mojo::PendingRemote<CameraModuleCallbacks> callbacks, SetCallbacksCallback callback) final; |
| |
| void SetTorchMode(int32_t camera_id, bool enabled, SetTorchModeCallback callback) final; |
| |
| void Init(InitCallback callback) final; |
| |
| void GetVendorTagOps(::mojo::PendingReceiver<VendorTagOps> vendor_tag_ops_receiver, GetVendorTagOpsCallback callback) final; |
| |
| void SetCallbacksAssociated(::mojo::PendingAssociatedRemote<CameraModuleCallbacks> callbacks, SetCallbacksAssociatedCallback callback) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| class CameraModuleCallbacksStubDispatch { |
| public: |
| static bool Accept(CameraModuleCallbacks* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| CameraModuleCallbacks* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<CameraModuleCallbacks>> |
| class CameraModuleCallbacksStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| CameraModuleCallbacksStub() = default; |
| ~CameraModuleCallbacksStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return CameraModuleCallbacksStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return CameraModuleCallbacksStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class VendorTagOpsStubDispatch { |
| public: |
| static bool Accept(VendorTagOps* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| VendorTagOps* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<VendorTagOps>> |
| class VendorTagOpsStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| VendorTagOpsStub() = default; |
| ~VendorTagOpsStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return VendorTagOpsStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return VendorTagOpsStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class CameraModuleStubDispatch { |
| public: |
| static bool Accept(CameraModule* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| CameraModule* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<CameraModule>> |
| class CameraModuleStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| CameraModuleStub() = default; |
| ~CameraModuleStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return CameraModuleStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return CameraModuleStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class CameraModuleCallbacksRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class VendorTagOpsRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class CameraModuleRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class VendorTagOpsResponseValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class CameraModuleResponseValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| |
| |
| |
| |
| |
| class CameraResourceCost { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<CameraResourceCost, T>::value>; |
| using DataView = CameraResourceCostDataView; |
| using Data_ = internal::CameraResourceCost_Data; |
| |
| template <typename... Args> |
| static CameraResourceCostPtr New(Args&&... args) { |
| return CameraResourceCostPtr( |
| std::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static CameraResourceCostPtr From(const U& u) { |
| return mojo::TypeConverter<CameraResourceCostPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, CameraResourceCost>::Convert(*this); |
| } |
| |
| |
| CameraResourceCost(); |
| |
| explicit CameraResourceCost( |
| uint32_t resource_cost); |
| |
| |
| ~CameraResourceCost(); |
| |
| // Clone() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Clone() or copy |
| // constructor/assignment are available for members. |
| template <typename StructPtrType = CameraResourceCostPtr> |
| CameraResourceCostPtr Clone() const; |
| |
| // Equals() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Equals() or == operator |
| // are available for members. |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool operator!=(const T& rhs) const { return !operator==(rhs); } |
| size_t Hash(size_t seed) const; |
| template <typename UserType> |
| static std::vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| CameraResourceCost::DataView, std::vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| CameraResourceCost::DataView>(input); |
| } |
| |
| // The returned Message is serialized only if the message is moved |
| // cross-process or cross-language. Otherwise if the message is Deserialized |
| // as the same UserType |input| will just be moved to |output| in |
| // DeserializeFromMessage. |
| template <typename UserType> |
| static mojo::Message WrapAsMessage(UserType input) { |
| return mojo::Message(std::make_unique< |
| internal::CameraResourceCost_UnserializedMessageContext< |
| UserType, CameraResourceCost::DataView>>(0, 0, std::move(input)), |
| MOJO_CREATE_MESSAGE_FLAG_NONE); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| mojo::Message message; |
| return mojo::internal::DeserializeImpl<CameraResourceCost::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const std::vector<uint8_t>& input, |
| UserType* output) { |
| return CameraResourceCost::Deserialize( |
| input.size() == 0 ? nullptr : &input.front(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::CameraResourceCost_UnserializedMessageContext< |
| UserType, CameraResourceCost::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<CameraResourceCost::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| uint32_t resource_cost; |
| |
| // Serialise this struct into a trace. |
| void WriteIntoTrace(perfetto::TracedValue traced_context) const; |
| |
| private: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| }; |
| |
| // The comparison operators are templates, so they are only instantiated if they |
| // are used. Thus, the bindings generator does not need to know whether |
| // comparison operators are available for members. |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class CameraInfo { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<CameraInfo, T>::value>; |
| using DataView = CameraInfoDataView; |
| using Data_ = internal::CameraInfo_Data; |
| |
| template <typename... Args> |
| static CameraInfoPtr New(Args&&... args) { |
| return CameraInfoPtr( |
| std::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static CameraInfoPtr From(const U& u) { |
| return mojo::TypeConverter<CameraInfoPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, CameraInfo>::Convert(*this); |
| } |
| |
| |
| CameraInfo(); |
| |
| CameraInfo( |
| CameraFacing facing, |
| int32_t orientation, |
| uint32_t device_version, |
| ::cros::mojom::CameraMetadataPtr static_camera_characteristics); |
| |
| CameraInfo( |
| CameraFacing facing, |
| int32_t orientation, |
| uint32_t device_version, |
| ::cros::mojom::CameraMetadataPtr static_camera_characteristics, |
| CameraResourceCostPtr resource_cost, |
| std::optional<std::vector<std::string>> conflicting_devices); |
| |
| CameraInfo(const CameraInfo&) = delete; |
| CameraInfo& operator=(const CameraInfo&) = delete; |
| |
| ~CameraInfo(); |
| |
| // Clone() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Clone() or copy |
| // constructor/assignment are available for members. |
| template <typename StructPtrType = CameraInfoPtr> |
| CameraInfoPtr Clone() const; |
| |
| // Equals() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Equals() or == operator |
| // are available for members. |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool operator!=(const T& rhs) const { return !operator==(rhs); } |
| template <typename UserType> |
| static std::vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| CameraInfo::DataView, std::vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| CameraInfo::DataView>(input); |
| } |
| |
| // The returned Message is serialized only if the message is moved |
| // cross-process or cross-language. Otherwise if the message is Deserialized |
| // as the same UserType |input| will just be moved to |output| in |
| // DeserializeFromMessage. |
| template <typename UserType> |
| static mojo::Message WrapAsMessage(UserType input) { |
| return mojo::Message(std::make_unique< |
| internal::CameraInfo_UnserializedMessageContext< |
| UserType, CameraInfo::DataView>>(0, 0, std::move(input)), |
| MOJO_CREATE_MESSAGE_FLAG_NONE); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| mojo::Message message; |
| return mojo::internal::DeserializeImpl<CameraInfo::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const std::vector<uint8_t>& input, |
| UserType* output) { |
| return CameraInfo::Deserialize( |
| input.size() == 0 ? nullptr : &input.front(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::CameraInfo_UnserializedMessageContext< |
| UserType, CameraInfo::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<CameraInfo::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| CameraFacing facing; |
| |
| int32_t orientation; |
| |
| uint32_t device_version; |
| |
| ::cros::mojom::CameraMetadataPtr static_camera_characteristics; |
| |
| CameraResourceCostPtr resource_cost; |
| |
| std::optional<std::vector<std::string>> conflicting_devices; |
| |
| // Serialise this struct into a trace. |
| void WriteIntoTrace(perfetto::TracedValue traced_context) const; |
| |
| private: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| }; |
| |
| // The comparison operators are templates, so they are only instantiated if they |
| // are used. Thus, the bindings generator does not need to know whether |
| // comparison operators are available for members. |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, CameraInfo::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| template <typename StructPtrType> |
| CameraResourceCostPtr CameraResourceCost::Clone() const { |
| return New( |
| mojo::Clone(resource_cost) |
| ); |
| } |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>*> |
| bool CameraResourceCost::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->resource_cost, other_struct.resource_cost)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, CameraResourceCost::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.resource_cost < rhs.resource_cost) |
| return true; |
| if (rhs.resource_cost < lhs.resource_cost) |
| return false; |
| return false; |
| } |
| template <typename StructPtrType> |
| CameraInfoPtr CameraInfo::Clone() const { |
| return New( |
| mojo::Clone(facing), |
| mojo::Clone(orientation), |
| mojo::Clone(device_version), |
| mojo::Clone(static_camera_characteristics), |
| mojo::Clone(resource_cost), |
| mojo::Clone(conflicting_devices) |
| ); |
| } |
| |
| template <typename T, CameraInfo::EnableIfSame<T>*> |
| bool CameraInfo::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->facing, other_struct.facing)) |
| return false; |
| if (!mojo::Equals(this->orientation, other_struct.orientation)) |
| return false; |
| if (!mojo::Equals(this->device_version, other_struct.device_version)) |
| return false; |
| if (!mojo::Equals(this->static_camera_characteristics, other_struct.static_camera_characteristics)) |
| return false; |
| if (!mojo::Equals(this->resource_cost, other_struct.resource_cost)) |
| return false; |
| if (!mojo::Equals(this->conflicting_devices, other_struct.conflicting_devices)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, CameraInfo::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.facing < rhs.facing) |
| return true; |
| if (rhs.facing < lhs.facing) |
| return false; |
| if (lhs.orientation < rhs.orientation) |
| return true; |
| if (rhs.orientation < lhs.orientation) |
| return false; |
| if (lhs.device_version < rhs.device_version) |
| return true; |
| if (rhs.device_version < lhs.device_version) |
| return false; |
| if (lhs.static_camera_characteristics < rhs.static_camera_characteristics) |
| return true; |
| if (rhs.static_camera_characteristics < lhs.static_camera_characteristics) |
| return false; |
| if (lhs.resource_cost < rhs.resource_cost) |
| return true; |
| if (rhs.resource_cost < lhs.resource_cost) |
| return false; |
| if (lhs.conflicting_devices < rhs.conflicting_devices) |
| return true; |
| if (rhs.conflicting_devices < lhs.conflicting_devices) |
| return false; |
| return false; |
| } |
| |
| |
| } // cros::mojom |
| |
| namespace mojo { |
| |
| |
| template <> |
| struct StructTraits<::cros::mojom::CameraResourceCost::DataView, |
| ::cros::mojom::CameraResourceCostPtr> { |
| static bool IsNull(const ::cros::mojom::CameraResourceCostPtr& input) { return !input; } |
| static void SetToNull(::cros::mojom::CameraResourceCostPtr* output) { output->reset(); } |
| |
| static decltype(::cros::mojom::CameraResourceCost::resource_cost) resource_cost( |
| const ::cros::mojom::CameraResourceCostPtr& input) { |
| return input->resource_cost; |
| } |
| |
| static bool Read(::cros::mojom::CameraResourceCost::DataView input, ::cros::mojom::CameraResourceCostPtr* output); |
| }; |
| |
| |
| template <> |
| struct StructTraits<::cros::mojom::CameraInfo::DataView, |
| ::cros::mojom::CameraInfoPtr> { |
| static bool IsNull(const ::cros::mojom::CameraInfoPtr& input) { return !input; } |
| static void SetToNull(::cros::mojom::CameraInfoPtr* output) { output->reset(); } |
| |
| static decltype(::cros::mojom::CameraInfo::facing) facing( |
| const ::cros::mojom::CameraInfoPtr& input) { |
| return input->facing; |
| } |
| |
| static decltype(::cros::mojom::CameraInfo::orientation) orientation( |
| const ::cros::mojom::CameraInfoPtr& input) { |
| return input->orientation; |
| } |
| |
| static decltype(::cros::mojom::CameraInfo::device_version) device_version( |
| const ::cros::mojom::CameraInfoPtr& input) { |
| return input->device_version; |
| } |
| |
| static const decltype(::cros::mojom::CameraInfo::static_camera_characteristics)& static_camera_characteristics( |
| const ::cros::mojom::CameraInfoPtr& input) { |
| return input->static_camera_characteristics; |
| } |
| |
| static const decltype(::cros::mojom::CameraInfo::resource_cost)& resource_cost( |
| const ::cros::mojom::CameraInfoPtr& input) { |
| return input->resource_cost; |
| } |
| |
| static const decltype(::cros::mojom::CameraInfo::conflicting_devices)& conflicting_devices( |
| const ::cros::mojom::CameraInfoPtr& input) { |
| return input->conflicting_devices; |
| } |
| |
| static bool Read(::cros::mojom::CameraInfo::DataView input, ::cros::mojom::CameraInfoPtr* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_MOJOM_CAMERA_COMMON_MOJOM_H_ |