#include "ui/views/repeat_controller.h"
#include <utility>
namespace views {
RepeatController::RepeatController(base::RepeatingClosure callback,
const base::TickClock* tick_clock)
: timer_(tick_clock), callback_(std::move(callback)) {}
RepeatController::~RepeatController() = default;
void RepeatController::Start() {
timer_.Start(FROM_HERE, kInitialWait, this, &RepeatController::Run);
}
void RepeatController::Stop() {
timer_.Stop();
}
constexpr base::TimeDelta RepeatController::kInitialWait;
constexpr base::TimeDelta RepeatController::kRepeatingWait;
void RepeatController::Run() {
timer_.Start(FROM_HERE, kRepeatingWait, this, &RepeatController::Run);
callback_.Run();
}
}