#include "components/optimization_guide/core/model_execution/on_device_model_access_controller.h"
#include "base/metrics/histogram_functions.h"
#include "components/optimization_guide/core/model_execution/model_execution_prefs.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_model_executor.h"
#include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h"
namespace optimization_guide {
namespace {
kOnDeviceModelChromeVersion;
kOnDeviceModelCrashCount;
kOnDeviceModelTimeoutCount;
kOnDeviceModelValidationResult;
const char kComponentVersionKey[] = …;
const char kResultKey[] = …;
const char kAttemptCountKey[] = …;
OnDeviceModelValidationResult ConvertToOnDeviceModelValidationResult(
int value) { … }
}
OnDeviceModelAccessController::OnDeviceModelAccessController(
PrefService& pref_service)
: … { … }
OnDeviceModelAccessController::~OnDeviceModelAccessController() = default;
OnDeviceModelEligibilityReason
OnDeviceModelAccessController::ShouldStartNewSession() const { … }
void OnDeviceModelAccessController::OnResponseCompleted() { … }
void OnDeviceModelAccessController::OnDisconnectedFromRemote() { … }
void OnDeviceModelAccessController::OnGpuBlocked() { … }
void OnDeviceModelAccessController::OnSessionTimedOut() { … }
bool OnDeviceModelAccessController::ShouldValidateModel(
std::string_view component_version) { … }
void OnDeviceModelAccessController::OnValidationFinished(
OnDeviceModelValidationResult result) { … }
OnDeviceModelAccessController::ValidationState
OnDeviceModelAccessController::GetValidationState() const { … }
void OnDeviceModelAccessController::SetValidationState(
const ValidationState& state) { … }
}