#ifndef SERVICES_ON_DEVICE_MODEL_BACKEND_MODEL_H_
#define SERVICES_ON_DEVICE_MODEL_BACKEND_MODEL_H_
#include <memory>
#include "base/component_export.h"
#include "base/types/expected.h"
#include "services/on_device_model/backend_session.h"
#include "services/on_device_model/public/mojom/on_device_model.mojom.h"
#include "services/on_device_model/public/mojom/on_device_model_service.mojom.h"
namespace on_device_model {
class COMPONENT_EXPORT(ON_DEVICE_MODEL) BackendModel {
public:
class COMPONENT_EXPORT(ON_DEVICE_MODEL) ScopedAdaptation {
public:
ScopedAdaptation(base::WeakPtr<BackendModel> model, uint32_t adaptation_id);
~ScopedAdaptation();
uint32_t adaptation_id() const { return adaptation_id_; }
private:
base::WeakPtr<BackendModel> model_;
uint32_t adaptation_id_;
};
virtual ~BackendModel() = default;
virtual std::unique_ptr<BackendSession> CreateSession(
const ScopedAdaptation* adaptation,
on_device_model::mojom::SessionParamsPtr params) = 0;
virtual std::unique_ptr<ScopedAdaptation> LoadAdaptation(
on_device_model::mojom::LoadAdaptationParamsPtr params) = 0;
virtual void UnloadAdaptation(uint32_t adaptation_id) = 0;
};
}
#endif