#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "components/ml/mojom/web_platform_model.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 "components/ml/mojom/web_platform_model.mojom-params-data.h"
#include "components/ml/mojom/web_platform_model.mojom-shared-message-ids.h"
#include "components/ml/mojom/web_platform_model.mojom-import-headers.h"
#include "components/ml/mojom/web_platform_model.mojom-test-utils.h"
namespace ml::model_loader::mojom {
CreateModelLoaderOptions::CreateModelLoaderOptions()
: … { … }
CreateModelLoaderOptions::CreateModelLoaderOptions(
uint32_t num_threads_in,
ModelFormat model_format_in,
DevicePreference device_preference_in)
: … { … }
CreateModelLoaderOptions::~CreateModelLoaderOptions() = default;
size_t CreateModelLoaderOptions::Hash(size_t seed) const { … }
void CreateModelLoaderOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool CreateModelLoaderOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
TensorInfo::TensorInfo()
: … { … }
TensorInfo::TensorInfo(
uint32_t byte_size_in,
DataType data_type_in,
std::vector<uint32_t> dimensions_in)
: … { … }
TensorInfo::~TensorInfo() = default;
void TensorInfo::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool TensorInfo::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
ModelInfo::ModelInfo()
: … { … }
ModelInfo::ModelInfo(
base::flat_map<std::string, TensorInfoPtr> input_tensor_info_in,
base::flat_map<std::string, TensorInfoPtr> output_tensor_info_in)
: … { … }
ModelInfo::~ModelInfo() = default;
void ModelInfo::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool ModelInfo::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char ModelLoader::Name_[] = …;
ModelLoader::IPCStableHashFunction ModelLoader::MessageToMethodInfo_(mojo::Message& message) { … }
const char* ModelLoader::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t ModelLoader::Load_Sym::IPCStableHash() { … }
# endif
class ModelLoader_Load_ForwardToCallback
: public mojo::MessageReceiver { … };
ModelLoaderProxy::ModelLoaderProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void ModelLoaderProxy::Load(
::mojo_base::BigBuffer in_model_content, LoadCallback callback) { … }
class ModelLoader_Load_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool ModelLoader_Load_ForwardToCallback::Accept(
mojo::Message* message) { … }
void ModelLoader_Load_ProxyToResponder::Run(
LoadModelResult in_result, ::mojo::PendingRemote<Model> in_remote, ModelInfoPtr in_model_info) { … }
bool ModelLoaderStubDispatch::Accept(
ModelLoader* impl,
mojo::Message* message) { … }
bool ModelLoaderStubDispatch::AcceptWithResponder(
ModelLoader* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kModelLoaderValidationInfo[] = …;
bool ModelLoaderRequestValidator::Accept(mojo::Message* message) { … }
bool ModelLoaderResponseValidator::Accept(mojo::Message* message) { … }
const char Model::Name_[] = …;
Model::IPCStableHashFunction Model::MessageToMethodInfo_(mojo::Message& message) { … }
const char* Model::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t Model::Compute_Sym::IPCStableHash() { … }
# endif
class Model_Compute_ForwardToCallback
: public mojo::MessageReceiver { … };
ModelProxy::ModelProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void ModelProxy::Compute(
const base::flat_map<std::string, std::vector<uint8_t>>& in_input_tensors, ComputeCallback callback) { … }
class Model_Compute_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Model_Compute_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Model_Compute_ProxyToResponder::Run(
ComputeResult in_result, const std::optional<base::flat_map<std::string, std::vector<uint8_t>>>& in_output_tensors) { … }
bool ModelStubDispatch::Accept(
Model* impl,
mojo::Message* message) { … }
bool ModelStubDispatch::AcceptWithResponder(
Model* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kModelValidationInfo[] = …;
bool ModelRequestValidator::Accept(mojo::Message* message) { … }
bool ModelResponseValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::ml::model_loader::mojom::CreateModelLoaderOptions::DataView, ::ml::model_loader::mojom::CreateModelLoaderOptionsPtr>::Read(
::ml::model_loader::mojom::CreateModelLoaderOptions::DataView input,
::ml::model_loader::mojom::CreateModelLoaderOptionsPtr* output) { … }
bool StructTraits<::ml::model_loader::mojom::TensorInfo::DataView, ::ml::model_loader::mojom::TensorInfoPtr>::Read(
::ml::model_loader::mojom::TensorInfo::DataView input,
::ml::model_loader::mojom::TensorInfoPtr* output) { … }
bool StructTraits<::ml::model_loader::mojom::ModelInfo::DataView, ::ml::model_loader::mojom::ModelInfoPtr>::Read(
::ml::model_loader::mojom::ModelInfo::DataView input,
::ml::model_loader::mojom::ModelInfoPtr* output) { … }
}
namespace ml::model_loader::mojom {
void ModelLoaderInterceptorForTesting::Load(::mojo_base::BigBuffer model_content, LoadCallback callback) { … }
ModelLoaderAsyncWaiter::ModelLoaderAsyncWaiter(
ModelLoader* proxy) : … { … }
ModelLoaderAsyncWaiter::~ModelLoaderAsyncWaiter() = default;
void ModelLoaderAsyncWaiter::Load(
::mojo_base::BigBuffer model_content, LoadModelResult* out_result, ::mojo::PendingRemote<Model>* out_remote, ModelInfoPtr* out_model_info) { … }
void ModelInterceptorForTesting::Compute(const base::flat_map<std::string, std::vector<uint8_t>>& input_tensors, ComputeCallback callback) { … }
ModelAsyncWaiter::ModelAsyncWaiter(
Model* proxy) : … { … }
ModelAsyncWaiter::~ModelAsyncWaiter() = default;
void ModelAsyncWaiter::Compute(
const base::flat_map<std::string, std::vector<uint8_t>>& input_tensors, ComputeResult* out_result, std::optional<base::flat_map<std::string, std::vector<uint8_t>>>* out_output_tensors) { … }
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif