#include "components/segmentation_platform/internal/execution/model_executor_impl.h"
#include <memory>
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/raw_ref.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "base/trace_event/typed_macros.h"
#include "components/segmentation_platform/internal/database/segment_info_database.h"
#include "components/segmentation_platform/internal/execution/execution_request.h"
#include "components/segmentation_platform/internal/execution/processing/feature_list_query_processor.h"
#include "components/segmentation_platform/internal/segmentation_ukm_helper.h"
#include "components/segmentation_platform/internal/stats.h"
#include "components/segmentation_platform/public/model_provider.h"
#include "components/segmentation_platform/public/proto/model_metadata.pb.h"
#include "components/segmentation_platform/public/proto/segmentation_platform.pb.h"
#include "third_party/perfetto/include/perfetto/tracing/track.h"
namespace segmentation_platform {
namespace {
FeatureListQueryProcessor;
SegmentId;
}
struct ModelExecutorImpl::ModelExecutionTraceEvent { … };
struct ModelExecutorImpl::ExecutionState { … };
ModelExecutorImpl::ModelExecutionTraceEvent::ModelExecutionTraceEvent(
const char* event_name,
const ModelExecutorImpl::ExecutionState& state)
: … { … }
ModelExecutorImpl::ModelExecutionTraceEvent::~ModelExecutionTraceEvent() { … }
ModelExecutorImpl::ModelExecutorImpl(
base::Clock* clock,
SegmentInfoDatabase* segment_db,
processing::FeatureListQueryProcessor* feature_list_query_processor)
: … { … }
ModelExecutorImpl::~ModelExecutorImpl() = default;
void ModelExecutorImpl::ExecuteModel(
std::unique_ptr<ExecutionRequest> request) { … }
void ModelExecutorImpl::OnProcessingFeatureListComplete(
std::unique_ptr<ExecutionState> state,
bool error,
const ModelProvider::Request& input_tensor,
const ModelProvider::Response& output_tensor) { … }
void ModelExecutorImpl::ExecuteModel(std::unique_ptr<ExecutionState> state) { … }
void ModelExecutorImpl::OnModelExecutionComplete(
std::unique_ptr<ExecutionState> state,
const std::optional<ModelProvider::Response>& result) { … }
void ModelExecutorImpl::RunModelExecutionCallback(
const ExecutionState& state,
ModelExecutionCallback callback,
std::unique_ptr<ModelExecutionResult> result) { … }
}