#include "components/optimization_guide/core/prediction_model_override.h"
#include "base/files/file_util.h"
#include "base/functional/callback_helpers.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "components/optimization_guide/core/model_util.h"
#include "components/optimization_guide/core/prediction_model_download_manager.h"
#include "components/services/unzip/public/cpp/unzip.h"
#if BUILDFLAG(IS_IOS)
#include "components/services/unzip/in_process_unzipper.h"
#else
#include "components/services/unzip/content/unzip_service.h"
#endif
namespace optimization_guide {
namespace {
void OnModelOverrideProcessed(OnPredictionModelBuiltCallback callback,
std::unique_ptr<proto::PredictionModel> model) { … }
std::unique_ptr<proto::PredictionModel> ProcessModelOverrideOnBGThread(
proto::OptimizationTarget optimization_target,
const base::FilePath& unzipped_dir_path) { … }
void OnModelOverrideUnzipped(proto::OptimizationTarget optimization_target,
const base::FilePath& base_model_dir,
OnPredictionModelBuiltCallback callback,
bool success) { … }
void OnModelOverrideVerified(proto::OptimizationTarget optimization_target,
const base::FilePath& passed_crx_file_path,
const base::FilePath& base_model_dir,
OnPredictionModelBuiltCallback callback,
bool is_verify_success) { … }
}
bool BuildPredictionModelFromCommandLineForOptimizationTarget(
proto::OptimizationTarget optimization_target,
const base::FilePath& base_model_dir,
OnPredictionModelBuiltCallback callback) { … }
}