#include "components/optimization_guide/core/model_execution/on_device_model_metadata.h"
#include <cstddef>
#include <memory>
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/optimization_guide/core/model_execution/model_execution_util.h"
#include "components/optimization_guide/core/model_execution/on_device_model_feature_adapter.h"
#include "components/optimization_guide/core/optimization_guide_constants.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_switches.h"
namespace optimization_guide {
OnDeviceModelMetadata::OnDeviceModelMetadata(
const base::FilePath& model_path,
const std::string& version,
const OnDeviceBaseModelSpec& model_spec,
std::unique_ptr<proto::OnDeviceModelExecutionConfig> config)
: … { … }
OnDeviceModelMetadata::~OnDeviceModelMetadata() = default;
std::unique_ptr<OnDeviceModelMetadata> OnDeviceModelMetadata::New(
base::FilePath model_path,
std::string version,
const OnDeviceBaseModelSpec& model_spec,
std::unique_ptr<proto::OnDeviceModelExecutionConfig> config) { … }
scoped_refptr<const OnDeviceModelFeatureAdapter>
OnDeviceModelMetadata::GetAdapter(proto::ModelExecutionFeature feature) const { … }
OnDeviceModelMetadataLoader::OnDeviceModelMetadataLoader(
OnLoadFn on_load_fn,
base::WeakPtr<OnDeviceModelComponentStateManager>
on_device_component_state_manager)
: … { … }
OnDeviceModelMetadataLoader::~OnDeviceModelMetadataLoader() { … }
void OnDeviceModelMetadataLoader::Load(
const base::FilePath& model_path,
const std::string& version,
const OnDeviceBaseModelSpec& model_spec) { … }
void OnDeviceModelMetadataLoader::StateChanged(
const OnDeviceModelComponentState* state) { … }
void OnDeviceModelMetadataLoader::Invalidate() { … }
}