#include "components/optimization_guide/core/prediction_model_fetch_timer.h"
#include "base/rand_util.h"
#include "base/time/default_clock.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_prefs.h"
#include "components/prefs/pref_service.h"
namespace optimization_guide {
namespace {
base::TimeDelta RandomFetchDelay() { … }
}
PredictionModelFetchTimer::PredictionModelFetchTimer(
PrefService* pref_service,
base::RepeatingCallback<void(void)> fetch_callback)
: … { … }
PredictionModelFetchTimer::~PredictionModelFetchTimer() = default;
void PredictionModelFetchTimer::NotifyModelFetchAttempt() { … }
void PredictionModelFetchTimer::NotifyModelFetchSuccess() { … }
base::Time PredictionModelFetchTimer::GetLastFetchAttemptTime() const { … }
base::Time PredictionModelFetchTimer::GetLastFetchSuccessTime() const { … }
bool PredictionModelFetchTimer::IsFirstModelFetch() const { … }
void PredictionModelFetchTimer::OnFetchTimerFired() { … }
void PredictionModelFetchTimer::MaybeScheduleFirstModelFetch() { … }
void PredictionModelFetchTimer::ScheduleFetchOnModelRegistration() { … }
void PredictionModelFetchTimer::SchedulePeriodicModelsFetch() { … }
void PredictionModelFetchTimer::Stop() { … }
PredictionModelFetchTimer::PredictionModelFetchTimerState
PredictionModelFetchTimer::GetStateForTesting() const { … }
const base::OneShotTimer* PredictionModelFetchTimer::GetFetchTimerForTesting()
const { … }
void PredictionModelFetchTimer::SetClockForTesting(const base::Clock* clock) { … }
void PredictionModelFetchTimer::ScheduleImmediateFetchForTesting() { … }
}