forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimer_update_scheduler.h
37 lines (28 loc) · 1.11 KB
/
timer_update_scheduler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_COMPONENT_UPDATER_TIMER_UPDATE_SCHEDULER_H_
#define COMPONENTS_COMPONENT_UPDATER_TIMER_UPDATE_SCHEDULER_H_
#include "base/callback.h"
#include "base/macros.h"
#include "components/component_updater/timer.h"
#include "components/component_updater/update_scheduler.h"
namespace component_updater {
// Scheduler that uses base::Timer to schedule updates.
class TimerUpdateScheduler : public UpdateScheduler {
public:
TimerUpdateScheduler();
~TimerUpdateScheduler() override;
// UpdateScheduler:
void Schedule(const base::TimeDelta& initial_delay,
const base::TimeDelta& delay,
const UserTask& user_task,
const OnStopTaskCallback& on_stop) override;
void Stop() override;
private:
Timer timer_;
base::RepeatingClosure user_task_;
DISALLOW_COPY_AND_ASSIGN(TimerUpdateScheduler);
};
} // namespace component_updater
#endif // COMPONENTS_COMPONENT_UPDATER_TIMER_UPDATE_SCHEDULER_H_