blob: 89c1a2a4aa00dc258a560880c69cd27c82e124ec [file] [log] [blame]
// chromeos/services/machine_learning/public/mojom/model.mojom-blink.h 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.
#ifndef CHROMEOS_SERVICES_MACHINE_LEARNING_PUBLIC_MOJOM_MODEL_MOJOM_BLINK_H_
#define CHROMEOS_SERVICES_MACHINE_LEARNING_PUBLIC_MOJOM_MODEL_MOJOM_BLINK_H_
#include <stdint.h>
#include <limits>
#include <type_traits>
#include <utility>
#include "third_party/abseil-cpp/absl/types/optional.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 "chromeos/services/machine_learning/public/mojom/model.mojom-shared.h"
#include "chromeos/services/machine_learning/public/mojom/model.mojom-blink-forward.h"
#include "chromeos/services/machine_learning/public/mojom/graph_executor.mojom-blink-forward.h"
#include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h"
#include "mojo/public/cpp/bindings/lib/wtf_hash_util.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
#include "base/component_export.h"
#ifdef KYTHE_IS_RUNNING
#pragma kythe_inline_metadata "Metadata comment"
#endif
namespace WTF {
struct chromeos_machine_learning_mojom_internal_BuiltinModelId_DataHashFn {
static unsigned GetHash(const ::chromeos::machine_learning::mojom::BuiltinModelId& value) {
using utype = std::underlying_type<::chromeos::machine_learning::mojom::BuiltinModelId>::type;
return DefaultHash<utype>::Hash().GetHash(static_cast<utype>(value));
}
static bool Equal(const ::chromeos::machine_learning::mojom::BuiltinModelId& left, const ::chromeos::machine_learning::mojom::BuiltinModelId& right) {
return left == right;
}
static const bool safe_to_compare_to_empty_or_deleted = true;
};
template <>
struct HashTraits<::chromeos::machine_learning::mojom::BuiltinModelId>
: public GenericHashTraits<::chromeos::machine_learning::mojom::BuiltinModelId> {
static_assert(true,
"-1000000 is a reserved enum value");
static_assert(true,
"-1000001 is a reserved enum value");
static const bool kEmptyValueIsZero = false;
static ::chromeos::machine_learning::mojom::BuiltinModelId EmptyValue() { return static_cast<::chromeos::machine_learning::mojom::BuiltinModelId>(-1000000); }
static void ConstructDeletedValue(::chromeos::machine_learning::mojom::BuiltinModelId& slot, bool) {
slot = static_cast<::chromeos::machine_learning::mojom::BuiltinModelId>(-1000001);
}
static bool IsDeletedValue(const ::chromeos::machine_learning::mojom::BuiltinModelId& value) {
return value == static_cast<::chromeos::machine_learning::mojom::BuiltinModelId>(-1000001);
}
};
} // namespace WTF
namespace WTF {
struct chromeos_machine_learning_mojom_internal_GpuDelegateApi_DataHashFn {
static unsigned GetHash(const ::chromeos::machine_learning::mojom::GpuDelegateApi& value) {
using utype = std::underlying_type<::chromeos::machine_learning::mojom::GpuDelegateApi>::type;
return DefaultHash<utype>::Hash().GetHash(static_cast<utype>(value));
}
static bool Equal(const ::chromeos::machine_learning::mojom::GpuDelegateApi& left, const ::chromeos::machine_learning::mojom::GpuDelegateApi& right) {
return left == right;
}
static const bool safe_to_compare_to_empty_or_deleted = true;
};
template <>
struct HashTraits<::chromeos::machine_learning::mojom::GpuDelegateApi>
: public GenericHashTraits<::chromeos::machine_learning::mojom::GpuDelegateApi> {
static_assert(true,
"-1000000 is a reserved enum value");
static_assert(true,
"-1000001 is a reserved enum value");
static const bool kEmptyValueIsZero = false;
static ::chromeos::machine_learning::mojom::GpuDelegateApi EmptyValue() { return static_cast<::chromeos::machine_learning::mojom::GpuDelegateApi>(-1000000); }
static void ConstructDeletedValue(::chromeos::machine_learning::mojom::GpuDelegateApi& slot, bool) {
slot = static_cast<::chromeos::machine_learning::mojom::GpuDelegateApi>(-1000001);
}
static bool IsDeletedValue(const ::chromeos::machine_learning::mojom::GpuDelegateApi& value) {
return value == static_cast<::chromeos::machine_learning::mojom::GpuDelegateApi>(-1000001);
}
};
} // namespace WTF
namespace WTF {
struct chromeos_machine_learning_mojom_internal_CreateGraphExecutorResult_DataHashFn {
static unsigned GetHash(const ::chromeos::machine_learning::mojom::CreateGraphExecutorResult& value) {
using utype = std::underlying_type<::chromeos::machine_learning::mojom::CreateGraphExecutorResult>::type;
return DefaultHash<utype>::Hash().GetHash(static_cast<utype>(value));
}
static bool Equal(const ::chromeos::machine_learning::mojom::CreateGraphExecutorResult& left, const ::chromeos::machine_learning::mojom::CreateGraphExecutorResult& right) {
return left == right;
}
static const bool safe_to_compare_to_empty_or_deleted = true;
};
template <>
struct HashTraits<::chromeos::machine_learning::mojom::CreateGraphExecutorResult>
: public GenericHashTraits<::chromeos::machine_learning::mojom::CreateGraphExecutorResult> {
static_assert(true,
"-1000000 is a reserved enum value");
static_assert(true,
"-1000001 is a reserved enum value");
static const bool kEmptyValueIsZero = false;
static ::chromeos::machine_learning::mojom::CreateGraphExecutorResult EmptyValue() { return static_cast<::chromeos::machine_learning::mojom::CreateGraphExecutorResult>(-1000000); }
static void ConstructDeletedValue(::chromeos::machine_learning::mojom::CreateGraphExecutorResult& slot, bool) {
slot = static_cast<::chromeos::machine_learning::mojom::CreateGraphExecutorResult>(-1000001);
}
static bool IsDeletedValue(const ::chromeos::machine_learning::mojom::CreateGraphExecutorResult& value) {
return value == static_cast<::chromeos::machine_learning::mojom::CreateGraphExecutorResult>(-1000001);
}
};
} // namespace WTF
namespace chromeos {
namespace machine_learning {
namespace mojom {
namespace blink {
class ModelProxy;
template <typename ImplRefTraits>
class ModelStub;
class ModelRequestValidator;
class ModelResponseValidator;
// @generated_from: chromeos.machine_learning.mojom.Model
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) Model
: public ModelInterfaceBase {
public:
static const char Name_[];
static std::pair<uint32_t, const void*> 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 HasSyncMethods_ = false;
static constexpr bool HasUninterruptableMethods_ = false;
using Base_ = ModelInterfaceBase;
using Proxy_ = ModelProxy;
template <typename ImplRefTraits>
using Stub_ = ModelStub<ImplRefTraits>;
using RequestValidator_ = ModelRequestValidator;
using ResponseValidator_ = ModelResponseValidator;
enum MethodMinVersions : uint32_t {
kREMOVED_0MinVersion = 0,
kCreateGraphExecutorMinVersion = 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 REMOVED_0_Sym {
NOINLINE static void IPCSymbol();
};
struct CreateGraphExecutor_Sym {
NOINLINE static void IPCSymbol();
};
#endif // !BUILDFLAG(IS_FUCHSIA)
virtual ~Model() = default;
using REMOVED_0Callback = base::OnceCallback<void(CreateGraphExecutorResult)>;
// @generated_from: chromeos.machine_learning.mojom.Model.REMOVED_0
virtual void REMOVED_0(::mojo::PendingReceiver<::chromeos::machine_learning::mojom::blink::GraphExecutor> receiver, REMOVED_0Callback callback) = 0;
using CreateGraphExecutorCallback = base::OnceCallback<void(CreateGraphExecutorResult)>;
// @generated_from: chromeos.machine_learning.mojom.Model.CreateGraphExecutor
virtual void CreateGraphExecutor(GraphExecutorOptionsPtr options, ::mojo::PendingReceiver<::chromeos::machine_learning::mojom::blink::GraphExecutor> receiver, CreateGraphExecutorCallback callback) = 0;
};
// @generated_from: chromeos.machine_learning.mojom.Model
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) ModelProxy
: public Model {
public:
using InterfaceType = Model;
explicit ModelProxy(mojo::MessageReceiverWithResponder* receiver);
// @generated_from: chromeos.machine_learning.mojom.Model.REMOVED_0
void REMOVED_0(::mojo::PendingReceiver<::chromeos::machine_learning::mojom::blink::GraphExecutor> receiver, REMOVED_0Callback callback) final;
// @generated_from: chromeos.machine_learning.mojom.Model.CreateGraphExecutor
void CreateGraphExecutor(GraphExecutorOptionsPtr options, ::mojo::PendingReceiver<::chromeos::machine_learning::mojom::blink::GraphExecutor> receiver, CreateGraphExecutorCallback callback) final;
private:
mojo::MessageReceiverWithResponder* receiver_;
};
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) ModelStubDispatch {
public:
static bool Accept(Model* impl, mojo::Message* message);
static bool AcceptWithResponder(
Model* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};
template <typename ImplRefTraits =
mojo::RawPtrImplRefTraits<Model>>
class ModelStub
: public mojo::MessageReceiverWithResponderStatus {
public:
using ImplPointerType = typename ImplRefTraits::PointerType;
ModelStub() = default;
~ModelStub() 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 ModelStubDispatch::Accept(
ImplRefTraits::GetRawPointer(&sink_), message);
}
bool AcceptWithResponder(
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
if (ImplRefTraits::IsNull(sink_))
return false;
return ModelStubDispatch::AcceptWithResponder(
ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
}
private:
ImplPointerType sink_;
};
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) ModelRequestValidator : public mojo::MessageReceiver {
public:
bool Accept(mojo::Message* message) override;
};
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) ModelResponseValidator : public mojo::MessageReceiver {
public:
bool Accept(mojo::Message* message) override;
};
// @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) GraphExecutorOptions {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<GraphExecutorOptions, T>::value>;
using DataView = GraphExecutorOptionsDataView;
using Data_ = internal::GraphExecutorOptions_Data;
template <typename... Args>
static GraphExecutorOptionsPtr New(Args&&... args) {
return GraphExecutorOptionsPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static GraphExecutorOptionsPtr From(const U& u) {
return mojo::TypeConverter<GraphExecutorOptionsPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, GraphExecutorOptions>::Convert(*this);
}
GraphExecutorOptions();
explicit GraphExecutorOptions(
bool use_nnapi);
GraphExecutorOptions(
bool use_nnapi,
bool use_gpu);
GraphExecutorOptions(
bool use_nnapi,
bool use_gpu,
GpuDelegateApi gpu_delegate_api);
~GraphExecutorOptions();
// 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 = GraphExecutorOptionsPtr>
GraphExecutorOptionsPtr 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, GraphExecutorOptions::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
size_t Hash(size_t seed) const;
template <typename UserType>
static WTF::Vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
GraphExecutorOptions::DataView, WTF::Vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
GraphExecutorOptions::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::GraphExecutorOptions_UnserializedMessageContext<
UserType, GraphExecutorOptions::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<GraphExecutorOptions::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const WTF::Vector<uint8_t>& input,
UserType* output) {
return GraphExecutorOptions::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::GraphExecutorOptions_UnserializedMessageContext<
UserType, GraphExecutorOptions::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<GraphExecutorOptions::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
// @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions.use_nnapi
bool use_nnapi;
// @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions.use_gpu
bool use_gpu;
// @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions.gpu_delegate_api
GpuDelegateApi gpu_delegate_api;
// 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, GraphExecutorOptions::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
// @generated_from: chromeos.machine_learning.mojom.BuiltinModelSpec
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) BuiltinModelSpec {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<BuiltinModelSpec, T>::value>;
using DataView = BuiltinModelSpecDataView;
using Data_ = internal::BuiltinModelSpec_Data;
template <typename... Args>
static BuiltinModelSpecPtr New(Args&&... args) {
return BuiltinModelSpecPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static BuiltinModelSpecPtr From(const U& u) {
return mojo::TypeConverter<BuiltinModelSpecPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, BuiltinModelSpec>::Convert(*this);
}
BuiltinModelSpec();
explicit BuiltinModelSpec(
BuiltinModelId id);
~BuiltinModelSpec();
// 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 = BuiltinModelSpecPtr>
BuiltinModelSpecPtr 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, BuiltinModelSpec::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
size_t Hash(size_t seed) const;
template <typename UserType>
static WTF::Vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
BuiltinModelSpec::DataView, WTF::Vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
BuiltinModelSpec::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::BuiltinModelSpec_UnserializedMessageContext<
UserType, BuiltinModelSpec::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<BuiltinModelSpec::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const WTF::Vector<uint8_t>& input,
UserType* output) {
return BuiltinModelSpec::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::BuiltinModelSpec_UnserializedMessageContext<
UserType, BuiltinModelSpec::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<BuiltinModelSpec::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
// @generated_from: chromeos.machine_learning.mojom.BuiltinModelSpec.id
BuiltinModelId id;
// 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, BuiltinModelSpec::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
// @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec
class COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) FlatBufferModelSpec {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<FlatBufferModelSpec, T>::value>;
using DataView = FlatBufferModelSpecDataView;
using Data_ = internal::FlatBufferModelSpec_Data;
template <typename... Args>
static FlatBufferModelSpecPtr New(Args&&... args) {
return FlatBufferModelSpecPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static FlatBufferModelSpecPtr From(const U& u) {
return mojo::TypeConverter<FlatBufferModelSpecPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, FlatBufferModelSpec>::Convert(*this);
}
FlatBufferModelSpec();
FlatBufferModelSpec(
const WTF::String& model_string,
const WTF::HashMap<WTF::String, int32_t>& inputs,
const WTF::HashMap<WTF::String, int32_t>& outputs,
const WTF::String& metrics_model_name);
~FlatBufferModelSpec();
// 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 = FlatBufferModelSpecPtr>
FlatBufferModelSpecPtr 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, FlatBufferModelSpec::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename UserType>
static WTF::Vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
FlatBufferModelSpec::DataView, WTF::Vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
FlatBufferModelSpec::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::FlatBufferModelSpec_UnserializedMessageContext<
UserType, FlatBufferModelSpec::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<FlatBufferModelSpec::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const WTF::Vector<uint8_t>& input,
UserType* output) {
return FlatBufferModelSpec::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::FlatBufferModelSpec_UnserializedMessageContext<
UserType, FlatBufferModelSpec::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<FlatBufferModelSpec::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
// @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.model_string
WTF::String model_string;
// @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.inputs
WTF::HashMap<WTF::String, int32_t> inputs;
// @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.outputs
WTF::HashMap<WTF::String, int32_t> outputs;
// @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.metrics_model_name
WTF::String metrics_model_name;
// 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, FlatBufferModelSpec::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
GraphExecutorOptionsPtr GraphExecutorOptions::Clone() const {
return New(
mojo::Clone(use_nnapi),
mojo::Clone(use_gpu),
mojo::Clone(gpu_delegate_api)
);
}
template <typename T, GraphExecutorOptions::EnableIfSame<T>*>
bool GraphExecutorOptions::Equals(const T& other_struct) const {
if (!mojo::Equals(this->use_nnapi, other_struct.use_nnapi))
return false;
if (!mojo::Equals(this->use_gpu, other_struct.use_gpu))
return false;
if (!mojo::Equals(this->gpu_delegate_api, other_struct.gpu_delegate_api))
return false;
return true;
}
template <typename T, GraphExecutorOptions::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.use_nnapi < rhs.use_nnapi)
return true;
if (rhs.use_nnapi < lhs.use_nnapi)
return false;
if (lhs.use_gpu < rhs.use_gpu)
return true;
if (rhs.use_gpu < lhs.use_gpu)
return false;
if (lhs.gpu_delegate_api < rhs.gpu_delegate_api)
return true;
if (rhs.gpu_delegate_api < lhs.gpu_delegate_api)
return false;
return false;
}
template <typename StructPtrType>
BuiltinModelSpecPtr BuiltinModelSpec::Clone() const {
return New(
mojo::Clone(id)
);
}
template <typename T, BuiltinModelSpec::EnableIfSame<T>*>
bool BuiltinModelSpec::Equals(const T& other_struct) const {
if (!mojo::Equals(this->id, other_struct.id))
return false;
return true;
}
template <typename T, BuiltinModelSpec::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.id < rhs.id)
return true;
if (rhs.id < lhs.id)
return false;
return false;
}
template <typename StructPtrType>
FlatBufferModelSpecPtr FlatBufferModelSpec::Clone() const {
return New(
mojo::Clone(model_string),
mojo::Clone(inputs),
mojo::Clone(outputs),
mojo::Clone(metrics_model_name)
);
}
template <typename T, FlatBufferModelSpec::EnableIfSame<T>*>
bool FlatBufferModelSpec::Equals(const T& other_struct) const {
if (!mojo::Equals(this->model_string, other_struct.model_string))
return false;
if (!mojo::Equals(this->inputs, other_struct.inputs))
return false;
if (!mojo::Equals(this->outputs, other_struct.outputs))
return false;
if (!mojo::Equals(this->metrics_model_name, other_struct.metrics_model_name))
return false;
return true;
}
template <typename T, FlatBufferModelSpec::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.model_string < rhs.model_string)
return true;
if (rhs.model_string < lhs.model_string)
return false;
if (lhs.inputs < rhs.inputs)
return true;
if (rhs.inputs < lhs.inputs)
return false;
if (lhs.outputs < rhs.outputs)
return true;
if (rhs.outputs < lhs.outputs)
return false;
if (lhs.metrics_model_name < rhs.metrics_model_name)
return true;
if (rhs.metrics_model_name < lhs.metrics_model_name)
return false;
return false;
}
} // namespace blink
} // namespace mojom
} // namespace machine_learning
} // namespace chromeos
namespace mojo {
template <>
struct COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) StructTraits<::chromeos::machine_learning::mojom::blink::GraphExecutorOptions::DataView,
::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr* output) { output->reset(); }
static decltype(::chromeos::machine_learning::mojom::blink::GraphExecutorOptions::use_nnapi) use_nnapi(
const ::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr& input) {
return input->use_nnapi;
}
static decltype(::chromeos::machine_learning::mojom::blink::GraphExecutorOptions::use_gpu) use_gpu(
const ::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr& input) {
return input->use_gpu;
}
static decltype(::chromeos::machine_learning::mojom::blink::GraphExecutorOptions::gpu_delegate_api) gpu_delegate_api(
const ::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr& input) {
return input->gpu_delegate_api;
}
static bool Read(::chromeos::machine_learning::mojom::blink::GraphExecutorOptions::DataView input, ::chromeos::machine_learning::mojom::blink::GraphExecutorOptionsPtr* output);
};
template <>
struct COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) StructTraits<::chromeos::machine_learning::mojom::blink::BuiltinModelSpec::DataView,
::chromeos::machine_learning::mojom::blink::BuiltinModelSpecPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::blink::BuiltinModelSpecPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::blink::BuiltinModelSpecPtr* output) { output->reset(); }
static decltype(::chromeos::machine_learning::mojom::blink::BuiltinModelSpec::id) id(
const ::chromeos::machine_learning::mojom::blink::BuiltinModelSpecPtr& input) {
return input->id;
}
static bool Read(::chromeos::machine_learning::mojom::blink::BuiltinModelSpec::DataView input, ::chromeos::machine_learning::mojom::blink::BuiltinModelSpecPtr* output);
};
template <>
struct COMPONENT_EXPORT(MLSERVICE_MOJOM_BLINK) StructTraits<::chromeos::machine_learning::mojom::blink::FlatBufferModelSpec::DataView,
::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr* output) { output->reset(); }
static const decltype(::chromeos::machine_learning::mojom::blink::FlatBufferModelSpec::model_string)& model_string(
const ::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr& input) {
return input->model_string;
}
static const decltype(::chromeos::machine_learning::mojom::blink::FlatBufferModelSpec::inputs)& inputs(
const ::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr& input) {
return input->inputs;
}
static const decltype(::chromeos::machine_learning::mojom::blink::FlatBufferModelSpec::outputs)& outputs(
const ::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr& input) {
return input->outputs;
}
static const decltype(::chromeos::machine_learning::mojom::blink::FlatBufferModelSpec::metrics_model_name)& metrics_model_name(
const ::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr& input) {
return input->metrics_model_name;
}
static bool Read(::chromeos::machine_learning::mojom::blink::FlatBufferModelSpec::DataView input, ::chromeos::machine_learning::mojom::blink::FlatBufferModelSpecPtr* output);
};
} // namespace mojo
#endif // CHROMEOS_SERVICES_MACHINE_LEARNING_PUBLIC_MOJOM_MODEL_MOJOM_BLINK_H_
/* Metadata comment
eyJtZXRhIjogW3siZW5kIjogNjkwNCwgImJlZ2luIjogNjg5OSwgImVkZ2UiOiAiJS9reXRoZS9l
ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw
dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui
OiAibW9qb20iLCAic2lnbmF0dXJlIjogImNocm9tZW9zLm1hY2hpbmVfbGVhcm5pbmcubW9qb20u
TW9kZWwifX0sIHsiZW5kIjogODI0MSwgImJlZ2luIjogODIzMiwgImVkZ2UiOiAiJS9reXRoZS9l
ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw
dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui
OiAibW9qb20iLCAic2lnbmF0dXJlIjogImNocm9tZW9zLm1hY2hpbmVfbGVhcm5pbmcubW9qb20u
TW9kZWwuUkVNT1ZFRF8wIn19LCB7ImVuZCI6IDg1NzYsICJiZWdpbiI6IDg1NTcsICJlZGdlIjog
IiUva3l0aGUvZWRnZS9nZW5lcmF0ZXMiLCAidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJ2bmFt
ZSI6IHsiY29ycHVzIjogImNocm9taXVtLmdvb2dsZXNvdXJjZS5jb20vY2hyb21pdW0vc3JjIiwg
Imxhbmd1YWdlIjogIm1vam9tIiwgInNpZ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