#include "components/segmentation_platform/internal/scheduler/model_execution_scheduler_impl.h"
#include <optional>
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/time/clock.h"
#include "components/segmentation_platform/internal/database/segment_info_database.h"
#include "components/segmentation_platform/internal/database/signal_storage_config.h"
#include "components/segmentation_platform/internal/execution/execution_request.h"
#include "components/segmentation_platform/internal/execution/model_manager_impl.h"
#include "components/segmentation_platform/internal/metadata/metadata_utils.h"
#include "components/segmentation_platform/internal/platform_options.h"
#include "components/segmentation_platform/internal/stats.h"
#include "components/segmentation_platform/public/model_provider.h"
#include "components/segmentation_platform/public/proto/segmentation_platform.pb.h"
namespace segmentation_platform {
ModelExecutionSchedulerImpl::ModelExecutionSchedulerImpl(
std::vector<raw_ptr<Observer, VectorExperimental>>&& observers,
SegmentInfoDatabase* segment_database,
SignalStorageConfig* signal_storage_config,
ModelManager* model_manager,
ModelExecutor* model_executor,
base::flat_set<proto::SegmentId> segment_ids,
base::Clock* clock,
const PlatformOptions& platform_options)
: … { … }
ModelExecutionSchedulerImpl::~ModelExecutionSchedulerImpl() = default;
void ModelExecutionSchedulerImpl::OnNewModelInfoReady(
const proto::SegmentInfo& segment_info) { … }
void ModelExecutionSchedulerImpl::RequestModelExecutionForEligibleSegments(
bool expired_only) { … }
void ModelExecutionSchedulerImpl::RequestModelExecution(
const proto::SegmentInfo& segment_info) { … }
void ModelExecutionSchedulerImpl::OnModelExecutionCompleted(
const proto::SegmentInfo& segment_info,
std::unique_ptr<ModelExecutionResult> result) { … }
void ModelExecutionSchedulerImpl::FilterEligibleSegments(
bool expired_only,
std::unique_ptr<SegmentInfoDatabase::SegmentInfoList> all_segments) { … }
bool ModelExecutionSchedulerImpl::ShouldExecuteSegment(
bool expired_only,
const proto::SegmentInfo& segment_info) { … }
void ModelExecutionSchedulerImpl::CancelOutstandingExecutionRequests(
SegmentId segment_id) { … }
void ModelExecutionSchedulerImpl::OnResultSaved(SegmentId segment_id,
bool success) { … }
}